diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-09-23 23:28:16 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-09-23 23:28:16 +0000 |
commit | c8350a727731da83d6b9dbe560722357cf2db4ba (patch) | |
tree | 1e923249bc12f73058119139fafc26e317517820 /sys/netinet6/in6.c | |
parent | c8c9c6eceb7c953a550fd0239f00dbd12cfd8b52 (diff) |
better "ifconfig ipv6addr deprecated" flag handling. sync w/kame
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r-- | sys/netinet6/in6.c | 30 |
1 files changed, 24 insertions, 6 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; |