summaryrefslogtreecommitdiff
path: root/lib/route/pktloc_syntax.y
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-10-29 00:14:34 +0200
committerThomas Graf <tgraf@suug.ch>2010-10-29 00:14:34 +0200
commit0fe5b29423c1ad97012a865f1cd8b4f7ff37f143 (patch)
tree2776ab0e83cea83f4582b0f2313901a7c4c918be /lib/route/pktloc_syntax.y
parent65e386c8ba490d405f539322a12e1f1c7ea2eb5c (diff)
downloadlibnl-0fe5b29423c1ad97012a865f1cd8b4f7ff37f143.tar.gz
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
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; }