History

netfilter: nf_tables: Introduce NFTA_DEVICE_PREFIX

This new attribute is supposed to be used instead of NFTA_DEVICE_NAME for simple wildcard interface specs. It holds a NUL-terminated string representing an interface name prefix to match on. While kernel code to distinguish full names from prefixes in NFTA_DEVICE_NAME is simpler than this solution, reusing the existing attribute with different semantics leads to confusion between different versions of kernel and user space though: * With old kernels, wildcards submitted by user space are accepted yet silently treated as regular names. * With old user space, wildcards submitted by kernel may cause crashes since libnftnl expects NUL-termination when there is none. Using a distinct attribute type sanitizes these situations as the receiving part detects and rejects the unexpected attribute nested in *_HOOK_DEVS attributes.

Phil Sutter committed 1 year ago

Commit 4039ce71 parent 661a4f32 files · +33 −11Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/netfilter/nf_tables.h+2−0
@@ -1784,10 +1784,12 @@ enum nft_synproxy_attributes { · 1783 unmodified lines
17841784 * enum nft_device_attributes - nf_tables device netlink attributes
17851785 *
17861786 * @NFTA_DEVICE_NAME: name of this device (NLA_STRING)
1787+ * @NFTA_DEVICE_PREFIX: device name prefix, a simple wildcard (NLA_STRING)
17871788 */
17881789 enum nft_devices_attributes {
17891790 NFTA_DEVICE_UNSPEC,
17901791 NFTA_DEVICE_NAME,
1792+ NFTA_DEVICE_PREFIX,
17911793 __NFTA_DEVICE_MAX
17921794 };
17931795 #define NFTA_DEVICE_MAX (__NFTA_DEVICE_MAX - 1)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t