summaryrefslogtreecommitdiffstats
path: root/sys/net/if_atmsubr.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2003-03-13 12:44:06 +0000
committerharti <harti@FreeBSD.org>2003-03-13 12:44:06 +0000
commit928f52e38a8aec1a91cd52ec7a2cc4836cc13ea4 (patch)
tree5f5f42dd1599d5fb9757e97ae85f60c6a65be5ee /sys/net/if_atmsubr.c
parentb90d854c5fb6c36b8eda669f20407dcf5436de9d (diff)
downloadFreeBSD-src-928f52e38a8aec1a91cd52ec7a2cc4836cc13ea4.zip
FreeBSD-src-928f52e38a8aec1a91cd52ec7a2cc4836cc13ea4.tar.gz
This corrects a longstanding endian bug in processing LLC/SNAP encoded
frames. A comment in if_atm.h suggests that both macros, that for extracting the ethertype and that for inserting it, handle their argument in host byte order. In fact, the inserting macro treated its argument as an opposite host order short and the calling code feeds it the result of htons(). This happens to work on i386, but fails on sparc. Make the macro use real host endianess. Reviewed by: kjc, atm@
Diffstat (limited to 'sys/net/if_atmsubr.c')
-rw-r--r--sys/net/if_atmsubr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c
index 782ed88..7fbf1e8 100644
--- a/sys/net/if_atmsubr.c
+++ b/sys/net/if_atmsubr.c
@@ -130,9 +130,9 @@ atm_output(ifp, m0, dst, rt0)
case AF_INET:
case AF_INET6:
if (dst->sa_family == AF_INET6)
- etype = htons(ETHERTYPE_IPV6);
+ etype = ETHERTYPE_IPV6;
else
- etype = htons(ETHERTYPE_IP);
+ etype = ETHERTYPE_IP;
if (!atmresolve(rt, m, dst, &atmdst)) {
m = NULL;
/* XXX: atmresolve already free'd it */
@@ -180,7 +180,7 @@ atm_output(ifp, m0, dst, rt0)
bcopy(ATMLLC_HDR, atmllc->llchdr,
sizeof(atmllc->llchdr));
ATM_LLC_SETTYPE(atmllc, etype);
- /* note: already in network order */
+ /* note: in host order */
}
else
bcopy(llc_hdr, atmllc, sizeof(struct atmllc));
OpenPOWER on IntegriCloud