tools/hv: Make the sample hv_get_dhcp_info script more useful
Origin: https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/commit?id=
29c75ddc2d1952528a1195b6ac52054c47c0ee89
Bug-Debian: https://bugs.debian.org/919350
Currently the sample hv_get_dhcp_info script only supports the old Red
Hat network-scripts configuration format and leaves everything else to
downstream distributions.
However, Network Manager and systemd-networkd are available across
many distributions, so it makes more sense to implement support for
them here.
Debian's ifupdown is also used in several distributions that are not
Debian derivatives, so I think it makes sense to implement support for
that here too.
Extend the script to support all of these:
- Add a report function that reports the status based on the result of
the previous command
- Add a function for each configuration system that checks whether
that system in use for the given interface, and:
- If so, checks and reports the DHCP status
- If not, returns failure
- Call each of those functions, exiting once one of them succeeds,
with a final fallback to reporting 'Disabled'
The network-scripts check is placed last, because it only checks a
file and not the actual interface state and so is the least reliable
check.
Signed-off-by: Ben Hutchings <benh@debian.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name tools-hv-Make-the-sample-hv_get_dhcp_info-script-mor.patch