OffloadUtils - Introduce 'RAWIP' and 'ETHER' helper constants.
Makes things a tad easier to read.
Test: build, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib556d10d15bd5a3c901f20cb9f28644574a58ce4
diff --git a/server/OffloadUtilsTest.cpp b/server/OffloadUtilsTest.cpp
index 6566f3b..6bfe52c 100644
--- a/server/OffloadUtilsTest.cpp
+++ b/server/OffloadUtilsTest.cpp
@@ -76,7 +76,7 @@
TEST_F(OffloadUtilsTest, GetClatEgressRawIpProgFd) {
SKIP_IF_BPF_NOT_SUPPORTED;
- int fd = getClatEgressProgFd(false);
+ int fd = getClatEgressProgFd(RAWIP);
ASSERT_LE(3, fd);
close(fd);
}
@@ -84,7 +84,7 @@
TEST_F(OffloadUtilsTest, GetClatEgressEtherProgFd) {
SKIP_IF_BPF_NOT_SUPPORTED;
- int fd = getClatEgressProgFd(true);
+ int fd = getClatEgressProgFd(ETHER);
ASSERT_LE(3, fd);
close(fd);
}
@@ -100,7 +100,7 @@
TEST_F(OffloadUtilsTest, GetClatIngressRawIpProgFd) {
SKIP_IF_BPF_NOT_SUPPORTED;
- int fd = getClatIngressProgFd(false);
+ int fd = getClatIngressProgFd(RAWIP);
ASSERT_LE(3, fd);
close(fd);
}
@@ -108,7 +108,7 @@
TEST_F(OffloadUtilsTest, GetClatIngressEtherProgFd) {
SKIP_IF_BPF_NOT_SUPPORTED;
- int fd = getClatIngressProgFd(true);
+ int fd = getClatIngressProgFd(ETHER);
ASSERT_LE(3, fd);
close(fd);
}
@@ -126,7 +126,7 @@
// RX Rawip -> TX Ether requires header adjustments and thus 4.14.
SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED;
- int fd = getTetherIngressProgFd(false);
+ int fd = getTetherIngressProgFd(RAWIP);
ASSERT_LE(3, fd);
close(fd);
}
@@ -136,7 +136,7 @@
// RX Ether -> TX Ether does not require header adjustments
SKIP_IF_BPF_NOT_SUPPORTED;
- int fd = getTetherIngressProgFd(true);
+ int fd = getTetherIngressProgFd(ETHER);
ASSERT_LE(3, fd);
close(fd);
}
@@ -247,19 +247,19 @@
}
TEST_F(OffloadUtilsTest, CheckAttachBpfFilterRawIpClsactEgressLo) {
- checkAttachDetachBpfFilterClsactLo(/*ingress*/ false, /*ethernet*/ false);
+ checkAttachDetachBpfFilterClsactLo(/*ingress*/ false, RAWIP);
}
TEST_F(OffloadUtilsTest, CheckAttachBpfFilterEthernetClsactEgressLo) {
- checkAttachDetachBpfFilterClsactLo(/*ingress*/ false, /*ethernet*/ true);
+ checkAttachDetachBpfFilterClsactLo(/*ingress*/ false, ETHER);
}
TEST_F(OffloadUtilsTest, CheckAttachBpfFilterRawIpClsactIngressLo) {
- checkAttachDetachBpfFilterClsactLo(/*ingress*/ true, /*ethernet*/ false);
+ checkAttachDetachBpfFilterClsactLo(/*ingress*/ true, RAWIP);
}
TEST_F(OffloadUtilsTest, CheckAttachBpfFilterEthernetClsactIngressLo) {
- checkAttachDetachBpfFilterClsactLo(/*ingress*/ true, /*ethernet*/ true);
+ checkAttachDetachBpfFilterClsactLo(/*ingress*/ true, ETHER);
}
} // namespace net