Remove NET_ADMIN capability from mtpd.

I decided to take a look at the SELinux configs for the VPN daemons.

CAP_NET_ADMIN is not allowed by the SELinux policy at:
https://android.googlesource.com/platform/system/sepolicy/+/master/public/mtp.te#9

"allow mtp self:capability net_raw;"

A quick grep in the mtpd source code shows no use of ioctl, which is
the syscall used to configure interfaces (and what usually requires
NET_ADMIN). Remove it, since it could never have worked. The line in
question was added in 2013:
https://android.googlesource.com/platform/system/sepolicy/+blame/master/public/mtp.te#9

Bug: 33938230
Test: 'start mtpd', 'cat /proc/`pgrep mtpd`/status | grep Cap'.
Test: "Cap" lines show correct mask: 0000000000002000
Test: Add a VPN, enable it, mtpd starts correctly.

Change-Id: Iee689736e3f4fe53ad61da706e98e8416d775485
1 file changed
tree: ef4c2e16e5a165c410dfabfeffd203eb04be1265
  1. Android.bp
  2. l2tp.c
  3. MODULE_LICENSE_APACHE2
  4. mtpd.c
  5. mtpd.h
  6. mtpd.rc
  7. NOTICE
  8. pptp.c