diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-05-18 20:15:15 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-05-18 20:15:15 +0000 |
commit | ce2de0339b6b5835f7134b4a7a4f1bf4cd54553c (patch) | |
tree | 1e542663206bfba4ec1491d9084e14daa93009f4 /sys | |
parent | 424dd71678c6bfc47289fcf1d46ea8a7eac50f94 (diff) |
Remove some superflous if_get(9)/if_put(9) dances now that ARP input
routines are call directly by ether_input().
ok visa@, dlg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_ethersubr.c | 6 | ||||
-rw-r--r-- | sys/netinet/if_ether.c | 35 | ||||
-rw-r--r-- | sys/netinet/if_ether.h | 6 |
3 files changed, 17 insertions, 30 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index eeb488122b3..542fa2b5dcc 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.235 2016/04/01 04:03:35 jsg Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.236 2016/05/18 20:15:14 mpi Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -372,13 +372,13 @@ decapsulate: case ETHERTYPE_ARP: if (ifp->if_flags & IFF_NOARP) goto dropanyway; - arpinput(m); + arpinput(ifp, m); return (1); case ETHERTYPE_REVARP: if (ifp->if_flags & IFF_NOARP) goto dropanyway; - revarpinput(m); + revarpinput(ifp, m); return (1); #ifdef INET6 diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 096a49822b8..e4c6ff71525 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.206 2016/05/18 08:05:51 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.207 2016/05/18 20:15:14 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -81,8 +81,8 @@ int arpt_down = 20; /* once declared down, don't send for 20 secs */ void arptfree(struct rtentry *); void arptimer(void *); struct rtentry *arplookup(u_int32_t, int, int, u_int); -void in_arpinput(struct mbuf *); -void in_revarpinput(struct mbuf *); +void in_arpinput(struct ifnet *, struct mbuf *); +void in_revarpinput(struct ifnet *, struct mbuf *); int arpcache(struct ifnet *, struct ether_arp *, struct rtentry *); LIST_HEAD(, llinfo_arp) arp_list; @@ -413,7 +413,7 @@ bad: * then the protocol-specific routine is called. */ void -arpinput(struct mbuf *m) +arpinput(struct ifnet *ifp, struct mbuf *m) { struct arphdr *ar; int len; @@ -438,7 +438,7 @@ arpinput(struct mbuf *m) if (m->m_len < len && (m = m_pullup(m, len)) == NULL) return; - in_arpinput(m); + in_arpinput(ifp, m); } /* @@ -447,10 +447,9 @@ arpinput(struct mbuf *m) * protocol address, to catch impersonators. */ void -in_arpinput(struct mbuf *m) +in_arpinput(struct ifnet *ifp, struct mbuf *m) { struct ether_arp *ea; - struct ifnet *ifp; struct ether_header *eh; struct rtentry *rt = NULL; struct sockaddr sa; @@ -463,11 +462,6 @@ in_arpinput(struct mbuf *m) rdomain = rtable_l2(m->m_pkthdr.ph_rtableid); - ifp = if_get(m->m_pkthdr.ph_ifidx); - if (ifp == NULL) { - m_freem(m); - return; - } ea = mtod(m, struct ether_arp *); op = ntohs(ea->arp_op); if ((op != ARPOP_REQUEST) && (op != ARPOP_REPLY)) @@ -557,12 +551,10 @@ in_arpinput(struct mbuf *m) sa.sa_family = pseudo_AF_HDRCMPLT; sa.sa_len = sizeof(sa); ifp->if_output(ifp, m, &sa, NULL); - if_put(ifp); return; out: rtfree(rt); - if_put(ifp); m_freem(m); } @@ -770,7 +762,7 @@ arpproxy(struct in_addr in, unsigned int rtableid) * then the protocol-specific routine is called. */ void -revarpinput(struct mbuf *m) +revarpinput(struct ifnet *ifp, struct mbuf *m) { struct arphdr *ar; @@ -784,7 +776,7 @@ revarpinput(struct mbuf *m) switch (ntohs(ar->ar_pro)) { case ETHERTYPE_IP: - in_revarpinput(m); + in_revarpinput(ifp, m); return; default: @@ -806,9 +798,8 @@ out: * Note: also supports ARP via RARP packets, per the RFC. */ void -in_revarpinput(struct mbuf *m) +in_revarpinput(struct ifnet *ifp, struct mbuf *m) { - struct ifnet *ifp = NULL; struct ether_arp *ar; int op; @@ -817,7 +808,7 @@ in_revarpinput(struct mbuf *m) switch (op) { case ARPOP_REQUEST: case ARPOP_REPLY: /* per RFC */ - in_arpinput(m); + in_arpinput(ifp, m); return; case ARPOP_REVREPLY: break; @@ -832,9 +823,6 @@ in_revarpinput(struct mbuf *m) goto out; if (revarp_finished) goto wake; - ifp = if_get(revarp_ifidx); - if (ifp == NULL) - goto out; if (memcmp(ar->arp_tha, LLADDR(ifp->if_sadl), sizeof(ar->arp_tha))) goto out; memcpy(&revarp_srvip, ar->arp_spa, sizeof(revarp_srvip)); @@ -842,11 +830,10 @@ in_revarpinput(struct mbuf *m) revarp_finished = 1; wake: /* Do wakeup every time in case it was missed. */ wakeup((caddr_t)&revarp_myip); -#endif +#endif /* NFSCLIENT */ out: m_freem(m); - if_put(ifp); } /* diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h index a6e5fc1bd01..56e52bd79fa 100644 --- a/sys/netinet/if_ether.h +++ b/sys/netinet/if_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.h,v 1.70 2016/03/30 10:13:14 mpi Exp $ */ +/* $OpenBSD: if_ether.h,v 1.71 2016/05/18 20:15:14 mpi Exp $ */ /* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */ /* @@ -211,12 +211,12 @@ extern u_int8_t ether_ipmulticast_max[ETHER_ADDR_LEN]; extern unsigned int revarp_ifidx; #endif /* NFSCLIENT */ -void revarpinput(struct mbuf *); +void revarpinput(struct ifnet *, struct mbuf *); void revarprequest(struct ifnet *); int revarpwhoarewe(struct ifnet *, struct in_addr *, struct in_addr *); int revarpwhoami(struct in_addr *, struct ifnet *); -void arpinput(struct mbuf *); +void arpinput(struct ifnet *, struct mbuf *); void arprequest(struct ifnet *, u_int32_t *, u_int32_t *, u_int8_t *); void arpwhohas(struct arpcom *, struct in_addr *); int arpproxy(struct in_addr, unsigned int); |