From 842e591e8fbec20578d11e407e9d327f2e974276 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Fri, 10 Jan 2014 09:28:37 +0000 Subject: nftables: shorten "could not process rule in batch" message Remove the "in batch" part, it makes most messages exceed a single line, the user doesn't care about this and we process even single rules in "batches". Signed-off-by: Patrick McHardy --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 32a991a6..e8be423d 100644 --- a/src/main.c +++ b/src/main.c @@ -183,8 +183,8 @@ static int nft_netlink(struct parser_state *state, struct list_head *msgs) if (err->seqnum == cmd->seqnum || err->seqnum == batch_seqnum) { netlink_io_error(&ctx, &cmd->location, - "Could not process rule in batch: %s", - strerror(err->err)); + "Could not process rule: %s", + strerror(err->err)); if (err->seqnum == cmd->seqnum) { mnl_err_list_free(err); break; -- cgit v1.2.3 From 806f8bba0a611fc0ce5b3104b929ce441f2b6f77 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Fri, 10 Jan 2014 09:28:37 +0000 Subject: erec: fix error markup for errors starting at column 0 For errors starting at column 0, we must not subtract 1 to avoid underflow. Signed-off-by: Patrick McHardy --- src/erec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/erec.c b/src/erec.c index 7451d94c..a157d2fa 100644 --- a/src/erec.c +++ b/src/erec.c @@ -138,7 +138,8 @@ void erec_print(FILE *f, const struct error_record *erec) end = 0; for (l = erec->num_locations - 1; l >= 0; l--) { loc = &erec->locations[l]; - for (i = loc->first_column - 1; i < loc->last_column; i++) + for (i = loc->first_column ? loc->first_column - 1 : 0; + i < loc->last_column; i++) buf[i] = l ? '~' : '^'; end = max(end, loc->last_column); } -- cgit v1.2.3 From aed3e22a4fd7ef4ae7c249cfb9f71387df14ff73 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Fri, 10 Jan 2014 09:28:37 +0000 Subject: datatype: revert "fix crash if wrong integer type is passed" Revert commit a320531e7: We have generic type checks that handle this case just fine and indeed the bugzilla entry mentioned in the reverted patch states: BUG: invalid input descriptor type 538976288 nft: src/erec.c:100: erec_print: Assertion `0' failed. Abandon So the problem is not related to datatypes at all and generic type checking works perfectly fine: :1:52-57: Error: datatype mismatch, expected Ethernet protocol, expression has type Internet protocol add rule ip6 filter input position 4 meta protocol icmpv6 accept ~~~~~~~~~~~~~ ^^^^^^ Signed-off-by: Patrick McHardy --- src/datatype.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/datatype.c b/src/datatype.c index 2e5788dc..9910a1b3 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -230,10 +230,8 @@ static struct error_record *integer_type_parse(const struct expr *sym, if (gmp_sscanf(sym->identifier, "%Zu%n", v, &len) != 1 || (int)strlen(sym->identifier) != len) { mpz_clear(v); - if (sym->dtype != &integer_type) { - return error(&sym->location, "This is not a valid %s", - sym->dtype->desc); - } + if (sym->dtype != &integer_type) + return NULL; return error(&sym->location, "Could not parse %s", sym->dtype->desc); } -- cgit v1.2.3 From 4097ad726fce2398b42795d7b316d39fb8ea6ee5 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Fri, 10 Jan 2014 09:28:37 +0000 Subject: meta: fix crash when parsing unresolvable mark values *res has undefined contents, set to NULL before invoking the parse function to make sure the test for != NULL doesn't falsely return true. Signed-off-by: Patrick McHardy --- src/datatype.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/datatype.c b/src/datatype.c index 9910a1b3..86ea80e3 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -643,6 +643,7 @@ static struct error_record *mark_type_parse(const struct expr *sym, } } + *res = NULL; erec = sym->dtype->basetype->parse(sym, res); if (erec != NULL) return erec; -- cgit v1.2.3