From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roopa Prabhu Subject: [PATCH net-next v5 2/3] ipv6: support sport, dport and ip_proto in RTM_GETROUTE Date: Tue, 22 May 2018 14:03:28 -0700 Message-ID: <1527023009-13609-3-git-send-email-roopa@cumulusnetworks.com> References: <1527023009-13609-1-git-send-email-roopa@cumulusnetworks.com> Cc: netdev@vger.kernel.org, nikolay@cumulusnetworks.com, dsa@cumulusnetworks.com, idosch@mellanox.com, eric.dumazet@gmail.com To: davem@davemloft.net Return-path: Received: from mail-pl0-f65.google.com ([209.85.160.65]:35849 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752832AbeEVVDg (ORCPT ); Tue, 22 May 2018 17:03:36 -0400 Received: by mail-pl0-f65.google.com with SMTP id v24-v6so11622188plo.3 for ; Tue, 22 May 2018 14:03:36 -0700 (PDT) In-Reply-To: <1527023009-13609-1-git-send-email-roopa@cumulusnetworks.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Roopa Prabhu This is a followup to fib6 rules sport, dport and ipproto match support. Only supports tcp, udp and icmp for ipproto. Used by fib rule self tests. Signed-off-by: Roopa Prabhu --- net/ipv6/route.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index bcb8785..038d661 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -63,6 +63,7 @@ #include #include #include +#include #include #include @@ -4083,6 +4084,9 @@ static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { [RTA_UID] = { .type = NLA_U32 }, [RTA_MARK] = { .type = NLA_U32 }, [RTA_TABLE] = { .type = NLA_U32 }, + [RTA_IP_PROTO] = { .type = NLA_U8 }, + [RTA_SPORT] = { .type = NLA_U16 }, + [RTA_DPORT] = { .type = NLA_U16 }, }; static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, @@ -4795,6 +4799,19 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, else fl6.flowi6_uid = iif ? INVALID_UID : current_uid(); + if (tb[RTA_SPORT]) + fl6.fl6_sport = nla_get_be16(tb[RTA_SPORT]); + + if (tb[RTA_DPORT]) + fl6.fl6_dport = nla_get_be16(tb[RTA_DPORT]); + + if (tb[RTA_IP_PROTO]) { + err = rtm_getroute_parse_ip_proto(tb[RTA_IP_PROTO], + &fl6.flowi6_proto, extack); + if (err) + goto errout; + } + if (iif) { struct net_device *dev; int flags = 0; -- 2.1.4