[network] When IP is not set don't assume certain interface.

When ip is not set the default interface was assumed to be usb0.
Also do proper cleaning in the end to ensure that memory is not leaked.

Signed-off-by: Marko Saukko <marko.saukko@jollamobile.com>
Unify code by creating a common get_interface function that returns interface in configs or the default one.

Signed-off-by: Marko Saukko <marko.saukko@jollamobile.com>
Merge pull request #3 from saukko/master

networking