mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-03 07:31:54 +00:00
RAdv: Use new syntax for custom options
And use WALK_LIST macro
This commit is contained in:
parent
9c81250c04
commit
ccfa48a24a
@ -42,7 +42,7 @@ CF_KEYWORDS(RADV, PREFIX, INTERFACE, MIN, MAX, RA, DELAY, INTERVAL, SOLICITED,
|
|||||||
RETRANS, TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT,
|
RETRANS, TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT,
|
||||||
LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN, LOCAL,
|
LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN, LOCAL,
|
||||||
TRIGGER, SENSITIVE, PREFERENCE, LOW, MEDIUM, HIGH, PROPAGATE, ROUTE,
|
TRIGGER, SENSITIVE, PREFERENCE, LOW, MEDIUM, HIGH, PROPAGATE, ROUTE,
|
||||||
ROUTES, RA_PREFERENCE, RA_LIFETIME)
|
ROUTES, RA_PREFERENCE, RA_LIFETIME, CUSTOM, OPTION, TYPE, VALUE)
|
||||||
|
|
||||||
CF_ENUM(T_ENUM_RA_PREFERENCE, RA_PREF_, LOW, MEDIUM, HIGH)
|
CF_ENUM(T_ENUM_RA_PREFERENCE, RA_PREF_, LOW, MEDIUM, HIGH)
|
||||||
|
|
||||||
@ -50,6 +50,8 @@ CF_ENUM(T_ENUM_RA_PREFERENCE, RA_PREF_, LOW, MEDIUM, HIGH)
|
|||||||
|
|
||||||
CF_GRAMMAR
|
CF_GRAMMAR
|
||||||
|
|
||||||
|
kw_sym: CUSTOM | OPTION | VALUE ;
|
||||||
|
|
||||||
proto: radv_proto ;
|
proto: radv_proto ;
|
||||||
|
|
||||||
radv_proto_start: proto_start RADV
|
radv_proto_start: proto_start RADV
|
||||||
@ -71,7 +73,7 @@ radv_proto_item:
|
|||||||
| PREFIX radv_prefix { add_tail(&RADV_CFG->pref_list, NODE this_radv_prefix); }
|
| PREFIX radv_prefix { add_tail(&RADV_CFG->pref_list, NODE this_radv_prefix); }
|
||||||
| RDNSS { init_list(&radv_dns_list); } radv_rdnss { add_tail_list(&RADV_CFG->rdnss_list, &radv_dns_list); }
|
| RDNSS { init_list(&radv_dns_list); } radv_rdnss { add_tail_list(&RADV_CFG->rdnss_list, &radv_dns_list); }
|
||||||
| DNSSL { init_list(&radv_dns_list); } radv_dnssl { add_tail_list(&RADV_CFG->dnssl_list, &radv_dns_list); }
|
| DNSSL { init_list(&radv_dns_list); } radv_dnssl { add_tail_list(&RADV_CFG->dnssl_list, &radv_dns_list); }
|
||||||
| OTHER TYPE expr BYTESTRING { radv_add_to_custom_list(&RADV_CFG->custom_list, $3, $4); }
|
| CUSTOM OPTION TYPE expr VALUE BYTESTRING { radv_add_to_custom_list(&RADV_CFG->custom_list, $4, $6); }
|
||||||
| TRIGGER net_ip6 { RADV_CFG->trigger = $2; }
|
| TRIGGER net_ip6 { RADV_CFG->trigger = $2; }
|
||||||
| PROPAGATE ROUTES bool { RADV_CFG->propagate_routes = $3; }
|
| PROPAGATE ROUTES bool { RADV_CFG->propagate_routes = $3; }
|
||||||
;
|
;
|
||||||
@ -136,10 +138,10 @@ radv_iface_item:
|
|||||||
| PREFIX radv_prefix { add_tail(&RADV_IFACE->pref_list, NODE this_radv_prefix); }
|
| PREFIX radv_prefix { add_tail(&RADV_IFACE->pref_list, NODE this_radv_prefix); }
|
||||||
| RDNSS { init_list(&radv_dns_list); } radv_rdnss { add_tail_list(&RADV_IFACE->rdnss_list, &radv_dns_list); }
|
| RDNSS { init_list(&radv_dns_list); } radv_rdnss { add_tail_list(&RADV_IFACE->rdnss_list, &radv_dns_list); }
|
||||||
| DNSSL { init_list(&radv_dns_list); } radv_dnssl { add_tail_list(&RADV_IFACE->dnssl_list, &radv_dns_list); }
|
| DNSSL { init_list(&radv_dns_list); } radv_dnssl { add_tail_list(&RADV_IFACE->dnssl_list, &radv_dns_list); }
|
||||||
| OTHER TYPE expr BYTESTRING { radv_add_to_custom_list(&RADV_IFACE->custom_list, $3, $4); }
|
| CUSTOM OPTION TYPE expr VALUE BYTESTRING { radv_add_to_custom_list(&RADV_IFACE->custom_list, $4, $6); }
|
||||||
| RDNSS LOCAL bool { RADV_IFACE->rdnss_local = $3; }
|
| RDNSS LOCAL bool { RADV_IFACE->rdnss_local = $3; }
|
||||||
| DNSSL LOCAL bool { RADV_IFACE->dnssl_local = $3; }
|
| DNSSL LOCAL bool { RADV_IFACE->dnssl_local = $3; }
|
||||||
| OTHER LOCAL bool { RADV_IFACE->custom_local = $3; }
|
| CUSTOM OPTION LOCAL bool { RADV_IFACE->custom_local = $4; }
|
||||||
;
|
;
|
||||||
|
|
||||||
radv_preference:
|
radv_preference:
|
||||||
|
@ -264,9 +264,8 @@ radv_prepare_dnssl(struct radv_iface *ifa, list *dnssl_list, char **buf, char *b
|
|||||||
static int
|
static int
|
||||||
radv_prepare_custom(struct radv_iface *ifa, list *custom_list, char **buf, char *bufend)
|
radv_prepare_custom(struct radv_iface *ifa, list *custom_list, char **buf, char *bufend)
|
||||||
{
|
{
|
||||||
struct radv_custom_config *ccf = HEAD(*custom_list);
|
struct radv_custom_config *ccf;
|
||||||
|
WALK_LIST(ccf, *custom_list)
|
||||||
while(NODE_VALID(ccf))
|
|
||||||
{
|
{
|
||||||
struct radv_opt_custom *op = (void *) *buf;
|
struct radv_opt_custom *op = (void *) *buf;
|
||||||
/* Add 2 octets for type and size and 8 - 1 for ceiling the division up to 8 octets */
|
/* Add 2 octets for type and size and 8 - 1 for ceiling the division up to 8 octets */
|
||||||
@ -280,7 +279,6 @@ radv_prepare_custom(struct radv_iface *ifa, list *custom_list, char **buf, char
|
|||||||
memcpy(op->payload, ccf->payload->data, ccf->payload->length);
|
memcpy(op->payload, ccf->payload->data, ccf->payload->length);
|
||||||
|
|
||||||
*buf += 8 * op->length;
|
*buf += 8 * op->length;
|
||||||
ccf = NODE_NEXT(ccf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user