diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2010-04-06 14:12:11 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2010-04-06 14:12:11 +0000 |
commit | bda25d7c59718889fb1f1811744126e675edb2bb (patch) | |
tree | 1cc22039fc2575ca3495e34023ca3f25f1aefaa7 /sbin/ifconfig/ifconfig.c | |
parent | 63114f2f6b5cca92cb2e9808403730c1e3acd928 (diff) |
Simple implementation of RFC4941, "Privacy Extensions for Stateless
Address Autoconfiguration in IPv6". For those among us who are paranoid
about broadcasting their MAC address to the IPv6 internet.
Man page help from jmc, testing by weerd, arc4random API hints from djm.
ok deraadt, claudio
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 7dcc488e362..b3ba114f908 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.230 2010/04/03 03:13:01 deraadt Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.231 2010/04/06 14:12:10 stsp Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -338,6 +338,8 @@ const struct cmd { { "pltime", NEXTARG, 0, setia6pltime }, { "vltime", NEXTARG, 0, setia6vltime }, { "eui64", 0, 0, setia6eui64 }, + { "autoconfprivacy", IFXF_INET6_PRIVACY, 0, setifxflags }, + { "-autoconfprivacy", -IFXF_INET6_PRIVACY, 0, setifxflags }, #endif /*INET6*/ #ifndef SMALL { "rtlabel", NEXTARG, 0, setifrtlabel }, @@ -1189,6 +1191,12 @@ setifxflags(const char *vname, int value) { struct ifreq my_ifr; + if ((value == IFXF_INET6_PRIVACY || value == -IFXF_INET6_PRIVACY) + && afp->af_af != AF_INET6) { + errx(1, "autoconfprivacy needs AF inet6, current AF is `%s'", + afp->af_name); + } + bcopy((char *)&ifr, (char *)&my_ifr, sizeof(struct ifreq)); if (ioctl(s, SIOCGIFXFLAGS, (caddr_t)&my_ifr) < 0) @@ -2981,6 +2989,8 @@ in6_alias(struct in6_ifreq *creq) printf(" deprecated"); if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_AUTOCONF) printf(" autoconf"); + if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_PRIVACY) + printf(" autoconfprivacy"); } if (scopeid) |