diff options
author | 2000-06-20 04:19:10 +0000 | |
---|---|---|
committer | 2000-06-20 04:19:10 +0000 | |
commit | d5b5603271fb1a66cc9d992db84f5f317ffb8e8e (patch) | |
tree | bd6c1cd3fb254be464d96fe032878f3f735e6491 | |
parent | initialize mtu/hlim for enc interface at encattach(). (diff) | |
download | wireguard-openbsd-d5b5603271fb1a66cc9d992db84f5f317ffb8e8e.tar.xz wireguard-openbsd-d5b5603271fb1a66cc9d992db84f5f317ffb8e8e.zip |
try to cope with AH6 with scoped address case better.
-rw-r--r-- | sys/netinet/ip_ah.c | 8 | ||||
-rw-r--r-- | sys/netinet/ip_ipip.c | 11 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index 6e1a2481820..2cfc5cf60fc 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.41 2000/06/18 08:23:46 angelos Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.42 2000/06/20 04:19:10 itojun Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -336,6 +336,12 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) ip6.ip6_vfc &= ~IPV6_VERSION_MASK; ip6.ip6_vfc |= IPV6_VERSION; + /* scoped address handling */ + if (IN6_IS_SCOPE_LINKLOCAL(&ip6.ip6_src)) + ip6.ip6_src.s6_addr16[1] = 0; + if (IN6_IS_SCOPE_LINKLOCAL(&ip6.ip6_dst)) + ip6.ip6_dst.s6_addr16[1] = 0; + /* Done with IPv6 header */ m_copyback(m, 0, sizeof(struct ip6_hdr), (caddr_t) &ip6); diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index 12638d96dfc..a6386f8ebdf 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.2 2000/01/21 03:16:24 angelos Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.3 2000/06/20 04:19:11 itojun Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -404,7 +404,7 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, #endif /* INET */ #ifdef INET6 - struct ip6_hdr *ip6o; + struct ip6_hdr *ip6, *ip6o; #endif /* INET6 */ /* Deal with empty TDB source/destination addresses */ @@ -510,6 +510,13 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, return ENOBUFS; } + /* scoped address handling */ + ip6 = mtod(m, struct ip6_hdr *); + if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) + ip6->ip6_src.s6_addr16[1] = 0; + if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) + ip6->ip6_dst.s6_addr16[1] = 0; + M_PREPEND(m, sizeof(struct ip6_hdr), M_DONTWAIT); if (m == 0) { |