Merge "Remove setCounterSet and deleteTagData support from libcutils"
This commit is contained in:
commit
78b86ae297
|
@ -33,24 +33,6 @@ extern int qtaguid_tagSocket(int sockfd, int tag, uid_t uid);
|
||||||
*/
|
*/
|
||||||
extern int qtaguid_untagSocket(int sockfd);
|
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.
|
* Enable/disable qtaguid functionnality at a lower level.
|
||||||
* When pacified, the kernel will accept commands but do nothing.
|
* When pacified, the kernel will accept commands but do nothing.
|
||||||
|
|
|
@ -34,8 +34,6 @@ class netdHandler {
|
||||||
public:
|
public:
|
||||||
int (*netdTagSocket)(int, uint32_t, uid_t);
|
int (*netdTagSocket)(int, uint32_t, uid_t);
|
||||||
int (*netdUntagSocket)(int);
|
int (*netdUntagSocket)(int);
|
||||||
int (*netdSetCounterSet)(uint32_t, uid_t);
|
|
||||||
int (*netdDeleteTagData)(uint32_t, uid_t);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int stubTagSocket(int, uint32_t, uid_t) {
|
int stubTagSocket(int, uint32_t, uid_t) {
|
||||||
|
@ -46,16 +44,8 @@ int stubUntagSocket(int) {
|
||||||
return -EREMOTEIO;
|
return -EREMOTEIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stubSetCounterSet(uint32_t, uid_t) {
|
|
||||||
return -EREMOTEIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
int stubDeleteTagData(uint32_t, uid_t) {
|
|
||||||
return -EREMOTEIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
netdHandler initHandler(void) {
|
netdHandler initHandler(void) {
|
||||||
netdHandler handler = {stubTagSocket, stubUntagSocket, stubSetCounterSet, stubDeleteTagData};
|
netdHandler handler = {stubTagSocket, stubUntagSocket};
|
||||||
|
|
||||||
void* netdClientHandle = dlopen("libnetd_client.so", RTLD_NOW);
|
void* netdClientHandle = dlopen("libnetd_client.so", RTLD_NOW);
|
||||||
if (!netdClientHandle) {
|
if (!netdClientHandle) {
|
||||||
|
@ -73,15 +63,6 @@ netdHandler initHandler(void) {
|
||||||
ALOGE("load netdUntagSocket handler failed: %s", dlerror());
|
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;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,13 +95,3 @@ int qtaguid_untagSocket(int sockfd) {
|
||||||
ALOGV("Untagging socket %d", sockfd);
|
ALOGV("Untagging socket %d", sockfd);
|
||||||
return getHandler().netdUntagSocket(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);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue