]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser: include leading '.' in concat subexpression location
authorPatrick McHardy <kaber@trash.net>
Mon, 22 Apr 2013 17:58:54 +0000 (19:58 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 22 Apr 2013 17:58:54 +0000 (19:58 +0200)
Make error messages point to the entire subexpression.

Before:

filter output ip daddr . tcp dport . tcp dport { 192.168.0.1 . ssh . ssh . ssh}
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^

After:

filter output ip daddr . tcp dport . tcp dport { 192.168.0.1 . ssh . ssh . ssh}
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^

Signed-off-by: Patrick McHardy <kaber@trash.net>
src/parser.y

index 166cbcc551820675ab6dda6dcde8dacf90a84192..ff8ca0d05af4733e4698efca26c14458f250d2e5 100644 (file)
@@ -1078,6 +1078,12 @@ concat_expr              :       basic_expr
                                        $$ = concat_expr_alloc(&@$);
                                        compound_expr_add($$, $1);
                                } else {
+                                       struct location rhs[] = {
+                                               [1]     = @2,
+                                               [2]     = @3,
+                                       };
+                                       location_update(&$3->location, rhs, 2);
+
                                        $$ = $1;
                                        $$->location = @$;
                                }