Merge pull request #51 from lpotter/master

[connman] fix accessing null object crash in wifi.c
[connman] Return an in progress error if the service is already connecting.

If the network service is already connecting return an in progress
error and do nothing. Previously only the pending variable was tested
indicating that a previous DBus call started the connection. This
variable is not set for an internally initiated connection.

If the connect_sevice call is not aborted it is possible that the
service connection will be needlessly aborted when looking for an
available interface.
gdhcp: Remove unnecessary listener channel variable

The variable is not used for anything and can be removed.
dhcp: Keep DHCP running until an explicit stop is called

In order to recover from a lost lease, gdhcp will restart the address
acquisition process. As the dhcp structures are removed from the hash
and freed in dhcp_invalidate() without notifying gdhcp, the following
happens:

connmand[28337]: DHCP index 3: lease expired
connmand[28337]: DHCP index 3: restart DHCP (retries 0)
connmand[28337]: DHCP index 3: DHCP client start with state init_reboot
connmand[28337]: DHCP index 3: sending DHCP request
connmand[28337]: src/dhcp.c:lease_lost_cb() Lease lost
connmand[28337]: src/dhcp.c:dhcp_invalidate() dhcp 0xb958a0 callback 1
connmand[28337]: src/dhcp.c:dhcp_invalidate() last address 10.0.0.18
connmand[28337]: src/dhcp.c:__connman_dhcp_stop() network_table 0xb94c60 network 0xb9b500
connmand[28337]: wlan0 {del} address 10.0.0.18/20 label wlan0
connmand[28337]: wlan0 {del} route 10.0.0.0 gw 0.0.0.0 scope 253 <LINK>
connmand[28337]: DHCP index 3: received DHCP packet xid 0x0000 (current state 1)
connmand[28337]: DHCP index 3: switch listening mode (1 ==> 0)
connmand[28337]: src/dhcp.c:lease_available_cb() Lease available
connmand[28337]: Aborting (signal 11) [src/connmand]
connmand[28337]: ++++++++ backtrace ++++++++
connmand[28337]: #0  0x7f1890e98420 in /lib/x86_64-linux-gnu/libc.so.6
connmand[28337]: #1  0x439580 in connman_device_get_ident() at src/device.c:555
connmand[28337]: #2  0x448041 in connman_service_lookup_from_network() at src/service.c:6483
connmand[28337]: #3  0x459d97 in lease_available_cb() at src/dhcp.c:331
connmand[28337]: #4  0x4122b1 in start_bound() at gdhcp/client.c:1740
connmand[28337]: #5  0x7f1891f8a526 in /lib/x86_64-linux-gnu/libglib-2.0.so.0
connmand[28337]: #6  0x7f1891f8a878 in /lib/x86_64-linux-gnu/libglib-2.0.so.0
connmand[28337]: #7  0x7f1891f8ab3a in /lib/x86_64-linux-gnu/libglib-2.0.so.0
connmand[28337]: #8  0x40f902 in main() at src/main.c:690
connmand[28337]: #9  0x7f1890e84b45 in /lib/x86_64-linux-gnu/libc.so.6
connmand[28337]: +++++++++++++++++++++++++++

Fix this by freeing and removing the dhcp structure only when calling
__connman_dhcp_stop() and modify dhcp_invalidate() so that it only
resets IP configuration data for the service.

This also fixes the reference counting issue reported by Eduardo
Abinader.
dhcp: Restart existing DHCP client with __connman_dhcp_start()

Check whether the dhcp structure already exists when calling
 __connman_dhcp_start() and initialize callbacks and other data
only on newly created objects.

As dhcp_request() now handles initialization, rename it to
dhcp_initialize().
Merge pull request #52 from amccarthy/master

[connman] Return an in progress error if the service is already connecti...
[connman] allow user_context to be null when queueing agent message.

This allows our dns error patch to pass.