OffloadUtils - introduce tcFilterDelDevIngressTether()
We don't put IPv4/IPv6 in the name because once we have support
for both we'll actually switch these to be protocol agnostic.
Test: build, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I86958a08ee9102a3244b9552430b009d5c16e9f6
diff --git a/server/OffloadUtils.h b/server/OffloadUtils.h
index 2caace0..2248b0c 100644
--- a/server/OffloadUtils.h
+++ b/server/OffloadUtils.h
@@ -40,6 +40,10 @@
constexpr bool EGRESS = false;
constexpr bool INGRESS = true;
+// The priority of clat/tether hooks - smaller is higher priority.
+constexpr uint16_t PRIO_CLAT = 1;
+constexpr uint16_t PRIO_TETHER = 2;
+
inline int getClatEgressMapFd(void) {
const int fd = bpf::bpfFdGet(CLAT_EGRESS_MAP_PATH, 0);
return (fd == -1) ? -errno : fd;
@@ -112,12 +116,17 @@
// tc filter del dev .. ingress prio 1 protocol ipv6
inline int tcFilterDelDevIngressClatIpv6(int ifIndex) {
- return tcFilterDelDev(ifIndex, INGRESS, /*prio*/ 1, ETH_P_IPV6);
+ return tcFilterDelDev(ifIndex, INGRESS, PRIO_CLAT, ETH_P_IPV6);
}
// tc filter del dev .. egress prio 1 protocol ip
inline int tcFilterDelDevEgressClatIpv4(int ifIndex) {
- return tcFilterDelDev(ifIndex, EGRESS, /*prio*/ 1, ETH_P_IP);
+ return tcFilterDelDev(ifIndex, EGRESS, PRIO_CLAT, ETH_P_IP);
+}
+
+// tc filter del dev .. ingress prio 2 protocol ipv6
+inline int tcFilterDelDevIngressTether(int ifIndex) {
+ return tcFilterDelDev(ifIndex, INGRESS, PRIO_TETHER, ETH_P_IPV6);
}
} // namespace net