diff options
author | Thomas GraF <tgraf@suug.ch> | 2010-11-04 19:01:36 (GMT) |
---|---|---|
committer | Thomas GraF <tgraf@suug.ch> | 2010-11-04 19:01:36 (GMT) |
commit | 59880cb01e0609f64bf004f8226541646b652cec (patch) | |
tree | 68c4d7efd722fdd5b48d56c21eeed08f319ad5fc /lib | |
parent | d283c8e889a64771ff4d42a56c1ce64fa3395ed8 (diff) | |
download | libnl-59880cb01e0609f64bf004f8226541646b652cec.zip libnl-59880cb01e0609f64bf004f8226541646b652cec.tar.gz libnl-59880cb01e0609f64bf004f8226541646b652cec.tar.bz2 |
pktloc: support to specify a shift operator for packet locations
no users yet though.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/route/pktloc.c | 5 | ||||
-rw-r--r-- | lib/route/pktloc_syntax.y | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/route/pktloc.c b/lib/route/pktloc.c index b5e5b77..823a3c7 100644 --- a/lib/route/pktloc.c +++ b/lib/route/pktloc.c @@ -222,8 +222,9 @@ int rtnl_pktloc_add(struct rtnl_pktloc *loc) } NL_DBG(2, "New packet location entry \"%s\" align=%u layer=%u " - "offset=%u mask=%#x refnt=%u\n", loc->name, loc->align, - loc->layer, loc->offset, loc->mask, loc->refcnt); + "offset=%u mask=%#x shift=%u refnt=%u\n", + loc->name, loc->align, loc->layer, loc->offset, + loc->mask, loc->shift, loc->refcnt); nl_list_add_tail(&loc->list, &pktloc_name_ht[pktloc_hash(loc->name)]); diff --git a/lib/route/pktloc_syntax.y b/lib/route/pktloc_syntax.y index 95cd6f4..4a2ce48 100644 --- a/lib/route/pktloc_syntax.y +++ b/lib/route/pktloc_syntax.y @@ -13,6 +13,7 @@ %parse-param {void *scanner} %lex-param {void *scanner} +%expect 1 %union { struct rtnl_pktloc *l; @@ -32,7 +33,7 @@ static void yyerror(YYLTYPE *locp, void *scanner, const char *msg) %token <i> ERROR NUMBER LAYER ALIGN %token <s> NAME -%type <i> mask layer align +%type <i> mask layer align shift %type <l> location %destructor { free($$); } NAME @@ -47,7 +48,7 @@ input: ; location: - NAME align layer NUMBER mask + NAME align layer NUMBER mask shift { struct rtnl_pktloc *loc; @@ -62,6 +63,7 @@ location: loc->layer = $3; loc->offset = $4; loc->mask = $5; + loc->shift = $6; if (rtnl_pktloc_add(loc) < 0) { NL_DBG(1, "Duplicate packet location entry " @@ -92,3 +94,10 @@ mask: | NUMBER { $$ = $1; } ; + +shift: + /* empty */ + { $$ = 0; } + | NUMBER + { $$ = $1; } + ; |