natmap: merge "ipv4" and "ipv6" options into single "family" option
authorRichard Yu <yurichard3839@gmail.com>
Wed, 7 Dec 2022 07:18:09 +0000 (15:18 +0800)
committerRichard Yu <yurichard3839@gmail.com>
Wed, 7 Dec 2022 07:18:09 +0000 (15:18 +0800)
Signed-off-by: Richard Yu <yurichard3839@gmail.com>
net/natmap/files/natmap.config
net/natmap/files/natmap.init

index 519cea052f001711e0398a3e4b733bf4d16dbb3f..71931f6c5684580943c99ab6b385c197d7d429c8 100644 (file)
@@ -1,7 +1,6 @@
 config natmap
        option enable '0'
-       option ipv4 '0'
-       option ipv6 '0'
+       option family ''
        option udp_mode '1'
        option interface ''
        option interval ''
index e729e72755132b5375fc1a41e9e5b1957e02899b..a9ff90539103c6a5cbef99a0c0bc79ac10cc5275 100644 (file)
@@ -18,8 +18,7 @@ load_interfaces() {
 validate_section_natmap() {
        uci_load_validate "${NAME}" natmap "$1" "$2" \
                'enable:bool:1' \
-               'ipv4:bool:0' \
-               'ipv6:bool:0' \
+               'family:string' \
                'udp_mode:bool:0' \
                'interface:string' \
                'interval:uinteger' \
@@ -44,8 +43,8 @@ natmap_instance() {
                ${stun_server:+-s "$stun_server"} \
                ${http_server:+-h "$http_server"}
 
-       [ "${ipv4}" = 1 ] && procd_append_param command -4
-       [ "${ipv6}" = 1 ] && procd_append_param command -6
+       [ "${family}" = ipv4 ] && procd_append_param command -4
+       [ "${family}" = ipv6 ] && procd_append_param command -6
        [ "${udp_mode}" = 1 ] && procd_append_param command -u
 
        [ -n "$interface" ] && {