diff options
author | Jörg Thalheim <joerg@higgsboson.tk> | 2016-12-20 20:27:06 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-12-20 20:27:06 +0100 |
commit | 9f702d00d61a9d7bceeb07eced01427a85193021 (patch) | |
tree | f6bed6a7f4312595c3adbee4e23e0a7267967302 /src/libsystemd-network | |
parent | 72d17ce680a22b958b4c074f62d9fa44bc1f54e0 (diff) |
ndisc: ignore invalid SLAAC prefix lengths (#4923)
- linux does not accept prefixes for SLAAC unequal to 64 bits: http://lxr.free-electrons.com/source/net/ipv6/addrconf.c#L2741
- when networkd tries export such a route to the kernel it will get -EINVAL and
set the whole device into a failed state.
- this patch will make networkd ignore such prefixes for SLAAC,
but process other informations which may contain other prefixes.
- Note that rfc4862 does not forbid prefix length != 64 bit
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/ndisc-router.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libsystemd-network/ndisc-router.c b/src/libsystemd-network/ndisc-router.c index cf56c89d76..845a6b7c6c 100644 --- a/src/libsystemd-network/ndisc-router.c +++ b/src/libsystemd-network/ndisc-router.c @@ -459,6 +459,7 @@ _public_ int sd_ndisc_router_prefix_get_preferred_lifetime(sd_ndisc_router *rt, _public_ int sd_ndisc_router_prefix_get_flags(sd_ndisc_router *rt, uint8_t *ret) { struct nd_opt_prefix_info *pi; + uint8_t flags; int r; assert_return(rt, -EINVAL); @@ -468,7 +469,14 @@ _public_ int sd_ndisc_router_prefix_get_flags(sd_ndisc_router *rt, uint8_t *ret) if (r < 0) return r; - *ret = pi->nd_opt_pi_flags_reserved; + flags = pi->nd_opt_pi_flags_reserved; + + if ((flags & ND_OPT_PI_FLAG_AUTO) && (pi->nd_opt_pi_prefix_len != 64)) { + log_ndisc("Invalid prefix length, ignoring prefix for stateless autoconfiguration."); + flags &= ~ND_OPT_PI_FLAG_AUTO; + } + + *ret = flags; return 0; } |