summaryrefslogtreecommitdiffstats
path: root/lib/route/pktloc_syntax.y
diff options
context:
space:
mode:
Diffstat (limited to 'lib/route/pktloc_syntax.y')
-rw-r--r--lib/route/pktloc_syntax.y13
1 files changed, 10 insertions, 3 deletions
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 <i> ERROR NUMBER LAYER ALIGN
%token <s> NAME
-%type <i> mask layer
+%type <i> mask layer align
%type <l> 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; }