diff options
author | Pierre Pfister <ppfister@cisco.com> | 2017-12-08 15:15:02 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-12-08 18:22:06 +0100 |
commit | 750e457e3000187b85906814a2529ede24775325 (patch) | |
tree | 020851603a89a5cbed9ae0d92e0647a76de037c4 /src/config.c | |
parent | c516801e3dbb992ce1ea5274439b9b30888d9fb1 (diff) |
Support muliple RAs on single interface
IETF is moving toward implementing IPv6 multihoming by sending
multiple RAs on a single interface:
- draft-ietf-intarea-provisioning-domains-00
- draft-ietf-rtgwg-enterprise-pa-multihoming-02
odhcpd supports configuration of multiple software interfaces
on the same physical interface, which already advertises
multiple RAs, but had two issues:
- Each RA includes all the prefixes available on the interface.
- Replies to sollicits with a single RA.
This patch introduces the prefix_filter configuration parameter
which allows filtering prefixes that are sent in a given RA,
and fixes the sollicit code in order to reply with all the RAs
that are configured on a given interface.
Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index bb885d0..409b3b8 100644 --- a/src/config.c +++ b/src/config.c @@ -62,6 +62,7 @@ enum { IFACE_ATTR_PD_CER, IFACE_ATTR_NDPROXY_ROUTING, IFACE_ATTR_NDPROXY_SLAVE, + IFACE_ATTR_PREFIX_FILTER, IFACE_ATTR_MAX }; @@ -104,6 +105,7 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = { [IFACE_ATTR_RA_MTU] = { .name = "ra_mtu", .type = BLOBMSG_TYPE_INT32 }, [IFACE_ATTR_NDPROXY_ROUTING] = { .name = "ndproxy_routing", .type = BLOBMSG_TYPE_BOOL }, [IFACE_ATTR_NDPROXY_SLAVE] = { .name = "ndproxy_slave", .type = BLOBMSG_TYPE_BOOL }, + [IFACE_ATTR_PREFIX_FILTER] = { .name = "prefix_filter", .type = BLOBMSG_TYPE_STRING }, }; static const struct uci_blob_param_info iface_attr_info[IFACE_ATTR_MAX] = { @@ -720,6 +722,23 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_NDPROXY_SLAVE])) iface->external = blobmsg_get_bool(c); + if ((c = tb[IFACE_ATTR_PREFIX_FILTER])) { + const char *str = blobmsg_get_string(c); + char *astr = malloc(strlen(str) + 1); + char *delim; + int l; + if (!astr || !strcpy(astr, str) || + (delim = strchr(astr, '/')) == NULL || (*(delim++) = 0) || + sscanf(delim, "%i", &l) == 0 || l > 128 || + inet_pton(AF_INET6, astr, &iface->pio_filter_addr) == 0) { + iface->pio_filter_length = 0; + } else { + iface->pio_filter_length = l; + } + if (astr) + free(astr); + } + return 0; err: |