}
#ifdef IPV6_MANAGETEMPADDR
-#ifndef IPV6CTL_TEMPVLTIME
+#if defined(IPV6CTL_TEMPVLTIME) && !defined(__OpenBSD__)
#define get_inet6_sysctlbyname(code) inet6_sysctlbyname(code, 0, 0)
#define set_inet6_sysctlbyname(code, val) inet6_sysctlbyname(code, val, 1)
static int
}
#endif
+#ifdef __OpenBSD__
+int
+ip6_use_tempaddr(const char *ifname)
+{
+ int s, r;
+ struct ifreq ifr;
+
+ s = socket(PF_INET6, SOCK_DGRAM, 0); /* XXX Not efficient */
+ if (s == -1)
+ return -1;
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+ r = ioctl(s, SIOCGIFXFLAGS, &ifr);
+ close(s);
+ if (r == -1)
+ return -1;
+ return ifr.ifr_flags & IFXF_INET6_NOPRIVACY ? 0 : 1;
+}
+
+int
+ip6_temp_preferred_lifetime(__unused const char *ifname)
+{
+
+ return ND6_PRIV_PREFERRED_LIFETIME;
+}
+
+int
+ip6_temp_valid_lifetime(__unused const char *ifname)
+{
+
+ return ND6_PRIV_VALID_LIFETIME;
+}
+
+#else /* __OpenBSD__ */
+
int
ip6_use_tempaddr(__unused const char *ifname)
{
#endif
return val < 0 ? TEMP_VALID_LIFETIME : val;
}
+#endif /* !__OpenBSD__ */
#endif
int
# undef IPV6_POLLADDRFLAG
#endif
+/* Of course OpenBSD has their own special name. */
+#if !defined(IN6_IFF_TEMPORARY) && defined(IN6_IFF_PRIVACY)
+#define IN6_IFF_TEMPORARY IN6_IFF_PRIVACY
+#endif
+
#ifdef __sun
/* Solaris lacks these defines.
* While it supports DaD, to seems to only expose IFF_DUPLICATE