if_gif.c (121816) | if_gif.c (123922) |
---|---|
1/* $FreeBSD: head/sys/net/if_gif.c 121816 2003-10-31 18:32:15Z brooks $ */ | 1/* $FreeBSD: head/sys/net/if_gif.c 123922 2003-12-28 03:56:00Z sam $ */ |
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 --- 334 unchanged lines hidden (view full) --- 344 if (!(ifp->if_flags & IFF_UP) || 345 sc->gif_psrc == NULL || sc->gif_pdst == NULL) { 346 m_freem(m); 347 error = ENETDOWN; 348 goto end; 349 } 350 351 if (ifp->if_bpf) { | 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 --- 334 unchanged lines hidden (view full) --- 344 if (!(ifp->if_flags & IFF_UP) || 345 sc->gif_psrc == NULL || sc->gif_pdst == NULL) { 346 m_freem(m); 347 error = ENETDOWN; 348 goto end; 349 } 350 351 if (ifp->if_bpf) { |
352 /* 353 * We need to prepend the address family as 354 * a four byte field. Cons up a dummy header 355 * to pacify bpf. This is safe because bpf 356 * will only read from the mbuf (i.e., it won't 357 * try to free it or keep a pointer a to it). 358 */ 359 struct mbuf m0; | |
360 u_int32_t af = dst->sa_family; | 352 u_int32_t af = dst->sa_family; |
361 362 m0.m_next = m; 363 m0.m_len = 4; 364 m0.m_data = (char *)⁡ 365 366 BPF_MTAP(ifp, &m0); | 353 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); |
367 } 368 ifp->if_opackets++; 369 ifp->if_obytes += m->m_pkthdr.len; 370 371 /* inner AF-specific encapsulation */ 372 373 /* XXX should we check if our outer source is legal? */ 374 --- 38 unchanged lines hidden (view full) --- 413 414 m->m_pkthdr.rcvif = ifp; 415 416#ifdef MAC 417 mac_create_mbuf_from_ifnet(ifp, m); 418#endif 419 420 if (ifp->if_bpf) { | 354 } 355 ifp->if_opackets++; 356 ifp->if_obytes += m->m_pkthdr.len; 357 358 /* inner AF-specific encapsulation */ 359 360 /* XXX should we check if our outer source is legal? */ 361 --- 38 unchanged lines hidden (view full) --- 400 401 m->m_pkthdr.rcvif = ifp; 402 403#ifdef MAC 404 mac_create_mbuf_from_ifnet(ifp, m); 405#endif 406 407 if (ifp->if_bpf) { |
421 /* 422 * We need to prepend the address family as 423 * a four byte field. Cons up a dummy header 424 * to pacify bpf. This is safe because bpf 425 * will only read from the mbuf (i.e., it won't 426 * try to free it or keep a pointer a to it). 427 */ 428 struct mbuf m0; | |
429 u_int32_t af1 = af; | 408 u_int32_t af1 = af; |
430 431 m0.m_next = m; 432 m0.m_len = 4; 433 m0.m_data = (char *)&af1; 434 435 BPF_MTAP(ifp, &m0); | 409 bpf_mtap2(ifp->if_bpf, &af1, sizeof(af1), m); |
436 } 437 438 if (ng_gif_input_p != NULL) { 439 (*ng_gif_input_p)(ifp, &m, af); 440 if (m == NULL) 441 return; 442 } 443 --- 412 unchanged lines hidden --- | 410 } 411 412 if (ng_gif_input_p != NULL) { 413 (*ng_gif_input_p)(ifp, &m, af); 414 if (m == NULL) 415 return; 416 } 417 --- 412 unchanged lines hidden --- |