statement: Print NAT IPv4 address in nat_stmt_print()
PATCH 1/1 statement: Print NAT IPv4 address in nat_stmt_print()
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)
--- src/statement.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
src/statement.c +16 -15
@@ -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 (":" );
Signature · 1 line
2.7.4
Pablo Neira Ayuso
maintainerQuoted 6 lines · Elise Lennion
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.