Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78b86ae2 authored by Patrick Rohr's avatar Patrick Rohr Committed by Gerrit Code Review
Browse files

Merge "Remove setCounterSet and deleteTagData support from libcutils"

parents 79aedde9 ccc18d7f
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -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.
+1 −30
Original line number Diff line number Diff line
@@ -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);
}