summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIan Lewis <ianlewis@google.com>2020-11-01 18:01:57 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-01 18:03:43 -0800
commit5e606844df577936ebcd13225da85eda80317021 (patch)
tree5f1048aaea3e0c594f66745fcb6e7e58288c1486
parentdf88f223bb5474a462da65ede6f266eb52f1b2ef (diff)
Fix returned error when deleting non-existant address
PiperOrigin-RevId: 340149214
-rw-r--r--pkg/sentry/socket/netlink/route/protocol.go2
-rw-r--r--test/syscalls/linux/socket_netlink_route.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/pkg/sentry/socket/netlink/route/protocol.go b/pkg/sentry/socket/netlink/route/protocol.go
index 22216158e..f4d034c13 100644
--- a/pkg/sentry/socket/netlink/route/protocol.go
+++ b/pkg/sentry/socket/netlink/route/protocol.go
@@ -487,7 +487,7 @@ func (p *Protocol) delAddr(ctx context.Context, msg *netlink.Message, ms *netlin
Addr: value,
})
if err != nil {
- return syserr.ErrInvalidArgument
+ return syserr.ErrBadLocalAddress
}
case linux.IFA_ADDRESS:
default:
diff --git a/test/syscalls/linux/socket_netlink_route.cc b/test/syscalls/linux/socket_netlink_route.cc
index e83f0d81f..ee3c08770 100644
--- a/test/syscalls/linux/socket_netlink_route.cc
+++ b/test/syscalls/linux/socket_netlink_route.cc
@@ -536,7 +536,7 @@ TEST(NetlinkRouteTest, AddAndRemoveAddr) {
// Second delete should fail, as address no longer exists.
EXPECT_THAT(LinkDelLocalAddr(loopback_link.index, AF_INET,
/*prefixlen=*/24, &addr, sizeof(addr)),
- PosixErrorIs(EINVAL, ::testing::_));
+ PosixErrorIs(EADDRNOTAVAIL, ::testing::_));
});
// Replace an existing address should succeed.