Bug 73852 - [patch] [firewire] Not htonl() but ntohl() in if_fwsubr.c
Summary: [patch] [firewire] Not htonl() but ntohl() in if_fwsubr.c
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 1.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-firewire (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-12 05:10 UTC by KIYOHARA Takashi
Modified: 2005-10-12 20:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description KIYOHARA Takashi 2004-11-12 05:10:27 UTC
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().

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);
Comment 1 Tilman Keskinoz freebsd_committer freebsd_triage 2005-06-06 18:27:02 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-firewire

over to the firewire Mailinglist
Comment 2 Warner Losh freebsd_committer freebsd_triage 2005-10-12 20:13:06 UTC
State Changed
From-To: open->closed

Looks good, applied!  No need to merge this specifically, so closed.