Internal change.

PiperOrigin-RevId: 554591336
This commit is contained in:
Jeff Martin
2023-08-07 14:22:55 -07:00
committed by gVisor bot
parent f2b4f07d78
commit 4c5d0ffc37
+10 -2
View File
@@ -675,6 +675,7 @@ TEST(NetlinkRouteTest, GetRouteDump) {
bool routeFound = false;
bool dstFound = true;
bool defaultRouteDstFound = false;
ASSERT_NO_ERRNO(NetlinkRequestResponse(
fd, &req, sizeof(req),
[&](const struct nlmsghdr* hdr) {
@@ -700,7 +701,8 @@ TEST(NetlinkRouteTest, GetRouteDump) {
std::cout << "Found route table=" << static_cast<int>(msg->rtm_table)
<< ", protocol=" << static_cast<int>(msg->rtm_protocol)
<< ", scope=" << static_cast<int>(msg->rtm_scope)
<< ", type=" << static_cast<int>(msg->rtm_type);
<< ", type=" << static_cast<int>(msg->rtm_type)
<< ", prefixlen=" << static_cast<int>(msg->rtm_dst_len);
int len = RTM_PAYLOAD(hdr);
bool rtDstFound = false;
@@ -721,7 +723,11 @@ TEST(NetlinkRouteTest, GetRouteDump) {
if (msg->rtm_table == RT_TABLE_MAIN ||
(!IsRunningOnGvisor() && msg->rtm_table == RT_TABLE_LOCAL)) {
routeFound = true;
dstFound = rtDstFound && dstFound;
if (msg->rtm_dst_len) {
dstFound = rtDstFound && dstFound;
} else {
defaultRouteDstFound = rtDstFound || defaultRouteDstFound;
}
}
},
false));
@@ -729,6 +735,8 @@ TEST(NetlinkRouteTest, GetRouteDump) {
EXPECT_TRUE(routeFound);
// Found RTA_DST for each route in main table.
EXPECT_TRUE(dstFound);
// RTA_DST should not be present for default routes.
EXPECT_FALSE(defaultRouteDstFound);
}
// GetRouteRequest tests a RTM_GETROUTE request with RTM_F_LOOKUP_TABLE flag.