summaryrefslogtreecommitdiffstats
path: root/src/scanner.l
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2025-11-21 16:53:35 +0100
committerPhil Sutter <phil@nwl.cc>2026-01-20 16:02:37 +0100
commit7cab33a24a7293dc2ec4f132933ce1227d226b5b (patch)
tree017043d4b786ce08918c497a37094042fa5b6d92 /src/scanner.l
parent9e80bfd0344cc0c05004c8cd1dd13e6cfa3df446 (diff)
parser_bison: Introduce tokens for chain types
Use the already existing SCANSTATE_TYPE for keyword scoping. This is a bit of back-n-forth from string to token and back to string but it eliminates the helper function and also takes care of error handling. Note that JSON parser does not validate the type string at all but relies upon the kernel to reject wrong ones. Signed-off-by: Phil Sutter <phil@nwl.cc> Reviewed-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/scanner.l')
-rw-r--r--src/scanner.l6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/scanner.l b/src/scanner.l
index 99ace057..b397a147 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -858,6 +858,12 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"out" { return OUT; }
}
+<SCANSTATE_TYPE>{
+ "filter" { return FILTER; }
+ "nat" { return NAT; }
+ "route" { return ROUTE; }
+}
+
"secmark" { scanner_push_start_cond(yyscanner, SCANSTATE_SECMARK); return SECMARK; }
"xt" { scanner_push_start_cond(yyscanner, SCANSTATE_XT); return XT; }