in6_gif.c (276215) | in6_gif.c (282965) |
---|---|
1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * $KAME: in6_gif.c,v 1.49 2001/05/14 14:02:17 itojun Exp $ 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * $KAME: in6_gif.c,v 1.49 2001/05/14 14:02:17 itojun Exp $ 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/netinet6/in6_gif.c 276215 2014-12-25 21:32:37Z ae $"); | 33__FBSDID("$FreeBSD: head/sys/netinet6/in6_gif.c 282965 2015-05-15 12:19:45Z ae $"); |
34 35#include "opt_inet.h" 36#include "opt_inet6.h" 37 38#include <sys/param.h> 39#include <sys/lock.h> 40#include <sys/rmlock.h> 41#include <sys/systm.h> --- 133 unchanged lines hidden (view full) --- 175 176/* 177 * validate outer address. 178 */ 179static int 180gif_validate6(const struct ip6_hdr *ip6, struct gif_softc *sc, 181 struct ifnet *ifp) 182{ | 34 35#include "opt_inet.h" 36#include "opt_inet6.h" 37 38#include <sys/param.h> 39#include <sys/lock.h> 40#include <sys/rmlock.h> 41#include <sys/systm.h> --- 133 unchanged lines hidden (view full) --- 175 176/* 177 * validate outer address. 178 */ 179static int 180gif_validate6(const struct ip6_hdr *ip6, struct gif_softc *sc, 181 struct ifnet *ifp) 182{ |
183 int ret; |
|
183 184 GIF_RLOCK_ASSERT(sc); 185 /* 186 * Check for address match. Note that the check is for an incoming 187 * packet. We should compare the *source* address in our configuration 188 * and the *destination* address of the packet, and vice versa. 189 */ | 184 185 GIF_RLOCK_ASSERT(sc); 186 /* 187 * Check for address match. Note that the check is for an incoming 188 * packet. We should compare the *source* address in our configuration 189 * and the *destination* address of the packet, and vice versa. 190 */ |
190 if (!IN6_ARE_ADDR_EQUAL(&sc->gif_ip6hdr->ip6_src, &ip6->ip6_dst) || 191 !IN6_ARE_ADDR_EQUAL(&sc->gif_ip6hdr->ip6_dst, &ip6->ip6_src)) | 191 if (!IN6_ARE_ADDR_EQUAL(&sc->gif_ip6hdr->ip6_src, &ip6->ip6_dst)) |
192 return (0); | 192 return (0); |
193 ret = 128; 194 if (!IN6_ARE_ADDR_EQUAL(&sc->gif_ip6hdr->ip6_dst, &ip6->ip6_src)) { 195 if ((sc->gif_options & GIF_IGNORE_SOURCE) == 0) 196 return (0); 197 } else 198 ret += 128; |
|
193 194 /* martian filters on outer source - done in ip6_input */ 195 196 /* ingress filters on outer source */ 197 if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) { 198 struct sockaddr_in6 sin6; 199 struct rtentry *rt; 200 --- 8 unchanged lines hidden (view full) --- 209 if (!rt || rt->rt_ifp != ifp) { 210 if (rt) 211 RTFREE_LOCKED(rt); 212 return (0); 213 } 214 RTFREE_LOCKED(rt); 215 } 216 | 199 200 /* martian filters on outer source - done in ip6_input */ 201 202 /* ingress filters on outer source */ 203 if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) { 204 struct sockaddr_in6 sin6; 205 struct rtentry *rt; 206 --- 8 unchanged lines hidden (view full) --- 215 if (!rt || rt->rt_ifp != ifp) { 216 if (rt) 217 RTFREE_LOCKED(rt); 218 return (0); 219 } 220 RTFREE_LOCKED(rt); 221 } 222 |
217 return (128 * 2); | 223 return (ret); |
218} 219 220/* 221 * we know that we are in IFF_UP, outer address available, and outer family 222 * matched the physical addr family. see gif_encapcheck(). 223 */ 224int 225in6_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg) --- 25 unchanged lines hidden --- | 224} 225 226/* 227 * we know that we are in IFF_UP, outer address available, and outer family 228 * matched the physical addr family. see gif_encapcheck(). 229 */ 230int 231in6_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg) --- 25 unchanged lines hidden --- |