From 0fe5b29423c1ad97012a865f1cd8b4f7ff37f143 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Fri, 29 Oct 2010 00:14:34 +0200 Subject: Extended pktloc to support nbyte locations for ipv6, etc. The alignment column/field now also takes a number, specifying the length in bytes of the field described by the location --- lib/route/pktloc_syntax.y | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/route/pktloc_syntax.y') diff --git a/lib/route/pktloc_syntax.y b/lib/route/pktloc_syntax.y index bf00549..95cd6f4 100644 --- a/lib/route/pktloc_syntax.y +++ b/lib/route/pktloc_syntax.y @@ -32,7 +32,7 @@ static void yyerror(YYLTYPE *locp, void *scanner, const char *msg) %token ERROR NUMBER LAYER ALIGN %token NAME -%type mask layer +%type mask layer align %type location %destructor { free($$); } NAME @@ -47,11 +47,11 @@ input: ; location: - NAME ALIGN layer NUMBER mask + NAME align layer NUMBER mask { struct rtnl_pktloc *loc; - if (!(loc = calloc(1, sizeof(*loc)))) { + if (!(loc = rtnl_pktloc_alloc())) { NL_DBG(1, "Allocating a packet location " "object failed.\n"); YYABORT; @@ -72,6 +72,13 @@ location: } ; +align: + ALIGN + { $$ = $1; } + | NUMBER + { $$ = $1; } + ; + layer: /* empty */ { $$ = TCF_LAYER_NETWORK; } -- cgit v1.2.1