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

Commit 5b11831a authored by Chenbo Feng's avatar Chenbo Feng
Browse files

Move qtaguid API out of libcutils

The qtaguid kernel module will be deprecated on devices running 4.9
kernel or above and we need to support both old and new module in
userspace. Netd is responsible for choosing which kernel module to use
and all the current qtaguid native implementation need to be hided
behind it. So the current qtaguid native API implementation will be
moved to a isolate library under system/core and only netd can access to
it. The libcutils qtaguid API will become a wrapper to send request to
netd module. This modification will make sure the apps that currently
using this native API will not be broken.

Bug: 30950746
Test: All cts and vts test related should not fail.
Change-Id: I9de98a25ed5dc71bbf520ee0aadd16d59025699a
parent dbef1eeb
Loading
Loading
Loading
Loading

libqtaguid/Android.bp

0 → 100644
+56 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

cc_library_headers {
    name: "libqtaguid_headers",
    vendor_available: false,
    host_supported: false,
    export_include_dirs: ["include"],
    target: {
        linux_bionic: {
            enabled: true,
        },
    },
}

cc_library {
    name: "libqtaguid",
    vendor_available: false,
    host_supported: false,
    target: {
        android: {
            srcs: [
                "qtaguid.c",
            ],
            sanitize: {
                misc_undefined: ["integer"],
            },
        },
    },

    shared_libs: ["liblog"],
    header_libs: [
        "libqtaguid_headers",
    ],
    export_header_lib_headers: ["libqtaguid_headers"],
    local_include_dirs: ["include"],

    cflags: [
        "-Werror",
        "-Wall",
        "-Wextra",
    ],
}
+9 −9
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@
#include <string.h>
#include <unistd.h>

#include <log/log.h>
#include <cutils/qtaguid.h>
#include <log/log.h>

static const char* CTRL_PROCPATH = "/proc/net/xt_qtaguid/ctrl";
static const int CTRL_MAX_INPUT_LEN = 128;
@@ -108,8 +108,8 @@ int qtaguid_tagSocket(int sockfd, int tag, uid_t uid) {

    res = write_ctrl(lineBuf);
    if (res < 0) {
        ALOGI("Tagging socket %d with tag %" PRIx64 "(%d) for uid %d failed errno=%d",
             sockfd, kTag, tag, uid, res);
        ALOGI("Tagging socket %d with tag %" PRIx64 "(%d) for uid %d failed errno=%d", sockfd, kTag,
              tag, uid, res);
    }

    return res;