From ccc18d7f110aa0085a19a9fc408e999f5c8b7432 Mon Sep 17 00:00:00 2001 From: Patrick Rohr Date: Wed, 2 Feb 2022 12:19:33 +0100 Subject: [PATCH] Remove setCounterSet and deleteTagData support from libcutils This functionality is now handled in mainline and has been removed from netd in Android T. Test: builds & boots Change-Id: Ic435eee0d89bda30d733efbc655692c697bbe9e8 --- libcutils/include/cutils/qtaguid.h | 18 ----------------- libcutils/qtaguid.cpp | 31 +----------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/libcutils/include/cutils/qtaguid.h b/libcutils/include/cutils/qtaguid.h index 3f5e41fd3..a5ffb0327 100644 --- a/libcutils/include/cutils/qtaguid.h +++ b/libcutils/include/cutils/qtaguid.h @@ -33,24 +33,6 @@ extern int qtaguid_tagSocket(int sockfd, int tag, uid_t uid); */ extern int qtaguid_untagSocket(int sockfd); -/* - * For the given uid, switch counter sets. - * The kernel only keeps a limited number of sets. - * 2 for now. - */ -extern int qtaguid_setCounterSet(int counterSetNum, uid_t uid); - -/* - * Delete all tag info that relates to the given tag an uid. - * If the tag is 0, then ALL info about the uid is freed. - * The delete data also affects active tagged sockets, which are - * then untagged. - * The calling process can only operate on its own tags. - * Unless it is part of the happy AID_NET_BW_ACCT group. - * In which case it can clobber everything. - */ -extern int qtaguid_deleteTagData(int tag, uid_t uid); - /* * Enable/disable qtaguid functionnality at a lower level. * When pacified, the kernel will accept commands but do nothing. diff --git a/libcutils/qtaguid.cpp b/libcutils/qtaguid.cpp index 2fe877c4e..a987b855d 100644 --- a/libcutils/qtaguid.cpp +++ b/libcutils/qtaguid.cpp @@ -34,8 +34,6 @@ class netdHandler { public: int (*netdTagSocket)(int, uint32_t, uid_t); int (*netdUntagSocket)(int); - int (*netdSetCounterSet)(uint32_t, uid_t); - int (*netdDeleteTagData)(uint32_t, uid_t); }; int stubTagSocket(int, uint32_t, uid_t) { @@ -46,16 +44,8 @@ int stubUntagSocket(int) { return -EREMOTEIO; } -int stubSetCounterSet(uint32_t, uid_t) { - return -EREMOTEIO; -} - -int stubDeleteTagData(uint32_t, uid_t) { - return -EREMOTEIO; -} - netdHandler initHandler(void) { - netdHandler handler = {stubTagSocket, stubUntagSocket, stubSetCounterSet, stubDeleteTagData}; + netdHandler handler = {stubTagSocket, stubUntagSocket}; void* netdClientHandle = dlopen("libnetd_client.so", RTLD_NOW); if (!netdClientHandle) { @@ -73,15 +63,6 @@ netdHandler initHandler(void) { ALOGE("load netdUntagSocket handler failed: %s", dlerror()); } - handler.netdSetCounterSet = (int (*)(uint32_t, uid_t))dlsym(netdClientHandle, "setCounterSet"); - if (!handler.netdSetCounterSet) { - ALOGE("load netdSetCounterSet handler failed: %s", dlerror()); - } - - handler.netdDeleteTagData = (int (*)(uint32_t, uid_t))dlsym(netdClientHandle, "deleteTagData"); - if (!handler.netdDeleteTagData) { - ALOGE("load netdDeleteTagData handler failed: %s", dlerror()); - } return handler; } @@ -114,13 +95,3 @@ int qtaguid_untagSocket(int sockfd) { ALOGV("Untagging socket %d", sockfd); return getHandler().netdUntagSocket(sockfd); } - -int qtaguid_setCounterSet(int counterSetNum, uid_t uid) { - ALOGV("Setting counters to set %d for uid %d", counterSetNum, uid); - return getHandler().netdSetCounterSet(counterSetNum, uid); -} - -int qtaguid_deleteTagData(int tag, uid_t uid) { - ALOGV("Deleting tag data with tag %u for uid %d", tag, uid); - return getHandler().netdDeleteTagData(tag, uid); -}