-/* $OpenBSD: if.c,v 1.631 2021/02/20 04:37:26 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.632 2021/02/20 04:55:52 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
counters_pkt(ifp->if_counters,
ifc_ipackets, ifc_ibytes, m->m_pkthdr.len);
+#if NPF > 0
+ pf_pkt_addr_changed(m);
+#endif
+
#if NBPFILTER > 0
if_bpf = ifp->if_bpf;
if (if_bpf) {
}
}
+int
+p2p_bpf_mtap(caddr_t if_bpf, const struct mbuf *m, u_int dir)
+{
+#if NBPFILTER > 0
+ return (bpf_mtap_af(if_bpf, m->m_pkthdr.ph_family, m, dir));
+#else
+ return (0);
+#endif
+}
+
+void
+p2p_input(struct ifnet *ifp, struct mbuf *m)
+{
+ void (*input)(struct ifnet *, struct mbuf *);
+
+ switch (m->m_pkthdr.ph_family) {
+ case AF_INET:
+ input = ipv4_input;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ input = ipv6_input;
+ break;
+#endif
+#ifdef MPLS
+ case AF_MPLS:
+ input = mpls_input;
+ break;
+#endif
+ default:
+ m_freem(m);
+ return;
+ }
+
+ (*input)(ifp, m);
+}
/*
* Bring down all interfaces
-/* $OpenBSD: if_var.h,v 1.113 2021/02/20 04:35:41 dlg Exp $ */
+/* $OpenBSD: if_var.h,v 1.114 2021/02/20 04:55:52 dlg Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
int if_output_local(struct ifnet *, struct mbuf *, sa_family_t);
void if_rtrequest_dummy(struct ifnet *, int, struct rtentry *);
void p2p_rtrequest(struct ifnet *, int, struct rtentry *);
+void p2p_input(struct ifnet *, struct mbuf *);
+int p2p_bpf_mtap(caddr_t, const struct mbuf *, u_int);
struct ifaddr *ifa_ifwithaddr(struct sockaddr *, u_int);
struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *, u_int);