session: Remove policy_probe()

policy_probe() is only called from connman_session_policy_register(),
that means only when ConnMan starts. At this point there wont be any
Sessions yet. Therefore, this function is useless.
gdbus: Fix trying to remove already removed sources

When we return FALSE from idle handlers, the source is removed.
This will be causing warnings in glib 2.40.

See https://bugzilla.gnome.org/show_bug.cgi?id=710724
dhcp: Stop IPv4 ll state machine properly

Now the IPv4 ll address is set correctly if the ll state machine
is run more than once. The real culprit was that the ipv4ll_running
flag was not cleared when dhcp_release() was called.

Reported-by: Tim Sander <tim@krieglstein.org>
dhcp: Add useful IPv4 ll debug information
wifi: Remove redundant initialization of zero'd wifi_data

wifi_data is already allocated and zeroed, meaning we do not have
to initialize the struct members individually.
wifi: Reset device retry count on failure

Previously the wifi retry count was never reset once MAXIMUM_RETRIES
had been reached, making it impossible to connect.

This commit rectifies the issue by ensuring we always reset the
current retries count to zero once we hit either the MAXIMUM_RETRIES
or FAVORITE_MAXIMUM_RETRIES limits, allowing networks to be tried
again.
wifi: Ignore adhoc networks

We ignore adhoc networks and do not create network or service
objects any longer for them.
network: Remove adhoc check as it is not needed

Adhoc networks are not created so this check is now obsolete.
dnsproxy: name variable should be initialized

If user queries a name without a domain then an uninitialized
memory read happens.

Log from valgrind:

connmand[28380]: src/dnsproxy.c:parse_response() qr 1 qdcount 1
==28380== Conditional jump or move depends on uninitialised value(s)
==28380==    at 0x4009777: strlen (mc_replace_strmem.c:403)
==28380==    by 0x4D65A73E: g_strdup (gstrfuncs.c:355)
==28380==    by 0x80C6B45: cache_update.isra.2 (dnsproxy.c:1110)
==28380==    by 0x80C6FE9: forward_dns_reply (dnsproxy.c:1800)
==28380==    by 0x80C7368: udp_server_event (dnsproxy.c:1909)
==28380==    by 0x4D67F2BE: g_io_unix_dispatch (giounix.c:166)
==28380==    by 0x4D63D0BA: g_main_context_dispatch (gmain.c:2539)
==28380==    by 0x4D63D45F: g_main_context_iterate.isra.21 (gmain.c:3146)
==28380==    by 0x4D63D8C2: g_main_loop_run (gmain.c:3340)
==28380==    by 0x805416C: main (main.c:693)
device: Disable had too strict checks which can prevent disconnect

The __connman_device_disable() was checking in the start of the function
whether the driver supports disabling at all. This is too soon as
if the driver has not set the disable callback, the disconnection
of driver connections would not be done at all in that case.
bluetooth: Do not turn off hci device when ConnMan stops

We only disconnect PAN connections when ConnMan stops and leave
other BT connections running.
bluetooth-legacy: Do not turn off hci device when ConnMan stops

We only disconnect PAN connections when ConnMan stops and leave
other BT connections running.
service: Enable split routing

Because need_split was reinitialized to false for each iteration
the do_split_routing was never considered.

Reported by coverity.
dbus: Initialize uid for error path

When the error path is taken, uid was not initialized. This
is not a problem since we also pass in the error code to the
callback.

Reported by clang and coverity.
inet: Close socket when leaving function early

The socket is not closed when we hit the error path.

Reported by coverity.
core: Set device name with null termination

ifr_name is a null terminated buffer, therefore we should
only copy IFNAMSIZ - 1 characters.

While we are at it we also use sizeof() consistenlty.

Reported by coverity.
inet: Initialize flags to 0

Set flags to 0 in struct mshdr instead of a random value.

Reported by coverity.
rtnl: Do not access variables out of scope

ipv4_addr and ipv6_addr are assigned to src which is then access
outside of the scope. Let's fix this by moving the variables to
the outside scope.

Reported by coverity.
timezone: Null terminate pathname

strncpy does not null terminate the string if basepath is longer
than the max size of the buffer. Let's stop at max - 1 and have
proper terminated string.

Reported by coverity.
log: Do not access array out of bounds

If read returns sizeof(buf) characters buf[len] will be a out of
bound access.

Reported by coverity.