-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firewall: T4694: Adding GRE flags & fields matches to firewall rules
* Only matching flags and fields used by modern RFC2890 "extended GRE" - this is backwards-compatible, but does not match all possible flags. * There are no nftables helpers for the GRE key field, which is critical to match individual tunnel sessions (more detail in the forum post) * nft expression syntax is not flexible enough for multiple field matches in a single rule and the key offset changes depending on flags. * Thus, clumsy compromise in requiring an explicit match on the "checksum" flag if a key is present, so we know where key will be. In most cases, nobody uses the checksum, but assuming it to be off or automatically adding a "not checksum" match unless told otherwise would be confusing * The automatic "flags key" check when specifying a key doesn't have similar validation, I added it first and it makes sense. I would still like to find a workaround to the "checksum" offset problem. * If we could add 2 rules from 1 config definition, we could match both cases with appropriate offsets, but this would break existing FW generation logic, logging, etc. * Added a "test_gre_match" smoketest
- Loading branch information
Showing
5 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<!-- include start from firewall/gre.xml.i --> | ||
<node name="gre"> | ||
<properties> | ||
<help>GRE fields to match</help> | ||
</properties> | ||
<children> | ||
<node name="flags"> | ||
<properties> | ||
<help>GRE flag bits to match</help> | ||
</properties> | ||
<children> | ||
<node name="key"> | ||
<properties> | ||
<help>Header includes optional key field</help> | ||
</properties> | ||
<children> | ||
<leafNode name="unset"> | ||
<properties> | ||
<help>Header does not include optional key field</help> | ||
<valueless/> | ||
</properties> | ||
</leafNode> | ||
</children> | ||
</node> | ||
<node name="checksum"> | ||
<properties> | ||
<help>Header includes optional checksum</help> | ||
</properties> | ||
<children> | ||
<leafNode name="unset"> | ||
<properties> | ||
<help>Header does not include optional checksum</help> | ||
<valueless/> | ||
</properties> | ||
</leafNode> | ||
</children> | ||
</node> | ||
<node name="sequence"> | ||
<properties> | ||
<help>Header includes a sequence number field</help> | ||
</properties> | ||
<children> | ||
<leafNode name="unset"> | ||
<properties> | ||
<help>Header does not include a sequence number field</help> | ||
<valueless/> | ||
</properties> | ||
</leafNode> | ||
</children> | ||
</node> | ||
</children> | ||
</node> | ||
<leafNode name="inner-proto"> | ||
<properties> | ||
<help>EtherType of encapsulated packet</help> | ||
<completionHelp> | ||
<list>ip ip6 arp 802.1q 802.1ad</list> | ||
</completionHelp> | ||
<valueHelp> | ||
<format>u32:0-65535</format> | ||
<description>Ethernet protocol number</description> | ||
</valueHelp> | ||
<valueHelp> | ||
<format>u32:0x0-0xFFFF</format> | ||
<description>Ethernet protocol number (hex)</description> | ||
</valueHelp> | ||
<valueHelp> | ||
<format>ip</format> | ||
<description>IPv4</description> | ||
</valueHelp> | ||
<valueHelp> | ||
<format>ip6</format> | ||
<description>IPv6</description> | ||
</valueHelp> | ||
<valueHelp> | ||
<format>arp</format> | ||
<description>Address Resolution Protocol</description> | ||
</valueHelp> | ||
<valueHelp> | ||
<format>802.1q</format> | ||
<description>VLAN-tagged frames (IEEE 802.1q)</description> | ||
</valueHelp> | ||
<valueHelp> | ||
<format>802.1ad</format> | ||
<description>Provider Bridging (IEEE 802.1ad, Q-in-Q)</description> | ||
</valueHelp> | ||
<valueHelp> | ||
<format>gretap</format> | ||
<description>Transparent Ethernet Bridging (L2 Ethernet over GRE, gretap)</description> | ||
</valueHelp> | ||
<constraint> | ||
<regex>(ip|ip6|arp|802.1q|802.1ad|gretap|\d+|0x[0-9a-fA-F]+)</regex> | ||
</constraint> | ||
</properties> | ||
</leafNode> | ||
<leafNode name="key"> | ||
<properties> | ||
<help>Tunnel key</help> | ||
<valueHelp> | ||
<format>u32</format> | ||
<description>Tunnel key ID</description> | ||
</valueHelp> | ||
<constraint> | ||
<validator name="numeric" /> | ||
</constraint> | ||
</properties> | ||
</leafNode> | ||
<leafNode name="version"> | ||
<properties> | ||
<help>GRE Version</help> | ||
<valueHelp> | ||
<format>gre</format> | ||
<description>Standard GRE</description> | ||
</valueHelp> | ||
<valueHelp> | ||
<format>pptp</format> | ||
<description>Point to Point Tunnelling Protocol</description> | ||
</valueHelp> | ||
<constraint> | ||
<regex>(gre|pptp)</regex> | ||
</constraint> | ||
</properties> | ||
</leafNode> | ||
</children> | ||
</node> | ||
<!-- include end --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters