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:

(cherry picked from Ia22847dd9611ff16eea25336716d4440461565e0)

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.

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.

netd: Validate input argument for Route commands
Check for valid command line argument that is
passed to RouteController module.
CRs-fixed: 569443

RouteController: use fixed priority for ip rule
Use fixed priority when adding source policy rules
CR-fixed: 613222

Conflicts:
	server/CommandListener.cpp
	server/CommandListener.h

Change-Id: Ic828041d8f5be77a764ce22c45c5091ee8ae6dd2
wlan: Add softap support through ndc commands.

Changes required to support the softap commands
through ndc cli. This new support as part of the
64bit enablement and ndc is used for cli automation
in softap testcases.

Change-Id: I460a3785c3b4a44656281c7243ebdf921fe20f91
CRs-Fixed: 710050
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
- After repeatedly toggling tethering/Wifi hotspot on and off, hotspot
  may not turn on anymore. It appears untethering is unsuccessful and
  this eventually leads to a timeout and a framework reboot. The NDP
  proxy daemon appears to be started multiple times even though there
  is no ipv6 upstream interface present. There appears to be a signifcant
  number of calls to fork and exec this daemon even though this
  functionality is not needed in this case. Fix this overhead by invoking
  the daemon only if there are atleast 2 interfaces to establish a bridge
  and proxy the NDP messages.

Conflicts:
	server/TetherController.cpp

CRs-fixed: 665103
Change-Id: I89170f8acd60b949ede749f353acd27363ff5798
netd-client: support for intercepting socket and connect

Allow for hooks to capture the socket and connect calls
and handle them in external shared lib

Change-Id: I0eb7ac3b819d0f08351f33a39051d2542635a3a0
Add support for ipv6 tethering stats

Requirement: Support for ipv6 tethering stats

Current implementation does not have support
for calculating the Ipv6 tethering  traffic

Solution:
Parse the ipv6 tether counter chains output
Update the output data to NetworkManagementService

Change-Id: I7d626b5697f5aa07c0266032a07be8f70a17f4e3
CRs-Fixed: 690173
netd: Fix 64bit incompatibility issue for NDC commands

Due to 64-bit incompatibility NDC commands output was not printed
on consolse. This commit handles 64-bit incompatibility issues and
ensures NDC command output are printed on console in proper format.

Change-Id: I4fe4dcdf9f991d361e6273bf715671c4cd160e76
CRs-Fixed: 726587
Add support for ipv6 tethering when using non default apn

When tethering is enabled and a non default apn is used, a policy
route table is created per upstream interface. The table number is
the sum of the interface index and  offset from BASE_TABLE_NUMBER.
There is a rule added per upstream interface which is specific for
the tethered traffic which looks up this table.
This patch adds the capability to pass this table name specific
to the upstream interface to the router advertisement daemon. The
route advertisement daemon will then add the rule which looks up
this table for the ipv6 traffic.

Removed the function addV6RtrAdvIface and removeV6RtrAdvIface
and replaced it with configureV6RtrAdv which has no arguments since
the arguments of the former functions were not being used.

CRs-fixed: 654872
Change-Id: I2845558068ba53032fbbc6be618ac64cfed63c6e
Fix concurrency error during iptables execution

When multiple userspace processes run iptables commands concurrently,
some of the commands fail with the following error

08:40:59.164 I/ip6tables( 2308): Another app is currently holding the
xtables lock. Perhaps you want to use the -w option?
08:40:59.165 I/ip6tables( 2308): ip6tables terminated by exit(4)

This is because Iptables uses the xtables lock to handle concurrency.
If the -w option is not used, iptables will exit immediately once it
fails to acquire that lock and this can cause the framework to hang.

CRs-Fixed: 722552
Change-Id: I92281abd5d05745899f9aa3b7fceca31082c47aa
Notificate the STA (dis)connect message

Create a thread to poll the hostapd's message
through the wpa_ctrl_* interface, and broadcast
the message to the uplayer.

CRs-Fixed: 685913
Change-Id: I4dd0326110c655fcd6cd5f8425be523d9e64ffa7