From d1dfc01a4068e3c15a1195f804448a9a3dee5b2b Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Mon, 8 Feb 2016 08:01:53 +0200 Subject: trafgen: parser: Add syntax for MPLS header creating Add 'mpls()' function for creating MPLS header with parameters: lbl|label MPLS label last Indicates the last label on MPLS stack tc|tclass|exp Traffic Class (TC) ttl TTL (Time To Live) Currently only unicast MPLS is supported, but multicast might be set via 'eth()' function. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen_lexer.l | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'trafgen_lexer.l') diff --git a/trafgen_lexer.l b/trafgen_lexer.l index e1d1a3f..3c624f8 100644 --- a/trafgen_lexer.l +++ b/trafgen_lexer.l @@ -120,6 +120,12 @@ ip4_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) "1ad" { return K_1AD; } "1q" { return K_1Q; } + /* MPLS (Multi Protocol Label Switching) */ +"lbl"|"label" { return K_LABEL; } +"last" { return K_LAST; } +"tc"|"tclass" { return K_TC; } +"exp" { return K_EXP; } + /* ARP */ "sha"|"smac" { return K_SHA; } "spa"|"sip" { return K_SPA; } @@ -167,6 +173,7 @@ ip4_addr ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) "eth" { return K_ETH; } "vlan" { return K_VLAN; } +"mpls" { return K_MPLS; } "arp" { return K_ARP; } "ip4"|"ipv4" { return K_IP4; } "udp" { return K_UDP; } -- cgit v1.2.3-54-g00ecf