am e019b659: Add v4/v6 route add/remove to netd.

* commit 'e019b65925217bcc3ad9b662aa3125f0593057af':
  Add v4/v6 route add/remove to netd.
am 442017ef: am e019b659: Add v4/v6 route add/remove to netd.

* commit '442017eff8f783a2ea86d73c2ee9d88aef175327':
  Add v4/v6 route add/remove to netd.
Reconcile with gingerbread-release

Change-Id: Ibac35b4865cd0c39eff053ad84bddab50a2d6d6e
Do not wipe all netd iptables rules in test mode

The NatController fail-safe which flushes the iptables when the ref
count reaches zero unintentionally wipes out all static rules setup
by init in bp-tools test mode.  Doing this flush is not necessary.

Change-Id: I37890e79cd701aa2e970958a246dfe7514a65c47
am ac208608: Do not wipe all netd iptables rules in test mode

* commit 'ac208608c9e10ef199fdd11c38a31675ee9290c0':
  Do not wipe all netd iptables rules in test mode
am 0b0383be: am ac208608: Do not wipe all netd iptables rules in test mode

* commit '0b0383befa6843ad32c3ff30da3e91a0c0a8f9c7':
  Do not wipe all netd iptables rules in test mode
system/netd: bandwidth management initial support (uid+tag stats)

This is a minimalistic version to get accounting of data going
through tagged socket per uid.

When netd starts up the BandwidthController, it will look at the
properties for
   persist.bandwidth.enable=1
and enabled it.

It needs the kernel with the xt_qtaguid + iptables/netfilter goodness.
stlport is ok to use.

The "owner" netfilter module used is actually our xt_qtaguid that acts as it
(just until we get around to talking directly the to kernel).

Once
  "ndc bandwidth enable"
is invoked all traffic is counted against the UIDs receiving/sending it.
This allows BlockGuard.java to "tag" sockets and see stats for the tags.

Data shows up in
  /proc/net/xt_qtaguid/stats

  /proc/net/xt_qtaguid/iface_stat/<iface>/
     rx_packets_tcp
     rx_bytes_tcp
     ...
There is no <uid>/...

Supported commands:
 - "ndc bandwidth enable"
   will setup the needed iptable entries to track tag/uid.
 - "ndc bandwidth disable"
   will remove the iptable entries.
 - "ndc bandwidth setquota <iface> <value>"
   will set a quota on the iface.
   Once quota is reached, packets are rejected.
   With the correct kernel, rejects are turned in socket errors.

TODO
----
 * make bandwidth controller cooperate with tethering.
   - they both manipulate the iptables.

Change-Id: Ieb9e7c60ef8c974e99828f7833065d59b2922bf3
Add netd command to clean up IP addresses

Bug: 4676254
Change-Id: Ifb0b573750504f5daeb8db038d13dddd553797de
Remove obsolete support for controlling RNDIS USB networking

Change-Id: I1a49dc2c96998e9a44729b4b0303dbe9eb8c6569
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge "Add ResolverController class"
am d41806cb: Merge "Add ResolverController class"

* commit 'd41806cb55874d0eaf82fe11ffc62cf50a227313':
  Add ResolverController class
NatController: remove flushing the INPUT/OUTPUT tables.

It doesn't use them, so it should not have to flush them.
This is a minimalistic attempt to cooperate with the BandwidthController.

Change-Id: Ia175a86403adf034ac6f44d7ebc4ebe941881368
netd:bandwidth: initial pass at app-rules, and some ipv6.

Adds initial per-app penalty box rules, and prepares for
handling per iface quota.

The following commands work:

* penalty box

ndc bandwidth addnaughtyapps <uid> ...
ndc bandwidth removenaughtyapps <uid> ...

* Shared quota

 - add (updates the bytes, if they differ from last time)

ndc bandwidth setquota <iface> <bytes>
ndc bandwidth setquota <iface1> <bytes>
ndc bandwidth setquota <iface2> <bytes>

  - remove
ndc bandwidth removequota <iface>
[ oldschool: ndc bandwidth setquota <iface> -1 ]

Change-Id: Ibefc16e81c7713feb47577a9687dcd032dedf06e
Revert "Revert "Add NETLINK_ROUTE socket creation and event propagation""

This reverts commit 19fb0c4e5ec6a10473666a2d45267fbc8305ba85.

Conflicts:

	NetlinkManager.cpp

Brings back Stan Chesnutt's change related to adding NETLINK_ROUTE
socket creation and event propagation.

Change-Id: I8c0625a95b7996ef75b883ce764c3244dd553a47
Signed-off-by: Mike J. Chen <mjchen@google.com>
Change string notification for link state change.

Changed from linkstatus to linkstate to be more like the
notification function name.

Change-Id: Ie9674ca04bf9a9bdff2583786c301452d02b19fc
Signed-off-by: Mike J. Chen <mjchen@google.com>
BandwidthController: cleanup ipv4/v6, set/remove multiple quotas.

Regroup the ipv4/ipv6 choice deeper down to avoid copypasted code.
Shared quota accross ifaces.
Single quota per ifaces.

Nothing preventing an iface from have a single and shared quota.
Might be close to having a working combination.

Added commands:
 - shared quota
  ndc bandwidth setquotas <quotaBytes> <iface> ...
  ndc bandwidth setquota <iface> <quotaBytes>
  ndc bandwidth removequota <iface>
  ndc bandwidth removequotas <iface> ...

 - quota per iface
  ndc bandwidth setiquota <iface> <quotaBytes>
  ndc bandwidth removeiquota <iface>

Change-Id: I370d223da3c8b6e16e8d0a455309ae9e0756a721
netd: bandwidthcontroller: cleanup bool usage for readability.

replace stuff like:
   f(buff, true, false) -> f(buff, ActionA, CaseD)

Change-Id: I8ff1d84f077d8f57263ecb7937b3f2caca86284b
Merge changes Ie9674ca0,I8c0625a9

* changes:
  Change string notification for link state change.
  Revert "Revert "Add NETLINK_ROUTE socket creation and event propagation""
resolved conflicts for merge of 80adaddf to master

Change-Id: I53c036b229352430c3faf57ce1d02fa889827690
Merge "resolved conflicts for merge of 80adaddf to master"