From: Jonatan Schlag Date: Tue, 30 May 2017 08:24:15 +0000 (+0200) Subject: ip: Allow detection of protocol for networks, too X-Git-Tag: 009~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0af2168d4eedd7f2d602215dc8c8f3f547cb7034;p=network.git ip: Allow detection of protocol for networks, too This is very convenient when we need to detect the protocol of a network without splitting off the prefix first. Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.ip b/src/functions/functions.ip index 9572141b..e938a535 100644 --- a/src/functions/functions.ip +++ b/src/functions/functions.ip @@ -41,9 +41,11 @@ ip_get_prefix() { ip_detect_protocol() { local address="${1}" - assert isset address + # Remove prefix so that we can handle subnet, too + address=$(ip_split_prefix ${address}) + local protocol for protocol in ${IP_SUPPORTED_PROTOCOLS}; do if ${protocol}_is_valid "${address}"; then