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~250^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30d871f4db4d11e7c789c182a80e1efa9bf7426c;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 --- 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