Skip to contentSkip to conversation

scanner: add aliases to symbols for easier interaction with most shells

PATCH In review Pablo Neira Ayuso 1 participant 2 messages Jan 14, 2014 – Jan 15, 2014 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 scanner: add aliases to symbols for easier interaction with most shells

These symbols need to be escaped in bash and if you use them without escaping then, it can lead to confusion. This patch adds nominal aliases, eg.

nft add rule filter output meta mark and 0x3 eq 0x1

as an alternative to:

nft add rule filter output meta mark \& 0x3 == 0x1

---
 src/scanner.l |   12 ++++++++++++
 1 file changed, 12 insertions(+)
src/scanner.l +12 -0
index ee71492..50e24a4 100644
@@ -182,11 +182,17 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 %%
 
 "=="			{ return EQ; }
+"eq"			{ return EQ; }
 "!="			{ return NEQ; }
+"ne"			{ return NEQ; }
 "<="			{ return LTE; }
+"le"			{ return LTE; }
 "<"			{ return LT; }
+"lt"			{ return LT; }
 ">="			{ return GTE; }
+"ge"			{ return GTE; }
 ">"			{ return GT; }
+"gt"			{ return GT; }
 ","			{ return COMMA; }
 "."			{ return DOT; }
 ":"			{ return COLON; }
@@ -198,11 +204,17 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 "("			{ return '('; }
 ")"			{ return ')'; }
 "<<"			{ return LSHIFT; }
+"lshift"		{ return LSHIFT; }
 ">>"			{ return RSHIFT; }
+"rshift"		{ return RSHIFT; }
 "^"			{ return CARET; }
+"xor"			{ return CARET; }
 "&"			{ return AMPERSAND; }
+"and"			{ return AMPERSAND; }
 "|"			{ return '|'; }
+"or"			{ return '|'; }
 "!"			{ return NOT; }
+"not"			{ return NOT; }
 "/"			{ return SLASH; }
 "-"			{ return DASH; }
 "*"			{ return ASTERISK; }
Signature · 1 line
1.7.10.4
author maintainer
#1 lore raw
Quoted 9 lines · Pablo Neira Ayuso

These symbols need to be escaped in bash and if you use them without escaping then, it can lead to confusion. This patch adds nominal aliases, eg.

nft add rule filter output meta mark and 0x3 eq 0x1

as an alternative to:

nft add rule filter output meta mark \& 0x3 == 0x1

Just pushed this patch.