diff options
author | 2013-10-24 11:20:16 +0000 | |
---|---|---|
committer | 2013-10-24 11:20:16 +0000 | |
commit | 5453c090dc30f151d07471e0569e538c383cf7d8 (patch) | |
tree | 0f65a8d04112950b47fe74e0cad8d6b6cd9f620f | |
parent | Move obvious kernel prototypes (and structure's with kernel pointers, (diff) | |
download | wireguard-openbsd-5453c090dc30f151d07471e0569e538c383cf7d8.tar.xz wireguard-openbsd-5453c090dc30f151d07471e0569e538c383cf7d8.zip |
Significant namespace cleanup of netinet6 symbols.
One worrying bit is in icmp6.h where some htols() and htonl() are
added, which may affect compatibility down the line. This component
can be reverted if issues show up. Ports tree greps indicate no issue.
ok claudio mpi etc
-rw-r--r-- | sys/netinet/icmp6.h | 132 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 14 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 34 | ||||
-rw-r--r-- | sys/netinet6/in6.h | 301 | ||||
-rw-r--r-- | sys/netinet6/in6_var.h | 12 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 10 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 14 |
7 files changed, 160 insertions, 357 deletions
diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index 00d6a84078c..d370c36f3dc 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.h,v 1.37 2013/10/21 08:42:24 phessler Exp $ */ +/* $OpenBSD: icmp6.h,v 1.38 2013/10/24 11:20:16 deraadt Exp $ */ /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ /* @@ -103,13 +103,6 @@ struct icmp6_hdr { #define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ -#ifndef _KERNEL -/* the followings are for backward compatibility to old KAME apps. */ -#define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY -#define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT -#define MLD6_LISTENER_DONE MLD_LISTENER_DONE -#endif - #define ND_ROUTER_SOLICIT 133 /* router solicitation */ #define ND_ROUTER_ADVERT 134 /* router advertisement */ #define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ @@ -130,12 +123,6 @@ struct icmp6_hdr { #define MLD_MTRACE_RESP 200 /* mtrace response(to sender) */ #define MLD_MTRACE 201 /* mtrace messages */ -#ifndef _KERNEL -/* the followings are for backward compatibility to old KAME apps. */ -#define MLD6_MTRACE_RESP MLD_MTRACE_RESP -#define MLD6_MTRACE MLD_MTRACE -#endif - #define ICMP6_MAXTYPE 201 #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ @@ -178,17 +165,6 @@ struct mld_hdr { struct in6_addr mld_addr; /* multicast address */ } __packed; -/* definitions to provide backward compatibility to old KAME applications */ -#ifndef _KERNEL -#define mld6_hdr mld_hdr -#define mld6_type mld_type -#define mld6_code mld_code -#define mld6_cksum mld_cksum -#define mld6_maxdelay mld_maxdelay -#define mld6_reserved mld_reserved -#define mld6_addr mld_addr -#endif - /* shortcut macro definitions */ #define mld_type mld_icmp6_hdr.icmp6_type #define mld_code mld_icmp6_hdr.icmp6_code @@ -255,17 +231,9 @@ struct nd_neighbor_advert { /* neighbor advertisement */ #define nd_na_code nd_na_hdr.icmp6_code #define nd_na_cksum nd_na_hdr.icmp6_cksum #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] -#if _BYTE_ORDER == _BIG_ENDIAN -#define ND_NA_FLAG_ROUTER 0x80000000 -#define ND_NA_FLAG_SOLICITED 0x40000000 -#define ND_NA_FLAG_OVERRIDE 0x20000000 -#else -#if _BYTE_ORDER == _LITTLE_ENDIAN -#define ND_NA_FLAG_ROUTER 0x80 -#define ND_NA_FLAG_SOLICITED 0x40 -#define ND_NA_FLAG_OVERRIDE 0x20 -#endif -#endif +#define ND_NA_FLAG_ROUTER htonl(0x80000000) +#define ND_NA_FLAG_SOLICITED htonl(0x40000000) +#define ND_NA_FLAG_OVERRIDE htonl(0x20000000) struct nd_redirect { /* redirect */ struct icmp6_hdr nd_rd_hdr; @@ -350,7 +318,6 @@ struct nd_opt_dnssl { /* DNSSL option */ /* * icmp6 namelookup */ - struct icmp6_namelookup { struct icmp6_hdr icmp6_nl_hdr; u_int8_t icmp6_nl_nonce[8]; @@ -384,49 +351,16 @@ struct icmp6_nodeinfo { #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ -#if _BYTE_ORDER == _BIG_ENDIAN -#define NI_SUPTYPE_FLAG_COMPRESS 0x1 -#define NI_FQDN_FLAG_VALIDTTL 0x1 -#elif _BYTE_ORDER == _LITTLE_ENDIAN -#define NI_SUPTYPE_FLAG_COMPRESS 0x0100 -#define NI_FQDN_FLAG_VALIDTTL 0x0100 -#endif +#define NI_SUPTYPE_FLAG_COMPRESS htons(0x0001) +#define NI_FQDN_FLAG_VALIDTTL htons(0x0001) -#ifdef NAME_LOOKUPS_04 -#if _BYTE_ORDER == _BIG_ENDIAN -#define NI_NODEADDR_FLAG_LINKLOCAL 0x1 -#define NI_NODEADDR_FLAG_SITELOCAL 0x2 -#define NI_NODEADDR_FLAG_GLOBAL 0x4 -#define NI_NODEADDR_FLAG_ALL 0x8 -#define NI_NODEADDR_FLAG_TRUNCATE 0x10 -#define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */ -#elif _BYTE_ORDER == _LITTLE_ENDIAN -#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100 -#define NI_NODEADDR_FLAG_SITELOCAL 0x0200 -#define NI_NODEADDR_FLAG_GLOBAL 0x0400 -#define NI_NODEADDR_FLAG_ALL 0x0800 -#define NI_NODEADDR_FLAG_TRUNCATE 0x1000 -#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */ -#endif -#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */ -#if _BYTE_ORDER == _BIG_ENDIAN -#define NI_NODEADDR_FLAG_TRUNCATE 0x1 -#define NI_NODEADDR_FLAG_ALL 0x2 -#define NI_NODEADDR_FLAG_COMPAT 0x4 -#define NI_NODEADDR_FLAG_LINKLOCAL 0x8 -#define NI_NODEADDR_FLAG_SITELOCAL 0x10 -#define NI_NODEADDR_FLAG_GLOBAL 0x20 -#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */ -#elif _BYTE_ORDER == _LITTLE_ENDIAN -#define NI_NODEADDR_FLAG_TRUNCATE 0x0100 -#define NI_NODEADDR_FLAG_ALL 0x0200 -#define NI_NODEADDR_FLAG_COMPAT 0x0400 -#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 -#define NI_NODEADDR_FLAG_SITELOCAL 0x1000 -#define NI_NODEADDR_FLAG_GLOBAL 0x2000 -#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ -#endif -#endif +#define NI_NODEADDR_FLAG_TRUNCATE htons(0x0001) +#define NI_NODEADDR_FLAG_ALL htons(0x0002) +#define NI_NODEADDR_FLAG_COMPAT htons(0x0004) +#define NI_NODEADDR_FLAG_LINKLOCAL htons(0x0008) +#define NI_NODEADDR_FLAG_SITELOCAL htons(0x0010) +#define NI_NODEADDR_FLAG_GLOBAL htons(0x0020) +#define NI_NODEADDR_FLAG_ANYCAST htons(0x0040) /* not in spec */ struct ni_reply_fqdn { u_int32_t ni_fqdn_ttl; /* TTL */ @@ -485,13 +419,8 @@ struct rr_pco_use { /* use prefix part */ #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 -#if _BYTE_ORDER == _BIG_ENDIAN -#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 -#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 -#elif _BYTE_ORDER == _LITTLE_ENDIAN -#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 -#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 -#endif +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME htonl(0x80000000) +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME htonl(0x40000000) struct rr_result { /* router renumbering result message */ u_int16_t rrr_flags; @@ -500,13 +429,8 @@ struct rr_result { /* router renumbering result message */ u_int32_t rrr_ifid; struct in6_addr rrr_prefix; } __packed; -#if _BYTE_ORDER == _BIG_ENDIAN -#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 -#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 -#elif _BYTE_ORDER == _LITTLE_ENDIAN -#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 -#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 -#endif +#define ICMP6_RR_RESULT_FLAGS_OOB htons(0x0002) +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN htons(0x0001) /* * icmp6 filter structures. @@ -516,23 +440,10 @@ struct icmp6_filter { u_int32_t icmp6_filt[8]; }; -#ifdef _KERNEL -#define ICMP6_FILTER_SETPASSALL(filterp) \ -do { \ - int i; u_char *p; \ - p = (u_char *)filterp; \ - for (i = 0; i < sizeof(struct icmp6_filter); i++) \ - p[i] = 0xff; \ -} while (0) -#define ICMP6_FILTER_SETBLOCKALL(filterp) \ - bzero(filterp, sizeof(struct icmp6_filter)) -#else /* _KERNEL */ #define ICMP6_FILTER_SETPASSALL(filterp) \ memset(filterp, 0xff, sizeof(struct icmp6_filter)) #define ICMP6_FILTER_SETBLOCKALL(filterp) \ memset(filterp, 0x00, sizeof(struct icmp6_filter)) -#endif /* _KERNEL */ - #define ICMP6_FILTER_SETPASS(type, filterp) \ (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) #define ICMP6_FILTER_SETBLOCK(type, filterp) \ @@ -614,15 +525,11 @@ struct icmp6stat { #define ICMPV6CTL_STATS 1 #define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */ #define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */ -#if 0 /*obsoleted*/ -#define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */ -#endif #define ICMPV6CTL_ND6_PRUNE 6 #define ICMPV6CTL_ND6_DELAY 8 #define ICMPV6CTL_ND6_UMAXTRIES 9 #define ICMPV6CTL_ND6_MMAXTRIES 10 #define ICMPV6CTL_ND6_USELOOPBACK 11 -/*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */ #define ICMPV6CTL_NODEINFO 13 #define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */ #define ICMPV6CTL_ND6_MAXNUDHINT 15 @@ -684,11 +591,11 @@ struct icmp6stat { #define RTF_PROBEMTU RTF_PROTO1 #ifdef _KERNEL -# ifdef __STDC__ + struct rtentry; struct rttimer; struct in6_multi; -# endif + void icmp6_init(void); void icmp6_paramerror(struct mbuf *, int); void icmp6_error(struct mbuf *, int, int, int); @@ -764,5 +671,6 @@ do { \ extern int icmp6_rediraccept; /* accept/process redirects */ extern int icmp6_redirtimeout; /* cache time for redirect routes */ + #endif /* _KERNEL */ #endif /* _NETINET_ICMP6_H_ */ diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index ca5ffbd420c..ea643e4b205 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.134 2013/10/23 19:57:50 deraadt Exp $ */ +/* $OpenBSD: icmp6.c,v 1.135 2013/10/24 11:20:18 deraadt Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1672,15 +1672,15 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, /* What do we have to do about ::1? */ switch (in6_addrscope(&ifa6->ia_addr.sin6_addr)) { - case IPV6_ADDR_SCOPE_LINKLOCAL: + case __IPV6_ADDR_SCOPE_LINKLOCAL: if ((niflags & NI_NODEADDR_FLAG_LINKLOCAL) == 0) continue; break; - case IPV6_ADDR_SCOPE_SITELOCAL: + case __IPV6_ADDR_SCOPE_SITELOCAL: if ((niflags & NI_NODEADDR_FLAG_SITELOCAL) == 0) continue; break; - case IPV6_ADDR_SCOPE_GLOBAL: + case __IPV6_ADDR_SCOPE_GLOBAL: if ((niflags & NI_NODEADDR_FLAG_GLOBAL) == 0) continue; break; @@ -1752,15 +1752,15 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, /* What do we have to do about ::1? */ switch (in6_addrscope(&ifa6->ia_addr.sin6_addr)) { - case IPV6_ADDR_SCOPE_LINKLOCAL: + case __IPV6_ADDR_SCOPE_LINKLOCAL: if ((niflags & NI_NODEADDR_FLAG_LINKLOCAL) == 0) continue; break; - case IPV6_ADDR_SCOPE_SITELOCAL: + case __IPV6_ADDR_SCOPE_SITELOCAL: if ((niflags & NI_NODEADDR_FLAG_SITELOCAL) == 0) continue; break; - case IPV6_ADDR_SCOPE_GLOBAL: + case __IPV6_ADDR_SCOPE_GLOBAL: if ((niflags & NI_NODEADDR_FLAG_GLOBAL) == 0) continue; break; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 57c8d825405..8a319fbbf11 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.121 2013/10/20 11:03:02 phessler Exp $ */ +/* $OpenBSD: in6.c,v 1.122 2013/10/24 11:20:18 deraadt Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -1969,13 +1969,13 @@ in6_addrscope(struct in6_addr *addr) switch (scope) { case 0x80: - return IPV6_ADDR_SCOPE_LINKLOCAL; + return __IPV6_ADDR_SCOPE_LINKLOCAL; break; case 0xc0: - return IPV6_ADDR_SCOPE_SITELOCAL; + return __IPV6_ADDR_SCOPE_SITELOCAL; break; default: - return IPV6_ADDR_SCOPE_GLOBAL; /* just in case */ + return __IPV6_ADDR_SCOPE_GLOBAL; /* just in case */ break; } } @@ -1989,29 +1989,29 @@ in6_addrscope(struct in6_addr *addr) * return scope doesn't work. */ switch (scope) { - case IPV6_ADDR_SCOPE_INTFACELOCAL: - return IPV6_ADDR_SCOPE_INTFACELOCAL; + case __IPV6_ADDR_SCOPE_INTFACELOCAL: + return __IPV6_ADDR_SCOPE_INTFACELOCAL; break; - case IPV6_ADDR_SCOPE_LINKLOCAL: - return IPV6_ADDR_SCOPE_LINKLOCAL; + case __IPV6_ADDR_SCOPE_LINKLOCAL: + return __IPV6_ADDR_SCOPE_LINKLOCAL; break; - case IPV6_ADDR_SCOPE_SITELOCAL: - return IPV6_ADDR_SCOPE_SITELOCAL; + case __IPV6_ADDR_SCOPE_SITELOCAL: + return __IPV6_ADDR_SCOPE_SITELOCAL; break; default: - return IPV6_ADDR_SCOPE_GLOBAL; + return __IPV6_ADDR_SCOPE_GLOBAL; break; } } if (bcmp(&in6addr_loopback, addr, sizeof(*addr) - 1) == 0) { if (addr->s6_addr8[15] == 1) /* loopback */ - return IPV6_ADDR_SCOPE_INTFACELOCAL; + return __IPV6_ADDR_SCOPE_INTFACELOCAL; if (addr->s6_addr8[15] == 0) /* unspecified */ - return IPV6_ADDR_SCOPE_LINKLOCAL; + return __IPV6_ADDR_SCOPE_LINKLOCAL; } - return IPV6_ADDR_SCOPE_GLOBAL; + return __IPV6_ADDR_SCOPE_GLOBAL; } /* @@ -2025,12 +2025,12 @@ in6_addr2scopeid(struct ifnet *ifp, struct in6_addr *addr) int scope = in6_addrscope(addr); switch(scope) { - case IPV6_ADDR_SCOPE_INTFACELOCAL: - case IPV6_ADDR_SCOPE_LINKLOCAL: + case __IPV6_ADDR_SCOPE_INTFACELOCAL: + case __IPV6_ADDR_SCOPE_LINKLOCAL: /* XXX: we do not distinguish between a link and an I/F. */ return (ifp->if_index); - case IPV6_ADDR_SCOPE_SITELOCAL: + case __IPV6_ADDR_SCOPE_SITELOCAL: return (0); /* XXX: invalid. */ default: diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index 94e3cdf9070..b598c467592 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.h,v 1.66 2013/10/21 12:27:15 deraadt Exp $ */ +/* $OpenBSD: in6.h,v 1.67 2013/10/24 11:20:18 deraadt Exp $ */ /* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */ /* @@ -102,8 +102,8 @@ struct in6_addr { * Socket address for IPv6 */ #if __BSD_VISIBLE -#define SIN6_LEN -#endif +#define SIN6_LEN /* Indicates sockaddr_in6 has a sin6_len field */ +#endif /* __BSD_VISIBLE */ struct sockaddr_in6 { u_int8_t sin6_len; /* length of this struct(sa_family_t)*/ sa_family_t sin6_family; /* AF_INET6 (sa_family_t) */ @@ -113,6 +113,7 @@ struct sockaddr_in6 { u_int32_t sin6_scope_id; /* intface scope id */ }; + /* * Local definition for masks */ @@ -126,9 +127,7 @@ struct sockaddr_in6 { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}} #define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}} -#endif -#ifdef _KERNEL extern const struct sockaddr_in6 sa6_any; extern const struct in6_addr in6mask0; @@ -138,35 +137,25 @@ extern const struct in6_addr in6mask96; extern const struct in6_addr in6mask128; #endif /* _KERNEL */ +/* Both kernel and libc define these for use */ +extern const struct in6_addr in6addr_any; +extern const struct in6_addr in6addr_loopback; +extern const struct in6_addr in6addr_intfacelocal_allnodes; +extern const struct in6_addr in6addr_linklocal_allnodes; + +#if __BSD_VISIBLE /* - * Macros started with IPV6_ADDR is KAME local + * IPv6 route structure */ -#ifdef _KERNEL /* XXX nonstandard */ -#if BYTE_ORDER == BIG_ENDIAN -#define IPV6_ADDR_INT32_ONE 1 -#define IPV6_ADDR_INT32_TWO 2 -#define IPV6_ADDR_INT32_MNL 0xff010000 -#define IPV6_ADDR_INT32_MLL 0xff020000 -#define IPV6_ADDR_INT32_SMP 0x0000ffff -#define IPV6_ADDR_INT16_ULL 0xfe80 -#define IPV6_ADDR_INT16_USL 0xfec0 -#define IPV6_ADDR_INT16_MLL 0xff02 -#elif BYTE_ORDER == LITTLE_ENDIAN -#define IPV6_ADDR_INT32_ONE 0x01000000 -#define IPV6_ADDR_INT32_TWO 0x02000000 -#define IPV6_ADDR_INT32_MNL 0x000001ff -#define IPV6_ADDR_INT32_MLL 0x000002ff -#define IPV6_ADDR_INT32_SMP 0xffff0000 -#define IPV6_ADDR_INT16_ULL 0x80fe -#define IPV6_ADDR_INT16_USL 0xc0fe -#define IPV6_ADDR_INT16_MLL 0x02ff -#endif -#endif +struct route_in6 { + struct rtentry *ro_rt; + u_long ro_tableid; /* padded to long for alignment */ + struct sockaddr_in6 ro_dst; +}; /* * Definition of some useful macros to handle IP6 addresses */ -#if __BSD_VISIBLE #define IN6ADDR_ANY_INIT \ {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} @@ -185,30 +174,23 @@ extern const struct in6_addr in6mask128; #define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}} -#endif -extern const struct in6_addr in6addr_any; -extern const struct in6_addr in6addr_loopback; -#if __BSD_VISIBLE -extern const struct in6_addr in6addr_intfacelocal_allnodes; -extern const struct in6_addr in6addr_linklocal_allnodes; -#endif +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) + +#endif /* __BSD_VISIBLE */ /* - * Equality - * NOTE: Some of kernel programming environment (for example, OpenBSD/sparc) - * does not supply memcmp(). For userland memcmp() is preferred as it is - * in ANSI standard. + * Macros started with IPV6_ADDR is KAME local */ -#ifdef _KERNEL -#define IN6_ARE_ADDR_EQUAL(a, b) \ - (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) -#else -#if __BSD_VISIBLE -#define IN6_ARE_ADDR_EQUAL(a, b) \ - (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) -#endif -#endif +#define __IPV6_ADDR_INT32_ONE htonl(1) +#define __IPV6_ADDR_INT32_TWO htonl(2) +#define __IPV6_ADDR_INT32_MNL htonl(0xff010000) +#define __IPV6_ADDR_INT32_MLL htonl(0xff020000) +#define __IPV6_ADDR_INT32_SMP htonl(0x0000ffff) +#define __IPV6_ADDR_INT16_ULL htons(0xfe80) +#define __IPV6_ADDR_INT16_USL htons(0xfec0) +#define __IPV6_ADDR_INT16_MLL htons(0xff02) /* * Unspecified @@ -226,7 +208,7 @@ extern const struct in6_addr in6addr_linklocal_allnodes; ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1))) + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == __IPV6_ADDR_INT32_ONE)) /* * IPv4 compatible @@ -236,7 +218,7 @@ extern const struct in6_addr in6addr_linklocal_allnodes; (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1))) + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != __IPV6_ADDR_INT32_ONE)) /* * Mapped @@ -244,27 +226,7 @@ extern const struct in6_addr in6addr_linklocal_allnodes; #define IN6_IS_ADDR_V4MAPPED(a) \ ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) - -/* - * KAME Scope Values - */ - -#ifdef _KERNEL /* XXX nonstandard */ -#define IPV6_ADDR_SCOPE_NODELOCAL 0x01 -#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 -#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 -#define IPV6_ADDR_SCOPE_SITELOCAL 0x05 -#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ -#define IPV6_ADDR_SCOPE_GLOBAL 0x0e -#else -#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 -#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 -#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 -#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 -#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ -#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e -#endif + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == __IPV6_ADDR_INT32_SMP)) /* * Unicast Scope @@ -278,37 +240,16 @@ extern const struct in6_addr in6addr_linklocal_allnodes; /* * Multicast */ +#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) -#ifdef _KERNEL /* XXX nonstandard */ -#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) -#else -#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) -#endif +#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 +#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 +#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ +#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e -/* - * Multicast Scope - */ -#ifdef _KERNEL /* refers nonstandard items */ -#define IN6_IS_ADDR_MC_NODELOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL)) -#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL)) -#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL)) -#define IN6_IS_ADDR_MC_SITELOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL)) -#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL)) -#define IN6_IS_ADDR_MC_GLOBAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL)) -#else #define IN6_IS_ADDR_MC_NODELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL)) @@ -327,12 +268,8 @@ extern const struct in6_addr in6addr_linklocal_allnodes; #define IN6_IS_ADDR_MC_GLOBAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) -#endif -#ifdef _KERNEL /* nonstandard */ -/* - * KAME Scope - */ +#ifdef _KERNEL #define IN6_IS_SCOPE_LINKLOCAL(a) \ ((IN6_IS_ADDR_LINKLOCAL(a)) || \ (IN6_IS_ADDR_MC_LINKLOCAL(a))) @@ -349,33 +286,14 @@ extern const struct in6_addr in6addr_linklocal_allnodes; ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \ (u_int32_t)((time_second - (a)->ia6_updatetime)) > \ (a)->ia6_lifetime.ia6t_vltime) -#endif -/* - * IP6 route structure - */ -#if __BSD_VISIBLE -struct route_in6 { - struct rtentry *ro_rt; - u_long ro_tableid; /* padded to long for alignment */ - struct sockaddr_in6 ro_dst; -}; -#endif +#endif /* _KERNEL */ /* * Options for use with [gs]etsockopt at the IPV6 level. * First word of comment is data type; bool is stored in int. */ -#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */ -/* no hdrincl */ -#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */ #define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */ -#if 0 /* the followings are relic in IPv4 and hence are disabled */ -#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */ -#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */ -#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */ -#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */ -#endif #define IPV6_MULTICAST_IF 9 /* u_char; set/get IP6 multicast i/f */ #define IPV6_MULTICAST_HOPS 10 /* u_char; set/get IP6 multicast hops */ #define IPV6_MULTICAST_LOOP 11 /* u_char; set/get IP6 multicast loopback */ @@ -400,13 +318,6 @@ struct route_in6 { #define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */ #define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */ -#if 0 /*KAME IPSEC*/ -#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */ -#endif -#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */ - -/* 30-34: reserved */ - /* new socket options introduced in RFC3542 */ #define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */ @@ -425,9 +336,7 @@ struct route_in6 { #define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt), 4 bytes int; MTU notification (cmsg) */ -/* 45: reserved */ - -/* more new socket options introduced in RFC3542 */ +/* More new socket options introduced in RFC3542 */ #define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */ #define IPV6_HOPLIMIT 47 /* int; send hop limit */ #define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */ @@ -435,7 +344,6 @@ struct route_in6 { #define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */ #define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */ -/* 52: reserved */ #define IPV6_AUTH_LEVEL 53 /* int; authentication used */ #define IPV6_ESP_TRANS_LEVEL 54 /* int; transport encryption */ #define IPV6_ESP_NETWORK_LEVEL 55 /* int; full-packet encryption */ @@ -443,7 +351,7 @@ struct route_in6 { #define IPSEC6_OUTSA 56 /* set the outbound SA for a socket */ #endif #define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */ -/* 58: reserved */ + #define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */ #define IPV6_IPCOMP_LEVEL 60 /* int; compression */ @@ -456,10 +364,8 @@ struct route_in6 { #define IPV6_RTABLE 0x1021 /* int; routing table, see SO_RTABLE */ /* to define items, should talk with KAME guys first, for *BSD compatibility */ - -#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */ -#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */ -#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */ +#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor */ +#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */ /* * Defaults and limits for options @@ -501,6 +407,58 @@ struct ip6_mtuinfo { #define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ #define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ +#ifdef __BSD_VISIBLE + +#ifndef _SOCKLEN_T_DEFINED_ +#define _SOCKLEN_T_DEFINED_ +typedef __socklen_t socklen_t; /* length type for network syscalls */ +#endif + +#endif /* __BSD_VISIBLE */ + +#ifdef _KERNEL +struct cmsghdr; + +int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t); +extern void in6_proto_cksum_out(struct mbuf *, struct ifnet *); +int in6_localaddr(struct in6_addr *); +int in6_addrscope(struct in6_addr *); +struct in6_ifaddr *in6_ifawithscope(struct ifnet *, struct in6_addr *, u_int); +extern void in6_if_up(struct ifnet *); +void in6_get_rand_ifid(struct ifnet *, struct in6_addr *); +int in6_mask2len(struct in6_addr *, u_char *); + +struct sockaddr; +struct sockaddr_in6; +struct ifaddr; +struct in6_ifaddr; + +/* + * Convert between address family specific and general structs. + * Inline functions check the source type and are stricter than + * casts or defines. + */ + +static __inline struct sockaddr_in6 * +satosin6(struct sockaddr *sa) +{ + return ((struct sockaddr_in6 *)(sa)); +} + +static __inline struct sockaddr * +sin6tosa(struct sockaddr_in6 *sin6) +{ + return ((struct sockaddr *)(sin6)); +} + +static __inline struct in6_ifaddr * +ifatoia6(struct ifaddr *ifa) +{ + return ((struct in6_ifaddr *)(ifa)); +} + +#endif /* _KERNEL */ + #if __BSD_VISIBLE /* * Definitions for inet6 sysctl operations. @@ -606,9 +564,6 @@ struct ip6_mtuinfo { #define IPV6CTL_FORWARDING 1 /* act as router */ #define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/ #define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */ -#ifdef notyet -#define IPV6CTL_DEFMTU 4 /* default MTU */ -#endif #define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */ #define IPV6CTL_STATS 6 /* stats */ #define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */ @@ -622,13 +577,9 @@ struct ip6_mtuinfo { #define IPV6CTL_DAD_COUNT 16 #define IPV6CTL_AUTO_FLOWLABEL 17 #define IPV6CTL_DEFMCASTHLIM 18 -#ifdef notdef /* obsolete */ -#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */ -#endif #define IPV6CTL_KAME_VERSION 20 #define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */ #define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */ -/*#define IPV6CTL_MAPPED_ADDR 23 not for OpenBSD */ #define IPV6CTL_V6ONLY 24 /* 25 to 40: resrved */ #define IPV6CTL_MAXFRAGS 41 /* max fragments */ @@ -651,7 +602,7 @@ struct ip6_mtuinfo { { "forwarding", CTLTYPE_INT }, \ { "redirect", CTLTYPE_INT }, \ { "hlim", CTLTYPE_INT }, \ - { "mtu", CTLTYPE_INT }, \ + { 0, 0 }, \ { "forwsrcrt", CTLTYPE_INT }, \ { 0, 0 }, \ { 0, 0 }, \ @@ -754,57 +705,6 @@ struct ip6_mtuinfo { NULL, \ } -#endif /* __BSD_VISIBLE */ - -#ifdef _KERNEL -struct cmsghdr; - -int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t); -extern void in6_proto_cksum_out(struct mbuf *, struct ifnet *); -int in6_localaddr(struct in6_addr *); -int in6_addrscope(struct in6_addr *); -struct in6_ifaddr *in6_ifawithscope(struct ifnet *, struct in6_addr *, u_int); -extern void in6_if_up(struct ifnet *); -void in6_get_rand_ifid(struct ifnet *, struct in6_addr *); -int in6_mask2len(struct in6_addr *, u_char *); - -struct sockaddr; -struct sockaddr_in6; -struct ifaddr; -struct in6_ifaddr; - -/* - * Convert between address family specific and general structs. - * Inline functions check the source type and are stricter than - * casts or defines. - */ - -static __inline struct sockaddr_in6 * -satosin6(struct sockaddr *sa) -{ - return ((struct sockaddr_in6 *)(sa)); -} - -static __inline struct sockaddr * -sin6tosa(struct sockaddr_in6 *sin6) -{ - return ((struct sockaddr *)(sin6)); -} - -static __inline struct in6_ifaddr * -ifatoia6(struct ifaddr *ifa) -{ - return ((struct in6_ifaddr *)(ifa)); -} -#endif /* _KERNEL */ - -#if __BSD_VISIBLE - -#ifndef _SOCKLEN_T_DEFINED_ -#define _SOCKLEN_T_DEFINED_ -typedef __socklen_t socklen_t; /* length type for network syscalls */ -#endif - __BEGIN_DECLS struct cmsghdr; @@ -821,9 +721,6 @@ extern struct cmsghdr *inet6_rthdr_init(void *, int); extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *, unsigned int); extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int); -#if 0 /* not implemented yet */ -extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *); -#endif extern int inet6_rthdr_segments(const struct cmsghdr *); extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int); extern int inet6_rthdr_getflags(const struct cmsghdr *, int); diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 4e7c00f538a..f391cc7bcd9 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_var.h,v 1.42 2013/10/14 11:07:42 mpi Exp $ */ +/* $OpenBSD: in6_var.h,v 1.43 2013/10/24 11:20:18 deraadt Exp $ */ /* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */ /* @@ -86,6 +86,7 @@ struct in6_addrlifetime { u_int32_t ia6t_pltime; /* prefix lifetime */ }; +#ifdef _KERNEL struct nd_ifinfo; struct in6_ifextra { struct in6_ifstat *in6_ifstat; @@ -121,6 +122,7 @@ struct in6_ifaddr { /* multicast addresses joined from the kernel */ LIST_HEAD(, in6_multi_mship) ia6_memberships; }; +#endif /* _KERNEL */ /* * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12). @@ -374,7 +376,7 @@ struct in6_rrenumreq { (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \ (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \ (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 ) -#endif +#endif /* _KERNEL */ #define SIOCSIFADDR_IN6 _IOW('i', 12, struct in6_ifreq) #define SIOCGIFADDR_IN6 _IOWR('i', 33, struct in6_ifreq) @@ -386,7 +388,7 @@ struct in6_rrenumreq { */ #define SIOCSIFDSTADDR_IN6 _IOW('i', 14, struct in6_ifreq) #define SIOCSIFNETMASK_IN6 _IOW('i', 22, struct in6_ifreq) -#endif +#endif /* _KERNEL */ #define SIOCGIFDSTADDR_IN6 _IOWR('i', 34, struct in6_ifreq) #define SIOCGIFNETMASK_IN6 _IOWR('i', 37, struct in6_ifreq) @@ -444,9 +446,7 @@ struct in6_rrenumreq { #ifdef _KERNEL #define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b)) #define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b)) -#endif -#ifdef _KERNEL TAILQ_HEAD(in6_ifaddrhead, in6_ifaddr); extern struct in6_ifaddrhead in6_ifaddr; @@ -479,7 +479,6 @@ do { \ } \ (ia) = (struct in6_ifaddr *)ifa; \ } while (0) -#endif /* _KERNEL */ /* * Multi-cast membership entry. One for each group/ifp that a PCB @@ -500,7 +499,6 @@ struct in6_multi { u_int in6m_timer; /* MLD6 listener report timer */ }; -#ifdef _KERNEL /* * Macro for iterating over all the in6_multi records linked to a given * interface. diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index b50750532fc..d005e72e840 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6.c,v 1.30 2013/10/17 16:27:46 bluhm Exp $ */ +/* $OpenBSD: mld6.c,v 1.31 2013/10/24 11:20:18 deraadt Exp $ */ /* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */ /* @@ -129,7 +129,7 @@ mld6_start_listening(struct in6_multi *in6m) mld_all_nodes_linklocal.s6_addr16[1] = htons(in6m->in6m_ifp->if_index); /* XXX */ if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &mld_all_nodes_linklocal) || - IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) < IPV6_ADDR_SCOPE_LINKLOCAL) { + __IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) < __IPV6_ADDR_SCOPE_LINKLOCAL) { in6m->in6m_timer = 0; in6m->in6m_state = MLD_OTHERLISTENER; } else { @@ -153,7 +153,7 @@ mld6_stop_listening(struct in6_multi *in6m) if (in6m->in6m_state == MLD_IREPORTEDLAST && (!IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &mld_all_nodes_linklocal)) && - IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) > IPV6_ADDR_SCOPE_INTFACELOCAL) + __IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) > __IPV6_ADDR_SCOPE_INTFACELOCAL) mld6_sendpkt(in6m, MLD_LISTENER_DONE, &mld_all_routers_linklocal); } @@ -244,8 +244,8 @@ mld6_input(struct mbuf *m, int off) LIST_FOREACH(in6m, &ia->ia6_multiaddrs, in6m_entry) { if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &mld_all_nodes_linklocal) || - IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) < - IPV6_ADDR_SCOPE_LINKLOCAL) + __IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) < + __IPV6_ADDR_SCOPE_LINKLOCAL) continue; if (IN6_IS_ADDR_UNSPECIFIED(&mldh->mld_addr) || diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index d8b82afbdf4..ce214b09f7a 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.69 2013/10/20 11:03:02 phessler Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.70 2013/10/24 11:20:18 deraadt Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -121,9 +121,9 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) { /* dst has to be solicited node multicast address. */ /* don't check ifindex portion */ - if (daddr6.s6_addr16[0] == IPV6_ADDR_INT16_MLL && + if (daddr6.s6_addr16[0] == __IPV6_ADDR_INT16_MLL && daddr6.s6_addr32[1] == 0 && - daddr6.s6_addr32[2] == IPV6_ADDR_INT32_ONE && + daddr6.s6_addr32[2] == __IPV6_ADDR_INT32_ONE && daddr6.s6_addr8[12] == 0xff) { ; /*good*/ } else { @@ -406,10 +406,10 @@ nd6_ns_output(struct ifnet *ifp, struct in6_addr *daddr6, if (daddr6) dst_sa.sin6_addr = *daddr6; else { - dst_sa.sin6_addr.s6_addr16[0] = IPV6_ADDR_INT16_MLL; + dst_sa.sin6_addr.s6_addr16[0] = __IPV6_ADDR_INT16_MLL; dst_sa.sin6_addr.s6_addr16[1] = htons(ifp->if_index); dst_sa.sin6_addr.s6_addr32[1] = 0; - dst_sa.sin6_addr.s6_addr32[2] = IPV6_ADDR_INT32_ONE; + dst_sa.sin6_addr.s6_addr32[2] = __IPV6_ADDR_INT32_ONE; dst_sa.sin6_addr.s6_addr32[3] = taddr6->s6_addr32[3]; dst_sa.sin6_addr.s6_addr8[12] = 0xff; } @@ -936,11 +936,11 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, dst_sa.sin6_addr = *daddr6; if (IN6_IS_ADDR_UNSPECIFIED(daddr6)) { /* reply to DAD */ - dst_sa.sin6_addr.s6_addr16[0] = IPV6_ADDR_INT16_MLL; + dst_sa.sin6_addr.s6_addr16[0] = __IPV6_ADDR_INT16_MLL; dst_sa.sin6_addr.s6_addr16[1] = htons(ifp->if_index); dst_sa.sin6_addr.s6_addr32[1] = 0; dst_sa.sin6_addr.s6_addr32[2] = 0; - dst_sa.sin6_addr.s6_addr32[3] = IPV6_ADDR_INT32_ONE; + dst_sa.sin6_addr.s6_addr32[3] = __IPV6_ADDR_INT32_ONE; flags &= ~ND_NA_FLAG_SOLICITED; } |