summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2015-03-18 12:35:02 +0900
committerLorenzo Colitti <lorenzo@google.com>2015-03-18 17:13:27 +0900
commite0273519773d7b14680fe0aa8bc180836042f245 (patch)
tree1ddf416d4e48aef62009c0de3e1ad6e2aa0ac5d1
parentbf9a16e6edb7fe8e36fe2ea83efaceaa8eb538cd (diff)
downloadlibcore-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.cpp2
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);