diff options
author | harti <harti@FreeBSD.org> | 2003-07-24 08:15:20 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2003-07-24 08:15:20 +0000 |
commit | 21804925b22e8dfdb24c092b7313df2d2b7d2097 (patch) | |
tree | 5d865fdd2aacd3d8716334448a4da6bb899eafae /sys/netatm | |
parent | e6af3a1393324f87f4f4865c1bbb1065e3bfc667 (diff) | |
download | FreeBSD-src-21804925b22e8dfdb24c092b7313df2d2b7d2097.zip FreeBSD-src-21804925b22e8dfdb24c092b7313df2d2b7d2097.tar.gz |
Add BPF support to HARP network interfaces. This allows one to see
the traffic on LLC multiplexed connections (like CLIP).
PR: kern/51831
Submitted by: Vincent Jardin <vjardin@wanadoo.fr>
MFC after: 2 weeks
Diffstat (limited to 'sys/netatm')
-rw-r--r-- | sys/netatm/atm_cm.c | 12 | ||||
-rw-r--r-- | sys/netatm/atm_device.c | 12 | ||||
-rw-r--r-- | sys/netatm/atm_if.c | 13 |
3 files changed, 37 insertions, 0 deletions
diff --git a/sys/netatm/atm_cm.c b/sys/netatm/atm_cm.c index 8ca491f..f21db37 100644 --- a/sys/netatm/atm_cm.c +++ b/sys/netatm/atm_cm.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socketvar.h> #include <sys/syslog.h> #include <net/if.h> +#include <net/bpf.h> #include <netatm/port.h> #include <netatm/queue.h> #include <netatm/atm.h> @@ -2900,6 +2901,17 @@ atm_cm_cpcs_upper(cmd, tok, arg1, arg2) case ATM_ENC_LLC: /* + * Send the packet to the interface's bpf if this + * vc has one. + */ + if (cvp->cvc_vcc != NULL && + cvp->cvc_vcc->vc_nif != NULL) { + struct ifnet *ifp = + (struct ifnet *)cvp->cvc_vcc->vc_nif; + + BPF_MTAP(ifp, m); + } + /* * Find connection with matching LLC header */ if (KB_LEN(m) < T_ATM_LLC_MAX_LEN) { diff --git a/sys/netatm/atm_device.c b/sys/netatm/atm_device.c index d3bc45b..cbfdaa6 100644 --- a/sys/netatm/atm_device.c +++ b/sys/netatm/atm_device.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socketvar.h> #include <sys/syslog.h> #include <net/if.h> +#include <net/bpf.h> #include <netatm/port.h> #include <netatm/queue.h> #include <netatm/atm.h> @@ -371,6 +372,17 @@ atm_dev_lower(cmd, tok, arg1, arg2) } /* + * Send the packet to the interface's bpf if this vc has one. + */ + if (cvcp->cvc_conn->co_mpx == ATM_ENC_LLC && + cvcp->cvc_vcc && cvcp->cvc_vcc->vc_nif) { + struct ifnet *ifp = + (struct ifnet *)cvcp->cvc_vcc->vc_nif; + + BPF_MTAP(ifp, (KBuffer *)arg1); + } + + /* * Hand the data off to the device */ (*cup->cu_output)(cup, cvp, (KBuffer *)arg1); diff --git a/sys/netatm/atm_if.c b/sys/netatm/atm_if.c index cc0b657..52e2362 100644 --- a/sys/netatm/atm_if.c +++ b/sys/netatm/atm_if.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_types.h> #include <net/if_dl.h> #include <net/route.h> +#include <net/bpf.h> #include <netinet/in.h> #include <netinet/in_var.h> #include <netatm/port.h> @@ -777,6 +778,13 @@ atm_nif_attach(nip) if_attach(ifp); /* + * Add to BPF interface list + * DLT_ATM_RFC_1483 cannot be used because both NULL and LLC/SNAP could + * be provisioned + */ + bpfattach(ifp, DLT_ATM_CLIP, T_ATM_LLC_MAX_LEN); + + /* * Add to physical interface list */ LINK2TAIL(nip, struct atm_nif, pip->pif_nif, nif_pnext); @@ -839,6 +847,11 @@ atm_nif_detach(nip) } /* + * Remove from BPF interface list + */ + bpfdetach(ifp); + + /* * Mark interface down */ if_down(ifp); |