summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2022-08-21 14:15:56 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2022-08-21 14:15:56 +0000
commit881a0e084ca0a52d7d06b8e4bf80fe8526aa7b8f (patch)
treeba0e965878e42c8a73de953a2c2711a1dbaccb92 /sys/netinet/ip_input.c
parent7ad677aafb2ea8ac8cbb8c513425581fb8d4c64a (diff)
Remove ip_local() and ip6_local(). After moving the IPv4 fragment
reassembly and IPv6 hob-by-hob header chain processing out of ip_local() and ip6_local(), they are almost empty stubs. The check for local deliver loop in ip_ours() and ip6_ours() is sufficient. Recover mbuf offset and next protocol directly in ipintr() and ip6intr(). OK mvs@
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 1a4e2d8d90e..affe27038c6 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.379 2022/08/15 16:15:36 bluhm Exp $ */
+/* $OpenBSD: ip_input.c,v 1.380 2022/08/21 14:15:55 bluhm Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -138,7 +138,6 @@ static struct mbuf_queue ipsendraw_mq;
extern struct niqueue arpinq;
int ip_ours(struct mbuf **, int *, int, int);
-int ip_local(struct mbuf **, int *, int, int);
int ip_dooptions(struct mbuf *, struct ifnet *);
int in_ouraddr(struct mbuf *, struct ifnet *, struct rtentry **);
@@ -245,7 +244,7 @@ ip_ours(struct mbuf **mp, int *offp, int nxt, int af)
/* We are already in a IPv4/IPv6 local deliver loop. */
if (af != AF_UNSPEC)
- return ip_local(mp, offp, nxt, af);
+ return nxt;
niq_enqueue(&ipintrq, *mp);
*mp = NULL;
@@ -260,15 +259,20 @@ void
ipintr(void)
{
struct mbuf *m;
- int off, nxt;
while ((m = niq_dequeue(&ipintrq)) != NULL) {
+ struct ip *ip;
+ int off, nxt;
+
#ifdef DIAGNOSTIC
if ((m->m_flags & M_PKTHDR) == 0)
panic("ipintr no HDR");
#endif
- off = 0;
- nxt = ip_local(&m, &off, IPPROTO_IPV4, AF_UNSPEC);
+ ip = mtod(m, struct ip *);
+ off = ip->ip_hl << 2;
+ nxt = ip->ip_p;
+
+ nxt = ip_deliver(&m, &off, nxt, AF_INET);
KASSERT(nxt == IPPROTO_DONE);
}
}
@@ -552,28 +556,6 @@ ip_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
return nxt;
}
-/*
- * IPv4 local-delivery routine.
- *
- * If fragmented try to reassemble. Pass to next level.
- */
-int
-ip_local(struct mbuf **mp, int *offp, int nxt, int af)
-{
- if (*offp == 0) {
- struct ip *ip;
-
- ip = mtod(*mp, struct ip *);
- *offp = ip->ip_hl << 2;
- nxt = ip->ip_p;
- }
-
- /* Check whether we are already in a IPv4/IPv6 local deliver loop. */
- if (af == AF_UNSPEC)
- nxt = ip_deliver(mp, offp, nxt, AF_INET);
- return nxt;
-}
-
int
ip_fragcheck(struct mbuf **mp, int *offp)
{