From 7b00dd6a87c6daada23e0a3b0ffe4d19e3a39ace Mon Sep 17 00:00:00 2001 From: Le Yao Date: Sun, 13 Feb 2022 19:59:44 -0500 Subject: [PATCH] Fix the bug that ensures consistency Ip and interface are not configured correctly Signed-off-by: Le Yao Change-Id: I108629dc96b59e8347a0d662c6ddf23429e1f2e4 --- platform/cnf-openwrt/src/rest_v1/nat_rest.lua | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.16.6