netfilter: ipset: Add wildcard support to net,iface
authorKristian Evensen <kristian.evensen@gmail.com>
Thu, 26 Sep 2019 10:06:45 +0000 (12:06 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Mon, 4 Nov 2019 19:44:17 +0000 (20:44 +0100)
commitb6520fce073b619e6f2c0d510bb3481c9386c70b
tree452a6fe396a644fce6690628d8e08993f310074e
parentd5a721c96a4411d3f35545b694fc9794fbbfc98e
netfilter: ipset: Add wildcard support to net,iface

The net,iface equal functions currently compares the full interface
names. In several cases, wildcard (or prefix) matching is useful. For
example, when converting a large iptables rule-set to make use of ipset,
I was able to significantly reduce the number of set elements by making
use of wildcard matching.

Wildcard matching is enabled by adding "wildcard" when adding an element
to a set. Internally, this causes the IPSET_FLAG_IFACE_WILDCARD-flag to
be set.  When this flag is set, only the initial part of the interface
name is used for comparison.

Wildcard matching is done per element and not per set, as there are many
cases where mixing wildcard and non-wildcard elements are useful. This
means that is up to the user to handle (avoid) overlapping interface
names.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
include/uapi/linux/netfilter/ipset/ip_set.h
net/netfilter/ipset/ip_set_hash_netiface.c