* [PATCH nft] statement: Print NAT IPv4 address in nat_stmt_print()
@ 2017-02-03 18:50 Elise Lennion
2017-02-05 20:46 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Elise Lennion @ 2017-02-03 18:50 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
The case which "nat.addr != NULL && nat.proto != NULL && type != ipv6"
wasn't caught in nat_stmt_print(). Now all cases should be considered.
Also, the if statements were reorganized to get rid of one nested if.
Fixes(Bug 1117 - Table ipv4-nat prerouting dnat doesn't accept dest IP:PORT)
Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
---
src/statement.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/statement.c b/src/statement.c
index 9cdabbb..0585d66 100644
--- a/src/statement.c
+++ b/src/statement.c
@@ -494,25 +494,26 @@ static void nat_stmt_print(const struct stmt *stmt)
};
printf("%s to ", nat_types[stmt->nat.type]);
- if (stmt->nat.addr) {
- if (stmt->nat.proto) {
- if (stmt->nat.addr->ops->type == EXPR_VALUE &&
- stmt->nat.addr->dtype->type == TYPE_IP6ADDR) {
- printf("[");
- expr_print(stmt->nat.addr);
- printf("]");
- } else if (stmt->nat.addr->ops->type == EXPR_RANGE &&
- stmt->nat.addr->left->dtype->type == TYPE_IP6ADDR) {
- printf("[");
- expr_print(stmt->nat.addr->left);
- printf("]-[");
- expr_print(stmt->nat.addr->right);
- printf("]");
- }
+ if (stmt->nat.addr && stmt->nat.proto) {
+ if (stmt->nat.addr->ops->type == EXPR_RANGE &&
+ stmt->nat.addr->left->dtype->type == TYPE_IP6ADDR) {
+ printf("[");
+ expr_print(stmt->nat.addr->left);
+ printf("]-[");
+ expr_print(stmt->nat.addr->right);
+ printf("]");
+ }
+ else if (stmt->nat.addr->dtype->type == TYPE_IP6ADDR) {
+ printf("[");
+ expr_print(stmt->nat.addr);
+ printf("]");
} else {
expr_print(stmt->nat.addr);
}
}
+ else if (stmt->nat.addr) {
+ expr_print(stmt->nat.addr);
+ }
if (stmt->nat.proto) {
printf(":");
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH nft] statement: Print NAT IPv4 address in nat_stmt_print()
2017-02-03 18:50 [PATCH nft] statement: Print NAT IPv4 address in nat_stmt_print() Elise Lennion
@ 2017-02-05 20:46 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-02-05 20:46 UTC (permalink / raw)
To: Elise Lennion; +Cc: netfilter-devel, fw
On Fri, Feb 03, 2017 at 04:50:38PM -0200, Elise Lennion wrote:
> The case which "nat.addr != NULL && nat.proto != NULL && type != ipv6"
> wasn't caught in nat_stmt_print(). Now all cases should be considered.
>
> Also, the if statements were reorganized to get rid of one nested if.
>
> Fixes(Bug 1117 - Table ipv4-nat prerouting dnat doesn't accept dest IP:PORT)
Thanks Elise. Florian was very fast to catch this one too.
Let's remember to keep him on Cc so he also knows what you're working
on.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-05 20:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-03 18:50 [PATCH nft] statement: Print NAT IPv4 address in nat_stmt_print() Elise Lennion
2017-02-05 20:46 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).