From d52a8921b85057682f2cf5bae7d6353142ba279a Mon Sep 17 00:00:00 2001 From: Alexander Chernavin Date: Wed, 26 May 2021 09:55:42 -0400 Subject: nat: test all intf addrs in is_interface_addr() Type: fix Currently, is_interface_addr() tests if a given IPv4 address belongs to an interface by a given sw_if_index. However, there are several issues: * only the first found address on the interface is actually tested, * sw_if_index is always cached even if the interface hasn't been assigned any addresses yet. With this change, is_interface_addr() tests all IPv4 addresses on an interface by a given sw_if_index and caches sw_if_index only if there are addresses present. Signed-off-by: Alexander Chernavin Change-Id: If1acc4a534647a5f0ce8e9b565b867c92a016dc3 --- src/plugins/nat/nat44-ei/nat44_ei.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/nat/nat44-ei/nat44_ei.h') diff --git a/src/plugins/nat/nat44-ei/nat44_ei.h b/src/plugins/nat/nat44-ei/nat44_ei.h index ae63d9de050..055f81c069b 100644 --- a/src/plugins/nat/nat44-ei/nat44_ei.h +++ b/src/plugins/nat/nat44-ei/nat44_ei.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -304,7 +305,7 @@ typedef struct typedef struct { u32 cached_sw_if_index; - u32 cached_ip4_address; + uword *cached_presence_by_ip4_address; } nat44_ei_runtime_t; typedef struct -- cgit 1.2.3-korg