diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2004-10-09 19:55:30 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2004-10-09 19:55:30 +0000 |
commit | 36fee5ad51a494ea2a99d02ba507b822da9220d8 (patch) | |
tree | 6eca67bfe77c56ef5187df0e1d92bcb2501b8760 /sys/net | |
parent | faf72ac487efb530d82918a5b281a5eb1b07ccdb (diff) |
sizeof(struct ether_header) -> ETHER_HDR_LEN
ok mcbride@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/bpf.c | 4 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 50 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 8 | ||||
-rw-r--r-- | sys/net/if_vlan.c | 15 |
4 files changed, 38 insertions, 39 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index d524037d9ae..79e147d34bd 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.53 2004/09/23 03:31:08 brad Exp $ */ +/* $OpenBSD: bpf.c,v 1.54 2004/10/09 19:55:28 brad Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -138,7 +138,7 @@ bpf_movein(uio, linktype, mp, sockp, filter) case DLT_EN10MB: sockp->sa_family = AF_UNSPEC; /* XXX Would MAXLINKHDR be better? */ - hlen = sizeof(struct ether_header); + hlen = ETHER_HDR_LEN; break; case DLT_ARCNET: diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 74aa4d6ab1b..a99466c4d5c 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.137 2004/08/18 11:07:47 markus Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.138 2004/10/09 19:55:28 brad Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -220,12 +220,12 @@ bridge_clone_create(struct if_clone *ifc, int unit) ifp->if_start = bridge_start; ifp->if_type = IFT_BRIDGE; ifp->if_snd.ifq_maxlen = ifqmaxlen; - ifp->if_hdrlen = sizeof(struct ether_header); + ifp->if_hdrlen = ETHER_HDR_LEN; if_attach(ifp); if_alloc_sadl(ifp); #if NBPFILTER > 0 bpfattach(&sc->sc_if.if_bpf, ifp, - DLT_EN10MB, sizeof(struct ether_header)); + DLT_EN10MB, ETHER_HDR_LEN); #endif s = splnet(); LIST_INSERT_HEAD(&bridge_list, sc, sc_list); @@ -1013,13 +1013,13 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa, } else { struct mbuf *m1, *m2, *mx; - m1 = m_copym2(m, 0, sizeof(struct ether_header), + m1 = m_copym2(m, 0, ETHER_HDR_LEN, M_DONTWAIT); if (m1 == NULL) { sc->sc_if.if_oerrors++; continue; } - m2 = m_copym2(m, sizeof(struct ether_header), + m2 = m_copym2(m, ETHER_HDR_LEN, M_COPYALL, M_DONTWAIT); if (m2 == NULL) { m_freem(m1); @@ -1140,7 +1140,7 @@ bridgeintr_frame(struct bridge_softc *sc, struct mbuf *m) m_freem(m); return; } - m_copydata(m, 0, sizeof(struct ether_header), (caddr_t)&eh); + m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&eh); dst = (struct ether_addr *)&eh.ether_dhost[0]; src = (struct ether_addr *)&eh.ether_shost[0]; @@ -1268,7 +1268,7 @@ bridgeintr_frame(struct bridge_softc *sc, struct mbuf *m) #endif len = m->m_pkthdr.len; - if ((len - sizeof(struct ether_header)) > dst_if->if_mtu) + if ((len - ETHER_HDR_LEN) > dst_if->if_mtu) bridge_fragment(sc, dst_if, &eh, m); else { s = splimp(); @@ -1340,10 +1340,10 @@ bridge_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) mc = m_copym2(m, 0, M_COPYALL, M_NOWAIT); if (mc == NULL) return (m); - M_PREPEND(mc, sizeof(struct ether_header), M_DONTWAIT); + M_PREPEND(mc, ETHER_HDR_LEN, M_DONTWAIT); if (mc == NULL) return (m); - bcopy(eh, mtod(mc, caddr_t), sizeof(struct ether_header)); + bcopy(eh, mtod(mc, caddr_t), ETHER_HDR_LEN); s = splimp(); if (IF_QFULL(&sc->sc_if.if_snd)) { m_freem(mc); @@ -1410,10 +1410,10 @@ bridge_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) return (NULL); } } - M_PREPEND(m, sizeof(struct ether_header), M_DONTWAIT); + M_PREPEND(m, ETHER_HDR_LEN, M_DONTWAIT); if (m == NULL) return (NULL); - bcopy(eh, mtod(m, caddr_t), sizeof(struct ether_header)); + bcopy(eh, mtod(m, caddr_t), ETHER_HDR_LEN); s = splimp(); if (IF_QFULL(&sc->sc_if.if_snd)) { m_freem(m); @@ -1486,13 +1486,13 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *ifp, } else { struct mbuf *m1, *m2, *mx; - m1 = m_copym2(m, 0, sizeof(struct ether_header), + m1 = m_copym2(m, 0, ETHER_HDR_LEN, M_DONTWAIT); if (m1 == NULL) { sc->sc_if.if_oerrors++; continue; } - m2 = m_copym2(m, sizeof(struct ether_header), + m2 = m_copym2(m, ETHER_HDR_LEN, M_COPYALL, M_DONTWAIT); if (m2 == NULL) { m_freem(m1); @@ -1520,7 +1520,7 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *ifp, continue; #endif - if ((len - sizeof(struct ether_header)) > dst_if->if_mtu) + if ((len - ETHER_HDR_LEN) > dst_if->if_mtu) bridge_fragment(sc, dst_if, eh, mc); else { bridge_ifenqueue(sc, dst_if, mc); @@ -1547,10 +1547,10 @@ bridge_span(struct bridge_softc *sc, struct ether_header *eh, if (m == NULL) return; if (eh != NULL) { - M_PREPEND(m, sizeof(struct ether_header), M_DONTWAIT); + M_PREPEND(m, ETHER_HDR_LEN, M_DONTWAIT); if (m == NULL) return; - bcopy(eh, mtod(m, caddr_t), sizeof(struct ether_header)); + bcopy(eh, mtod(m, caddr_t), ETHER_HDR_LEN); } LIST_FOREACH(p, &sc->sc_spanlist, next) { @@ -2012,7 +2012,7 @@ bridge_blocknonip(struct ether_header *eh, struct mbuf *m) struct llc llc; u_int16_t etype; - if (m->m_pkthdr.len < sizeof(struct ether_header)) + if (m->m_pkthdr.len < ETHER_HDR_LEN) return (1); etype = ntohs(eh->ether_type); @@ -2028,10 +2028,10 @@ bridge_blocknonip(struct ether_header *eh, struct mbuf *m) return (1); if (m->m_pkthdr.len < - (sizeof(struct ether_header) + LLC_SNAPFRAMELEN)) + (ETHER_HDR_LEN + LLC_SNAPFRAMELEN)) return (1); - m_copydata(m, sizeof(struct ether_header), LLC_SNAPFRAMELEN, + m_copydata(m, ETHER_HDR_LEN, LLC_SNAPFRAMELEN, (caddr_t)&llc); etype = ntohs(llc.llc_snap.ether_type); @@ -2344,10 +2344,10 @@ bridge_filter(struct bridge_softc *sc, int dir, struct ifnet *ifp, if (etype != ETHERTYPE_IP && etype != ETHERTYPE_IPV6) { if (etype > ETHERMTU || m->m_pkthdr.len < (LLC_SNAPFRAMELEN + - sizeof(struct ether_header))) + ETHER_HDR_LEN)) return (m); - m_copydata(m, sizeof(struct ether_header), + m_copydata(m, ETHER_HDR_LEN, LLC_SNAPFRAMELEN, (caddr_t)&llc); if (llc.llc_dsap != LLC_SNAP_LSAP || @@ -2364,7 +2364,7 @@ bridge_filter(struct bridge_softc *sc, int dir, struct ifnet *ifp, hassnap = 1; } - m_adj(m, sizeof(struct ether_header)); + m_adj(m, ETHER_HDR_LEN); if (hassnap) m_adj(m, LLC_SNAPFRAMELEN); @@ -2543,10 +2543,10 @@ bridge_fragment(struct bridge_softc *sc, struct ifnet *ifp, if (etype != ETHERTYPE_IP) { if (etype > ETHERMTU || m->m_pkthdr.len < (LLC_SNAPFRAMELEN + - sizeof(struct ether_header))) + ETHER_HDR_LEN)) goto dropit; - m_copydata(m, sizeof(struct ether_header), + m_copydata(m, ETHER_HDR_LEN, LLC_SNAPFRAMELEN, (caddr_t)&llc); if (llc.llc_dsap != LLC_SNAP_LSAP || @@ -2561,7 +2561,7 @@ bridge_fragment(struct bridge_softc *sc, struct ifnet *ifp, hassnap = 1; } - m_adj(m, sizeof(struct ether_header)); + m_adj(m, ETHER_HDR_LEN); if (hassnap) m_adj(m, LLC_SNAPFRAMELEN); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index bd750b9ed89..612c9fbe627 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.79 2004/07/16 15:01:08 henning Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.80 2004/10/09 19:55:29 brad Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -452,7 +452,7 @@ ether_output(ifp, m0, dst, rt0) * Add local net header. If no space in first mbuf, * allocate another. */ - M_PREPEND(m, sizeof (struct ether_header), M_DONTWAIT); + M_PREPEND(m, ETHER_HDR_LEN, M_DONTWAIT); if (m == 0) senderr(ENOBUFS); eh = mtod(m, struct ether_header *); @@ -529,7 +529,7 @@ ether_output(ifp, m0, dst, rt0) splx(s); return (error); } - ifp->if_obytes += len + sizeof (struct ether_header); + ifp->if_obytes += len + ETHER_HDR_LEN; if (mflags & M_MCAST) ifp->if_omcasts++; if ((ifp->if_flags & IFF_OACTIVE) == 0) @@ -859,7 +859,7 @@ ether_ifattach(ifp) LLADDR(ifp->if_sadl), ifp->if_addrlen); LIST_INIT(&((struct arpcom *)ifp)->ac_multiaddrs); #if NBPFILTER > 0 - bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); + bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, ETHER_HDR_LEN); #endif } diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 43fb15b1fb9..38f9ddb85fc 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.46 2004/03/27 23:41:04 deraadt Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.47 2004/10/09 19:55:29 brad Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology * @@ -218,12 +218,11 @@ vlan_start(struct ifnet *ifp) } else { struct ether_vlan_header evh; - m_copydata(m, 0, sizeof(struct ether_header), - (caddr_t)&evh); + m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&evh); evh.evl_proto = evh.evl_encap_proto; evh.evl_encap_proto = htons(ETHERTYPE_8021Q); evh.evl_tag = htons(ifv->ifv_tag); - m_adj(m, sizeof(struct ether_header)); + m_adj(m, ETHER_HDR_LEN); m0 = m_prepend(m, sizeof(struct ether_vlan_header), M_DONTWAIT); @@ -279,15 +278,15 @@ vlan_input_tag(struct mbuf *m, u_int16_t t) } if (ifv == NULL) { - if (m->m_pkthdr.len < sizeof(struct ether_header)) { + if (m->m_pkthdr.len < ETHER_HDR_LEN) { m_freem(m); return (-1); } - m_copydata(m, 0, sizeof(struct ether_header), (caddr_t)&vh); + m_copydata(m, 0, ETHER_HDR_LEN, (caddr_t)&vh); vh.evl_proto = vh.evl_encap_proto; vh.evl_tag = htons(t); vh.evl_encap_proto = htons(ETHERTYPE_8021Q); - m_adj(m, sizeof(struct ether_header)); + m_adj(m, ETHER_HDR_LEN); m = m_prepend(m, sizeof(struct ether_vlan_header), M_DONTWAIT); if (m == NULL) return (-1); @@ -382,7 +381,7 @@ vlan_input(eh, m) m0.m_flags = 0; m0.m_next = m; - m0.m_len = sizeof(struct ether_header); + m0.m_len = ETHER_HDR_LEN; m0.m_data = (char *)eh; bpf_mtap(ifv->ifv_if.if_bpf, &m0); } |