]> git.ipfire.org Git - people/arne_f/network.git/commitdiff
Make versioning of IP protocols more modular.
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Sep 1981 16:12:37 +0000 (16:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Sep 1981 16:12:37 +0000 (16:12 +0000)
functions.ip
functions.ipv4
functions.ipv6

index f95265e954fd5f1d72d67c7d3387e52aae3d32e5..a0dad1a18c8deb615f7dd66e75315083f805079d 100644 (file)
@@ -19,6 +19,9 @@
 #                                                                             #
 ###############################################################################
 
+# A list of supported versions of the IP protocol
+IP_SUPPORTED_PROTOCOLS=""
+
 function ip_split_prefix() {
        local address=${1}
 
@@ -41,7 +44,7 @@ function ip_detect_protocol() {
        assert isset address
 
        local protocol
-       for protocol in ipv4 ipv6; do
+       for protocol in ${IP_SUPPORTED_PROTOCOLS}; do
                if ${protocol}_is_valid ${address}; then
                        echo "${protocol}"
                        return ${EXIT_OK}
@@ -50,3 +53,11 @@ function ip_detect_protocol() {
 
        return ${EXIT_ERROR}
 }
+
+function ip_protocol_is_supported() {
+       local proto=${1}
+
+       assert isset proto
+
+       listmatch ${proto} ${IP_SUPPORTED_PROTOCOLS}
+}
index 74c524a4ce972533d6ceb6e2276be9b00137f76c..a29fc3978bbad0b258fdefa78c365f98fe5b7da4 100644 (file)
@@ -19,6 +19,8 @@
 #                                                                             #
 ###############################################################################
 
+IP_SUPPORTED_PROTOCOLS="${IP_SUPPORTED_PROTOCOLS} ipv4"
+
 function ipv4_split_prefix() {
        ip_split_prefix $@
 }
index 73a774bb61d8392858a91a914e12c9e16b312116..b733d0ca6cb63a0cd837f2a606174873a636fce9 100644 (file)
@@ -19,6 +19,8 @@
 #                                                                             #
 ###############################################################################
 
+IP_SUPPORTED_PROTOCOLS="${IP_SUPPORTED_PROTOCOLS} ipv6"
+
 function ipv6_init() {
        log INFO "Initializing IPv6 networking."