summaryrefslogtreecommitdiffhomepage
path: root/test/packetimpact/dut/posix_server.cc
diff options
context:
space:
mode:
authorJay Zhuang <jayzhuang@google.com>2020-07-14 11:48:26 -0700
committergVisor bot <gvisor-bot@google.com>2020-07-14 11:49:51 -0700
commit822fc99ecd65c6c93094d93e005a03ae25989fc9 (patch)
treeacccfcc8abb60f603ce31ecebc4b7d54f45655fb /test/packetimpact/dut/posix_server.cc
parent87c33be9af4ab8d80cd20dc58fe843e2eb5e4136 (diff)
Add support for UDP IPv6
Also ironed out all the bugs found on the IPv6 code path that affects socket bind, send and receive. PiperOrigin-RevId: 321202653
Diffstat (limited to 'test/packetimpact/dut/posix_server.cc')
-rw-r--r--test/packetimpact/dut/posix_server.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/packetimpact/dut/posix_server.cc b/test/packetimpact/dut/posix_server.cc
index a1a5c3612..29d4cc6fe 100644
--- a/test/packetimpact/dut/posix_server.cc
+++ b/test/packetimpact/dut/posix_server.cc
@@ -53,7 +53,10 @@
response_in6->set_flowinfo(ntohl(addr_in6->sin6_flowinfo));
response_in6->mutable_addr()->assign(
reinterpret_cast<const char *>(&addr_in6->sin6_addr.s6_addr), 16);
- response_in6->set_scope_id(ntohl(addr_in6->sin6_scope_id));
+ // sin6_scope_id is stored in host byte order.
+ //
+ // https://www.gnu.org/software/libc/manual/html_node/Internet-Address-Formats.html
+ response_in6->set_scope_id(addr_in6->sin6_scope_id);
return ::grpc::Status::OK;
}
}
@@ -89,7 +92,10 @@
addr_in6->sin6_flowinfo = htonl(proto_in6.flowinfo());
proto_in6.addr().copy(
reinterpret_cast<char *>(&addr_in6->sin6_addr.s6_addr), 16);
- addr_in6->sin6_scope_id = htonl(proto_in6.scope_id());
+ // sin6_scope_id is stored in host byte order.
+ //
+ // https://www.gnu.org/software/libc/manual/html_node/Internet-Address-Formats.html
+ addr_in6->sin6_scope_id = proto_in6.scope_id();
*addr_len = sizeof(*addr_in6);
break;
}