diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2024-11-08 10:24:14 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2024-11-08 10:24:14 +0000 |
commit | 259979fa01206bb04e9c6994607089926738cb18 (patch) | |
tree | 40f482b46dcac120db37be5ea1785fa183af5469 /sys/netinet | |
parent | 1ef4445c7bc0ab808a7082b106b0c58db5458d01 (diff) |
Use PCB iterator for raw IPv6 input loop.
Implement inpcb iterator in rip6_input(). Factor out the real work
to rip6_sbappend(). Now UDP broadcast and multicast, raw IPv4 and
IPv6 input work similar. While there, make rip_input() look more
like rip6_input().
OK mvs@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/raw_ip.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index feb723e4a22..0b846a75210 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.161 2024/11/05 22:44:20 bluhm Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.162 2024/11/08 10:24:13 bluhm Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -136,8 +136,6 @@ rip_input(struct mbuf **mp, int *offp, int proto, int af) struct inpcb_iterator iter = { .inp_table = NULL }; struct inpcb *inp, *last; struct in_addr *key; - struct counters_ref ref; - uint64_t *counters; struct sockaddr_in ripsrc; KASSERT(af == AF_INET); @@ -209,12 +207,15 @@ rip_input(struct mbuf **mp, int *offp, int proto, int af) mtx_leave(&rawcbtable.inpt_mtx); if (last == NULL) { - if (ip->ip_p != IPPROTO_ICMP) + struct counters_ref ref; + uint64_t *counters; + + if (ip->ip_p == IPPROTO_ICMP) { + m_freem(m); + } else { icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PROTOCOL, 0, 0); - else - m_freem(m); - + } counters = counters_enter(&ref, ipcounters); counters[ips_noproto]++; counters[ips_delivered]--; |