2 * $Id: gram.y,v 1.39.2.1 2011/08/22 12:30:47 reubenhwk Exp $
5 * Pedro Roque <roque@di.fc.ul.pt>
6 * Lars Fenneberg <lf@elemental.net>
8 * This software is Copyright 1996-2000 by the above mentioned author(s),
11 * The license which is distributed with this software in the file COPYRIGHT
12 * applies to this software. If your distribution is missing this file, you
13 * may request it from <pekkas@netcore.fi>.
22 extern
struct Interface
*IfaceList
;
23 struct Interface
*iface
= NULL
;
24 struct AdvPrefix
*prefix
= NULL
;
25 struct AdvRoute
*route
= NULL
;
26 struct AdvRDNSS
*rdnss
= NULL
;
27 struct AdvDNSSL
*dnssl
= NULL
;
29 extern
char *conf_file
;
33 static void cleanup
(void);
34 static void yyerror(char *msg
);
35 static int countbits
(int b
);
36 static int count_mask
(struct sockaddr_in6
*m
);
37 static struct in6_addr get_prefix6
(struct in6_addr
const *addr
, struct in6_addr
const *mask
);
39 #if 0 /* no longer necessary? */
40 #ifndef HAVE_IN6_ADDR_S6_ADDR
42 # define s6_addr32 __u6_addr.__u6_addr32
43 # define s6_addr16 __u6_addr.__u6_addr16
48 #define ABORT do { cleanup(); YYABORT; } while (0);
49 #define ADD_TO_LL(type, list, value) \
51 if
(iface
->list
== NULL
) \
52 iface
->list
= value
; \
54 type
*current
= iface
->list
; \
55 while
(current
->next
!= NULL
) \
56 current
= current
->next
; \
57 current
->next
= value
; \
73 %token
<snum
> SIGNEDNUMBER
76 %token
<addr
> IPV6ADDR
79 %token T_IgnoreIfMissing
80 %token T_AdvSendAdvert
81 %token T_MaxRtrAdvInterval
82 %token T_MinRtrAdvInterval
83 %token T_MinDelayBetweenRAs
84 %token T_AdvManagedFlag
85 %token T_AdvOtherConfigFlag
87 %token T_AdvReachableTime
88 %token T_AdvRetransTimer
89 %token T_AdvCurHopLimit
90 %token T_AdvDefaultLifetime
91 %token T_AdvDefaultPreference
92 %token T_AdvSourceLLAddress
95 %token T_AdvAutonomous
96 %token T_AdvValidLifetime
97 %token T_AdvPreferredLifetime
98 %token T_DeprecatePrefix
99 %token T_DecrementLifetimes
101 %token T_AdvRouterAddr
102 %token T_AdvHomeAgentFlag
103 %token T_AdvIntervalOpt
104 %token T_AdvHomeAgentInfo
106 %token T_Base6Interface
107 %token T_Base6to4Interface
110 %token T_HomeAgentPreference
111 %token T_HomeAgentLifetime
113 %token T_AdvRoutePreference
114 %token T_AdvRouteLifetime
117 %token T_AdvRDNSSPreference
118 %token T_AdvRDNSSOpenFlag
119 %token T_AdvRDNSSLifetime
122 %token T_AdvDNSSLLifetime
125 %token T_AdvMobRtrSupportFlag
130 %type
<pinfo
> prefixdef
131 %type
<ainfo
> clientslist v6addrlist
132 %type
<rinfo
> routedef
133 %type
<rdnssinfo
> rdnssdef
134 %type
<dnsslinfo
> dnssldef
135 %type
<num
> number_or_infinity
141 struct in6_addr
*addr
;
143 struct AdvPrefix
*pinfo
;
144 struct AdvRoute
*rinfo
;
145 struct AdvRDNSS
*rdnssinfo
;
146 struct AdvDNSSL
*dnsslinfo
;
147 struct Clients
*ainfo
;
152 grammar
: grammar ifacedef
156 ifacedef
: ifacehead
'{' ifaceparams
'}' ';'
158 struct Interface
*iface2
;
163 if
(!strcmp
(iface2
->Name
, iface
->Name
))
165 flog
(LOG_ERR
, "duplicate interface "
166 "definition for %s", iface
->Name
);
169 iface2
= iface2
->next
;
172 if
(check_device
(iface
) < 0) {
173 if
(iface
->IgnoreIfMissing
) {
174 dlog
(LOG_DEBUG
, 4, "interface %s did not exist, ignoring the interface", iface
->Name
);
177 flog
(LOG_ERR
, "interface %s does not exist", iface
->Name
);
181 if
(setup_deviceinfo
(iface
) < 0)
182 if
(!iface
->IgnoreIfMissing
)
184 if
(check_iface
(iface
) < 0)
185 if
(!iface
->IgnoreIfMissing
)
187 if
(setup_linklocal_addr
(iface
) < 0)
188 if
(!iface
->IgnoreIfMissing
)
190 if
(setup_allrouters_membership
(iface
) < 0)
191 if
(!iface
->IgnoreIfMissing
)
194 dlog
(LOG_DEBUG
, 4, "interface definition for %s is ok", iface
->Name
);
196 iface
->next
= IfaceList
;
202 ifacehead
: T_INTERFACE name
204 iface
= malloc
(sizeof
(struct Interface
));
207 flog
(LOG_CRIT
, "malloc failed: %s", strerror
(errno
));
211 iface_init_defaults
(iface
);
212 strncpy
(iface
->Name
, $2, IFNAMSIZ
-1);
213 iface
->Name
[IFNAMSIZ
-1] = '\0';
226 | ifaceparam ifaceparams
229 ifaceparam
: ifaceval
230 | prefixdef
{ ADD_TO_LL
(struct AdvPrefix
, AdvPrefixList
, $1); }
231 | clientslist
{ ADD_TO_LL
(struct Clients
, ClientList
, $1); }
232 | routedef
{ ADD_TO_LL
(struct AdvRoute
, AdvRouteList
, $1); }
233 | rdnssdef
{ ADD_TO_LL
(struct AdvRDNSS
, AdvRDNSSList
, $1); }
234 | dnssldef
{ ADD_TO_LL
(struct AdvDNSSL
, AdvDNSSLList
, $1); }
237 ifaceval
: T_MinRtrAdvInterval NUMBER
';'
239 iface
->MinRtrAdvInterval
= $2;
241 | T_MaxRtrAdvInterval NUMBER
';'
243 iface
->MaxRtrAdvInterval
= $2;
245 | T_MinDelayBetweenRAs NUMBER
';'
247 iface
->MinDelayBetweenRAs
= $2;
249 | T_MinRtrAdvInterval DECIMAL
';'
251 iface
->MinRtrAdvInterval
= $2;
253 | T_MaxRtrAdvInterval DECIMAL
';'
255 iface
->MaxRtrAdvInterval
= $2;
257 | T_MinDelayBetweenRAs DECIMAL
';'
259 iface
->MinDelayBetweenRAs
= $2;
261 | T_IgnoreIfMissing SWITCH
';'
263 iface
->IgnoreIfMissing
= $2;
265 | T_AdvSendAdvert SWITCH
';'
267 iface
->AdvSendAdvert
= $2;
269 | T_AdvManagedFlag SWITCH
';'
271 iface
->AdvManagedFlag
= $2;
273 | T_AdvOtherConfigFlag SWITCH
';'
275 iface
->AdvOtherConfigFlag
= $2;
277 | T_AdvLinkMTU NUMBER
';'
279 iface
->AdvLinkMTU
= $2;
281 | T_AdvReachableTime NUMBER
';'
283 iface
->AdvReachableTime
= $2;
285 | T_AdvRetransTimer NUMBER
';'
287 iface
->AdvRetransTimer
= $2;
289 | T_AdvDefaultLifetime NUMBER
';'
291 iface
->AdvDefaultLifetime
= $2;
293 | T_AdvDefaultPreference SIGNEDNUMBER
';'
295 iface
->AdvDefaultPreference
= $2;
297 | T_AdvCurHopLimit NUMBER
';'
299 iface
->AdvCurHopLimit
= $2;
301 | T_AdvSourceLLAddress SWITCH
';'
303 iface
->AdvSourceLLAddress
= $2;
305 | T_AdvIntervalOpt SWITCH
';'
307 iface
->AdvIntervalOpt
= $2;
309 | T_AdvHomeAgentInfo SWITCH
';'
311 iface
->AdvHomeAgentInfo
= $2;
313 | T_AdvHomeAgentFlag SWITCH
';'
315 iface
->AdvHomeAgentFlag
= $2;
317 | T_HomeAgentPreference NUMBER
';'
319 iface
->HomeAgentPreference
= $2;
321 | T_HomeAgentLifetime NUMBER
';'
323 iface
->HomeAgentLifetime
= $2;
325 | T_UnicastOnly SWITCH
';'
327 iface
->UnicastOnly
= $2;
329 | T_AdvMobRtrSupportFlag SWITCH
';'
331 iface
->AdvMobRtrSupportFlag
= $2;
335 clientslist
: T_CLIENTS
'{' v6addrlist
'}' ';'
341 v6addrlist
: IPV6ADDR
';'
343 struct Clients
*new
= calloc
(1, sizeof
(struct Clients
));
345 flog
(LOG_CRIT
, "calloc failed: %s", strerror
(errno
));
349 memcpy
(&(new
->Address
), $1, sizeof
(struct in6_addr
));
352 | v6addrlist IPV6ADDR
';'
354 struct Clients
*new
= calloc
(1, sizeof
(struct Clients
));
356 flog
(LOG_CRIT
, "calloc failed: %s", strerror
(errno
));
360 memcpy
(&(new
->Address
), $2, sizeof
(struct in6_addr
));
367 prefixdef
: prefixhead optional_prefixplist
';'
372 if
(prefix
->AdvPreferredLifetime
> prefix
->AdvValidLifetime
)
374 flog
(LOG_ERR
, "AdvValidLifeTime must be "
375 "greater than AdvPreferredLifetime in %s, line %d",
376 conf_file
, num_lines
);
380 if
( prefix
->if6
[0] && prefix
->if6to4
[0]) {
381 flog
(LOG_ERR
, "Base6Interface and Base6to4Interface are mutually exclusive at this time.");
385 if
( prefix
->if6to4
[0] )
387 if
(get_v4addr
(prefix
->if6to4
, &dst
) < 0)
389 flog
(LOG_ERR
, "interface %s has no IPv4 addresses, disabling 6to4 prefix", prefix
->if6to4
);
394 *((uint16_t *)(prefix
->Prefix.s6_addr
)) = htons
(0x2002);
395 memcpy
( prefix
->Prefix.s6_addr
+ 2, &dst
, sizeof
( dst
) );
399 if
( prefix
->if6
[0] )
401 #ifndef HAVE_IFADDRS_H
402 flog
(LOG_ERR
, "Base6Interface not supported in %s, line %d", conf_file
, num_lines
);
405 struct ifaddrs
*ifap
= 0, *ifa
= 0;
406 struct AdvPrefix
*next
= prefix
->next
;
408 if
(prefix
->PrefixLen
!= 64) {
409 flog
(LOG_ERR
, "Only /64 is allowed with Base6Interface. %s:%d", conf_file
, num_lines
);
413 if
(getifaddrs
(&ifap
) != 0)
414 flog
(LOG_ERR
, "getifaddrs failed: %s", strerror
(errno
));
416 for
(ifa
= ifap
; ifa
; ifa
= ifa
->ifa_next
) {
417 struct sockaddr_in6
*s6
= 0;
418 struct sockaddr_in6
*mask
= (struct sockaddr_in6
*)ifa
->ifa_netmask
;
419 struct in6_addr base6prefix
;
420 char buf
[INET6_ADDRSTRLEN
];
423 if
(strncmp
(ifa
->ifa_name
, prefix
->if6
, IFNAMSIZ
))
426 if
(ifa
->ifa_addr
->sa_family
!= AF_INET6
)
429 s6
= (struct sockaddr_in6
*)(ifa
->ifa_addr
);
431 if
(IN6_IS_ADDR_LINKLOCAL
(&s6
->sin6_addr
))
434 base6prefix
= get_prefix6
(&s6
->sin6_addr
, &mask
->sin6_addr
);
435 for
(i
= 0; i
< 8; ++i
) {
436 prefix
->Prefix.s6_addr
[i
] &= ~mask
->sin6_addr.s6_addr
[i
];
437 prefix
->Prefix.s6_addr
[i
] |
= base6prefix.s6_addr
[i
];
439 memset
(&prefix
->Prefix.s6_addr
[8], 0, 8);
440 prefix
->AdvRouterAddr
= 1;
441 prefix
->AutoSelected
= 1;
444 if
(inet_ntop
(ifa
->ifa_addr
->sa_family
, (void *)&(prefix
->Prefix
), buf
, sizeof
(buf
)) == NULL
)
445 flog
(LOG_ERR
, "%s: inet_ntop failed in %s, line %d!", ifa
->ifa_name
, conf_file
, num_lines
);
447 dlog
(LOG_DEBUG
, 3, "auto-selected prefix %s/%d on interface %s from interface %s",
448 buf
, prefix
->PrefixLen
, iface
->Name
, ifa
->ifa_name
);
450 /* Taking only one prefix from the Base6Interface. Taking more than one would require allocating new
451 prefixes and building a list. I'm not sure how to do that from here. So for now, break. */
457 #endif /* ifndef HAVE_IFADDRS_H */
465 prefixhead
: T_PREFIX IPV6ADDR
'/' NUMBER
467 struct in6_addr zeroaddr
;
468 memset
(&zeroaddr
, 0, sizeof
(zeroaddr
));
470 if
(!memcmp
($2, &zeroaddr
, sizeof
(struct in6_addr
))) {
471 #ifndef HAVE_IFADDRS_H
472 flog
(LOG_ERR
, "invalid all-zeros prefix in %s, line %d", conf_file
, num_lines
);
475 struct ifaddrs
*ifap
= 0, *ifa
= 0;
476 struct AdvPrefix
*next
= iface
->AdvPrefixList
;
479 if
(next
->AutoSelected
) {
480 flog
(LOG_ERR
, "auto selecting prefixes works only once per interface. See %s, line %d", conf_file
, num_lines
);
487 dlog
(LOG_DEBUG
, 5, "all-zeros prefix in %s, line %d, parsing..", conf_file
, num_lines
);
489 if
(getifaddrs
(&ifap
) != 0)
490 flog
(LOG_ERR
, "getifaddrs failed: %s", strerror
(errno
));
492 for
(ifa
= ifap
; ifa
; ifa
= ifa
->ifa_next
) {
493 struct sockaddr_in6
*s6
= (struct sockaddr_in6
*)ifa
->ifa_addr
;
494 struct sockaddr_in6
*mask
= (struct sockaddr_in6
*)ifa
->ifa_netmask
;
495 char buf
[INET6_ADDRSTRLEN
];
497 if
(strncmp
(ifa
->ifa_name
, iface
->Name
, IFNAMSIZ
))
500 if
(ifa
->ifa_addr
->sa_family
!= AF_INET6
)
503 s6
= (struct sockaddr_in6
*)(ifa
->ifa_addr
);
505 if
(IN6_IS_ADDR_LINKLOCAL
(&s6
->sin6_addr
))
508 prefix
= malloc
(sizeof
(struct AdvPrefix
));
510 if
(prefix
== NULL
) {
511 flog
(LOG_CRIT
, "malloc failed: %s", strerror
(errno
));
515 prefix_init_defaults
(prefix
);
516 prefix
->Prefix
= get_prefix6
(&s6
->sin6_addr
, &mask
->sin6_addr
);
517 prefix
->AdvRouterAddr
= 1;
518 prefix
->AutoSelected
= 1;
522 if
(prefix
->PrefixLen
== 0)
523 prefix
->PrefixLen
= count_mask
(mask
);
525 if
(inet_ntop
(ifa
->ifa_addr
->sa_family
, (void *)&(prefix
->Prefix
), buf
, sizeof
(buf
)) == NULL
)
526 flog
(LOG_ERR
, "%s: inet_ntop failed in %s, line %d!", ifa
->ifa_name
, conf_file
, num_lines
);
528 dlog
(LOG_DEBUG
, 3, "auto-selected prefix %s/%d on interface %s", buf
, prefix
->PrefixLen
, ifa
->ifa_name
);
532 flog
(LOG_WARNING
, "no auto-selected prefix on interface %s, disabling advertisements", iface
->Name
);
537 #endif /* ifndef HAVE_IFADDRS_H */
540 prefix
= malloc
(sizeof
(struct AdvPrefix
));
542 if
(prefix
== NULL
) {
543 flog
(LOG_CRIT
, "malloc failed: %s", strerror
(errno
));
547 prefix_init_defaults
(prefix
);
549 if
($4 > MAX_PrefixLen
)
551 flog
(LOG_ERR
, "invalid prefix length in %s, line %d", conf_file
, num_lines
);
555 prefix
->PrefixLen
= $4;
557 memcpy
(&prefix
->Prefix
, $2, sizeof
(struct in6_addr
));
562 optional_prefixplist: /* empty */
563 |
'{' /* somewhat empty */ '}'
564 |
'{' prefixplist
'}'
567 prefixplist
: prefixplist prefixparms
571 prefixparms
: T_AdvOnLink SWITCH
';'
574 if
(prefix
->AutoSelected
) {
575 struct AdvPrefix
*p
= prefix
;
577 p
->AdvOnLinkFlag
= $2;
579 } while
(p
&& p
->AutoSelected
);
582 prefix
->AdvOnLinkFlag
= $2;
585 | T_AdvAutonomous SWITCH
';'
588 if
(prefix
->AutoSelected
) {
589 struct AdvPrefix
*p
= prefix
;
591 p
->AdvAutonomousFlag
= $2;
593 } while
(p
&& p
->AutoSelected
);
596 prefix
->AdvAutonomousFlag
= $2;
599 | T_AdvRouterAddr SWITCH
';'
602 if
(prefix
->AutoSelected
&& $2 == 0)
603 flog
(LOG_WARNING
, "prefix automatically selected, AdvRouterAddr always enabled, ignoring config line %d", num_lines
);
605 prefix
->AdvRouterAddr
= $2;
608 | T_AdvValidLifetime number_or_infinity
';'
611 if
(prefix
->AutoSelected
) {
612 struct AdvPrefix
*p
= prefix
;
614 p
->AdvValidLifetime
= $2;
615 p
->curr_validlft
= $2;
617 } while
(p
&& p
->AutoSelected
);
620 prefix
->AdvValidLifetime
= $2;
621 prefix
->curr_validlft
= $2;
624 | T_AdvPreferredLifetime number_or_infinity
';'
627 if
(prefix
->AutoSelected
) {
628 struct AdvPrefix
*p
= prefix
;
630 p
->AdvPreferredLifetime
= $2;
631 p
->curr_preferredlft
= $2;
633 } while
(p
&& p
->AutoSelected
);
636 prefix
->AdvPreferredLifetime
= $2;
637 prefix
->curr_preferredlft
= $2;
640 | T_DeprecatePrefix SWITCH
';'
642 prefix
->DeprecatePrefixFlag
= $2;
644 | T_DecrementLifetimes SWITCH
';'
646 prefix
->DecrementLifetimesFlag
= $2;
648 | T_Base6Interface name
';'
651 if
(prefix
->AutoSelected
) {
652 flog
(LOG_ERR
, "automatically selecting the prefix and Base6to4Interface are mutually exclusive");
655 dlog
(LOG_DEBUG
, 4, "using prefixes on interface %s for prefixes on interface %s", $2, iface
->Name
);
656 strncpy
(prefix
->if6
, $2, IFNAMSIZ
-1);
657 prefix
->if6
[IFNAMSIZ
-1] = '\0';
661 | T_Base6to4Interface name
';'
664 if
(prefix
->AutoSelected
) {
665 flog
(LOG_ERR
, "automatically selecting the prefix and Base6to4Interface are mutually exclusive");
668 dlog
(LOG_DEBUG
, 4, "using interface %s for 6to4 prefixes on interface %s", $2, iface
->Name
);
669 strncpy
(prefix
->if6to4
, $2, IFNAMSIZ
-1);
670 prefix
->if6to4
[IFNAMSIZ
-1] = '\0';
675 routedef
: routehead
'{' optional_routeplist
'}' ';'
683 routehead
: T_ROUTE IPV6ADDR
'/' NUMBER
685 route
= malloc
(sizeof
(struct AdvRoute
));
688 flog
(LOG_CRIT
, "malloc failed: %s", strerror
(errno
));
692 route_init_defaults
(route
, iface
);
694 if
($4 > MAX_PrefixLen
)
696 flog
(LOG_ERR
, "invalid route prefix length in %s, line %d", conf_file
, num_lines
);
700 route
->PrefixLen
= $4;
702 memcpy
(&route
->Prefix
, $2, sizeof
(struct in6_addr
));
707 optional_routeplist: /* empty */
711 routeplist
: routeplist routeparms
716 routeparms
: T_AdvRoutePreference SIGNEDNUMBER
';'
718 route
->AdvRoutePreference
= $2;
720 | T_AdvRouteLifetime number_or_infinity
';'
722 route
->AdvRouteLifetime
= $2;
724 | T_RemoveRoute SWITCH
';'
726 route
->RemoveRouteFlag
= $2;
730 rdnssdef
: rdnsshead
'{' optional_rdnssplist
'}' ';'
737 rdnssaddrs
: rdnssaddrs rdnssaddr
745 rdnss
= malloc
(sizeof
(struct AdvRDNSS
));
748 flog
(LOG_CRIT
, "malloc failed: %s", strerror
(errno
));
752 rdnss_init_defaults
(rdnss
, iface
);
755 switch
(rdnss
->AdvRDNSSNumber
) {
757 memcpy
(&rdnss
->AdvRDNSSAddr1
, $1, sizeof
(struct in6_addr
));
758 rdnss
->AdvRDNSSNumber
++;
761 memcpy
(&rdnss
->AdvRDNSSAddr2
, $1, sizeof
(struct in6_addr
));
762 rdnss
->AdvRDNSSNumber
++;
765 memcpy
(&rdnss
->AdvRDNSSAddr3
, $1, sizeof
(struct in6_addr
));
766 rdnss
->AdvRDNSSNumber
++;
769 flog
(LOG_CRIT
, "Too many addresses in RDNSS section");
776 rdnsshead
: T_RDNSS rdnssaddrs
779 flog
(LOG_CRIT
, "No address specified in RDNSS section");
785 optional_rdnssplist: /* empty */
789 rdnssplist
: rdnssplist rdnssparms
794 rdnssparms
: T_AdvRDNSSPreference NUMBER
';'
796 flog
(LOG_WARNING
, "Ignoring deprecated RDNSS preference.");
798 | T_AdvRDNSSOpenFlag SWITCH
';'
800 flog
(LOG_WARNING
, "Ignoring deprecated RDNSS open flag.");
802 | T_AdvRDNSSLifetime number_or_infinity
';'
804 if
($2 < iface
->MaxRtrAdvInterval
&& $2 != 0) {
805 flog
(LOG_ERR
, "AdvRDNSSLifetime must be at least MaxRtrAdvInterval");
808 if
($2 > 2*(iface
->MaxRtrAdvInterval
))
809 flog
(LOG_WARNING
, "Warning: AdvRDNSSLifetime <= 2*MaxRtrAdvInterval would allow stale DNS servers to be deleted faster");
811 rdnss
->AdvRDNSSLifetime
= $2;
813 | T_FlushRDNSS SWITCH
';'
815 rdnss
->FlushRDNSSFlag
= $2;
819 dnssldef
: dnsslhead
'{' optional_dnsslplist
'}' ';'
826 dnsslsuffixes
: dnsslsuffixes dnsslsuffix
833 for
(ch
= $1;*ch
!= '\0';ch
++) {
834 if
(*ch
>= 'A' && *ch
<= 'Z')
836 if
(*ch
>= 'a' && *ch
<= 'z')
838 if
(*ch
>= '0' && *ch
<= '9')
840 if
(*ch
== '-' ||
*ch
== '.')
843 flog
(LOG_CRIT
, "Invalid domain suffix specified");
848 /* first domain found */
849 dnssl
= malloc
(sizeof
(struct AdvDNSSL
));
852 flog
(LOG_CRIT
, "malloc failed: %s", strerror
(errno
));
856 dnssl_init_defaults
(dnssl
, iface
);
859 dnssl
->AdvDNSSLNumber
++;
860 dnssl
->AdvDNSSLSuffixes
=
861 realloc
(dnssl
->AdvDNSSLSuffixes
,
862 dnssl
->AdvDNSSLNumber
* sizeof
(char*));
863 if
(dnssl
->AdvDNSSLSuffixes
== NULL
) {
864 flog
(LOG_CRIT
, "realloc failed: %s", strerror
(errno
));
868 dnssl
->AdvDNSSLSuffixes
[dnssl
->AdvDNSSLNumber
- 1] = strdup
($1);
872 dnsslhead
: T_DNSSL dnsslsuffixes
875 flog
(LOG_CRIT
, "No domain specified in DNSSL section");
881 optional_dnsslplist: /* empty */
885 dnsslplist
: dnsslplist dnsslparms
890 dnsslparms
: T_AdvDNSSLLifetime number_or_infinity
';'
892 if
($2 < iface
->MaxRtrAdvInterval
&& $2 != 0) {
893 flog
(LOG_ERR
, "AdvDNSSLLifetime must be at least MaxRtrAdvInterval");
896 if
($2 > 2*(iface
->MaxRtrAdvInterval
))
897 flog
(LOG_WARNING
, "Warning: AdvDNSSLLifetime <= 2*MaxRtrAdvInterval would allow stale DNS suffixes to be deleted faster");
899 dnssl
->AdvDNSSLLifetime
= $2;
901 | T_FlushDNSSL SWITCH
';'
903 dnssl
->FlushDNSSLFlag
= $2;
907 number_or_infinity
: NUMBER
924 for
(count
= 0; b
!= 0; count
++) {
925 b
&= b
- 1; // this clears the LSB-most set bit
932 int count_mask
(struct sockaddr_in6
*m
)
934 struct in6_addr
*in6
= &m
->sin6_addr
;
938 for
(i
= 0; i
< 16; ++i
) {
939 count
+= countbits
(in6
->s6_addr
[i
]);
945 struct in6_addr get_prefix6
(struct in6_addr
const *addr
, struct in6_addr
const *mask
)
947 struct in6_addr prefix
= *addr
;
950 for
(; i
< 16; ++i
) {
951 prefix.s6_addr
[i
] &= mask
->s6_addr
[i
];
974 for
(i
= 0;i
< dnssl
->AdvDNSSLNumber
;i
++)
975 free
(dnssl
->AdvDNSSLSuffixes
[i
]);
976 free
(dnssl
->AdvDNSSLSuffixes
);
985 flog
(LOG_ERR
, "%s in %s, line %d: %s", msg
, conf_file
, num_lines
, yytext
);