summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-04-20 15:31:57 +0100
committerRoy Marples <roy@marples.name>2020-04-20 15:31:57 +0100
commit8d0925b0c2887e9fd83011cd3c99ee40f1ac2b0b (patch)
treef995a9fb9b583c49ee7fdc74e1d47420a2563b72 /src
parent097c471bfccdda2b3b7e8a05ce42379c38f85d89 (diff)
downloaddhcpcd-8d0925b0c2887e9fd83011cd3c99ee40f1ac2b0b.tar.xz
OpenBSD: set IN6_IFF_AUTOCONF for addresses generated from a RA
NetBSD will follow suit once the code in the kernel to handle RA has been removed.
Diffstat (limited to 'src')
-rw-r--r--src/if-bsd.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c
index 973fca1a..47e3e57b 100644
--- a/src/if-bsd.c
+++ b/src/if-bsd.c
@@ -1015,28 +1015,21 @@ if_ioctl6(struct dhcpcd_ctx *ctx, unsigned long req, void *data, size_t len)
int
if_address6(unsigned char cmd, const struct ipv6_addr *ia)
{
- struct in6_aliasreq ifa;
+ struct in6_aliasreq ifa = { .ifra_flags = 0 };
struct in6_addr mask;
struct dhcpcd_ctx *ctx = ia->iface->ctx;
- memset(&ifa, 0, sizeof(ifa));
strlcpy(ifa.ifra_name, ia->iface->name, sizeof(ifa.ifra_name));
- /*
- * We should not set IN6_IFF_TENTATIVE as the kernel should be
- * able to work out if it's a new address or not.
- *
- * We should set IN6_IFF_AUTOCONF, but the kernel won't let us.
- * This is probably a safety measure, but still it's not entirely right
- * either.
- */
-#if 0
- if (ia->autoconf)
- ifa.ifra_flags |= IN6_IFF_AUTOCONF;
-#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
+ /* This is a bug - the kernel should work this out. */
if (ia->addr_flags & IN6_IFF_TENTATIVE)
ifa.ifra_flags |= IN6_IFF_TENTATIVE;
#endif
+// #if (defined(__NetBSD__) && __NetBSD_Version__ >= 999005700) ||
+#if (defined(__OpenBSD__) && OpenBSD >= 201605)
+ if (ia->flags & IPV6_AF_AUTOCONF)
+ ifa.ifra_flags |= IN6_IFF_AUTOCONF;
+#endif
#ifdef IPV6_MANAGETEMPADDR
if (ia->flags & IPV6_AF_TEMPORARY)
ifa.ifra_flags |= IN6_IFF_TEMPORARY;