4 * The olsr.org Optimized Link-State Routing daemon(olsrd)
5 * Copyright (c) 2004, Andreas Tonnesen(andreto@olsr.org)
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
18 * * Neither the name of olsr.org, olsrd nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
35 * Visit http://www.olsr.org for more information.
37 * If you find this software useful feel free to make a donation
38 * to the project. For more information see the website or contact
39 * the copyright holders.
44 #include "olsrd_conf.h"
46 #include "../ipcalc.h"
47 #include "../net_olsr.h"
48 #include "../link_set.h"
54 #include <sys/types.h>
55 #include <sys/socket.h>
56 #include <netinet/in.h>
57 #include <arpa/inet.h>
60 #define PARSER_DEBUG 0
63 #define PARSER_DEBUG_PRINTF(x, ...) printf(x, ##args)
65 #define PARSER_DEBUG_PRINTF(x, ...) do { } while (0)
68 static char interface_defaults_name[] = "[InterfaceDefaults]";
70 #define SET_IFS_CONF(ifs, ifcnt, field, value) do { \
71 for (; ifcnt>0; ifs=ifs->next, ifcnt--) { \
72 ifs->cnfi->field = (value); \
73 ifs->cnf->field = (value); \
77 #define YYSTYPE struct conf_token *
79 void yyerror(const char *);
82 static int ifs_in_curr_cfg = 0;
84 static int add_ipv6_addr(YYSTYPE ipaddr_arg, YYSTYPE prefixlen_arg);
86 static int lq_mult_helper(YYSTYPE ip_addr_arg, YYSTYPE mult_arg)
88 union olsr_ip_addr addr;
90 struct olsr_if *walker;
93 printf("\tLinkQualityMult %s %0.2f\n",
94 (ip_addr_arg != NULL) ? ip_addr_arg->string : "any",
98 memset(&addr, 0, sizeof(addr));
100 if (ip_addr_arg != NULL &&
101 inet_pton(olsr_cnf->ip_version, ip_addr_arg->string, &addr) <= 0) {
102 fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string);
106 walker = olsr_cnf->interfaces;
108 for (i = 0; i < ifs_in_curr_cfg; i++) {
109 struct olsr_lq_mult *mult = malloc(sizeof(*mult));
111 fprintf(stderr, "Out of memory (LQ multiplier).\n");
116 mult->value = (uint32_t)(mult_arg->floating * LINK_LOSS_MULTIPLIER);
118 mult->next = walker->cnf->lq_mult;
119 walker->cnfi->lq_mult = walker->cnf->lq_mult = mult;
120 walker->cnf->orig_lq_mult_cnt++;
121 walker->cnfi->orig_lq_mult_cnt=walker->cnf->orig_lq_mult_cnt;
123 walker = walker->next;
126 if (ip_addr_arg != NULL) {
127 free(ip_addr_arg->string);
136 static int add_ipv6_addr(YYSTYPE ipaddr_arg, YYSTYPE prefixlen_arg)
138 union olsr_ip_addr ipaddr;
139 PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", ipaddr_arg->string, prefixlen_arg->integer);
141 if (olsr_cnf->ip_version != AF_INET6) {
142 fprintf(stderr, "IPv6 addresses can only be used if \"IpVersion\" == 6, skipping HNA6.\n");
143 olsr_startup_sleep(3);
146 if(inet_pton(AF_INET6, ipaddr_arg->string, &ipaddr) <= 0) {
147 fprintf(stderr, "ihna6entry: Failed converting IP address %s\n", ipaddr_arg->string);
151 if (prefixlen_arg->integer > 128) {
152 fprintf(stderr, "ihna6entry: Illegal IPv6 prefix length %d\n", prefixlen_arg->integer);
157 ip_prefix_list_add(&olsr_cnf->hna_entries, &ipaddr, prefixlen_arg->integer);
159 free(ipaddr_arg->string);
179 %token TOK_DEBUGLEVEL
184 %token TOK_INTERFACE_DEFAULTS
191 %token TOK_RTTABLE_DEFAULT
192 %token TOK_WILLINGNESS
200 %token TOK_NICCHGSPOLLRT
201 %token TOK_TCREDUNDANCY
202 %token TOK_MPRCOVERAGE
209 %token TOK_LQ_NAT_THRESH
211 %token TOK_CLEAR_SCREEN
213 %token TOK_MIN_TC_VTIME
221 %token TOK_IPV4BROADCAST
222 %token TOK_IPV4MULTICAST
223 %token TOK_IPV6MULTICAST
235 %token TOK_AUTODETCHG
281 block: TOK_HNA4 hna4body
289 hna4body: TOK_OPEN hna4stmts TOK_CLOSE
292 hna4stmts: | hna4stmts hna4stmt
299 hna6body: TOK_OPEN hna6stmts TOK_CLOSE
302 hna6stmts: | hna6stmts hna6stmt
309 ipcbody: TOK_OPEN ipcstmts TOK_CLOSE
312 ipcstmts: | ipcstmts ipcstmt
321 ifblock: ifstart ifnicks
324 ifnicks: | ifnicks ifnick
327 ifbody: TOK_OPEN ifstmts TOK_CLOSE
330 ifstmts: | ifstmts ifstmt
353 plbody: TOK_OPEN plstmts TOK_CLOSE
356 plstmts: | plstmts plstmt
363 ifdblock: TOK_INTERFACE_DEFAULTS
365 struct olsr_if *in = malloc(sizeof(*in));
368 fprintf(stderr, "Out of memory(ADD IF)\n");
372 in->cnf = get_default_if_config();
373 in->cnfi = get_default_if_config();
375 if (in->cnf == NULL || in->cnfi == NULL) {
376 fprintf(stderr, "Out of memory(ADD DEFIFRULE)\n");
380 in->name = strdup(interface_defaults_name);
382 olsr_cnf->interface_defaults = in->cnf;
385 in->next = olsr_cnf->interfaces;
386 olsr_cnf->interfaces = in;
391 imaxipc: TOK_MAXIPC TOK_INTEGER
393 olsr_cnf->ipc_connections = $2->integer;
398 ipchost: TOK_HOSTLABEL TOK_IPV4_ADDR
400 union olsr_ip_addr ipaddr;
401 PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string);
403 if (inet_aton($2->string, &ipaddr.v4) == 0) {
404 fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string);
408 ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_cnf->maxplen);
415 ipcnet: TOK_NETLABEL TOK_IPV4_ADDR TOK_IPV4_ADDR
417 union olsr_ip_addr ipaddr, netmask;
419 PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string);
421 if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) {
422 fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string);
426 if (inet_pton(AF_INET, $3->string, &netmask.v4) == 0) {
427 fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string);
431 ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_netmask_to_prefix(&netmask));
438 | TOK_NETLABEL TOK_IPV4_ADDR TOK_SLASH TOK_INTEGER
440 union olsr_ip_addr ipaddr;
442 PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string);
444 if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) {
445 fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string);
449 if ($4->integer > olsr_cnf->maxplen) {
450 fprintf(stderr, "ipcnet: Prefix len %u > %d is not allowed!\n", $4->integer, olsr_cnf->maxplen);
454 ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, $4->integer);
462 iifweight: TOK_IFWEIGHT TOK_INTEGER
464 int ifcnt = ifs_in_curr_cfg;
465 struct olsr_if *ifs = olsr_cnf->interfaces;
467 PARSER_DEBUG_PRINTF("Fixed willingness: %d\n", $2->integer);
470 ifs->cnf->weight.value = $2->integer;
471 ifs->cnf->weight.fixed = true;
472 ifs->cnfi->weight.value = $2->integer;
473 ifs->cnfi->weight.fixed = true;
483 isetifmode: TOK_IFMODE TOK_STRING
485 int ifcnt = ifs_in_curr_cfg;
486 struct olsr_if *ifs = olsr_cnf->interfaces;
487 int mode = (strcmp($2->string, "ether") == 0)?IF_MODE_ETHER:IF_MODE_MESH;
489 PARSER_DEBUG_PRINTF("\tMode: %d\n", $2->string);
491 SET_IFS_CONF(ifs, ifcnt, mode, mode);
498 isetipv4br: TOK_IPV4BROADCAST TOK_IPV4_ADDR
501 int ifcnt = ifs_in_curr_cfg;
502 struct olsr_if *ifs = olsr_cnf->interfaces;
504 PARSER_DEBUG_PRINTF("\tIPv4 broadcast: %s\n", $2->string);
506 if (inet_aton($2->string, &in) == 0) {
507 fprintf(stderr, "isetipv4br: Failed converting IP address %s\n", $2->string);
511 SET_IFS_CONF(ifs, ifcnt, ipv4_multicast.v4, in);
518 isetipv4mc: TOK_IPV4MULTICAST TOK_IPV4_ADDR
521 int ifcnt = ifs_in_curr_cfg;
522 struct olsr_if *ifs = olsr_cnf->interfaces;
524 PARSER_DEBUG_PRINTF("\tIPv4 broadcast: %s\n", $2->string);
526 if (inet_aton($2->string, &in) == 0) {
527 fprintf(stderr, "isetipv4br: Failed converting IP address %s\n", $2->string);
531 SET_IFS_CONF(ifs, ifcnt, ipv4_multicast.v4, in);
538 isetipv6mc: TOK_IPV6MULTICAST TOK_IPV6_ADDR
541 int ifcnt = ifs_in_curr_cfg;
542 struct olsr_if *ifs = olsr_cnf->interfaces;
544 PARSER_DEBUG_PRINTF("\tIPv6 multicast: %s\n", $2->string);
546 if (inet_pton(AF_INET6, $2->string, &in6) <= 0) {
547 fprintf(stderr, "isetipv6mc: Failed converting IP address %s\n", $2->string);
551 SET_IFS_CONF(ifs, ifcnt, ipv6_multicast.v6, in6);
558 isetipv4src: TOK_IPV4SRC TOK_IPV4_ADDR
561 int ifcnt = ifs_in_curr_cfg;
562 struct olsr_if *ifs = olsr_cnf->interfaces;
564 PARSER_DEBUG_PRINTF("\tIPv4 src: %s\n", $2->string);
566 if (inet_aton($2->string, &in) == 0) {
567 fprintf(stderr, "isetipv4src: Failed converting IP address %s\n", $2->string);
571 SET_IFS_CONF(ifs, ifcnt, ipv4_src.v4, in);
578 isetipv6src: TOK_IPV6SRC TOK_IPV6_ADDR
580 struct olsr_ip_prefix pr6;
581 int ifcnt = ifs_in_curr_cfg;
582 struct olsr_if *ifs = olsr_cnf->interfaces;
584 PARSER_DEBUG_PRINTF("\tIPv6 src prefix: %s\n", $2->string);
586 if (olsr_string_to_prefix(AF_INET6, &pr6, $2->string) <= 0) {
587 fprintf(stderr, "isetipv6src: Failed converting IP prefix %s\n", $2->string);
591 SET_IFS_CONF(ifs, ifcnt, ipv6_src, pr6);
598 isethelloint: TOK_HELLOINT TOK_FLOAT
600 int ifcnt = ifs_in_curr_cfg;
601 struct olsr_if *ifs = olsr_cnf->interfaces;
603 PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n", $2->floating);
605 SET_IFS_CONF(ifs, ifcnt, hello_params.emission_interval, $2->floating);
610 isethelloval: TOK_HELLOVAL TOK_FLOAT
612 int ifcnt = ifs_in_curr_cfg;
613 struct olsr_if *ifs = olsr_cnf->interfaces;
615 PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating);
617 SET_IFS_CONF(ifs, ifcnt, hello_params.validity_time, $2->floating);
622 isettcint: TOK_TCINT TOK_FLOAT
624 int ifcnt = ifs_in_curr_cfg;
625 struct olsr_if *ifs = olsr_cnf->interfaces;
627 PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating);
629 SET_IFS_CONF(ifs, ifcnt, tc_params.emission_interval, $2->floating);
634 isettcval: TOK_TCVAL TOK_FLOAT
636 int ifcnt = ifs_in_curr_cfg;
637 struct olsr_if *ifs = olsr_cnf->interfaces;
639 PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating);
641 SET_IFS_CONF(ifs, ifcnt, tc_params.validity_time, $2->floating);
646 isetmidint: TOK_MIDINT TOK_FLOAT
648 int ifcnt = ifs_in_curr_cfg;
649 struct olsr_if *ifs = olsr_cnf->interfaces;
652 PARSER_DEBUG_PRINTF("\tMID interval: %0.2f\n", $2->floating);
654 SET_IFS_CONF(ifs, ifcnt, mid_params.emission_interval, $2->floating);
659 isetmidval: TOK_MIDVAL TOK_FLOAT
661 int ifcnt = ifs_in_curr_cfg;
662 struct olsr_if *ifs = olsr_cnf->interfaces;
664 PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating);
666 SET_IFS_CONF(ifs, ifcnt, mid_params.validity_time, $2->floating);
671 isethnaint: TOK_HNAINT TOK_FLOAT
673 int ifcnt = ifs_in_curr_cfg;
674 struct olsr_if *ifs = olsr_cnf->interfaces;
676 PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating);
678 SET_IFS_CONF(ifs, ifcnt, hna_params.emission_interval, $2->floating);
683 isethnaval: TOK_HNAVAL TOK_FLOAT
685 int ifcnt = ifs_in_curr_cfg;
686 struct olsr_if *ifs = olsr_cnf->interfaces;
688 PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating);
690 SET_IFS_CONF(ifs, ifcnt, hna_params.validity_time, $2->floating);
695 isetautodetchg: TOK_AUTODETCHG TOK_BOOLEAN
697 int ifcnt = ifs_in_curr_cfg;
698 struct olsr_if *ifs = olsr_cnf->interfaces;
700 PARSER_DEBUG_PRINTF("\tAutodetect changes: %s\n", $2->boolean ? "YES" : "NO");
702 SET_IFS_CONF(ifs, ifcnt, autodetect_chg, $2->boolean);
708 isetlqmult: TOK_LQ_MULT TOK_DEFAULT TOK_FLOAT
710 if (lq_mult_helper($2, $3) < 0) {
715 | TOK_LQ_MULT TOK_IPV4_ADDR TOK_FLOAT
717 if (lq_mult_helper($2, $3) < 0) {
722 | TOK_LQ_MULT TOK_IPV6_ADDR TOK_FLOAT
724 if (lq_mult_helper($2, $3) < 0) {
730 idebug: TOK_DEBUGLEVEL TOK_INTEGER
732 olsr_cnf->debug_level = $2->integer;
733 PARSER_DEBUG_PRINTF("Debug level: %d\n", olsr_cnf->debug_level);
739 iipversion: TOK_IPVERSION TOK_INTEGER
741 if ($2->integer == 4) {
742 olsr_cnf->ip_version = AF_INET;
743 olsr_cnf->ipsize = sizeof(struct in_addr);
744 olsr_cnf->maxplen = 32;
745 } else if ($2->integer == 6) {
746 olsr_cnf->ip_version = AF_INET6;
747 olsr_cnf->ipsize = sizeof(struct in6_addr);
748 olsr_cnf->maxplen = 128;
750 fprintf(stderr, "IPversion must be 4 or 6!\n");
754 PARSER_DEBUG_PRINTF("IpVersion: %d\n", $2->integer);
759 fibmetric: TOK_FIBMETRIC TOK_STRING
761 PARSER_DEBUG_PRINTF("FIBMetric: %d\n", $2->string);
762 if (strcmp($2->string, CFG_FIBM_FLAT) == 0) {
763 olsr_cnf->fib_metric = FIBM_FLAT;
764 } else if (strcmp($2->string, CFG_FIBM_CORRECT) == 0) {
765 olsr_cnf->fib_metric = FIBM_CORRECT;
766 } else if (strcmp($2->string, CFG_FIBM_APPROX) == 0) {
767 olsr_cnf->fib_metric = FIBM_APPROX;
769 fprintf(stderr, "FIBMetric must be \"%s\", \"%s\", or \"%s\"!\n", CFG_FIBM_FLAT, CFG_FIBM_CORRECT, CFG_FIBM_APPROX);
778 ihna4entry: TOK_IPV4_ADDR TOK_IPV4_ADDR
780 union olsr_ip_addr ipaddr, netmask;
782 if (olsr_cnf->ip_version == AF_INET6) {
783 fprintf(stderr, "IPv4 addresses can only be used if \"IpVersion\" == 4, skipping HNA.\n");
784 olsr_startup_sleep(3);
787 PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string);
789 if (inet_pton(AF_INET, $1->string, &ipaddr.v4) <= 0) {
790 fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string);
793 if (inet_pton(AF_INET, $2->string, &netmask.v4) <= 0) {
794 fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string);
798 /* check that the given IP address is actually a network address */
799 if ((ipaddr.v4.s_addr & ~netmask.v4.s_addr) != 0) {
800 fprintf(stderr, "ihna4entry: The ipaddress \"%s\" is not a network address!\n", $1->string);
805 ip_prefix_list_add(&olsr_cnf->hna_entries, &ipaddr, olsr_netmask_to_prefix(&netmask));
812 | TOK_IPV4_ADDR TOK_SLASH TOK_INTEGER
814 union olsr_ip_addr ipaddr, netmask;
816 if (olsr_cnf->ip_version == AF_INET6) {
817 fprintf(stderr, "IPv4 addresses can only be used if \"IpVersion\" == 4, skipping HNA.\n");
818 olsr_startup_sleep(3);
821 PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%d\n", $1->string, $3->integer);
823 if (inet_pton(AF_INET, $1->string, &ipaddr.v4) <= 0) {
824 fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string);
827 if ($3->integer > olsr_cnf->maxplen) {
828 fprintf(stderr, "ihna4entry: Prefix len %u > %d is not allowed!\n", $3->integer, olsr_cnf->maxplen);
832 /* check that the given IP address is actually a network address */
833 olsr_prefix_to_netmask(&netmask, $3->integer);
834 if ((ipaddr.v4.s_addr & ~netmask.v4.s_addr) != 0) {
835 fprintf(stderr, "ihna4entry: The ipaddress \"%s\" is not a network address!\n", $1->string);
840 ip_prefix_list_add(&olsr_cnf->hna_entries, &ipaddr, $3->integer);
848 ihna6entry: TOK_IPV6_ADDR TOK_INTEGER
850 if (add_ipv6_addr($1, $2)) {
854 | TOK_IPV6_ADDR TOK_SLASH TOK_INTEGER
856 if (add_ipv6_addr($1, $3)) {
862 ifstart: TOK_INTERFACE
864 PARSER_DEBUG_PRINTF("setting ifs_in_curr_cfg = 0\n");
871 struct olsr_if *in, *last;
872 in = olsr_cnf->interfaces;
875 if (strcmp(in->name, $1->string) == 0) {
884 /* remove old interface from list to add it later at the beginning */
886 last->next = in->next;
889 olsr_cnf->interfaces = in->next;
893 in = malloc(sizeof(*in));
895 fprintf(stderr, "Out of memory(ADD IF)\n");
898 memset(in, 0, sizeof(*in));
900 in->cnf = malloc(sizeof(*in->cnf));
901 if (in->cnf == NULL) {
902 fprintf(stderr, "Out of memory(ADD IFRULE)\n");
905 memset(in->cnf, 0x00, sizeof(*in->cnf));
907 in->cnfi = malloc(sizeof(*in->cnfi));
908 if (in->cnf == NULL) {
909 fprintf(stderr, "Out of memory(ADD IFRULE)\n");
912 memset(in->cnfi, 0xFF, sizeof(*in->cnfi));
913 in->cnfi->orig_lq_mult_cnt=0;
915 in->name = $1->string;
918 in->next = olsr_cnf->interfaces;
919 olsr_cnf->interfaces = in;
925 bnoint: TOK_NOINT TOK_BOOLEAN
927 PARSER_DEBUG_PRINTF("Noint set to %d\n", $2->boolean);
928 olsr_cnf->allow_no_interfaces = $2->boolean;
933 atos: TOK_TOS TOK_INTEGER
935 PARSER_DEBUG_PRINTF("TOS: %d\n", $2->integer);
936 olsr_cnf->tos = $2->integer;
942 aolsrport: TOK_OLSRPORT TOK_INTEGER
944 PARSER_DEBUG_PRINTF("OlsrPort: %d\n", $2->integer);
945 if ($2->integer>=1000) olsr_cnf->olsrport = $2->integer;
946 else olsr_cnf->olsrport = DEF_OLSRPORT;
951 arttable: TOK_RTTABLE TOK_INTEGER
953 PARSER_DEBUG_PRINTF("RtTable: %d\n", $2->integer);
954 olsr_cnf->rttable = $2->integer;
959 artproto: TOK_RTPROTO TOK_INTEGER
961 PARSER_DEBUG_PRINTF("RtProto: %d\n", $2->integer);
962 olsr_cnf->rtproto = $2->integer;
967 arttable_default: TOK_RTTABLE_DEFAULT TOK_INTEGER
969 PARSER_DEBUG_PRINTF("RtTableDefault: %d\n", $2->integer);
970 olsr_cnf->rttable_default = $2->integer;
975 awillingness: TOK_WILLINGNESS TOK_INTEGER
977 PARSER_DEBUG_PRINTF("Willingness: %d\n", $2->integer);
978 olsr_cnf->willingness_auto = false;
979 olsr_cnf->willingness = $2->integer;
984 busehyst: TOK_USEHYST TOK_BOOLEAN
986 olsr_cnf->use_hysteresis = $2->boolean;
987 PARSER_DEBUG_PRINTF("Hysteresis %s\n", olsr_cnf->use_hysteresis ? "enabled" : "disabled");
992 fhystscale: TOK_HYSTSCALE TOK_FLOAT
994 olsr_cnf->hysteresis_param.scaling = $2->floating;
995 PARSER_DEBUG_PRINTF("Hysteresis Scaling: %0.2f\n", $2->floating);
1000 fhystupper: TOK_HYSTUPPER TOK_FLOAT
1002 olsr_cnf->hysteresis_param.thr_high = $2->floating;
1003 PARSER_DEBUG_PRINTF("Hysteresis UpperThr: %0.2f\n", $2->floating);
1008 fhystlower: TOK_HYSTLOWER TOK_FLOAT
1010 olsr_cnf->hysteresis_param.thr_low = $2->floating;
1011 PARSER_DEBUG_PRINTF("Hysteresis LowerThr: %0.2f\n", $2->floating);
1016 fpollrate: TOK_POLLRATE TOK_FLOAT
1018 PARSER_DEBUG_PRINTF("Pollrate %0.2f\n", $2->floating);
1019 olsr_cnf->pollrate = $2->floating;
1024 fnicchgspollrt: TOK_NICCHGSPOLLRT TOK_FLOAT
1026 PARSER_DEBUG_PRINTF("NIC Changes Pollrate %0.2f\n", $2->floating);
1027 olsr_cnf->nic_chgs_pollrate = $2->floating;
1032 atcredundancy: TOK_TCREDUNDANCY TOK_INTEGER
1034 PARSER_DEBUG_PRINTF("TC redundancy %d\n", $2->integer);
1035 olsr_cnf->tc_redundancy = $2->integer;
1040 amprcoverage: TOK_MPRCOVERAGE TOK_INTEGER
1042 PARSER_DEBUG_PRINTF("MPR coverage %d\n", $2->integer);
1043 olsr_cnf->mpr_coverage = $2->integer;
1048 alq_level: TOK_LQ_LEVEL TOK_INTEGER
1050 PARSER_DEBUG_PRINTF("Link quality level %d\n", $2->integer);
1051 olsr_cnf->lq_level = $2->integer;
1056 alq_fish: TOK_LQ_FISH TOK_INTEGER
1058 PARSER_DEBUG_PRINTF("Link quality fish eye %d\n", $2->integer);
1059 olsr_cnf->lq_fish = $2->integer;
1064 alq_dlimit: TOK_LQ_DLIMIT TOK_INTEGER TOK_FLOAT
1066 PARSER_DEBUG_PRINTF("Link quality dijkstra limit %d, %0.2f\n", $2->integer, $3->floating);
1067 olsr_cnf->lq_dlimit = $2->integer;
1068 olsr_cnf->lq_dinter = $3->floating;
1073 alq_wsize: TOK_LQ_WSIZE TOK_INTEGER
1079 alq_aging: TOK_LQ_AGING TOK_FLOAT
1081 PARSER_DEBUG_PRINTF("Link quality aging factor %f\n", $2->floating);
1082 olsr_cnf->lq_aging = $2->floating;
1087 amin_tc_vtime: TOK_MIN_TC_VTIME TOK_FLOAT
1089 PARSER_DEBUG_PRINTF("Minimum TC validity time %f\n", $2->floating);
1090 olsr_cnf->min_tc_vtime = $2->floating;
1095 alock_file: TOK_LOCK_FILE TOK_STRING
1097 PARSER_DEBUG_PRINTF("Lock file %s\n", $2->string);
1098 olsr_cnf->lock_file = $2->string;
1102 alq_plugin: TOK_LQ_PLUGIN TOK_STRING
1104 olsr_cnf->lq_algorithm = $2->string;
1105 PARSER_DEBUG_PRINTF("LQ Algorithm: %s\n", $2->string);
1110 anat_thresh: TOK_LQ_NAT_THRESH TOK_FLOAT
1112 PARSER_DEBUG_PRINTF("NAT threshold %0.2f\n", $2->floating);
1113 olsr_cnf->lq_nat_thresh = $2->floating;
1118 bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN
1120 PARSER_DEBUG_PRINTF("Clear screen %s\n", olsr_cnf->clear_screen ? "enabled" : "disabled");
1121 olsr_cnf->clear_screen = $2->boolean;
1126 plblock: TOK_PLUGIN TOK_STRING
1128 struct plugin_entry *pe, *last;
1130 pe = olsr_cnf->plugins;
1132 while (pe != NULL) {
1133 if (strcmp(pe->name, $2->string) == 0) {
1142 /* remove old plugin from list to add it later at the beginning */
1144 last->next = pe->next;
1147 olsr_cnf->plugins = pe->next;
1151 pe = malloc(sizeof(*pe));
1154 fprintf(stderr, "Out of memory(ADD PL)\n");
1158 pe->name = $2->string;
1161 PARSER_DEBUG_PRINTF("Plugin: %s\n", $2->string);
1165 pe->next = olsr_cnf->plugins;
1166 olsr_cnf->plugins = pe;
1172 plparam: TOK_PLPARAM TOK_STRING TOK_STRING
1174 struct plugin_param *pp = malloc(sizeof(*pp));
1177 fprintf(stderr, "Out of memory(ADD PP)\n");
1181 PARSER_DEBUG_PRINTF("Plugin param key:\"%s\" val: \"%s\"\n", $2->string, $3->string);
1183 pp->key = $2->string;
1184 pp->value = $3->string;
1187 pp->next = olsr_cnf->plugins->params;
1188 olsr_cnf->plugins->params = pp;
1195 vcomment: TOK_COMMENT
1197 //PARSER_DEBUG_PRINTF("Comment\n");
1205 void yyerror (const char *string)
1207 fprintf(stderr, "Config line %d: %s\n", current_line, string);