diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2015-03-18 12:35:02 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2015-03-18 17:13:27 +0900 |
commit | e0273519773d7b14680fe0aa8bc180836042f245 (patch) | |
tree | 1ddf416d4e48aef62009c0de3e1ad6e2aa0ac5d1 | |
parent | bf9a16e6edb7fe8e36fe2ea83efaceaa8eb538cd (diff) | |
download | libcore-e0273519773d7b14680fe0aa8bc180836042f245.zip libcore-e0273519773d7b14680fe0aa8bc180836042f245.tar.gz libcore-e0273519773d7b14680fe0aa8bc180836042f245.tar.bz2 |
Fix an ntohs/htons issue.
When converting between sockaddr_ll and PacketSocketAddress, we
use ntohs in both directions. Converting from sockaddr_ll to
PacketSocketAddress should use ntohs instead.
This doesn't actually affect anything, because ntohs and htons
identical, but it is conceptually wrong.
Change-Id: Idd3cfcc11c4d6b7fed0c4b75a7935547f67eda12
-rw-r--r-- | luni/src/main/native/libcore_io_Posix.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/luni/src/main/native/libcore_io_Posix.cpp b/luni/src/main/native/libcore_io_Posix.cpp index 88990a5..f6af483 100644 --- a/luni/src/main/native/libcore_io_Posix.cpp +++ b/luni/src/main/native/libcore_io_Posix.cpp @@ -511,7 +511,7 @@ static bool javaPacketSocketAddressToSockaddr( sockaddr_ll *sll = reinterpret_cast<sockaddr_ll *>(&ss); sll->sll_family = AF_PACKET; - sll->sll_protocol = ntohs(env->GetShortField(javaSocketAddress, protocolFid)); + sll->sll_protocol = htons(env->GetShortField(javaSocketAddress, protocolFid)); sll->sll_ifindex = env->GetIntField(javaSocketAddress, ifindexFid); sll->sll_hatype = env->GetShortField(javaSocketAddress, hatypeFid); sll->sll_pkttype = env->GetByteField(javaSocketAddress, pkttypeFid); |