1 /* $KAME: cfparse.y,v 1.36 2005/05/03 06:46:00 jinmei Exp $ */
4 * Copyright (C) 2002 WIDE Project.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the project nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include <sys/types.h>
33 #include <sys/socket.h>
34 #include <sys/queue.h>
37 #include <netinet/in.h>
39 #include <arpa/inet.h>
51 extern
void yywarn __P
((char *, ...
))
52 __attribute__
((__format__
(__printf__
, 1, 2)));
53 extern
void yyerror __P
((char *, ...
))
54 __attribute__
((__format__
(__printf__
, 1, 2)));
56 #define MAKE_NAMELIST(l, n, p) do { \
57 (l
) = (struct cf_namelist
*)malloc
(sizeof
(*(l
))); \
59 yywarn
("can't allocate memory"); \
60 if
(p
) cleanup_cflist
(p
); \
63 memset
((l
), 0, sizeof
(*(l
))); \
69 #define MAKE_CFLIST(l, t, pp, pl) do { \
70 (l
) = (struct cf_list
*)malloc
(sizeof
(*(l
))); \
72 yywarn
("can't allocate memory"); \
74 if
(pl
) cleanup_cflist
(pl
); \
77 memset
((l
), 0, sizeof
(*(l
))); \
85 static struct cf_namelist
*iflist_head
, *hostlist_head
, *iapdlist_head
;
86 static struct cf_namelist
*addrpoollist_head
;
87 static struct cf_namelist
*authinfolist_head
, *keylist_head
;
88 static struct cf_namelist
*ianalist_head
;
89 struct cf_list
*cf_dns_list
, *cf_dns_name_list
, *cf_ntp_list
;
90 struct cf_list
*cf_sip_list
, *cf_sip_name_list
;
91 struct cf_list
*cf_nis_list
, *cf_nis_name_list
;
92 struct cf_list
*cf_nisp_list
, *cf_nisp_name_list
;
93 struct cf_list
*cf_bcmcs_list
, *cf_bcmcs_name_list
;
94 long long cf_refreshtime
= -1;
96 extern
int yylex __P
((void));
97 extern
int cfswitch_buffer __P
((char *));
98 static int add_namelist __P
((struct cf_namelist
*, struct cf_namelist
**));
99 static void cleanup __P
((void));
100 static void cleanup_namelist __P
((struct cf_namelist
*));
101 static void cleanup_cflist __P
((struct cf_list
*));
104 %token INTERFACE IFNAME
105 %token PREFIX_INTERFACE SLA_ID SLA_LEN DUID_ID
106 %token ID_ASSOC IA_PD IAID IA_NA
108 %token REQUEST SEND ALLOW PREFERENCE
109 %token HOST HOSTNAME DUID
110 %token OPTION RAPID_COMMIT DNS_SERVERS DNS_NAME NTP_SERVERS REFRESHTIME
111 %token SIP_SERVERS SIP_NAME
112 %token NIS_SERVERS NIS_NAME
113 %token NISP_SERVERS NISP_NAME
114 %token BCMCS_SERVERS BCMCS_NAME
116 %token SCRIPT DELAYEDKEY
117 %token AUTHENTICATION PROTOCOL ALGORITHM DELAYED RECONFIG HMACMD5 MONOCOUNTER
118 %token AUTHNAME RDM KEY
119 %token KEYINFO REALM KEYID SECRET KEYNAME EXPIRE
120 %token ADDRPOOL POOLNAME RANGE TO ADDRESS_POOL
123 %token NUMBER SLASH EOS BCL ECL STRING QSTRING PREFIX INFINITY
129 struct cf_list
*list
;
130 struct dhcp6_prefix
*prefix
;
131 struct dhcp6_range
*range
;
132 struct dhcp6_poolspec
*pool
;
135 %type
<str
> IFNAME HOSTNAME AUTHNAME KEYNAME DUID_ID STRING QSTRING IAID
137 %type
<num
> NUMBER duration authproto authalg authrdm
138 %type
<list
> declaration declarations dhcpoption ifparam ifparams
139 %type
<list
> address_list address_list_ent dhcpoption_list
140 %type
<list
> iapdconf_list iapdconf prefix_interface
141 %type
<list
> ianaconf_list ianaconf
142 %type
<list
> authparam_list authparam
143 %type
<list
> keyparam_list keyparam
144 %type
<prefix
> addressparam prefixparam
145 %type
<range
> rangeparam
146 %type
<pool
> poolparam
151 | statements statement
159 | authentication_statement
166 INTERFACE IFNAME BCL declarations ECL EOS
168 struct cf_namelist
*ifl
;
170 MAKE_NAMELIST
(ifl
, $2, $4);
172 if
(add_namelist
(ifl
, &iflist_head
))
178 HOST HOSTNAME BCL declarations ECL EOS
180 struct cf_namelist
*host
;
182 MAKE_NAMELIST
(host
, $2, $4);
184 if
(add_namelist
(host
, &hostlist_head
))
190 OPTION DNS_SERVERS address_list EOS
192 if
(cf_dns_list
== NULL
)
195 cf_dns_list
->tail
->next
= $3;
196 cf_dns_list
->tail
= $3->tail
;
199 | OPTION DNS_NAME QSTRING EOS
203 MAKE_CFLIST
(l
, CFLISTENT_GENERIC
, $3, NULL
);
205 if
(cf_dns_name_list
== NULL
) {
206 cf_dns_name_list
= l
;
207 cf_dns_name_list
->tail
= l
;
208 cf_dns_name_list
->next
= NULL
;
210 cf_dns_name_list
->tail
->next
= l
;
211 cf_dns_name_list
->tail
= l
->tail
;
214 | OPTION NTP_SERVERS address_list EOS
216 if
(cf_ntp_list
== NULL
)
219 cf_ntp_list
->tail
->next
= $3;
220 cf_ntp_list
->tail
= $3->tail
;
223 | OPTION SIP_SERVERS address_list EOS
225 if
(cf_sip_list
== NULL
)
228 cf_sip_list
->tail
->next
= $3;
229 cf_sip_list
->tail
= $3->tail
;
232 | OPTION SIP_NAME QSTRING EOS
236 MAKE_CFLIST
(l
, CFLISTENT_GENERIC
, $3, NULL
);
238 if
(cf_sip_name_list
== NULL
) {
239 cf_sip_name_list
= l
;
240 cf_sip_name_list
->tail
= l
;
241 cf_sip_name_list
->next
= NULL
;
243 cf_sip_name_list
->tail
->next
= l
;
244 cf_sip_name_list
->tail
= l
->tail
;
247 | OPTION NIS_SERVERS address_list EOS
249 if
(cf_nis_list
== NULL
)
252 cf_nis_list
->tail
->next
= $3;
253 cf_nis_list
->tail
= $3->tail
;
256 | OPTION NIS_NAME QSTRING EOS
260 MAKE_CFLIST
(l
, CFLISTENT_GENERIC
, $3, NULL
);
262 if
(cf_nis_name_list
== NULL
) {
263 cf_nis_name_list
= l
;
264 cf_nis_name_list
->tail
= l
;
265 cf_nis_name_list
->next
= NULL
;
267 cf_nis_name_list
->tail
->next
= l
;
268 cf_nis_name_list
->tail
= l
->tail
;
271 | OPTION NISP_SERVERS address_list EOS
273 if
(cf_nisp_list
== NULL
)
276 cf_nisp_list
->tail
->next
= $3;
277 cf_nisp_list
->tail
= $3->tail
;
280 | OPTION NISP_NAME QSTRING EOS
284 MAKE_CFLIST
(l
, CFLISTENT_GENERIC
, $3, NULL
);
286 if
(cf_nisp_name_list
== NULL
) {
287 cf_nisp_name_list
= l
;
288 cf_nisp_name_list
->tail
= l
;
289 cf_nisp_name_list
->next
= NULL
;
291 cf_nisp_name_list
->tail
->next
= l
;
292 cf_nisp_name_list
->tail
= l
->tail
;
295 | OPTION BCMCS_SERVERS address_list EOS
297 if
(cf_bcmcs_list
== NULL
)
300 cf_bcmcs_list
->tail
->next
= $3;
301 cf_bcmcs_list
->tail
= $3->tail
;
304 | OPTION BCMCS_NAME QSTRING EOS
308 MAKE_CFLIST
(l
, CFLISTENT_GENERIC
, $3, NULL
);
310 if
(cf_bcmcs_name_list
== NULL
) {
311 cf_bcmcs_name_list
= l
;
312 cf_bcmcs_name_list
->tail
= l
;
313 cf_bcmcs_name_list
->next
= NULL
;
315 cf_bcmcs_name_list
->tail
->next
= l
;
316 cf_bcmcs_name_list
->tail
= l
->tail
;
319 | OPTION REFRESHTIME NUMBER EOS
321 if
(cf_refreshtime
== -1) {
323 if
(cf_refreshtime
< -1 ||
324 cf_refreshtime
> 0xffffffff) {
326 * refresh time should not be negative
327 * according to the lex definition,
328 * but check it for safety.
330 yyerror("refresh time is out of range");
332 if
(cf_refreshtime
< DHCP6_IRT_MINIMUM
) {
334 * the value MUST NOT be smaller than
337 yyerror("refresh time is too small "
338 "(must not be smaller than %d)",
342 yywarn
("multiple refresh times (ignored)");
348 ID_ASSOC IA_PD IAID BCL iapdconf_list ECL EOS
350 struct cf_namelist
*iapd
;
352 MAKE_NAMELIST
(iapd
, $3, $5);
354 if
(add_namelist
(iapd
, &iapdlist_head
))
357 | ID_ASSOC IA_PD BCL iapdconf_list ECL EOS
359 struct cf_namelist
*iapd
;
362 if
((zero
= strdup
("0")) == NULL
) {
363 yywarn
("can't allocate memory");
366 MAKE_NAMELIST
(iapd
, zero
, $4);
368 if
(add_namelist
(iapd
, &iapdlist_head
))
371 | ID_ASSOC IA_NA IAID BCL ianaconf_list ECL EOS
373 struct cf_namelist
*iana
;
375 MAKE_NAMELIST
(iana
, $3, $5);
377 if
(add_namelist
(iana
, &ianalist_head
))
380 | ID_ASSOC IA_NA BCL ianaconf_list ECL EOS
382 struct cf_namelist
*iana
;
385 if
((zero
= strdup
("0")) == NULL
) {
386 yywarn
("can't allocate memory");
389 MAKE_NAMELIST
(iana
, zero
, $4);
391 if
(add_namelist
(iana
, &ianalist_head
))
396 authentication_statement:
397 AUTHENTICATION AUTHNAME BCL authparam_list ECL EOS
399 struct cf_namelist
*authinfo
;
401 MAKE_NAMELIST
(authinfo
, $2, $4);
403 if
(add_namelist
(authinfo
, &authinfolist_head
))
409 KEYINFO KEYNAME BCL keyparam_list ECL EOS
411 struct cf_namelist
*key
;
413 MAKE_NAMELIST
(key
, $2, $4);
415 if
(add_namelist
(key
, &keylist_head
))
423 if
(cfswitch_buffer
($2)) {
432 ADDRPOOL POOLNAME BCL declarations ECL EOS
434 struct cf_namelist
*pool
;
436 MAKE_NAMELIST
(pool
, $2, $4);
438 if
(add_namelist
(pool
, &addrpoollist_head
))
445 | address_list address_list_ent
447 struct cf_list
*head
;
449 if
((head
= $1) == NULL
) {
454 head
->tail
->next
= $2;
455 head
->tail
= $2->tail
;
466 struct in6_addr a0
, *a
;
468 if
(inet_pton
(AF_INET6
, $1, &a0
) != 1) {
469 yywarn
("invalid IPv6 address: %s", $1);
473 if
((a
= malloc
(sizeof
(*a
))) == NULL
) {
474 yywarn
("can't allocate memory");
479 MAKE_CFLIST
(l
, CFLISTENT_GENERIC
, a
, NULL
);
487 | declarations declaration
489 struct cf_list
*head
;
491 if
((head
= $1) == NULL
) {
496 head
->tail
->next
= $2;
497 head
->tail
= $2->tail
;
505 SEND dhcpoption_list EOS
509 MAKE_CFLIST
(l
, DECL_SEND
, NULL
, $2);
513 | REQUEST dhcpoption_list EOS
517 MAKE_CFLIST
(l
, DECL_REQUEST
, NULL
, $2);
525 MAKE_CFLIST
(l
, DECL_INFO_ONLY
, NULL
, NULL
);
529 | ALLOW dhcpoption EOS
533 MAKE_CFLIST
(l
, DECL_ALLOW
, NULL
, $2);
541 MAKE_CFLIST
(l
, DECL_DUID
, $2, NULL
);
545 | ADDRESS addressparam EOS
549 MAKE_CFLIST
(l
, DECL_ADDRESS
, $2,NULL
);
553 | PREFIX prefixparam EOS
557 MAKE_CFLIST
(l
, DECL_PREFIX
, $2, NULL
);
561 | PREFERENCE NUMBER EOS
565 MAKE_CFLIST
(l
, DECL_PREFERENCE
, NULL
, NULL
);
574 MAKE_CFLIST
(l
, DECL_SCRIPT
, $2, NULL
);
578 | DELAYEDKEY STRING EOS
582 MAKE_CFLIST
(l
, DECL_DELAYEDKEY
, $2, NULL
);
586 | RANGE rangeparam EOS
590 MAKE_CFLIST
(l
, DECL_RANGE
, $2, NULL
);
594 | ADDRESS_POOL poolparam EOS
598 MAKE_CFLIST
(l
, DECL_ADDRESSPOOL
, $2, NULL
);
609 | dhcpoption COMMA dhcpoption_list
623 MAKE_CFLIST
(l
, DHCPOPT_RAPID_COMMIT
, NULL
, NULL
);
627 | AUTHENTICATION AUTHNAME
631 MAKE_CFLIST
(l
, DHCPOPT_AUTHINFO
, NULL
, NULL
);
639 MAKE_CFLIST
(l
, DHCPOPT_IA_PD
, NULL
, NULL
);
647 MAKE_CFLIST
(l
, DHCPOPT_IA_NA
, NULL
, NULL
);
655 MAKE_CFLIST
(l
, DHCPOPT_SIP
, NULL
, NULL
);
656 /* currently no value */
663 MAKE_CFLIST
(l
, DHCPOPT_SIPNAME
, NULL
, NULL
);
664 /* currently no value */
671 MAKE_CFLIST
(l
, DHCPOPT_DNS
, NULL
, NULL
);
672 /* currently no value */
679 MAKE_CFLIST
(l
, DHCPOPT_DNSNAME
, NULL
, NULL
);
680 /* currently no value */
687 MAKE_CFLIST
(l
, DHCPOPT_NTP
, NULL
, NULL
);
688 /* currently no value */
695 MAKE_CFLIST
(l
, DHCPOPT_REFRESHTIME
, NULL
, NULL
);
696 /* currently no value */
703 MAKE_CFLIST
(l
, DHCPOPT_NIS
, NULL
, NULL
);
704 /* currently no value */
711 MAKE_CFLIST
(l
, DHCPOPT_NISNAME
, NULL
, NULL
);
712 /* currently no value */
719 MAKE_CFLIST
(l
, DHCPOPT_NISP
, NULL
, NULL
);
720 /* currently no value */
727 MAKE_CFLIST
(l
, DHCPOPT_NISPNAME
, NULL
, NULL
);
728 /* currently no value */
735 MAKE_CFLIST
(l
, DHCPOPT_BCMCS
, NULL
, NULL
);
736 /* currently no value */
743 MAKE_CFLIST
(l
, DHCPOPT_BCMCSNAME
, NULL
, NULL
);
744 /* currently no value */
752 struct dhcp6_range range0
, *range
;
754 memset
(&range0
, 0, sizeof
(range0
));
755 if
(inet_pton
(AF_INET6
, $1, &range0.min
) != 1) {
756 yywarn
("invalid IPv6 address: %s", $1);
761 if
(inet_pton
(AF_INET6
, $3, &range0.max
) != 1) {
762 yywarn
("invalid IPv6 address: %s", $3);
770 if
((range
= malloc
(sizeof
(*range
))) == NULL
) {
771 yywarn
("can't allocate memory");
783 struct dhcp6_prefix pconf0
, *pconf
;
785 memset
(&pconf0
, 0, sizeof
(pconf0
));
786 if
(inet_pton
(AF_INET6
, $1, &pconf0.addr
) != 1) {
787 yywarn
("invalid IPv6 address: %s", $1);
792 /* validate other parameters later */
793 pconf0.plen
= 128; /* XXX this field is ignored */
795 pconf0.pltime
= DHCP6_DURATION_INFINITE
;
797 pconf0.pltime
= (u_int32_t
)$2;
798 pconf0.vltime
= pconf0.pltime
;
800 if
((pconf
= malloc
(sizeof
(*pconf
))) == NULL
) {
801 yywarn
("can't allocate memory");
808 | STRING duration duration
810 struct dhcp6_prefix pconf0
, *pconf
;
812 memset
(&pconf0
, 0, sizeof
(pconf0
));
813 if
(inet_pton
(AF_INET6
, $1, &pconf0.addr
) != 1) {
814 yywarn
("invalid IPv6 address: %s", $1);
819 /* validate other parameters later */
820 pconf0.plen
= 128; /* XXX */
822 pconf0.pltime
= DHCP6_DURATION_INFINITE
;
824 pconf0.pltime
= (u_int32_t
)$2;
826 pconf0.vltime
= DHCP6_DURATION_INFINITE
;
828 pconf0.vltime
= (u_int32_t
)$3;
830 if
((pconf
= malloc
(sizeof
(*pconf
))) == NULL
) {
831 yywarn
("can't allocate memory");
841 STRING SLASH NUMBER duration
843 struct dhcp6_prefix pconf0
, *pconf
;
845 memset
(&pconf0
, 0, sizeof
(pconf0
));
846 if
(inet_pton
(AF_INET6
, $1, &pconf0.addr
) != 1) {
847 yywarn
("invalid IPv6 address: %s", $1);
852 /* validate other parameters later */
855 pconf0.pltime
= DHCP6_DURATION_INFINITE
;
857 pconf0.pltime
= (u_int32_t
)$4;
858 pconf0.vltime
= pconf0.pltime
;
860 if
((pconf
= malloc
(sizeof
(*pconf
))) == NULL
) {
861 yywarn
("can't allocate memory");
868 | STRING SLASH NUMBER duration duration
870 struct dhcp6_prefix pconf0
, *pconf
;
872 memset
(&pconf0
, 0, sizeof
(pconf0
));
873 if
(inet_pton
(AF_INET6
, $1, &pconf0.addr
) != 1) {
874 yywarn
("invalid IPv6 address: %s", $1);
879 /* validate other parameters later */
882 pconf0.pltime
= DHCP6_DURATION_INFINITE
;
884 pconf0.pltime
= (u_int32_t
)$4;
886 pconf0.vltime
= DHCP6_DURATION_INFINITE
;
888 pconf0.vltime
= (u_int32_t
)$5;
890 if
((pconf
= malloc
(sizeof
(*pconf
))) == NULL
) {
891 yywarn
("can't allocate memory");
903 struct dhcp6_poolspec
* pool
;
905 if
((pool
= malloc
(sizeof
(*pool
))) == NULL
) {
906 yywarn
("can't allocate memory");
910 if
((pool
->name
= strdup
($1)) == NULL
) {
911 yywarn
("can't allocate memory");
917 /* validate other parameters later */
919 pool
->pltime
= DHCP6_DURATION_INFINITE
;
921 pool
->pltime
= (u_int32_t
)$2;
922 pool
->vltime
= pool
->pltime
;
926 | STRING duration duration
928 struct dhcp6_poolspec
* pool
;
930 if
((pool
= malloc
(sizeof
(*pool
))) == NULL
) {
931 yywarn
("can't allocate memory");
935 if
((pool
->name
= strdup
($1)) == NULL
) {
936 yywarn
("can't allocate memory");
942 /* validate other parameters later */
944 pool
->pltime
= DHCP6_DURATION_INFINITE
;
946 pool
->pltime
= (u_int32_t
)$2;
948 pool
->vltime
= DHCP6_DURATION_INFINITE
;
950 pool
->vltime
= (u_int32_t
)$3;
969 | iapdconf_list iapdconf
971 struct cf_list
*head
;
973 if
((head
= $1) == NULL
) {
978 head
->tail
->next
= $2;
979 head
->tail
= $2->tail
;
987 prefix_interface
{ $$
= $1; }
988 | PREFIX prefixparam EOS
992 MAKE_CFLIST
(l
, IACONF_PREFIX
, $2, NULL
);
999 PREFIX_INTERFACE IFNAME BCL ifparams ECL EOS
1001 struct cf_list
*ifl
;
1003 MAKE_CFLIST
(ifl
, IACONF_PIF
, $2, $4);
1012 struct cf_list
*head
;
1014 if
((head
= $1) == NULL
) {
1019 head
->tail
->next
= $2;
1020 head
->tail
= $2->tail
;
1032 MAKE_CFLIST
(l
, IFPARAM_SLA_ID
, NULL
, NULL
);
1036 | SLA_LEN NUMBER EOS
1040 MAKE_CFLIST
(l
, IFPARAM_SLA_LEN
, NULL
, NULL
);
1048 | ianaconf_list ianaconf
1050 struct cf_list
*head
;
1052 if
((head
= $1) == NULL
) {
1057 head
->tail
->next
= $2;
1058 head
->tail
= $2->tail
;
1066 ADDRESS addressparam EOS
1070 MAKE_CFLIST
(l
, IACONF_ADDR
, $2, NULL
);
1078 | authparam_list authparam
1080 struct cf_list
*head
;
1082 if
((head
= $1) == NULL
) {
1087 head
->tail
->next
= $2;
1088 head
->tail
= $2->tail
;
1096 PROTOCOL authproto EOS
1100 MAKE_CFLIST
(l
, AUTHPARAM_PROTO
, NULL
, NULL
);
1104 | ALGORITHM authalg EOS
1108 MAKE_CFLIST
(l
, AUTHPARAM_ALG
, NULL
, NULL
);
1116 MAKE_CFLIST
(l
, AUTHPARAM_RDM
, NULL
, NULL
);
1124 MAKE_CFLIST
(l
, AUTHPARAM_KEY
, NULL
, NULL
);
1131 DELAYED
{ $$
= DHCP6_AUTHPROTO_DELAYED
; }
1132 | RECONFIG
{ $$
= DHCP6_AUTHPROTO_RECONFIG
; }
1136 HMACMD5
{ $$
= DHCP6_AUTHALG_HMACMD5
; }
1140 MONOCOUNTER
{ $$
= DHCP6_AUTHRDM_MONOCOUNTER
; }
1145 | keyparam_list keyparam
1147 struct cf_list
*head
;
1149 if
((head
= $1) == NULL
) {
1154 head
->tail
->next
= $2;
1155 head
->tail
= $2->tail
;
1167 MAKE_CFLIST
(l
, KEYPARAM_REALM
, NULL
, NULL
);
1175 MAKE_CFLIST
(l
, KEYPARAM_KEYID
, NULL
, NULL
);
1179 | SECRET QSTRING EOS
1183 MAKE_CFLIST
(l
, KEYPARAM_SECRET
, NULL
, NULL
);
1187 | EXPIRE QSTRING EOS
1191 MAKE_CFLIST
(l
, KEYPARAM_EXPIRE
, NULL
, NULL
);
1198 /* supplement routines for configuration */
1200 add_namelist
(new
, headp
)
1201 struct cf_namelist
*new
, **headp
;
1203 struct cf_namelist
*n
;
1205 /* check for duplicated configuration */
1206 for
(n
= *headp
; n
; n
= n
->next
) {
1207 if
(strcmp
(n
->name
, new
->name
) == 0) {
1208 yywarn
("duplicated name: %s (ignored)",
1210 cleanup_namelist
(new
);
1221 /* free temporary resources */
1225 cleanup_namelist
(iflist_head
);
1227 cleanup_namelist
(hostlist_head
);
1228 hostlist_head
= NULL
;
1229 cleanup_namelist
(iapdlist_head
);
1230 iapdlist_head
= NULL
;
1231 cleanup_namelist
(ianalist_head
);
1232 ianalist_head
= NULL
;
1233 cleanup_namelist
(authinfolist_head
);
1234 authinfolist_head
= NULL
;
1235 cleanup_namelist
(keylist_head
);
1236 keylist_head
= NULL
;
1237 cleanup_namelist
(addrpoollist_head
);
1238 addrpoollist_head
= NULL
;
1240 cleanup_cflist
(cf_sip_list
);
1242 cleanup_cflist
(cf_sip_name_list
);
1243 cf_sip_name_list
= NULL
;
1244 cleanup_cflist
(cf_dns_list
);
1246 cleanup_cflist
(cf_dns_name_list
);
1247 cf_dns_name_list
= NULL
;
1248 cleanup_cflist
(cf_ntp_list
);
1250 cleanup_cflist
(cf_nis_list
);
1252 cleanup_cflist
(cf_nis_name_list
);
1253 cf_nis_name_list
= NULL
;
1254 cleanup_cflist
(cf_nisp_list
);
1255 cf_nisp_list
= NULL
;
1256 cleanup_cflist
(cf_nisp_name_list
);
1257 cf_nisp_name_list
= NULL
;
1258 cleanup_cflist
(cf_bcmcs_list
);
1259 cf_bcmcs_list
= NULL
;
1260 cleanup_cflist
(cf_bcmcs_name_list
);
1261 cf_bcmcs_name_list
= NULL
;
1265 cleanup_namelist
(head
)
1266 struct cf_namelist
*head
;
1268 struct cf_namelist
*ifp
, *ifp_next
;
1270 for
(ifp
= head
; ifp
; ifp
= ifp_next
) {
1271 ifp_next
= ifp
->next
;
1272 cleanup_cflist
(ifp
->params
);
1288 if
(p
->type
== DECL_ADDRESSPOOL
) {
1289 free
(((struct dhcp6_poolspec
*)p
->ptr
)->name
);
1294 cleanup_cflist
(p
->list
);
1300 #define config_fail() \
1301 do
{ cleanup
(); configure_cleanup
(); return
(-1); } while
(0)
1306 if
(configure_keys
(keylist_head
))
1309 if
(configure_authinfo
(authinfolist_head
))
1312 if
(configure_ia
(iapdlist_head
, IATYPE_PD
))
1315 if
(configure_ia
(ianalist_head
, IATYPE_NA
))
1318 if
(configure_pool
(addrpoollist_head
))
1321 if
(configure_interface
(iflist_head
))
1324 if
(configure_host
(hostlist_head
))
1327 if
(configure_global_option
())