diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2021-02-20 04:39:17 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2021-02-20 04:39:17 +0000 |
commit | ec4ad68e31b81267e38a83058ebe94d8d5e53586 (patch) | |
tree | 0fed7da476cc8d3f1e4a12ea43a6a7b7f92568c0 /sys/net/if_tun.c | |
parent | 1853b72e8295f6a558b22c4d8c5e4f04f88dcbca (diff) |
let tun use bpf_mtap for handling input packets.
tun (not tap) input packets are written from userland in the same
format that it's bpf dlt is expecting, so we can push the packet
straight into bpf with bpf_mtap. this is more correct that using
bpf_mtap_ether for tun.
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 98572336439..bb5e27116bc 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.229 2021/01/19 19:39:58 mvs Exp $ */ +/* $OpenBSD: if_tun.c,v 1.230 2021/02/20 04:39:16 dlg Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -239,6 +239,9 @@ tun_create(struct if_clone *ifc, int unit, int flags) if_counters_alloc(ifp); if ((flags & TUN_LAYER2) == 0) { +#if NBPFILTER > 0 + ifp->if_bpf_mtap = bpf_mtap; +#endif ifp->if_input = tun_input; ifp->if_output = tun_output; ifp->if_mtu = ETHERMTU; |