OSDN Git Service

Introduce a SELECT_FOR_USER fwmarkd command.
authorSreeram Ramachandran <sreeram@google.com>
Fri, 11 Jul 2014 23:27:02 +0000 (16:27 -0700)
committerSreeram Ramachandran <sreeram@google.com>
Fri, 11 Jul 2014 23:27:02 +0000 (16:27 -0700)
commita69d9472ac48d4e09f049fb740e60b7217e03861
tree40f5ac5b38453441311390ade90498a919fed46e
parent335f2936156ca7b3b4d0a64446dc7545492f0476
Introduce a SELECT_FOR_USER fwmarkd command.

This lets SYSTEM apps mark a socket with the network that would apply to an
arbitrary UID. I.e., either the VPN that applies to that user, or the default
network, if there's no such VPN.

This command will be used by system apps that proxy stuff for a user, so that
they can route the same way that user would have. Examples of such system apps
are the DnsProxyListener, MediaServer and DownloadManager.

The "explicit" bit is NOT set, so that if the user's VPN is a split tunnel, the
route lookup will fall-through to the default network as desired.

The "protect" bit is set, so that the socket bypasses any VPN applicable to the
system app itself. Note that even if the uid being proxied for is also subject
to the same VPN, this still works because the relevant rule doesn't care about
the protected bit (see modifyVpnSystemPermissionRule() in RouteController.cpp).

Change-Id: I4d501e5214b127f4ae9eaeb7befb1751cd102308
client/NetdClient.cpp
include/FwmarkCommand.h
include/NetdClient.h
server/FwmarkServer.cpp