* [PATCH 0/4] nftables: bug fixes and minor cleanups
@ 2014-01-10 9:31 Patrick McHardy
2014-01-10 9:31 ` [PATCH 1/4] nftables: shorten "could not process rule in batch" message Patrick McHardy
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Patrick McHardy @ 2014-01-10 9:31 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
The following four patches fix error reporting for errors starting
at column 0, fix a crash for unresolvable mark values, revert the
incorrect integer_type parsing patch and reduce the size of the
"could not process rule in batch" message to avoid having it spill
over on the next line.
If there are no objections, I'll push them to master in a few hours.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] nftables: shorten "could not process rule in batch" message
2014-01-10 9:31 [PATCH 0/4] nftables: bug fixes and minor cleanups Patrick McHardy
@ 2014-01-10 9:31 ` Patrick McHardy
2014-01-10 9:31 ` [PATCH 2/4] erec: fix error markup for errors starting at column 0 Patrick McHardy
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2014-01-10 9:31 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
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 <kaber@trash.net>
---
src/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
index 32a991a..e8be423 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;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] erec: fix error markup for errors starting at column 0
2014-01-10 9:31 [PATCH 0/4] nftables: bug fixes and minor cleanups Patrick McHardy
2014-01-10 9:31 ` [PATCH 1/4] nftables: shorten "could not process rule in batch" message Patrick McHardy
@ 2014-01-10 9:31 ` Patrick McHardy
2014-01-10 9:31 ` [PATCH 3/4] datatype: revert "fix crash if wrong integer type is passed" Patrick McHardy
2014-01-10 9:31 ` [PATCH 4/4] meta: fix crash when parsing unresolvable mark values Patrick McHardy
3 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2014-01-10 9:31 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
For errors starting at column 0, we must not subtract 1 to avoid underflow.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
src/erec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/erec.c b/src/erec.c
index 7451d94..a157d2f 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);
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] datatype: revert "fix crash if wrong integer type is passed"
2014-01-10 9:31 [PATCH 0/4] nftables: bug fixes and minor cleanups Patrick McHardy
2014-01-10 9:31 ` [PATCH 1/4] nftables: shorten "could not process rule in batch" message Patrick McHardy
2014-01-10 9:31 ` [PATCH 2/4] erec: fix error markup for errors starting at column 0 Patrick McHardy
@ 2014-01-10 9:31 ` Patrick McHardy
2014-01-10 9:31 ` [PATCH 4/4] meta: fix crash when parsing unresolvable mark values Patrick McHardy
3 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2014-01-10 9:31 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
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:
<cmdline>: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 <kaber@trash.net>
---
src/datatype.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/datatype.c b/src/datatype.c
index 2e5788d..9910a1b 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);
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] meta: fix crash when parsing unresolvable mark values
2014-01-10 9:31 [PATCH 0/4] nftables: bug fixes and minor cleanups Patrick McHardy
` (2 preceding siblings ...)
2014-01-10 9:31 ` [PATCH 3/4] datatype: revert "fix crash if wrong integer type is passed" Patrick McHardy
@ 2014-01-10 9:31 ` Patrick McHardy
3 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2014-01-10 9:31 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
*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 <kaber@trash.net>
---
src/datatype.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/datatype.c b/src/datatype.c
index 9910a1b..86ea80e 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;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-10 9:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-10 9:31 [PATCH 0/4] nftables: bug fixes and minor cleanups Patrick McHardy
2014-01-10 9:31 ` [PATCH 1/4] nftables: shorten "could not process rule in batch" message Patrick McHardy
2014-01-10 9:31 ` [PATCH 2/4] erec: fix error markup for errors starting at column 0 Patrick McHardy
2014-01-10 9:31 ` [PATCH 3/4] datatype: revert "fix crash if wrong integer type is passed" Patrick McHardy
2014-01-10 9:31 ` [PATCH 4/4] meta: fix crash when parsing unresolvable mark values Patrick McHardy
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).