kern/73852: Not htonl() but ntohl()
KIYOHARA Takashi
kiyohara at kk.iij4u.or.jp
Thu Nov 11 21:10:28 PST 2004
>Number: 73852
>Category: kern
>Synopsis: Not htonl() but ntohl()
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Nov 12 05:10:27 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: KIYOHARA Takashi
>Release:
>Organization:
>Environment:
>Description:
see sys/net/if_fwsubr.c::firewire_input().
Why does it perform htonl() at the time of input of a packet?
An input packet is a network-byte-order. We should use ntohl().
>How-To-Repeat:
>Fix:
sys/net/if_fwsubr.c::firewire_input()
-------------------------------------
void
firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src)
{
... snip ...
/*
* Byte swap the encapsulation header manually.
*/
- enc->ul[0] = htonl(enc->ul[0]);
+ enc->ul[0] = ntohl(enc->ul[0]);
if (enc->unfrag.lf != 0) {
m = m_pullup(m, 2*sizeof(uint32_t));
if (!m)
return;
enc = mtod(m, union fw_encap *);
- enc->ul[1] = htonl(enc->ul[1]);
+ enc->ul[1] = ntohl(enc->ul[1]);
m = firewire_input_fragment(fc, m, src);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list