Merge pull request #20036 from ysc3839/natmap-fix

natmap: merge "ipv4" and "ipv6" options into single "family" option
This commit is contained in:
Tianling Shen 2022-12-07 22:28:29 +08:00 committed by GitHub
commit 5c17cd1c81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View 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 ''

View 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" ] && {