mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-27 16:39:08 +00:00
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
This commit is contained in:
parent
c24297c0f2
commit
5be9a825e2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117960
@ -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>
|
||||
@ -2899,6 +2900,17 @@ atm_cm_cpcs_upper(cmd, tok, arg1, arg2)
|
||||
break;
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -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>
|
||||
@ -370,6 +371,17 @@ atm_dev_lower(cmd, tok, arg1, arg2)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
@ -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>
|
||||
@ -776,6 +777,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
|
||||
*/
|
||||
@ -838,6 +846,11 @@ atm_nif_detach(nip)
|
||||
(void) (*ncp->ncm_stat)(NCM_DETACH, nip, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove from BPF interface list
|
||||
*/
|
||||
bpfdetach(ifp);
|
||||
|
||||
/*
|
||||
* Mark interface down
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user