summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-05-30 07:50:38 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-05-30 07:50:38 +0000
commitf821aa1c0a176765b922adda04e7978033816e93 (patch)
treef61129b0cc445f31adf461d1eabbc0438b2fe8aa /sys/net/if.c
parentdef6d835df8ef7186f4a9e02f0911bbfe939e469 (diff)
Introduce ipv{4,6}_input(), two wrappers around IP queues.
This will help transitionning to an un-KERNEL_LOCK()ed IP forwarding path. Disucssed with bluhm@, ok claudio@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 29ec9034760..cdeb70a2d13 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.501 2017/05/30 06:42:13 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.502 2017/05/30 07:50:37 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -734,8 +734,6 @@ if_input(struct ifnet *ifp, struct mbuf_list *ml)
int
if_input_local(struct ifnet *ifp, struct mbuf *m, sa_family_t af)
{
- struct niqueue *ifq = NULL;
-
#if NBPFILTER > 0
/*
* Only send packets to bpf if they are destinated to local
@@ -758,21 +756,22 @@ if_input_local(struct ifnet *ifp, struct mbuf *m, sa_family_t af)
ifp->if_opackets++;
ifp->if_obytes += m->m_pkthdr.len;
+ ifp->if_ipackets++;
+ ifp->if_ibytes += m->m_pkthdr.len;
+
switch (af) {
case AF_INET:
- ifq = &ipintrq;
+ ipv4_input(ifp, m);
break;
#ifdef INET6
case AF_INET6:
- ifq = &ip6intrq;
+ ipv6_input(ifp, m);
break;
#endif /* INET6 */
#ifdef MPLS
case AF_MPLS:
- ifp->if_ipackets++;
- ifp->if_ibytes += m->m_pkthdr.len;
mpls_input(m);
- return (0);
+ break;
#endif /* MPLS */
default:
printf("%s: can't handle af%d\n", ifp->if_xname, af);
@@ -780,12 +779,6 @@ if_input_local(struct ifnet *ifp, struct mbuf *m, sa_family_t af)
return (EAFNOSUPPORT);
}
- if (niq_enqueue(ifq, m) != 0)
- return (ENOBUFS);
-
- ifp->if_ipackets++;
- ifp->if_ibytes += m->m_pkthdr.len;
-
return (0);
}