summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2002-09-23 23:28:15 +0000
committeritojun <itojun@openbsd.org>2002-09-23 23:28:15 +0000
commit7d37e67a7866e82b0582c41afc4ddb43d61fb2eb (patch)
tree5211da19c7ff0d640ddbd81ec58583993ae9830b
parentcorrect length of PADN option before jumbo payload option. sync w/kame (diff)
downloadwireguard-openbsd-7d37e67a7866e82b0582c41afc4ddb43d61fb2eb.tar.xz
wireguard-openbsd-7d37e67a7866e82b0582c41afc4ddb43d61fb2eb.zip
better "ifconfig ipv6addr deprecated" flag handling. sync w/kame
-rw-r--r--sys/netinet6/in6.c30
-rw-r--r--sys/netinet6/nd6.c5
2 files changed, 26 insertions, 9 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index b113aeb593a..c52f013e59e 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.47 2002/09/11 03:15:36 itojun Exp $ */
+/* $OpenBSD: in6.c,v 1.48 2002/09/23 23:28:15 itojun Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@@ -644,6 +644,13 @@ in6_control(so, cmd, data, ifp, p)
int i, error = 0;
struct nd_prefix pr0, *pr;
+ /* reject read-only flags */
+ if ((ifra->ifra_flags & IN6_IFF_DUPLICATED) != 0 ||
+ (ifra->ifra_flags & IN6_IFF_DETACHED) != 0 ||
+ (ifra->ifra_flags & IN6_IFF_NODAD) != 0 ||
+ (ifra->ifra_flags & IN6_IFF_AUTOCONF) != 0) {
+ return (EINVAL);
+ }
/*
* first, make or update the interface address structure,
* and link it to the list.
@@ -877,13 +884,13 @@ in6_update_ifa(ifp, ifra, ia)
if ((ifp->if_flags & (IFF_POINTOPOINT|IFF_LOOPBACK)) == 0) {
/* XXX: noisy message */
- nd6log((LOG_INFO, "in6_update_ifa: a destination can be "
- "specified for a p2p or a loopback IF only\n"));
+ nd6log((LOG_INFO, "in6_update_ifa: a destination can "
+ "be specified for a p2p or a loopback IF only\n"));
return (EINVAL);
}
if (plen != 128) {
- nd6log((LOG_INFO, "in6_update_ifa: prefixlen should be "
- "128 when dstaddr is specified\n"));
+ nd6log((LOG_INFO, "in6_update_ifa: prefixlen should "
+ "be 128 when dstaddr is specified\n"));
#ifdef FORCE_P2PPLEN
/*
* To be compatible with old configurations,
@@ -1026,11 +1033,22 @@ in6_update_ifa(ifp, ifra, ia)
goto unlink;
/*
+ * configure address flags.
+ */
+ ia->ia6_flags = ifra->ifra_flags;
+ /*
+ * backward compatibility - if IN6_IFF_DEPRECATED is set from the
+ * userland, make it deprecated.
+ */
+ if ((ifra->ifra_flags & IN6_IFF_DEPRECATED) != 0) {
+ ia->ia6_lifetime.ia6t_pltime = 0;
+ ia->ia6_lifetime.ia6t_preferred = time_second;
+ }
+ /*
* Make the address tentative before joining multicast addresses,
* so that corresponding MLD responses would not have a tentative
* source address.
*/
- ia->ia6_flags = ifra->ifra_flags;
ia->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */
if (hostIsNew && in6if_do_dad(ifp))
ia->ia6_flags |= IN6_IFF_TENTATIVE;
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 67b0a1c8a35..64393ec5bc7 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.57 2002/09/11 03:15:36 itojun Exp $ */
+/* $OpenBSD: nd6.c,v 1.58 2002/09/23 23:28:15 itojun Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -512,8 +512,7 @@ nd6_timer(ignored_arg)
if (IFA6_IS_INVALID(ia6)) {
in6_purgeaddr(&ia6->ia_ifa);
}
- if ((ia6->ia6_flags & IN6_IFF_DEPRECATED) != 0 ||
- IFA6_IS_DEPRECATED(ia6)) {
+ if (IFA6_IS_DEPRECATED(ia6)) {
ia6->ia6_flags |= IN6_IFF_DEPRECATED;
} else {
/*