mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-18 04:27:47 +08:00
Update to FreeBSD head 2018-06-01
Git mirror commit fb63610a69b0eb7f69a201ba05c4c1a7a2739cf9. Update #3472.
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <rtems/bsd/local/opt_bpf.h>
|
||||
#include <rtems/bsd/local/opt_compat.h>
|
||||
#include <rtems/bsd/local/opt_ddb.h>
|
||||
#include <rtems/bsd/local/opt_netgraph.h>
|
||||
|
||||
@@ -106,6 +105,10 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
MALLOC_DEFINE(M_BPF, "BPF", "BPF data");
|
||||
|
||||
static struct bpf_if_ext dead_bpf_if = {
|
||||
.bif_dlist = LIST_HEAD_INITIALIZER()
|
||||
};
|
||||
|
||||
struct bpf_if {
|
||||
#define bif_next bif_ext.bif_next
|
||||
#define bif_dlist bif_ext.bif_dlist
|
||||
@@ -167,6 +170,9 @@ struct bpf_dltlist32 {
|
||||
#define BIOCSETFNR32 _IOW('B', 130, struct bpf_program32)
|
||||
#endif
|
||||
|
||||
#define BPF_LOCK() sx_xlock(&bpf_sx)
|
||||
#define BPF_UNLOCK() sx_xunlock(&bpf_sx)
|
||||
#define BPF_LOCK_ASSERT() sx_assert(&bpf_sx, SA_XLOCKED)
|
||||
/*
|
||||
* bpf_iflist is a list of BPF interface structures, each corresponding to a
|
||||
* specific DLT. The same network interface might have several BPF interface
|
||||
@@ -174,7 +180,7 @@ struct bpf_dltlist32 {
|
||||
* frames, ethernet frames, etc).
|
||||
*/
|
||||
static LIST_HEAD(, bpf_if) bpf_iflist, bpf_freelist;
|
||||
static struct mtx bpf_mtx; /* bpf global lock */
|
||||
static struct sx bpf_sx; /* bpf global lock */
|
||||
static int bpf_bpfd_cnt;
|
||||
|
||||
static void bpf_attachd(struct bpf_d *, struct bpf_if *);
|
||||
@@ -2752,7 +2758,7 @@ bpfdetach(struct ifnet *ifp)
|
||||
*/
|
||||
BPFIF_WLOCK(bp);
|
||||
bp->bif_flags |= BPFIF_FLAG_DYING;
|
||||
*bp->bif_bpf = NULL;
|
||||
*bp->bif_bpf = (struct bpf_if *)&dead_bpf_if;
|
||||
BPFIF_WUNLOCK(bp);
|
||||
|
||||
CTR4(KTR_NET, "%s: sheduling free for encap %d (%p) for if %p",
|
||||
@@ -3090,7 +3096,7 @@ bpf_drvinit(void *unused)
|
||||
int rv;
|
||||
#endif /* __rtems__ */
|
||||
|
||||
mtx_init(&bpf_mtx, "bpf global lock", NULL, MTX_DEF);
|
||||
sx_init(&bpf_sx, "bpf global lock");
|
||||
LIST_INIT(&bpf_iflist);
|
||||
LIST_INIT(&bpf_freelist);
|
||||
|
||||
@@ -3253,13 +3259,13 @@ bpf_stats_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,bpf_drvinit,NULL);
|
||||
|
||||
#else /* !DEV_BPF && !NETGRAPH_BPF */
|
||||
|
||||
/*
|
||||
* NOP stubs to allow bpf-using drivers to load and function.
|
||||
*
|
||||
* A 'better' implementation would allow the core bpf functionality
|
||||
* to be loaded at runtime.
|
||||
*/
|
||||
static struct bpf_if bp_null;
|
||||
|
||||
void
|
||||
bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen)
|
||||
@@ -3287,7 +3293,7 @@ void
|
||||
bpfattach2(struct ifnet *ifp, u_int dlt, u_int hdrlen, struct bpf_if **driverp)
|
||||
{
|
||||
|
||||
*driverp = &bp_null;
|
||||
*driverp = (struct bpf_if *)&dead_bpf_if;
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user