Improved dhcp autoconfig

Half of the PR is cleanup. Remaining part solves bnc#872319 for some configurations.