From: Le Yao Date: Mon, 14 Feb 2022 00:59:44 +0000 (-0500) Subject: Fix the bug that ensures consistency X-Git-Tag: 21.12.03~6 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=7b00dd6a87c6daada23e0a3b0ffe4d19e3a39ace;p=icn%2Fsdwan.git Fix the bug that ensures consistency Ip and interface are not configured correctly Signed-off-by: Le Yao Change-Id: I108629dc96b59e8347a0d662c6ddf23429e1f2e4 --- diff --git a/platform/cnf-openwrt/src/rest_v1/nat_rest.lua b/platform/cnf-openwrt/src/rest_v1/nat_rest.lua index adde1c2..629240c 100644 --- a/platform/cnf-openwrt/src/rest_v1/nat_rest.lua +++ b/platform/cnf-openwrt/src/rest_v1/nat_rest.lua @@ -50,6 +50,12 @@ function check_nat(value) if value["dest"] == nil then return false, "dest is required for SNAT" end + if dest == "#source" then + dest = ifutil.get_name_by_ip(src_dip) + if dest == nil or dest == "" then + return false, "428:ip not found on all interfaces" + end + end end if target == "MASQUERADE" then