ipconfig: iterate safely over ipconfig_list. Fixes JB#19212

The following valgrind report appears when a network toggled from
enabled to disabled and back; it is due to ipconfig_list being
modified by functions called in the loop while iterating over the
list. When the current list element gets deleted during iteration,
g_list_next() cannot be safely called anymore.

Fixed by making a shallow copy of the list for iteration purposes.

==1638== Invalid read of size 4
==1638==    at 0x542E0: __connman_ipconfig_newlink (ipconfig.c:560)
==1638==    by 0x633F7: process_newlink (rtnl.c:445)
==1638==    by 0x6424F: netlink_event (rtnl.c:958)
==1638==    by 0x4907733: g_io_unix_dispatch (giounix.c:167)
==1638==    by 0x48AC55B: g_main_context_dispatch (gmain.c:3054)
==1638==    by 0x48AC85F: g_main_context_iterate.part.17 (gmain.c:3701)
==1638==    by 0x48ACEB3: g_main_loop_run (gmain.c:3894)
==1638==    by 0x14957: main (main.c:739)
==1638==  Address 0x50df6fc is 4 bytes inside a block of size 12 free'd
==1638==    at 0x483752C: free (vg_replace_malloc.c:446)
==1638==    by 0x48B418B: g_free (gmem.c:252)
==1638==    by 0x48A758F: g_list_remove (glist.c:480)
==1638==    by 0x55AB7: __connman_ipconfig_disable (ipconfig.c:1691)
==1638==    by 0x4376F: service_lower_down (service.c:6703)
==1638==    by 0x54373: __connman_ipconfig_newlink (ipconfig.c:575)
==1638==    by 0x633F7: process_newlink (rtnl.c:445)
==1638==    by 0x6424F: netlink_event (rtnl.c:958)
==1638==    by 0x4907733: g_io_unix_dispatch (giounix.c:167)
==1638==    by 0x48AC55B: g_main_context_dispatch (gmain.c:3054)
==1638==    by 0x48AC85F: g_main_context_iterate.part.17 (gmain.c:3701)
==1638==    by 0x48ACEB3: g_main_loop_run (gmain.c:3894)
==1638==
Merge pull request #57 from hmallat/ipconfig-safe-iteration

ipconfig: iterate safely over ipconfig_list