From 170d586f25c9f4ebc6e2518e770183a3228a117e Mon Sep 17 00:00:00 2001 From: mpi Date: Tue, 26 May 2015 11:39:07 +0000 Subject: [PATCH] Now that the Ethernet header is always passed as part of the mbuf, kill the second (unused) argument of the input packet handlers. ok dlg@ --- sys/net/if.c | 4 ++-- sys/net/if_ethersubr.c | 19 +++++++------------ sys/net/if_trunk.c | 12 +++++------- sys/net/if_trunk.h | 3 +-- sys/net/if_var.h | 6 +++--- sys/net/if_vlan.c | 6 +++--- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 7f6a88e0bc5..b59a93e2787 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.334 2015/05/26 11:36:26 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.335 2015/05/26 11:39:07 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -540,7 +540,7 @@ again: */ ifp = m->m_pkthdr.rcvif; SLIST_FOREACH(ifih, &ifp->if_inputs, ifih_next) { - if ((*ifih->ifih_input)(m, NULL)) + if ((*ifih->ifih_input)(m)) break; /* Pseudo-drivers might be stacked. */ diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 3fe86227a93..2cc68153a64 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.200 2015/05/26 11:36:26 dlg Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.201 2015/05/26 11:39:07 mpi Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -422,10 +422,10 @@ bad: * the ether header, which is provided separately. */ int -ether_input(struct mbuf *m, void *hdr) +ether_input(struct mbuf *m) { struct ifnet *ifp; - struct ether_header *eh = hdr; + struct ether_header *eh; struct niqueue *inq; u_int16_t etype; int llcfound = 0; @@ -435,20 +435,15 @@ ether_input(struct mbuf *m, void *hdr) struct ether_header *eh_tmp; #endif - - /* mark incoming routing table */ ifp = m->m_pkthdr.rcvif; - m->m_pkthdr.ph_rtableid = ifp->if_rdomain; - - if (eh == NULL) { - eh = mtod(m, struct ether_header *); - m_adj(m, ETHER_HDR_LEN); - } - if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); return (1); } + + eh = mtod(m, struct ether_header *); + m_adj(m, ETHER_HDR_LEN); + if (ETHER_IS_MULTICAST(eh->ether_dhost)) { /* * If this is not a simplex interface, drop the packet diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 845d6f78755..99880efb888 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.99 2015/05/15 10:15:13 mpi Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.100 2015/05/26 11:39:07 mpi Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter @@ -77,7 +77,7 @@ int trunk_ether_delmulti(struct trunk_softc *, struct ifreq *); void trunk_ether_purgemulti(struct trunk_softc *); int trunk_ether_cmdmulti(struct trunk_port *, u_long); int trunk_ioctl_allports(struct trunk_softc *, u_long, caddr_t); -int trunk_input(struct mbuf *, void *); +int trunk_input(struct mbuf *); void trunk_start(struct ifnet *); void trunk_init(struct ifnet *); void trunk_stop(struct ifnet *); @@ -1080,19 +1080,17 @@ trunk_watchdog(struct ifnet *ifp) } int -trunk_input(struct mbuf *m, void *hdr) +trunk_input(struct mbuf *m) { struct ifnet *ifp; struct trunk_softc *tr; struct trunk_port *tp; struct ifnet *trifp = NULL; - struct ether_header *eh = hdr; + struct ether_header *eh; int error; ifp = m->m_pkthdr.rcvif; - - if (eh == NULL) - eh = mtod(m, struct ether_header *); + eh = mtod(m, struct ether_header *); if (ETHER_IS_MULTICAST(eh->ether_dhost)) ifp->if_imcasts++; diff --git a/sys/net/if_trunk.h b/sys/net/if_trunk.h index 2f392a13ba0..a5d1dea7774 100644 --- a/sys/net/if_trunk.h +++ b/sys/net/if_trunk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.h,v 1.22 2015/05/14 10:55:28 mpi Exp $ */ +/* $OpenBSD: if_trunk.h,v 1.23 2015/05/26 11:39:07 mpi Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter @@ -222,7 +222,6 @@ struct trunk_lb { struct trunk_port *lb_ports[TRUNK_MAX_PORTS]; }; -int trunk_input(struct mbuf *, void *); int trunk_enqueue(struct ifnet *, struct mbuf *); u_int32_t trunk_hashmbuf(struct mbuf *, SIPHASH_KEY *); #endif /* _KERNEL */ diff --git a/sys/net/if_var.h b/sys/net/if_var.h index a775c65a117..c6945655abe 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_var.h,v 1.29 2015/05/19 11:09:24 mpi Exp $ */ +/* $OpenBSD: if_var.h,v 1.30 2015/05/26 11:39:07 mpi Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -114,7 +114,7 @@ struct ifqueue { */ struct ifih { SLIST_ENTRY(ifih) ifih_next; - int (*ifih_input)(struct mbuf *, void *); + int (*ifih_input)(struct mbuf *); int ifih_refcnt; }; @@ -427,7 +427,7 @@ void ether_input_mbuf(struct ifnet *, struct mbuf *); void ether_ifattach(struct ifnet *); void ether_ifdetach(struct ifnet *); int ether_ioctl(struct ifnet *, struct arpcom *, u_long, caddr_t); -int ether_input(struct mbuf *, void *); +int ether_input(struct mbuf *); int ether_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); char *ether_sprintf(u_char *); diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index cc4691e3e82..76f20fea76c 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.125 2015/05/26 03:01:54 dlg Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.126 2015/05/26 11:39:07 mpi Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -80,7 +80,7 @@ u_long vlan_tagmask, svlan_tagmask; LIST_HEAD(vlan_taghash, ifvlan) *vlan_tagh, *svlan_tagh; -int vlan_input(struct mbuf *, void *); +int vlan_input(struct mbuf *); int vlan_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); void vlan_start(struct ifnet *ifp); @@ -261,7 +261,7 @@ vlan_start(struct ifnet *ifp) * vlan_input() returns 1 if it has consumed the packet, 0 otherwise. */ int -vlan_input(struct mbuf *m, void *hdr) +vlan_input(struct mbuf *m) { struct ifvlan *ifv; struct ifnet *ifp; -- 2.20.1