Refactor NetworkUtils to reduce redundancy

The refactored code also makes sure we discover changes
in network interfaces by not storing a static list of addresses
during startup.

Target: trunk
Require-notes: yes
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7602/