From: David Ahern Date: Fri, 4 Jan 2019 20:22:47 +0000 (-0800) Subject: Merge branch 'iproute2-master' into iproute2-next X-Git-Tag: v5.0.0~36^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfa2c3787ff7e1509739561a7c13e585a6db2f9b;p=thirdparty%2Fiproute2.git Merge branch 'iproute2-master' into iproute2-next Conflicts: ip/iprule.c Signed-off-by: David Ahern --- dfa2c3787ff7e1509739561a7c13e585a6db2f9b diff --cc ip/iprule.c index 6af71cab6,9a7173d00..2f58d8c2a --- a/ip/iprule.c +++ b/ip/iprule.c @@@ -177,39 -175,18 +178,51 @@@ static bool filter_nlmsg(struct nlmsghd return false; } + if (filter.ipproto) { + __u8 ipproto = 0; + + if (tb[FRA_IP_PROTO]) + ipproto = rta_getattr_u8(tb[FRA_IP_PROTO]); + if (filter.ipproto != ipproto) + return false; + } + + if (filter.sport.start) { + const struct fib_rule_port_range *r; + + if (!tb[FRA_SPORT_RANGE]) + return false; + + r = RTA_DATA(tb[FRA_SPORT_RANGE]); + if (r->start != filter.sport.start || + r->end != filter.sport.end) + return false; + } + + if (filter.dport.start) { + const struct fib_rule_port_range *r; + + if (!tb[FRA_DPORT_RANGE]) + return false; + + r = RTA_DATA(tb[FRA_DPORT_RANGE]); + if (r->start != filter.dport.start || + r->end != filter.dport.end) + return false; + } + + if (filter.tun_id) { + __u64 tun_id = 0; + + if (tb[FRA_TUN_ID]) { + tun_id = ntohll(rta_getattr_u64(tb[FRA_TUN_ID])); + if (filter.tun_id != tun_id) + return false; + } else { + return false; + } + } + table = frh_get_table(frh, tb); if (filter.tb > 0 && filter.tb ^ table) return false;