[Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c, 1.10, 1.11 olsrd_conf.c, 1.60, 1.61 oparse.y, 1.36, 1.37
Bernd Petrovitsch
(spam-protected)
Thu Nov 8 23:47:44 CET 2007
- Previous message: [Olsr-cvs] olsrd-current/src/olsr_switch main.c, 1.28, 1.29 olsr_host_switch.h, 1.10, 1.11
- Next message: [Olsr-cvs] olsrd-current/src/linux apm.c, 1.19, 1.20 kernel_routes.c, 1.29, 1.30 net.c, 1.34, 1.35
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/olsrd/olsrd-current/src/cfgparser
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/src/cfgparser
Modified Files:
cfgfile_gen.c olsrd_conf.c oparse.y
Log Message:
Another fat commit:
The main target was:
- Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom
"olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of
temporary variables to call inet_ntoa()/inet_ptoa() vanished .....
- declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface"
as "struct sockaddr_in" since it is that what we actually want there (and
it is similar to the IPv6 code).
To get that thoroughly via compiler errors, we get:
- We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string()
to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr"
into a string buffer.
Alas, this also annoyed me since ages:
- cleanup: olsr_ip_to_string() and similar non-reentrant functions now must
get a target buffer. To ease that, there is the "struct ipaddr_str"
which is large enough for all of them (read: for an IPv6 address). This
also removes the cyclic buffer there.
All of these function return a "const char *" which can be directly used
for printf(3) and friends.
And some cleanups:
- const'ified more functions
- converted the source to UTF-8.
- "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char")
- force the few inline function to always be inlined.
- #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table()
if nothing is done
- use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()"
- clean up the routes on more signals. Basically we want to do this on all
signals which terminate the program.
- killed a superflous global buffer in src/main.c
This version was breing since weeks and running for severa day in Vienna's
FunkFeuer net without any noticably problem!
Please report anything that broke!
Index: cfgfile_gen.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/cfgfile_gen.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** cfgfile_gen.c 5 Nov 2007 15:32:54 -0000 1.10
--- cfgfile_gen.c 8 Nov 2007 22:47:42 -0000 1.11
***************
*** 64,68 ****
char ipv6_buf[100]; /* buffer for IPv6 inet_htop */
- struct in_addr in4;
FILE *fd;
--- 64,67 ----
***************
*** 88,103 ****
/* HNA IPv4 */
fprintf(fd, "# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6);
! while(h)
! {
! fprintf(fd, " %s ", olsr_ip_to_string(&h->net.prefix));
! if (cnf->ip_version == AF_INET) {
! union olsr_ip_addr ip_addr;
! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len);
! fprintf(fd, "%s\n", olsr_ip_to_string(&ip_addr));
! } else {
! fprintf(fd, "%d\n", h->net.prefix_len);
! }
! h = h->next;
}
fprintf(fd, "}\n\n");
--- 87,102 ----
/* HNA IPv4 */
fprintf(fd, "# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6);
! while(h) {
! struct ipaddr_str buf;
! fprintf(fd, " %s ", olsr_ip_to_string(&buf, &h->net.prefix));
! if (cnf->ip_version == AF_INET) {
! union olsr_ip_addr ip_addr;
! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len);
! fprintf(fd, "%s\n", olsr_ip_to_string(&buf, &ip_addr));
! } else {
! fprintf(fd, "%d\n", h->net.prefix_len);
}
+ h = h->next;
+ }
fprintf(fd, "}\n\n");
***************
*** 131,144 ****
while(ih)
{
! in4.s_addr = ih->host.v4;
! fprintf(fd, " Host %s\n", inet_ntoa(in4));
ih = ih->next;
}
while(ie)
{
! in4.s_addr = ie->net.v4;
! fprintf(fd, " Net %s ", inet_ntoa(in4));
! in4.s_addr = ie->mask.v4;
! fprintf(fd, "%s\n", inet_ntoa(in4));
ie = ie->next;
}
--- 130,140 ----
while(ih)
{
! fprintf(fd, " Host %s\n", inet_ntoa(ih->host.v4));
ih = ih->next;
}
while(ie)
{
! fprintf(fd, " Net %s ", inet_ntoa(ie->net.v4));
! fprintf(fd, "%s\n", inet_ntoa(ie->mask.v4));
ie = ie->next;
}
***************
*** 232,239 ****
! if(in->cnf->ipv4_broadcast.v4)
{
! in4.s_addr = in->cnf->ipv4_broadcast.v4;
! fprintf(fd, " Ip4Broadcast\t %s\n\n", inet_ntoa(in4));
}
else
--- 228,234 ----
! if(in->cnf->ipv4_broadcast.v4.s_addr)
{
! fprintf(fd, " Ip4Broadcast\t %s\n\n", inet_ntoa(in->cnf->ipv4_broadcast.v4));
}
else
***************
*** 373,385 ****
char ipv6_buf[100]; /* buffer for IPv6 inet_htop */
- struct in_addr in4;
#if 0
printf("\n\n\n\nolsrd_write_cnf_buf bufsize %d\n\n\n\n\n", bufsize);
#endif
! if(buf == NULL || bufsize < MAX_LINESIZE)
! {
return -1;
! }
WRITE_TO_BUF("#\n# Configuration file for olsr.org olsrd\n# automatically generated by olsrd-cnf %s\n#\n\n\n", PARSER_VERSION);
--- 368,378 ----
char ipv6_buf[100]; /* buffer for IPv6 inet_htop */
#if 0
printf("\n\n\n\nolsrd_write_cnf_buf bufsize %d\n\n\n\n\n", bufsize);
#endif
! if (buf == NULL || bufsize < MAX_LINESIZE) {
return -1;
! }
WRITE_TO_BUF("#\n# Configuration file for olsr.org olsrd\n# automatically generated by olsrd-cnf %s\n#\n\n\n", PARSER_VERSION);
***************
*** 391,408 ****
WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t%d\n\n", cnf->ip_version == AF_INET ? 4 : 6);
! /* HNA IPv4 */
WRITE_TO_BUF("# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna%1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6);
! while(h)
! {
! WRITE_TO_BUF(" %s ", olsr_ip_to_string(&h->net.prefix));
! if (cnf->ip_version == AF_INET) {
! union olsr_ip_addr ip_addr;
! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len);
! WRITE_TO_BUF("%s\n", olsr_ip_to_string(&ip_addr));
! } else {
! WRITE_TO_BUF("%d\n", h->net.prefix_len);
! }
! h = h->next;
}
WRITE_TO_BUF("}\n\n");
--- 384,401 ----
WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t%d\n\n", cnf->ip_version == AF_INET ? 4 : 6);
! /* HNA IPv4 and IPv6 */
WRITE_TO_BUF("# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna%1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6);
! while(h) {
! struct ipaddr_str strbuf;
! WRITE_TO_BUF(" %s ", olsr_ip_to_string(&strbuf, &h->net.prefix));
! if (cnf->ip_version == AF_INET) {
! union olsr_ip_addr ip_addr;
! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len);
! WRITE_TO_BUF("%s\n", olsr_ip_to_string(&strbuf, &ip_addr));
! } else {
! WRITE_TO_BUF("%d\n", h->net.prefix_len);
}
+ h = h->next;
+ }
WRITE_TO_BUF("}\n\n");
***************
*** 436,449 ****
while(ih)
{
! in4.s_addr = ih->host.v4;
! WRITE_TO_BUF(" Host %s\n", inet_ntoa(in4));
ih = ih->next;
}
while(ie)
{
! in4.s_addr = ie->net.v4;
! WRITE_TO_BUF(" Net %s ", inet_ntoa(in4));
! in4.s_addr = ie->mask.v4;
! WRITE_TO_BUF("%s\n", inet_ntoa(in4));
ie = ie->next;
}
--- 429,439 ----
while(ih)
{
! WRITE_TO_BUF(" Host %s\n", inet_ntoa(ih->host.v4));
ih = ih->next;
}
while(ie)
{
! WRITE_TO_BUF(" Net %s ", inet_ntoa(ie->net.v4));
! WRITE_TO_BUF("%s\n", inet_ntoa(ie->mask.v4));
ie = ie->next;
}
***************
*** 533,540 ****
! if(in->cnf->ipv4_broadcast.v4)
{
! in4.s_addr = in->cnf->ipv4_broadcast.v4;
! WRITE_TO_BUF(" Ip4Broadcast\t %s\n", inet_ntoa(in4));
}
else
--- 523,529 ----
! if(in->cnf->ipv4_broadcast.v4.s_addr)
{
! WRITE_TO_BUF(" Ip4Broadcast\t %s\n", inet_ntoa(in->cnf->ipv4_broadcast.v4));
}
else
Index: olsrd_conf.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** olsrd_conf.c 5 Nov 2007 15:32:54 -0000 1.60
--- olsrd_conf.c 8 Nov 2007 22:47:42 -0000 1.61
***************
*** 53,56 ****
--- 53,57 ----
#include "olsr_cfg.h"
#include "defs.h"
+ #include "net_olsr.h"
***************
*** 521,525 ****
struct olsr_lq_mult *mult;
char ipv6_buf[100]; /* buffer for IPv6 inet_htop */
- struct in_addr in4;
printf(" *** olsrd configuration ***\n");
--- 522,525 ----
***************
*** 545,550 ****
while(ih)
{
! in4.s_addr = ih->host.v4;
! printf("\tHost %s\n", inet_ntoa(in4));
ih = ih->next;
}
--- 545,549 ----
while(ih)
{
! printf("\tHost %s\n", inet_ntoa(ih->host.v4));
ih = ih->next;
}
***************
*** 552,559 ****
while(ie)
{
! in4.s_addr = ie->net.v4;
! printf("\tNet %s/", inet_ntoa(in4));
! in4.s_addr = ie->mask.v4;
! printf("%s\n", inet_ntoa(in4));
ie = ie->next;
}
--- 551,556 ----
while(ie)
{
! printf("\tNet %s/", inet_ntoa(ie->net.v4));
! printf("%s\n", inet_ntoa(ie->mask.v4));
ie = ie->next;
}
***************
*** 586,593 ****
printf(" dev: \"%s\"\n", in->name);
! if(in->cnf->ipv4_broadcast.v4)
{
! in4.s_addr = in->cnf->ipv4_broadcast.v4;
! printf("\tIPv4 broadcast : %s\n", inet_ntoa(in4));
}
else
--- 583,589 ----
printf(" dev: \"%s\"\n", in->name);
! if(in->cnf->ipv4_broadcast.v4.s_addr)
{
! printf("\tIPv4 broadcast : %s\n", inet_ntoa(in->cnf->ipv4_broadcast.v4));
}
else
***************
*** 600,605 ****
//union olsr_ip_addr ipv6_multi_site;
//union olsr_ip_addr ipv6_multi_glbl;
! printf("\tIPv6 multicast site/glbl : %s", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf)));
! printf("/%s\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf)));
printf("\tHELLO emission/validity : %0.2f/%0.2f\n", in->cnf->hello_params.emission_interval, in->cnf->hello_params.validity_time);
--- 596,601 ----
//union olsr_ip_addr ipv6_multi_site;
//union olsr_ip_addr ipv6_multi_glbl;
! printf("\tIPv6 multicast site/glbl : %s", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf)));
! printf("/%s\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf)));
printf("\tHELLO emission/validity : %0.2f/%0.2f\n", in->cnf->hello_params.emission_interval, in->cnf->hello_params.validity_time);
***************
*** 610,618 ****
for (mult = in->cnf->lq_mult; mult != NULL; mult = mult->next)
{
! inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf,
! sizeof (ipv6_buf));
!
! printf("\tLinkQualityMult : %s %0.2f\n",
! ipv6_buf, mult->val);
}
--- 606,610 ----
for (mult = in->cnf->lq_mult; mult != NULL; mult = mult->next)
{
! printf("\tLinkQualityMult : %s %0.2f\n", inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf, sizeof (ipv6_buf)), mult->val);
}
***************
*** 647,663 ****
}
/* HNA IPv4 and IPv6 */
if(h) {
printf("HNA%d entries:\n", cnf->ip_version == AF_INET ? 4 : 6);
while(h) {
! printf("\t%s/", olsr_ip_to_string(&h->net.prefix));
if (cnf->ip_version == AF_INET) {
union olsr_ip_addr ip;
olsr_prefix_to_netmask(&ip, h->net.prefix_len);
! printf("%s\n", olsr_ip_to_string(&ip));
} else {
printf("%d\n", h->net.prefix_len);
}
h = h->next;
}
}
--- 639,681 ----
}
+ #if 0
+ /* HNA IPv4 */
+ if(h4)
+ {
+
+ printf("HNA4 entries:\n");
+ while(h4)
+ {
+ printf("\t%s/", inet_ntoa(h4->net.v4));
+ printf("%s\n", inet_ntoa(h4->netmask.v4));
+ h4 = h4->next;
+ }
+ }
+
+ /* HNA IPv6 */
+ if(h6)
+ {
+ printf("HNA6 entries:\n");
+ while(h6)
+ {
+ printf("\t%s/%d\n", inet_ntop(AF_INET6, &h6->net.v6, ipv6_buf, sizeof(ipv6_buf)), h6->prefix_len);
+ h6 = h6->next;
+ }
+ #else
/* HNA IPv4 and IPv6 */
if(h) {
printf("HNA%d entries:\n", cnf->ip_version == AF_INET ? 4 : 6);
while(h) {
! struct ipaddr_str buf;
! printf("\t%s/", olsr_ip_to_string(&buf, &h->net.prefix));
if (cnf->ip_version == AF_INET) {
union olsr_ip_addr ip;
olsr_prefix_to_netmask(&ip, h->net.prefix_len);
! printf("%s\n", olsr_ip_to_string(&buf, &ip));
} else {
printf("%d\n", h->net.prefix_len);
}
h = h->next;
+ #endif
}
}
Index: oparse.y
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** oparse.y 5 Nov 2007 15:32:54 -0000 1.36
--- oparse.y 8 Nov 2007 22:47:42 -0000 1.37
***************
*** 54,57 ****
--- 54,58 ----
#include "olsrd_conf.h"
#include "../defs.h"
+ #include "../net_olsr.h"
#define PARSER_DEBUG 0
***************
*** 86,90 ****
memset(&addr, 0, sizeof(addr));
! if(ip_addr_arg != NULL &&
inet_pton(olsr_cnf->ip_version, ip_addr_arg->string, &addr) < 0) {
fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string);
--- 87,91 ----
memset(&addr, 0, sizeof(addr));
! if (ip_addr_arg != NULL &&
inet_pton(olsr_cnf->ip_version, ip_addr_arg->string, &addr) < 0) {
fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string);
***************
*** 301,317 ****
ipchost: TOK_HOSTLABEL TOK_IP4_ADDR
{
! struct in_addr in;
! struct ipc_host *ipch;
PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string);
! if(inet_aton($2->string, &in) == 0)
! {
! fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string);
! return -1;
! }
!
! ipch = malloc(sizeof(*ipch));
! ipch->host.v4 = in.s_addr;
ipch->next = olsr_cnf->ipc_hosts;
--- 302,314 ----
ipchost: TOK_HOSTLABEL TOK_IP4_ADDR
{
! struct ipc_host *ipch = malloc(sizeof(struct ipc_host));
PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string);
! if (inet_aton($2->string, &ipch->host.v4) == 0) {
! fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string);
! free(ipch);
! return -1;
! }
ipch->next = olsr_cnf->ipc_hosts;
***************
*** 326,349 ****
ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR
{
! struct in_addr in1, in2;
! struct ipc_net *ipcn;
!
PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string);
! if(inet_aton($2->string, &in1) == 0)
! {
! fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string);
! return -1;
! }
!
! if(inet_aton($3->string, &in2) == 0)
! {
! fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string);
! return -1;
! }
! ipcn = malloc(sizeof(*ipcn));
! ipcn->net.v4 = in1.s_addr;
! ipcn->mask.v4 = in2.s_addr;
ipcn->next = olsr_cnf->ipc_nets;
--- 323,340 ----
ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR
{
! struct ipc_net *ipcn = malloc(sizeof(struct ipc_net));
PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string);
! if (inet_aton($2->string, &ipcn->net.v4) == 0) {
! fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string);
! free(ipcn);
! return -1;
! }
! if (inet_aton($3->string, &ipcn->mask.v4) == 0) {
! fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string);
! free(ipcn);
! return -1;
! }
ipcn->next = olsr_cnf->ipc_nets;
***************
*** 365,376 ****
PARSER_DEBUG_PRINTF("Fixed willingness: %d\n", $2->integer);
! while(ifcnt)
! {
! ifs->cnf->weight.value = $2->integer;
! ifs->cnf->weight.fixed = OLSR_TRUE;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 356,366 ----
PARSER_DEBUG_PRINTF("Fixed willingness: %d\n", $2->integer);
! while (ifcnt) {
! ifs->cnf->weight.value = $2->integer;
! ifs->cnf->weight.fixed = OLSR_TRUE;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 386,402 ****
PARSER_DEBUG_PRINTF("\tIPv4 broadcast: %s\n", $2->string);
! if(inet_aton($2->string, &in) == 0)
! {
! fprintf(stderr, "isetip4br: Failed converting IP address %s\n", $2->string);
! return -1;
! }
! while(ifcnt)
! {
! ifs->cnf->ipv4_broadcast.v4 = in.s_addr;
! ifs = ifs->next;
! ifcnt--;
! }
free($2->string);
--- 376,390 ----
PARSER_DEBUG_PRINTF("\tIPv4 broadcast: %s\n", $2->string);
! if (inet_aton($2->string, &in) == 0) {
! fprintf(stderr, "isetip4br: Failed converting IP address %s\n", $2->string);
! return -1;
! }
! while (ifcnt) {
! ifs->cnf->ipv4_broadcast.v4 = in;
! ifs = ifs->next;
! ifcnt--;
! }
free($2->string);
***************
*** 410,433 ****
struct olsr_if *ifs = olsr_cnf->interfaces;
! if($2->boolean)
! {
! while(ifcnt)
! {
! ifs->cnf->ipv6_addrtype = IPV6_ADDR_SITELOCAL;
! ifs = ifs->next;
! ifcnt--;
! }
}
! else
! {
! while(ifcnt)
! {
! ifs->cnf->ipv6_addrtype = 0;
! ifs = ifs->next;
! ifcnt--;
! }
}
free($2);
--- 398,416 ----
struct olsr_if *ifs = olsr_cnf->interfaces;
! if ($2->boolean) {
! while (ifcnt) {
! ifs->cnf->ipv6_addrtype = IPV6_ADDR_SITELOCAL;
! ifs = ifs->next;
! ifcnt--;
}
! } else {
! while (ifcnt) {
! ifs->cnf->ipv6_addrtype = 0;
! ifs = ifs->next;
! ifcnt--;
}
+ }
free($2);
***************
*** 443,460 ****
PARSER_DEBUG_PRINTF("\tIPv6 site-local multicast: %s\n", $2->string);
! if(inet_pton(AF_INET6, $2->string, &in6) < 0)
! {
! fprintf(stderr, "isetip6mults: Failed converting IP address %s\n", $2->string);
! return -1;
! }
! while(ifcnt)
! {
! ifs->cnf->ipv6_multi_site.v6 = in6;
! ifs = ifs->next;
! ifcnt--;
! }
!
free($2->string);
--- 426,440 ----
PARSER_DEBUG_PRINTF("\tIPv6 site-local multicast: %s\n", $2->string);
! if (inet_pton(AF_INET6, $2->string, &in6) < 0) {
! fprintf(stderr, "isetip6mults: Failed converting IP address %s\n", $2->string);
! return -1;
! }
! while (ifcnt) {
! ifs->cnf->ipv6_multi_site.v6 = in6;
! ifs = ifs->next;
! ifcnt--;
! }
free($2->string);
***************
*** 472,489 ****
PARSER_DEBUG_PRINTF("\tIPv6 global multicast: %s\n", $2->string);
! if(inet_pton(AF_INET6, $2->string, &in6) < 0)
! {
! fprintf(stderr, "isetip6multg: Failed converting IP address %s\n", $2->string);
! return -1;
! }
! while(ifcnt)
! {
! memcpy(&ifs->cnf->ipv6_multi_glbl.v6, &in6, sizeof(struct in6_addr));
! ifs = ifs->next;
! ifcnt--;
! }
!
free($2->string);
--- 452,467 ----
PARSER_DEBUG_PRINTF("\tIPv6 global multicast: %s\n", $2->string);
! if (inet_pton(AF_INET6, $2->string, &in6) < 0) {
! fprintf(stderr, "isetip6multg: Failed converting IP address %s\n", $2->string);
! return -1;
! }
! while (ifcnt) {
! //memcpy(&ifs->cnf->ipv6_multi_glbl.v6, &in6, sizeof(struct in6_addr));
! ifs->cnf->ipv6_multi_glbl.v6 = in6;
! ifs = ifs->next;
! ifcnt--;
! }
free($2->string);
***************
*** 498,508 ****
PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n", $2->floating);
! while(ifcnt)
! {
! ifs->cnf->hello_params.emission_interval = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 476,485 ----
PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n", $2->floating);
! while (ifcnt) {
! ifs->cnf->hello_params.emission_interval = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 516,526 ****
PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating);
! while(ifcnt)
! {
! ifs->cnf->hello_params.validity_time = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 493,502 ----
PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating);
! while (ifcnt) {
! ifs->cnf->hello_params.validity_time = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 534,544 ****
PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating);
! while(ifcnt)
! {
! ifs->cnf->tc_params.emission_interval = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
}
--- 510,519 ----
PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating);
! while (ifcnt) {
! ifs->cnf->tc_params.emission_interval = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
}
***************
*** 550,560 ****
PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating);
! while(ifcnt)
! {
! ifs->cnf->tc_params.validity_time = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 525,534 ----
PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating);
! while (ifcnt) {
! ifs->cnf->tc_params.validity_time = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 568,578 ****
PARSER_DEBUG_PRINTF("\tMID interval: %0.2f\n", $2->floating);
! while(ifcnt)
! {
! ifs->cnf->mid_params.emission_interval = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 542,551 ----
PARSER_DEBUG_PRINTF("\tMID interval: %0.2f\n", $2->floating);
! while (ifcnt) {
! ifs->cnf->mid_params.emission_interval = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 585,595 ****
PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating);
! while(ifcnt)
! {
! ifs->cnf->mid_params.validity_time = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 558,567 ----
PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating);
! while (ifcnt) {
! ifs->cnf->mid_params.validity_time = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 602,612 ****
PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating);
! while(ifcnt)
! {
! ifs->cnf->hna_params.emission_interval = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 574,583 ----
PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating);
! while (ifcnt) {
! ifs->cnf->hna_params.emission_interval = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 619,629 ****
PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating);
! while(ifcnt)
! {
! ifs->cnf->hna_params.validity_time = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 590,599 ----
PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating);
! while (ifcnt) {
! ifs->cnf->hna_params.validity_time = $2->floating;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 636,646 ****
PARSER_DEBUG_PRINTF("\tAutodetect changes: %s\n", $2->boolean ? "YES" : "NO");
! while(ifcnt)
! {
! ifs->cnf->autodetect_chg = $2->boolean;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
--- 606,615 ----
PARSER_DEBUG_PRINTF("\tAutodetect changes: %s\n", $2->boolean ? "YES" : "NO");
! while (ifcnt) {
! ifs->cnf->autodetect_chg = $2->boolean;
! ifs = ifs->next;
! ifcnt--;
! }
free($2);
***************
*** 650,674 ****
isetlqmult: TOK_LQ_MULT TOK_DEFAULT TOK_FLOAT
{
! if (lq_mult_helper($2, $3) < 0)
YYABORT;
}
| TOK_LQ_MULT TOK_IP4_ADDR TOK_FLOAT
{
! if (lq_mult_helper($2, $3) < 0)
YYABORT;
}
| TOK_LQ_MULT TOK_IP6_ADDR TOK_FLOAT
{
! if (lq_mult_helper($2, $3) < 0)
YYABORT;
}
!
! ;
idebug: TOK_DEBUGLEVEL TOK_INTEGER
{
-
olsr_cnf->debug_level = $2->integer;
PARSER_DEBUG_PRINTF("Debug level: %d\n", olsr_cnf->debug_level);
--- 619,644 ----
isetlqmult: TOK_LQ_MULT TOK_DEFAULT TOK_FLOAT
{
! if (lq_mult_helper($2, $3) < 0) {
YYABORT;
+ }
}
| TOK_LQ_MULT TOK_IP4_ADDR TOK_FLOAT
{
! if (lq_mult_helper($2, $3) < 0) {
YYABORT;
+ }
}
| TOK_LQ_MULT TOK_IP6_ADDR TOK_FLOAT
{
! if (lq_mult_helper($2, $3) < 0) {
YYABORT;
+ }
}
! ;
idebug: TOK_DEBUGLEVEL TOK_INTEGER
{
olsr_cnf->debug_level = $2->integer;
PARSER_DEBUG_PRINTF("Debug level: %d\n", olsr_cnf->debug_level);
***************
*** 680,692 ****
iipversion: TOK_IPVERSION TOK_INTEGER
{
! if($2->integer == 4)
olsr_cnf->ip_version = AF_INET;
! else if($2->integer == 6)
olsr_cnf->ip_version = AF_INET6;
! else
! {
! fprintf(stderr, "IPversion must be 4 or 6!\n");
! YYABORT;
! }
PARSER_DEBUG_PRINTF("IpVersion: %d\n", $2->integer);
--- 650,661 ----
iipversion: TOK_IPVERSION TOK_INTEGER
{
! if ($2->integer == 4) {
olsr_cnf->ip_version = AF_INET;
! } else if ($2->integer == 6) {
olsr_cnf->ip_version = AF_INET6;
! } else {
! fprintf(stderr, "IPversion must be 4 or 6!\n");
! YYABORT;
! }
PARSER_DEBUG_PRINTF("IpVersion: %d\n", $2->integer);
***************
*** 699,728 ****
{
struct local_hna_entry *h = malloc(sizeof(*h));
! struct in_addr in;
! union olsr_ip_addr ip_addr;
PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string);
! if(h == NULL)
! {
! fprintf(stderr, "Out of memory(HNA4)\n");
! YYABORT;
! }
! if(inet_aton($1->string, &in) == 0)
! {
! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string);
! return -1;
! }
! h->net.prefix.v4 = in.s_addr;
! if(inet_aton($2->string, &in) == 0)
! {
! fprintf(stderr, "ihna4entry: Failed converting IP netmask %s\n", $2->string);
! return -1;
! }
! ip_addr.v4 = in.s_addr;
! h->net.prefix_len = olsr_netmask_to_prefix(&ip_addr);
! /* Do we really want to following? */
! h->net.prefix.v4 &= in.s_addr;
/* Queue */
--- 668,692 ----
{
struct local_hna_entry *h = malloc(sizeof(*h));
! union olsr_ip_addr netmask;
PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string);
! if (h == NULL) {
! fprintf(stderr, "Out of memory(HNA4)\n");
! YYABORT;
! }
! if (inet_aton($1->string, &h->net.prefix.v4) == 0) {
! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string);
! free(h);
! return -1;
! }
! if (inet_aton($2->string, &netmask.v4) == 0) {
! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string);
! free(h);
! return -1;
! }
! h->net.prefix_len = olsr_netmask_to_prefix(&netmask);
! h->net.prefix.v4.s_addr &= netmask.v4.s_addr;
/* Queue */
***************
*** 744,752 ****
PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", $1->string, $2->integer);
! if(h == NULL)
! {
! fprintf(stderr, "Out of memory(HNA6)\n");
! YYABORT;
! }
if(inet_pton(AF_INET6, $1->string, &h->net.prefix.v6) < 0)
--- 708,715 ----
PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", $1->string, $2->integer);
! if (h == NULL) {
! fprintf(stderr, "Out of memory(HNA6)\n");
! YYABORT;
! }
if(inet_pton(AF_INET6, $1->string, &h->net.prefix.v6) < 0)
***************
*** 756,764 ****
}
! if($2->integer > 128)
! {
! fprintf(stderr, "ihna6entry: Illegal IPv6 prefix length %d\n", $2->integer);
! return -1;
! }
h->net.prefix_len = $2->integer;
--- 719,727 ----
}
! if ($2->integer > 128) {
! fprintf(stderr, "ihna6entry: Illegal IPv6 prefix length %d\n", $2->integer);
! free(h);
! return -1;
! }
h->net.prefix_len = $2->integer;
***************
*** 786,802 ****
struct olsr_if *in = malloc(sizeof(*in));
! if(in == NULL)
! {
! fprintf(stderr, "Out of memory(ADD IF)\n");
! YYABORT;
! }
in->cnf = get_default_if_config();
! if(in->cnf == NULL)
! {
! fprintf(stderr, "Out of memory(ADD IFRULE)\n");
! YYABORT;
! }
in->name = $1->string;
--- 749,763 ----
struct olsr_if *in = malloc(sizeof(*in));
! if (in == NULL) {
! fprintf(stderr, "Out of memory(ADD IF)\n");
! YYABORT;
! }
in->cnf = get_default_if_config();
! if (in->cnf == NULL) {
! fprintf(stderr, "Out of memory(ADD IFRULE)\n");
! YYABORT;
! }
in->name = $1->string;
***************
*** 805,811 ****
in->next = olsr_cnf->interfaces;
olsr_cnf->interfaces = in;
-
ifs_in_curr_cfg++;
-
free($1);
}
--- 766,770 ----
***************
*** 815,821 ****
{
PARSER_DEBUG_PRINTF("Noint set to %d\n", $2->boolean);
-
olsr_cnf->allow_no_interfaces = $2->boolean;
-
free($2);
}
--- 774,778 ----
***************
*** 826,830 ****
PARSER_DEBUG_PRINTF("TOS: %d\n", $2->integer);
olsr_cnf->tos = $2->integer;
-
free($2);
--- 783,786 ----
***************
*** 834,842 ****
arttable: TOK_RTTABLE TOK_INTEGER
{
! if(PARSER_DEBUG) printf("RtTable: %d\n", $2->integer);
olsr_cnf->rttable = $2->integer;
-
free($2);
-
}
;
--- 790,796 ----
arttable: TOK_RTTABLE TOK_INTEGER
{
! PARSER_DEBUG_PRINTF("RtTable: %d\n", $2->integer);
olsr_cnf->rttable = $2->integer;
free($2);
}
;
***************
*** 844,876 ****
awillingness: TOK_WILLINGNESS TOK_INTEGER
{
- olsr_cnf->willingness_auto = OLSR_FALSE;
-
PARSER_DEBUG_PRINTF("Willingness: %d\n", $2->integer);
olsr_cnf->willingness = $2->integer;
-
free($2);
-
}
;
-
-
busehyst: TOK_USEHYST TOK_BOOLEAN
{
olsr_cnf->use_hysteresis = $2->boolean;
! if(olsr_cnf->use_hysteresis)
! {
! PARSER_DEBUG_PRINTF("Hysteresis enabled\n");
! }
! else
! {
! PARSER_DEBUG_PRINTF("Hysteresis disabled\n");
! }
free($2);
-
}
;
-
fhystscale: TOK_HYSTSCALE TOK_FLOAT
{
--- 798,816 ----
awillingness: TOK_WILLINGNESS TOK_INTEGER
{
PARSER_DEBUG_PRINTF("Willingness: %d\n", $2->integer);
+ olsr_cnf->willingness_auto = OLSR_FALSE;
olsr_cnf->willingness = $2->integer;
free($2);
}
;
busehyst: TOK_USEHYST TOK_BOOLEAN
{
olsr_cnf->use_hysteresis = $2->boolean;
! PARSER_DEBUG_PRINTF("Hysteresis %s\n", olsr_cnf->use_hysteresis ? "enabled" : "disabled");
free($2);
}
;
fhystscale: TOK_HYSTSCALE TOK_FLOAT
{
***************
*** 881,885 ****
;
-
fhystupper: TOK_HYSTUPPER TOK_FLOAT
{
--- 821,824 ----
***************
*** 890,894 ****
;
-
fhystlower: TOK_HYSTLOWER TOK_FLOAT
{
--- 829,832 ----
***************
*** 903,907 ****
PARSER_DEBUG_PRINTF("Pollrate %0.2f\n", $2->floating);
olsr_cnf->pollrate = $2->floating;
-
free($2);
}
--- 841,844 ----
***************
*** 912,916 ****
PARSER_DEBUG_PRINTF("NIC Changes Pollrate %0.2f\n", $2->floating);
olsr_cnf->nic_chgs_pollrate = $2->floating;
-
free($2);
}
--- 849,852 ----
***************
*** 968,975 ****
bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN
{
- olsr_cnf->clear_screen = $2->boolean;
-
PARSER_DEBUG_PRINTF("Clear screen %s\n", olsr_cnf->clear_screen ? "enabled" : "disabled");
!
free($2);
}
--- 904,909 ----
bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN
{
PARSER_DEBUG_PRINTF("Clear screen %s\n", olsr_cnf->clear_screen ? "enabled" : "disabled");
! olsr_cnf->clear_screen = $2->boolean;
free($2);
}
***************
*** 980,991 ****
struct plugin_entry *pe = malloc(sizeof(*pe));
! if(pe == NULL)
! {
! fprintf(stderr, "Out of memory(ADD PL)\n");
! YYABORT;
! }
pe->name = $2->string;
-
pe->params = NULL;
--- 914,923 ----
struct plugin_entry *pe = malloc(sizeof(*pe));
! if (pe == NULL) {
! fprintf(stderr, "Out of memory(ADD PL)\n");
! YYABORT;
! }
pe->name = $2->string;
pe->params = NULL;
***************
*** 1004,1012 ****
struct plugin_param *pp = malloc(sizeof(*pp));
! if(pp == NULL)
! {
! fprintf(stderr, "Out of memory(ADD PP)\n");
! YYABORT;
! }
PARSER_DEBUG_PRINTF("Plugin param key:\"%s\" val: \"%s\"\n", $2->string, $3->string);
--- 936,943 ----
struct plugin_param *pp = malloc(sizeof(*pp));
! if (pp == NULL) {
! fprintf(stderr, "Out of memory(ADD PP)\n");
! YYABORT;
! }
PARSER_DEBUG_PRINTF("Plugin param key:\"%s\" val: \"%s\"\n", $2->string, $3->string);
- Previous message: [Olsr-cvs] olsrd-current/src/olsr_switch main.c, 1.28, 1.29 olsr_host_switch.h, 1.10, 1.11
- Next message: [Olsr-cvs] olsrd-current/src/linux apm.c, 1.19, 1.20 kernel_routes.c, 1.29, 1.30 net.c, 1.34, 1.35
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Olsr-cvs
mailing list