summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-03-03 05:04:57 +0000
committermdodd <mdodd@FreeBSD.org>2003-03-03 05:04:57 +0000
commit587970fdc3a5e96f3ae648daf6d10fddfd60310d (patch)
tree1a7da9ce88a0fd72ae2f765e952b5dcf1e2b93f7
parent2d1c8006af34da5cb4a92951bf42e868823f6e04 (diff)
downloadFreeBSD-src-587970fdc3a5e96f3ae648daf6d10fddfd60310d.zip
FreeBSD-src-587970fdc3a5e96f3ae648daf6d10fddfd60310d.tar.gz
sizeof(struct llc) -> LLC_SNAPFRAMELEN
sizeof(struct ether_header) -> ETHER_HDR_LEN sizeof(struct fddi_header) -> FDDI_HDR_LEN
-rw-r--r--sys/net/bpf.c2
-rw-r--r--sys/net/if_ef.c2
-rw-r--r--sys/net/if_ethersubr.c20
-rw-r--r--sys/net/if_fddisubr.c4
-rw-r--r--sys/net/if_ieee80211subr.c24
-rw-r--r--sys/net/if_iso88025subr.c6
-rw-r--r--sys/net/if_vlan.c4
7 files changed, 31 insertions, 31 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index bc13b59..38ae861 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -168,7 +168,7 @@ bpf_movein(uio, linktype, mp, sockp, datlen)
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_FDDI:
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
index b064d38..e136a6a 100644
--- a/sys/net/if_ef.c
+++ b/sys/net/if_ef.c
@@ -370,7 +370,7 @@ ef_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
if (eifp->if_bpf) {
struct mbuf m0;
m0.m_next = m;
- m0.m_len = sizeof(struct ether_header);
+ m0.m_len = ETHER_HDR_LEN;
m0.m_data = (char *)eh;
BPF_MTAP(eifp, &m0);
}
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 8b42de3..f3963e6 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -216,14 +216,14 @@ ether_output(ifp, m, dst, rt0)
if ( aa->aa_flags & AFA_PHASE2 ) {
struct llc llc;
- M_PREPEND(m, sizeof(struct llc), M_TRYWAIT);
+ M_PREPEND(m, LLC_SNAPFRAMELEN, M_TRYWAIT);
llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP;
llc.llc_control = LLC_UI;
bcopy(at_org_code, llc.llc_snap_org_code, sizeof(at_org_code));
llc.llc_snap_ether_type = htons( ETHERTYPE_AT );
- bcopy(&llc, mtod(m, caddr_t), sizeof(struct llc));
+ bcopy(&llc, mtod(m, caddr_t), LLC_SNAPFRAMELEN);
type = htons(m->m_pkthdr.len);
- hlen = sizeof(struct llc) + ETHER_HDR_LEN;
+ hlen = LLC_SNAPFRAMELEN + ETHER_HDR_LEN;
} else {
type = htons(ETHERTYPE_AT);
}
@@ -292,7 +292,7 @@ ether_output(ifp, m, 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 *);
@@ -515,7 +515,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
m_freem(m);
return;
}
- if (m->m_len < sizeof (struct ether_header)) {
+ if (m->m_len < ETHER_HDR_LEN) {
/* XXX maybe should pullup? */
if_printf(ifp, "discard frame w/o leading ethernet "
"header (len %u pkt len %u)\n",
@@ -742,7 +742,7 @@ post_stats:
}
/* Strip off Ethernet header. */
- m_adj(m, sizeof (struct ether_header));
+ m_adj(m, ETHER_HDR_LEN);
/* If the CRC is still on the packet, trim it off. */
if (m->m_flags & M_HASFCS) {
@@ -835,7 +835,7 @@ post_stats:
sizeof(at_org_code)) == 0 &&
ntohs(l->llc_snap_ether_type) == ETHERTYPE_AT) {
inq = &atintrq2;
- m_adj( m, sizeof( struct llc ));
+ m_adj( m, LLC_SNAPFRAMELEN);
schednetisr(NETISR_ATALK);
break;
}
@@ -843,7 +843,7 @@ post_stats:
if (Bcmp(&(l->llc_snap_org_code)[0], aarp_org_code,
sizeof(aarp_org_code)) == 0 &&
ntohs(l->llc_snap_ether_type) == ETHERTYPE_AARP) {
- m_adj( m, sizeof( struct llc ));
+ m_adj( m, LLC_SNAPFRAMELEN);
aarpinput(IFP2AC(ifp), m); /* XXX */
return;
}
@@ -873,7 +873,7 @@ discard:
* Put back the ethernet header so netgraph has a
* consistent view of inbound packets.
*/
- M_PREPEND(m, sizeof (struct ether_header), M_DONTWAIT);
+ M_PREPEND(m, ETHER_HDR_LEN, M_DONTWAIT);
(*ng_ether_input_orphan_p)(ifp, m);
return;
}
@@ -930,7 +930,7 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *llc)
if (llc != IFP2AC(ifp)->ac_enaddr)
bcopy(llc, IFP2AC(ifp)->ac_enaddr, ifp->if_addrlen);
- bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
+ bpfattach(ifp, DLT_EN10MB, ETHER_HDR_LEN);
if (ng_ether_attach_p != NULL)
(*ng_ether_attach_p)(ifp);
if (BDG_LOADED)
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index 4fb4bad..fa31889 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -399,9 +399,9 @@ fddi_input(ifp, m)
#endif
/* Strip off FDDI header. */
- m_adj(m, sizeof(struct fddi_header));
+ m_adj(m, FDDI_HDR_LEN);
- m = m_pullup(m, sizeof(struct llc));
+ m = m_pullup(m, LLC_SNAPFRAMELEN);
if (m == 0) {
ifp->if_ierrors++;
goto dropanyway;
diff --git a/sys/net/if_ieee80211subr.c b/sys/net/if_ieee80211subr.c
index b088e26..aee681f 100644
--- a/sys/net/if_ieee80211subr.c
+++ b/sys/net/if_ieee80211subr.c
@@ -560,12 +560,12 @@ ieee80211_encap(struct ifnet *ifp, struct mbuf *m)
struct llc *llc;
struct ieee80211_node *ni;
- if (m->m_len < sizeof(struct ether_header)) {
- m = m_pullup(m, sizeof(struct ether_header));
+ if (m->m_len < ETHER_HDR_LEN) {
+ m = m_pullup(m, ETHER_HDR_LEN);
if (m == NULL)
return NULL;
}
- memcpy(&eh, mtod(m, caddr_t), sizeof(struct ether_header));
+ memcpy(&eh, mtod(m, caddr_t), ETHER_HDR_LEN);
if (!IEEE80211_IS_MULTICAST(eh.ether_dhost) &&
(ic->ic_opmode == IEEE80211_M_IBSS ||
@@ -577,7 +577,7 @@ ieee80211_encap(struct ifnet *ifp, struct mbuf *m)
ni = &ic->ic_bss;
ni->ni_inact = 0;
- m_adj(m, sizeof(struct ether_header) - sizeof(struct llc));
+ m_adj(m, ETHER_HDR_LEN - LLC_SNAPFRAMELEN);
llc = mtod(m, struct llc *);
llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
llc->llc_control = LLC_UI;
@@ -625,8 +625,8 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m)
struct ieee80211_frame wh;
struct llc *llc;
- if (m->m_len < sizeof(wh) + sizeof(*llc)) {
- m = m_pullup(m, sizeof(wh) + sizeof(*llc));
+ if (m->m_len < sizeof(wh) + LLC_SNAPFRAMELEN) {
+ m = m_pullup(m, sizeof(wh) + LLC_SNAPFRAMELEN);
if (m == NULL)
return NULL;
}
@@ -635,10 +635,10 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m)
if (llc->llc_dsap == LLC_SNAP_LSAP && llc->llc_ssap == LLC_SNAP_LSAP &&
llc->llc_control == LLC_UI && llc->llc_snap.org_code[0] == 0 &&
llc->llc_snap.org_code[1] == 0 && llc->llc_snap.org_code[2] == 0) {
- m_adj(m, sizeof(wh) + sizeof(struct llc) - sizeof(*eh));
+ m_adj(m, sizeof(wh) + LLC_SNAPFRAMELEN - ETHER_HDR_LEN);
llc = NULL;
} else {
- m_adj(m, sizeof(wh) - sizeof(*eh));
+ m_adj(m, sizeof(wh) - ETHER_HDR_LEN);
}
eh = mtod(m, struct ether_header *);
switch (wh.i_fc[1] & IEEE80211_FC1_DIR_MASK) {
@@ -660,7 +660,7 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m)
m_freem(m);
return NULL;
}
- if (!ALIGNED_POINTER(mtod(m, caddr_t) + sizeof(*eh), u_int32_t)) {
+ if (!ALIGNED_POINTER(mtod(m, caddr_t) + ETHER_HDR_LEN, u_int32_t)) {
struct mbuf *n, *n0, **np;
caddr_t newdata;
int off, pktlen;
@@ -694,8 +694,8 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m)
}
if (n0 == NULL) {
newdata =
- (caddr_t)ALIGN(n->m_data + sizeof(*eh)) -
- sizeof(*eh);
+ (caddr_t)ALIGN(n->m_data + ETHER_HDR_LEN) -
+ ETHER_HDR_LEN;
n->m_len -= newdata - n->m_data;
n->m_data = newdata;
}
@@ -711,7 +711,7 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m)
}
if (llc != NULL) {
eh = mtod(m, struct ether_header *);
- eh->ether_type = htons(m->m_pkthdr.len - sizeof(*eh));
+ eh->ether_type = htons(m->m_pkthdr.len - ETHER_HDR_LEN);
}
return m;
}
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index 4e3d581..91fa8c6 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -321,7 +321,7 @@ iso88025_output(ifp, m, dst, rt0)
if (snap_type != 0) {
struct llc *l;
- M_PREPEND(m, sizeof (struct llc), M_DONTWAIT);
+ M_PREPEND(m, LLC_SNAPFRAMELEN, M_DONTWAIT);
if (m == 0)
senderr(ENOBUFS);
l = mtod(m, struct llc *);
@@ -372,7 +372,7 @@ iso88025_output(ifp, m, dst, rt0)
}
}
- if (! IF_HANDOFF_ADJ(&ifp->if_snd, m, ifp, ISO88025_HDR_LEN + (sizeof(struct llc))) ) {
+ if (! IF_HANDOFF_ADJ(&ifp->if_snd, m, ifp, ISO88025_HDR_LEN + LLC_SNAPFRAMELEN) ) {
printf("iso88025_output: packet dropped QFULL.\n");
senderr(ENOBUFS);
}
@@ -441,7 +441,7 @@ iso88025_input(ifp, th, m)
goto dropanyway;
type = ntohs(l->llc_un.type_snap.ether_type);
- m_adj(m, sizeof(struct llc));
+ m_adj(m, LLC_SNAPFRAMELEN);
switch (type) {
#ifdef INET
case ETHERTYPE_IP:
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index abef591..4e55f14 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -355,7 +355,7 @@ vlan_start(struct ifnet *ifp)
* with 802.1Q encapsulation.
*/
bcopy(mtod(m, char *) + ifv->ifv_encaplen,
- mtod(m, char *), sizeof(struct ether_header));
+ mtod(m, char *), ETHER_HDR_LEN);
evl = mtod(m, struct ether_vlan_header *);
evl->evl_proto = evl->evl_encap_proto;
evl->evl_encap_proto = htons(ETHERTYPE_VLAN);
@@ -446,7 +446,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
*/
bcopy(mtod(m, caddr_t),
mtod(m, caddr_t) + ETHER_VLAN_ENCAP_LEN,
- sizeof (struct ether_header));
+ ETHER_HDR_LEN);
m_adj(m, ETHER_VLAN_ENCAP_LEN);
}
OpenPOWER on IntegriCloud