diff options
author | Fahad Naeem <fahadnaeemkhan@gmail.com> | 2022-05-10 01:03:52 -0500 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2022-05-12 07:30:33 +0000 |
commit | 0891b6aa449cca525b61d0cc23759b2efcd158dc (patch) | |
tree | d2010d7871c420fd9631ec3ea57e62eba738e52e /src/plugins/nat/pnat/pnat_cli.c | |
parent | e2159bd2d3721592edee90a511647f83ea9a4781 (diff) |
pnat: add support to wildcard IP Protocol field if not specified
- add pnat_binding_add_v2 which explicitly requires match mask to
set to PNAT_PROTO if we want to match on IP Protocol
- fix pnat_binding_add backward compatibility i.e. no need to set
match mast to PNAT_PROTO
Type: improvement
Signed-off-by: Fahad Naeem <fahadnaeemkhan@gmail.com>
Change-Id: I5a23244be55b7d4c10552c555881527a4b2f325f
Diffstat (limited to 'src/plugins/nat/pnat/pnat_cli.c')
-rw-r--r-- | src/plugins/nat/pnat/pnat_cli.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/nat/pnat/pnat_cli.c b/src/plugins/nat/pnat/pnat_cli.c index 082f0778acb..ce9beee540d 100644 --- a/src/plugins/nat/pnat/pnat_cli.c +++ b/src/plugins/nat/pnat/pnat_cli.c @@ -122,6 +122,8 @@ uword unformat_pnat_match_tuple(unformat_input_t *input, va_list *args) { t->mask |= PNAT_SA; else if (unformat(input, "dst %U", unformat_ip4_address, &t->dst)) t->mask |= PNAT_DA; + else if (unformat(input, "proto %U", unformat_ip_protocol, &t->proto)) + t->mask |= PNAT_PROTO; else if (unformat(input, "sport %d", &sport)) { if (sport == 0 || sport > 65535) return 0; @@ -132,9 +134,7 @@ uword unformat_pnat_match_tuple(unformat_input_t *input, va_list *args) { return 0; t->mask |= PNAT_DPORT; t->dport = dport; - } else if (unformat(input, "proto %U", unformat_ip_protocol, &t->proto)) - ; - else + } else break; } return 1; |