home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / trace / tcpdump-2.2.1 / bpf / net / if_loop.c-bsdreno-patch < prev    next >
Encoding:
Text File  |  1992-01-28  |  1.2 KB  |  59 lines

  1. *** /tmp/,RCSt1a01575    Wed Jan 29 03:06:11 1992
  2. --- if_loop.c    Wed Jan 29 02:35:15 1992
  3. ***************
  4. *** 70,75 ****
  5. --- 70,82 ----
  6.   #include "../netiso/iso_var.h"
  7.   #endif
  8.   
  9. + #include "bpfilter.h"
  10. + #if NBPFILTER > 0
  11. + #include <sys/time.h>
  12. + #include <net/bpf.h>
  13. + static caddr_t lo_bpf;
  14. + #endif
  15.   #define    LOMTU    (1024+512)
  16.   
  17.   struct    ifnet loif;
  18. ***************
  19. *** 88,93 ****
  20. --- 95,103 ----
  21.       ifp->if_hdrlen = 0;
  22.       ifp->if_addrlen = 0;
  23.       if_attach(ifp);
  24. + #if NBPFILTER > 0
  25. +     bpfattach(&lo_bpf, ifp, DLT_NULL, sizeof(u_int));
  26. + #endif
  27.   }
  28.   
  29.   looutput(ifp, m, dst, rt)
  30. ***************
  31. *** 101,106 ****
  32. --- 111,135 ----
  33.   
  34.       if ((m->m_flags & M_PKTHDR) == 0)
  35.           panic("looutput no HDR");
  36. + #if NBPFILTER > 0
  37. +     if (lo_bpf) {
  38. +         /*
  39. +          * We need to prepend the address family as
  40. +          * a four byte field.  Cons up a dummy header
  41. +          * to pacify bpf.  This is safe because bpf
  42. +          * will only read from the mbuf (i.e., it won't
  43. +          * try to free it or keep a pointer a to it).
  44. +          */
  45. +         struct mbuf m0;
  46. +         u_int af = dst->sa_family;
  47. +         m0.m_next = m;
  48. +         m0.m_len = 4;
  49. +         m0.m_data = (char *)⁡
  50. +         
  51. +         bpf_mtap(lo_bpf, &m0);
  52. +     }
  53. + #endif
  54.       m->m_pkthdr.rcvif = ifp;
  55.   
  56.       if (rt && rt->rt_flags & RTF_REJECT) {
  57.