wifi: avoid device double release on disable

Per MEEGO-25999 <https://bugs.meego.com/show_bug.cgi?id=25999>, there
exists a race between scan_callback and wifi_disable such that a care-
fully-timed deassertion of the technology Powered property between
throw_wifi_scan and scan_callback will lead to a device reference
count underflow. A second Powered property false -> true -> false
transition will then deallocate the device and Wi-Fi will no longer
function until connman or the system is restarted.

This patch addresses that race by tracking and observing the disabling
state such that scan_callback ad wifi_disable can effectively negotiate
which has performed the device release, thereby avoiding the double
release and resulting underflow.
service: Set state properly after disconnecting the associating service

This is related to fix d7d8f8bdb7c1ddae098893e10608fcb42034a9ff
We did not set the state to idle after disconnecting the
associating service.

Fixes BMC#25981
tools: Make message buffers static
tools: Rename dnsproxy-unit to dnsproxy-test

Rename the dnsproxy file as it is more of a test tool than a unit test.
wifi: improve fix to avoid device double release on disable

Per MEEGO-25999 <https://bugs.meego.com/show_bug.cgi?id=25999>, there
exists a race between scan_callback and wifi_disable such that a care-
fully-timed deassertion of the technology Powered property between
throw_wifi_scan and scan_callback will lead to a device reference
count underflow. A second Powered property false -> true -> false
transition will then deallocate the device and Wi-Fi will no longer
function until connman or the system is restarted.

This patch improves upon and revises the prior patch to address this
issue by recognizing that hidden networks involve a slightly different
code path and timing and that both this and the prior case can be
addressed by tracking the device scanning state and only releasing the
device when the state is asserted.
session: Reorder shutdown sequence

By calling __connman_session_cleanup() before __connman_plugin_cleanup()
we make sure all resources allocated can released in the correct order.
The code assumes after an successful allocation, free will always work
and therefore we double free allocated memory.
session: Do not try to access already removed hash

Make sure we never try to cleanup when the hash table has
been destroyed. In this case all resources have been
freed already.
session: Empty policy list indicated no match all

Match all is expressed via CONNMAN_SERVICE_TYPE_UNKNOWN. An empty
list means no match.
session_policy_local: Set default policy using common code

Use connman_sessoin_set_default_config() instead of open coded
version.

This prepars the next fix.
session_policy_local: Empty policy list indicated no match all

Match all is expressed via CONNMAN_SERVICE_TYPE_UNKNOWN. An empty
list means no match.
session_policy_local: Do not free policy on load error

We should not unref the policy on parsing errors becase the policy
lifetime is attached to the lifetime of the file. When the file
is removed we remove it from the hash table.
session_policy_local: Load policy when a new file is added

When a file is added (not modified) we need to parse it as well