summaryrefslogtreecommitdiffhomepage
path: root/test/packetimpact/dut
diff options
context:
space:
mode:
authorEyal Soha <eyalsoha@google.com>2020-03-31 19:51:52 -0700
committergVisor bot <gvisor-bot@google.com>2020-03-31 19:53:11 -0700
commitd25036ad17a3ada7fa6ce9900f20e246e07acd2f (patch)
treef7fa1ea3c6023cdaefd4bd08388a5ea72bce992a /test/packetimpact/dut
parent639d94f9f71b43e86320a6e9157c932f5d7936a7 (diff)
Test receiving multicast packets over UDP
PiperOrigin-RevId: 304098611
Diffstat (limited to 'test/packetimpact/dut')
-rw-r--r--test/packetimpact/dut/posix_server.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/packetimpact/dut/posix_server.cc b/test/packetimpact/dut/posix_server.cc
index 2f10dda40..4a71c54c6 100644
--- a/test/packetimpact/dut/posix_server.cc
+++ b/test/packetimpact/dut/posix_server.cc
@@ -181,6 +181,17 @@ class PosixImpl final : public posix_server::Posix::Service {
response->set_errno_(errno);
return ::grpc::Status::OK;
}
+
+ ::grpc::Status Recv(::grpc::ServerContext *context,
+ const ::posix_server::RecvRequest *request,
+ ::posix_server::RecvResponse *response) override {
+ std::vector<char> buf(request->len());
+ response->set_ret(
+ recv(request->sockfd(), buf.data(), buf.size(), request->flags()));
+ response->set_errno_(errno);
+ response->set_buf(buf.data(), response->ret());
+ return ::grpc::Status::OK;
+ }
};
// Parse command line options. Returns a pointer to the first argument beyond