Remove qtaguid support on devices with bpf
For new devices that is using bpf for socket tagging/untagging, it is
no longer necessary to keep a reference of tagged socket stats in
xt_qtaguid module as well since the API for these detail per socket
stats is ready and apps should not read the proc file for it.
Test: run vts -m vtsKernelQtaguidTest
Bug: 30950746
Change-Id: Ibbd060dca023c7a5d5a1eb955242aabda1014fd0
diff --git a/server/TrafficController.cpp b/server/TrafficController.cpp
index b101174..0039d25 100644
--- a/server/TrafficController.cpp
+++ b/server/TrafficController.cpp
@@ -279,8 +279,10 @@
}
int TrafficController::tagSocket(int sockFd, uint32_t tag, uid_t uid) {
- if (legacy_tagSocket(sockFd, tag, uid)) return -errno;
- if (!ebpfSupported) return 0;
+ if (!ebpfSupported) {
+ if (legacy_tagSocket(sockFd, tag, uid)) return -errno;
+ return 0;
+ }
uint64_t sock_cookie = getSocketCookie(sockFd);
if (sock_cookie == INET_DIAG_NOCOOKIE) return -errno;
@@ -301,8 +303,10 @@
}
int TrafficController::untagSocket(int sockFd) {
- if (legacy_untagSocket(sockFd)) return -errno;
- if (!ebpfSupported) return 0;
+ if (!ebpfSupported) {
+ if (legacy_untagSocket(sockFd)) return -errno;
+ return 0;
+ }
uint64_t sock_cookie = getSocketCookie(sockFd);
if (sock_cookie == INET_DIAG_NOCOOKIE) return -errno;
@@ -317,8 +321,10 @@
int TrafficController::setCounterSet(int counterSetNum, uid_t uid) {
if (counterSetNum < 0 || counterSetNum >= COUNTERSETS_LIMIT) return -EINVAL;
int res;
- if (legacy_setCounterSet(counterSetNum, uid)) return -errno;
- if (!ebpfSupported) return 0;
+ if (!ebpfSupported) {
+ if (legacy_setCounterSet(counterSetNum, uid)) return -errno;
+ return 0;
+ }
// The default counter set for all uid is 0, so deleting the current counterset for that uid
// will automatically set it to 0.
@@ -345,8 +351,10 @@
int TrafficController::deleteTagData(uint32_t tag, uid_t uid) {
int res = 0;
- if (legacy_deleteTagData(tag, uid)) return -errno;
- if (!ebpfSupported) return 0;
+ if (!ebpfSupported) {
+ if (legacy_deleteTagData(tag, uid)) return -errno;
+ return 0;
+ }
uint64_t curCookie = NONEXIST_COOKIE;
uint64_t nextCookie = 0;