diff options
| author | Roy Marples <roy@marples.name> | 2019-01-05 11:42:12 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2019-01-05 11:42:12 +0000 |
| commit | 2f2db8dcf1a3acd87accc71951cae044118edcbf (patch) | |
| tree | 3d5b6596e4c07295d673ce00abb1ee266bbfedeb /src/if-bsd.c | |
| parent | 7bcb18539956b473fb90a89f7f42d030fbe5ea6c (diff) | |
| download | dhcpcd-2f2db8dcf1a3acd87accc71951cae044118edcbf.tar.xz | |
ip6: Implement IPv6 address sharing
This allows the same IPv6 address to exist on more than one
interface. Whenever dhcpcd address an IPv6 address, it will
advertise it along with the hardware address of the preferred
interface.
This is heavliy reliant on the kernel supporting this as it's the
kernel that handle the Duplicate Address Detection.
In a nutshell it needs to support RFC 7527 and ignore NA packets
from any hardware address the host owns.
Currently the only known kernel that fully supports this is
NetBSD-8.99.27
Diffstat (limited to 'src/if-bsd.c')
| -rw-r--r-- | src/if-bsd.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c index 7df647a2..5f76b544 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -1271,7 +1271,8 @@ if_machinearch(char *str, size_t len) #ifdef INET6 #if (defined(IPV6CTL_ACCEPT_RTADV) && !defined(ND6_IFF_ACCEPT_RTADV)) || \ - defined(IPV6CTL_USETEMPADDR) || defined(IPV6CTL_TEMPVLTIME) + defined(IPV6CTL_USETEMPADDR) || defined(IPV6CTL_TEMPVLTIME) || \ + defined(IPV6CTL_FORWARDING) #define get_inet6_sysctl(code) inet6_sysctl(code, 0, 0) #define set_inet6_sysctl(code, val) inet6_sysctl(code, val, 1) static int @@ -1355,6 +1356,19 @@ ip6_temp_valid_lifetime(__unused const char *ifname) } #endif +int +ip6_forwarding(__unused const char *ifname) +{ + int val; + +#ifdef IPV6CTL_FORWARDING + val = get_inet6_sysctl(IPV6CTL_FORWARDING); +#else + val = get_inet6_sysctlbyname("net.inet6.ip6.forwarding"); +#endif + return val < 0 ? 0 : val; +} + #ifdef SIOCIFAFATTACH static int af_attach(int s, const struct interface *ifp, int af) |
