From 056aaa3e6dc65aced5e552233ac3e7f89fb81f86 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 21 Jun 2018 14:01:13 +0200 Subject: netlink_delinearize: Refactor meta_may_dependency_kill() The original intent was to fix a bug: The following rule in inet table: | meta nfproto ipv4 icmpv6 type echo-reply Was added correctly but when printing the meta match was falsely removed. The fix is to deny dependency killing if RHS family of nfproto match doesn't match RHS family of l4proto match. Adding this to the already large conditional led to even more unreadable code, therefore this patch tries to clean that up (and also removes the partial code duplication. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- tests/py/inet/icmp.t | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/py/inet/icmp.t (limited to 'tests/py/inet/icmp.t') diff --git a/tests/py/inet/icmp.t b/tests/py/inet/icmp.t new file mode 100644 index 00000000..9014f846 --- /dev/null +++ b/tests/py/inet/icmp.t @@ -0,0 +1,18 @@ +:output;type filter hook output priority 0 + +*inet;test-inet;output + +# without nfproto specified, these should add an implicit dependency on +# the likely l3 proto (i.e., IPv6 for icmpv6 and IPv4 for icmp) + +icmp type echo-request;ok +icmpv6 type echo-request;ok + +# make sure only those nfproto matches are dropped if +# the next statement would add it as a dependency anyway + +meta nfproto ipv4 icmp type echo-request;ok;icmp type echo-request +meta nfproto ipv4 icmpv6 type echo-request;ok + +meta nfproto ipv6 icmp type echo-request;ok +meta nfproto ipv6 icmpv6 type echo-request;ok;icmpv6 type echo-request -- cgit v1.2.3