diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2021-08-11 18:18:36 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-08-11 18:21:40 -0700 |
commit | d51bc877f40d2acbf5b83895f636186c87463ab1 (patch) | |
tree | a3dcf26bcd3f05994df22cd359b2b4ac6503da55 /test/util/linux_capability_util.cc | |
parent | a50596874a4971167f97a05181363e91292a2885 (diff) |
Run packet socket tests on Fuchsia
+ Do not check for CAP_NET_RAW on Fuchsia
Fuchsia does not support capabilities the same way Linux does. Instead
emulate the check for CAP_NET_RAW by checking if a packet socket may
be created.
Bug: https://fxbug.dev/79016, https://fxbug.dev/81592
PiperOrigin-RevId: 390263666
Diffstat (limited to 'test/util/linux_capability_util.cc')
-rw-r--r-- | test/util/linux_capability_util.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/util/linux_capability_util.cc b/test/util/linux_capability_util.cc index 958eb96f9..7218aa4ac 100644 --- a/test/util/linux_capability_util.cc +++ b/test/util/linux_capability_util.cc @@ -32,6 +32,14 @@ namespace gvisor { namespace testing { +PosixErrorOr<bool> HaveRawIPSocketCapability() { + return HaveCapability(CAP_NET_RAW); +} + +PosixErrorOr<bool> HavePacketSocketCapability() { + return HaveCapability(CAP_NET_RAW); +} + PosixErrorOr<bool> CanCreateUserNamespace() { // The most reliable way to determine if userns creation is possible is by // trying to create one; see below. |