Date: Fri, 12 Nov 2004 05:09:19 GMT From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/73852: Not htonl() but ntohl() Message-ID: <200411120509.iAC59J9k051292@www.freebsd.org> Resent-Message-ID: <200411120510.iAC5AS2n088000@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411120509.iAC59J9k051292>