if_gif.c (147256) | if_gif.c (147611) |
---|---|
1/* $FreeBSD: head/sys/net/if_gif.c 147256 2005-06-10 16:49:24Z brooks $ */ | 1/* $FreeBSD: head/sys/net/if_gif.c 147611 2005-06-26 18:11:11Z dwmalone $ */ |
2/* $KAME: if_gif.c,v 1.87 2001/10/19 08:50:27 itojun Exp $ */ 3 4/*- 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 164 unchanged lines hidden (view full) --- 174#if 0 175 /* turn off ingress filter */ 176 GIF2IFP(sc)->if_flags |= IFF_LINK2; 177#endif 178 GIF2IFP(sc)->if_ioctl = gif_ioctl; 179 GIF2IFP(sc)->if_output = gif_output; 180 GIF2IFP(sc)->if_snd.ifq_maxlen = IFQ_MAXLEN; 181 if_attach(GIF2IFP(sc)); | 2/* $KAME: if_gif.c,v 1.87 2001/10/19 08:50:27 itojun Exp $ */ 3 4/*- 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 164 unchanged lines hidden (view full) --- 174#if 0 175 /* turn off ingress filter */ 176 GIF2IFP(sc)->if_flags |= IFF_LINK2; 177#endif 178 GIF2IFP(sc)->if_ioctl = gif_ioctl; 179 GIF2IFP(sc)->if_output = gif_output; 180 GIF2IFP(sc)->if_snd.ifq_maxlen = IFQ_MAXLEN; 181 if_attach(GIF2IFP(sc)); |
182 bpfattach(GIF2IFP(sc), DLT_NULL, sizeof(u_int)); | 182 bpfattach(GIF2IFP(sc), DLT_NULL, sizeof(u_int32_t)); |
183 if (ng_gif_attach_p != NULL) 184 (*ng_gif_attach_p)(GIF2IFP(sc)); 185} 186 187static void 188gif_destroy(struct gif_softc *sc) 189{ 190 struct ifnet *ifp = GIF2IFP(sc); --- 152 unchanged lines hidden (view full) --- 343 struct mbuf *m; 344 struct sockaddr *dst; 345 struct rtentry *rt; /* added in net2 */ 346{ 347 struct gif_softc *sc = ifp->if_softc; 348 struct m_tag *mtag; 349 int error = 0; 350 int gif_called; | 183 if (ng_gif_attach_p != NULL) 184 (*ng_gif_attach_p)(GIF2IFP(sc)); 185} 186 187static void 188gif_destroy(struct gif_softc *sc) 189{ 190 struct ifnet *ifp = GIF2IFP(sc); --- 152 unchanged lines hidden (view full) --- 343 struct mbuf *m; 344 struct sockaddr *dst; 345 struct rtentry *rt; /* added in net2 */ 346{ 347 struct gif_softc *sc = ifp->if_softc; 348 struct m_tag *mtag; 349 int error = 0; 350 int gif_called; |
351 u_int32_t af; |
|
351 352#ifdef MAC 353 error = mac_check_ifnet_transmit(ifp, m); 354 if (error) { 355 m_freem(m); 356 goto end; 357 } 358#endif --- 40 unchanged lines hidden (view full) --- 399 m->m_flags &= ~(M_BCAST|M_MCAST); 400 if (!(ifp->if_flags & IFF_UP) || 401 sc->gif_psrc == NULL || sc->gif_pdst == NULL) { 402 m_freem(m); 403 error = ENETDOWN; 404 goto end; 405 } 406 | 352 353#ifdef MAC 354 error = mac_check_ifnet_transmit(ifp, m); 355 if (error) { 356 m_freem(m); 357 goto end; 358 } 359#endif --- 40 unchanged lines hidden (view full) --- 400 m->m_flags &= ~(M_BCAST|M_MCAST); 401 if (!(ifp->if_flags & IFF_UP) || 402 sc->gif_psrc == NULL || sc->gif_pdst == NULL) { 403 m_freem(m); 404 error = ENETDOWN; 405 goto end; 406 } 407 |
408 /* BPF writes need to be handled specially. */ 409 if (dst->sa_family == AF_UNSPEC) { 410 bcopy(dst->sa_data, &af, sizeof(af)); 411 dst->sa_family = af; 412 } 413 |
|
407 if (ifp->if_bpf) { | 414 if (ifp->if_bpf) { |
408 u_int32_t af = dst->sa_family; | 415 af = dst->sa_family; |
409 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); 410 } 411 ifp->if_opackets++; 412 ifp->if_obytes += m->m_pkthdr.len; 413 414 /* inner AF-specific encapsulation */ 415 416 /* XXX should we check if our outer source is legal? */ --- 478 unchanged lines hidden --- | 416 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); 417 } 418 ifp->if_opackets++; 419 ifp->if_obytes += m->m_pkthdr.len; 420 421 /* inner AF-specific encapsulation */ 422 423 /* XXX should we check if our outer source is legal? */ --- 478 unchanged lines hidden --- |