diff options
author | Yoshinobu Inoue <shin@FreeBSD.org> | 1999-12-30 18:29:55 +0000 |
---|---|---|
committer | Yoshinobu Inoue <shin@FreeBSD.org> | 1999-12-30 18:29:55 +0000 |
commit | 0d0f9d1ed6c289d1487b5b4d99b024061fc2954e (patch) | |
tree | 248d43247847bf5a1d35bc0ac3bc8c6d281119d1 /sys/net/if.c | |
parent | 571b29ee9b580ec4c6fa6e6ed2521839c341bb44 (diff) | |
download | src-test2-0d0f9d1ed6c289d1487b5b4d99b024061fc2954e.tar.gz src-test2-0d0f9d1ed6c289d1487b5b4d99b024061fc2954e.zip |
Notes
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index afbad0516a86..1ae6f06dce10 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -36,6 +36,7 @@ #include "opt_compat.h" #include "opt_inet6.h" +#include "opt_inet.h" #include <sys/param.h> #include <sys/malloc.h> @@ -55,9 +56,10 @@ #include <net/radix.h> #include <net/route.h> -#ifdef INET6 +#if defined(INET) || defined(INET6) /*XXX*/ #include <netinet/in.h> +#include <netinet/in_var.h> #endif /* @@ -239,19 +241,36 @@ if_detach(ifp) for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = TAILQ_FIRST(&ifp->if_addrhead)) { +#ifdef INET /* XXX: Ugly!! ad hoc just for INET */ if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) { struct ifaliasreq ifr; bzero(&ifr, sizeof(ifr)); - if (ifa->ifa_addr) - ifr.ifra_addr = *ifa->ifa_addr; + ifr.ifra_addr = *ifa->ifa_addr; if (ifa->ifa_dstaddr) ifr.ifra_broadaddr = *ifa->ifa_dstaddr; if (in_control(NULL, SIOCDIFADDR, (caddr_t)&ifr, ifp, NULL) == 0) continue; } +#endif /* INET */ +#ifdef INET6 + /* XXX: Ugly!! ad hoc just for INET6 */ + if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET6) { + struct in6_aliasreq ifr; + + bzero(&ifr, sizeof(ifr)); + ifr.ifra_addr = + *((struct sockaddr_in6 *)ifa->ifa_addr); + if (ifa->ifa_dstaddr) + ifr.ifra_dstaddr = + *((struct sockaddr_in6 *)ifa->ifa_dstaddr); + if (in6_control(NULL, SIOCDIFADDR_IN6, (caddr_t)&ifr, + ifp, NULL) == 0) + continue; + } +#endif /* INET6 */ TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); IFAFREE(ifa); } |