bpf: attach a *bunch* more cgroup hooks
We attach trivial programs to:
{connect,recvmsg,sendmsg}{4,6}
inet_release
{g,s}etsockopt
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ifd3a6dff20a5881f4fdb5d1b4b7b03a55988fd74
This commit is contained in:
parent
cfdf420ae2
commit
22db590580
1 changed files with 214 additions and 30 deletions
|
|
@ -113,11 +113,20 @@ import static android.system.OsConstants.F_OK;
|
|||
import static android.system.OsConstants.IPPROTO_TCP;
|
||||
import static android.system.OsConstants.IPPROTO_UDP;
|
||||
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_GETSOCKOPT;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_INET4_BIND;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_INET4_CONNECT;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_INET6_BIND;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_INET6_CONNECT;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_INET_EGRESS;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_INET_INGRESS;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_INET_SOCK_CREATE;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_INET_SOCK_RELEASE;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_SETSOCKOPT;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_UDP4_RECVMSG;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_UDP4_SENDMSG;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_UDP6_RECVMSG;
|
||||
import static com.android.net.module.util.BpfUtils.BPF_CGROUP_UDP6_SENDMSG;
|
||||
import static com.android.net.module.util.NetworkMonitorUtils.isPrivateDnsValidationRequired;
|
||||
import static com.android.net.module.util.PermissionUtils.enforceAnyPermissionOf;
|
||||
import static com.android.net.module.util.PermissionUtils.enforceNetworkStackPermission;
|
||||
|
|
@ -3604,12 +3613,37 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_INET_INGRESS));
|
||||
pw.print("CGROUP_INET_EGRESS: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_INET_EGRESS));
|
||||
|
||||
pw.print("CGROUP_INET_SOCK_CREATE: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_INET_SOCK_CREATE));
|
||||
|
||||
pw.print("CGROUP_INET4_BIND: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_INET4_BIND));
|
||||
pw.print("CGROUP_INET6_BIND: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_INET6_BIND));
|
||||
|
||||
pw.print("CGROUP_INET4_CONNECT: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_INET4_CONNECT));
|
||||
pw.print("CGROUP_INET6_CONNECT: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_INET6_CONNECT));
|
||||
|
||||
pw.print("CGROUP_UDP4_SENDMSG: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_UDP4_SENDMSG));
|
||||
pw.print("CGROUP_UDP6_SENDMSG: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_UDP6_SENDMSG));
|
||||
|
||||
pw.print("CGROUP_UDP4_RECVMSG: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_UDP4_RECVMSG));
|
||||
pw.print("CGROUP_UDP6_RECVMSG: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_UDP6_RECVMSG));
|
||||
|
||||
pw.print("CGROUP_GETSOCKOPT: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_GETSOCKOPT));
|
||||
pw.print("CGROUP_SETSOCKOPT: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_SETSOCKOPT));
|
||||
|
||||
pw.print("CGROUP_INET_SOCK_RELEASE: ");
|
||||
pw.println(mDeps.getBpfProgramId(BPF_CGROUP_INET_SOCK_RELEASE));
|
||||
} catch (IOException e) {
|
||||
pw.println(" IOException");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue