Fix the bug that ensures consistency 82/4682/3
authorLe Yao <le.yao@intel.com>
Mon, 14 Feb 2022 00:59:44 +0000 (19:59 -0500)
committerLe Yao <le.yao@intel.com>
Mon, 14 Feb 2022 05:28:11 +0000 (00:28 -0500)
Ip and interface are not configured correctly

Signed-off-by: Le Yao <le.yao@intel.com>
Change-Id: I108629dc96b59e8347a0d662c6ddf23429e1f2e4

platform/cnf-openwrt/src/rest_v1/nat_rest.lua

index adde1c2..629240c 100644 (file)
@@ -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