Skip to contentSkip to conversation

parser: fix ether keyword clash

PATCH New Patrick McHardy 1 participant 1 message Apr 11, 2014 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parser: fix ether keyword clash

Due to the renaming of the "eth" keyword to "ether", parsing of arphrd type "ether" fails.

Fix similar to TCP, UDP etc by allocating a constant arphrd expression for the ether keyword without a following key.

---
 src/parser.y | 7 +++++++
 1 file changed, 7 insertions(+)
src/parser.y +7 -0
index af34857..de5c0ed 100644
@@ -1639,6 +1639,13 @@ eth_hdr_expr		:	ETHER	eth_hdr_field
 			{
 				$$ = payload_expr_alloc(&@$, &proto_eth, $2);
 			}
+			|	ETHER
+			{
+				uint16_t data = ARPHRD_ETHER;
+				$$ = constant_expr_alloc(&@$, &arphrd_type,
+							 BYTEORDER_BIG_ENDIAN,
+							 sizeof(data) * BITS_PER_BYTE, &data);
+			}
 			;
 
 eth_hdr_field		:	SADDR		{ $$ = ETHHDR_SADDR; }
Signature · 1 line
1.9.0