netd: Add enhanced routing support

Add support for policy and metric based routing APIs to netd. This
functionality is used for WQE, IMS, and Android QoS features.

Combined merge commit for following commits

netd: Do not reset routing policies

Stop flushing of all routing policies when resetting to default rule
configuration. This is detrimental to other policy routes set on the
system and creates a conflict. Tethering related rules are already
removed by NatController so this step is unnecessary.

(cherry picked from commit 64e7e8102d233f46fe6cd4c8311301da0d4444da)
(cherry picked from commit e36cabf99eb9c8ceb08c81adca465c8e421a8d59)

netd: add metric support for routing

Add support for adding of cost (metric) of a route.
Changed call to ip from logwrapper to popen to handle errors caught during
a route operation.

(cherry picked from commit 5325183e94ad2ad0bd9399dcff620f061ce3a431)
(cherry picked from commit 72d33e4a5947bcd9bb4dfa318d36ba23b0de3409)

netd: Add policy routing functionality to netd

Adding a new class RouteController to handle policy routing (source)
functionality in netd.
Installing a handler in CommandListener to handle policy routing
commands.

(cherry picked from commit 07c8592a7f43b46f11ad05ffbbb8bdf35fd078f8)
(cherry picked from commit 8ad39dcf7927a7cadb763b5d731b1c5f933d33df)

Change-Id: Ia94bf165a8cd7d3477e583516259a0d9c783e833
(cherry picked from commit 5ba8d9d41a5dce9131c1a45d5770de03ef79e550)

Conflicts:
  CommandListener.cpp
  CommandListener.h
  ResponseCode.h
(cherry picked from commit b4558f72107573c559d1ec1150e9ef04245512f0)
(cherry picked from commit adf66db52b5ce2fe70b5e32366896e4077225ff7)
(cherry picked from commit 175104c30eba629ff81de3c30257c0e330e0a1db)
netd: IPV6 tethering support

- Start NDP proxy daemon when tethering is enabled
- Add new interface commands "add_upstream" and "remove_upstream".
  Used to provide the complete set of interfaces to be proxied to
  the NDP proxy daemon
- Enable ipv6 forwarding

CRs-fixed: 555006
Change-Id: I89170f8acd60b949ede749f353acd27363ff5798
Acked-by: Subash Abhinov Kasiviswanathan <subashab@qti.qualcomm.com>
(cherry picked from commit ce4125bcffad4ebf10a51690da1b673a978115db)
(cherry picked from commit 555db6bad4a0e20cebc7e2e72b5613622d69dc3a)
(cherry picked from commit c55f0eba5f6c0974073c449a3d68227b7a354aa7)
netd: Support the QSAP Softap SDK.

The QSoftAP SDK extendes the HotSpot capability provided by
the stock Android distribution.  This allows the creation of a more
feature-rich HotSpot application.
In order to minimize the changes required to the stock Android
distribution, place the majority of the changes into a new
QsoftapCmd class that contains most of the command dispatching
logic.

Change-Id: Iaa895f11208641b72e2dc4ba7120f7dbef347577
CRs-Fixed: 436332
netd: Change QsoftapCmd to add AR6004 support

Currently, commands for setting SoftAP will be redirected
to QsoftapCmd, and this will set some fields in
the hostapd.conf that AR6004 driver doesn't support.
In this change, "set" command will be redirected to
the Android native SoftapController to let AR6004 able run
into softap mode, when the WLAN is AR6004.

Change-Id: Iec65332facf8ee84ef76d2b919eadbbec4d5cfdf
CRs-Fixed: 436332
Merge "netd: Support the QSAP Softap SDK."
Merge "netd: Change QsoftapCmd to add AR6004 support"
SecondaryTableController: force the MSS to match pmtu on TCP SYN

Without this change, the VPN sets up a tun/ppp that needs a small
MTU, and during TCP SYN the MSS will end up matching the outgoing iface
MTU which is potentially too big.
This leads to connection flakiness. The wrong MSS is visible by
tcpdump-ing on the tun/ppp device.

With this change, the MSS now is correct.
It requires the kernel to be configured with
 CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
If kernel is not configured, it silently fails.

Bug: 11579326
Change-Id: I254d8c39435b92dff91931e461e1efb8b35f6b1e
Merge commit 'android-4.4.1_r1' into merge_branch

* commit 'android-4.4.1_r1':
  SecondaryTableController: force the MSS to match pmtu on TCP SYN
Merge "Merge commit 'android-4.4.1_r1' into merge_branch"
Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch""
Merge "Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch"""
Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch""
Merge "Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch"""
Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch""
Merge "Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch"""
Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch""
Merge "Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch"""
netd: Test the return value from snprintf() in runCommand()

Properly test the return value from snprintf() in runCommand() to
avoid error conditions.

Change-Id: Idfa099e5eb2b8ff3f5b67a0a3aea3174045f4563
CRs-fixed: 549627
Merge "netd: Test the return value from snprintf() in runCommand()"
Merge "Merge "Merge commit 'android-4.4.1_r1' into merge_branch""