Skip to content

Commit eacb938

Browse files
roopa-prabhudavem330
authored andcommitted
ipv6: support sport, dport and ip_proto in RTM_GETROUTE
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 <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 404eb77 commit eacb938

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

net/ipv6/route.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include <net/lwtunnel.h>
6464
#include <net/ip_tunnels.h>
6565
#include <net/l3mdev.h>
66+
#include <net/ip.h>
6667
#include <trace/events/fib6.h>
6768

6869
#include <linux/uaccess.h>
@@ -4083,6 +4084,9 @@ static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
40834084
[RTA_UID] = { .type = NLA_U32 },
40844085
[RTA_MARK] = { .type = NLA_U32 },
40854086
[RTA_TABLE] = { .type = NLA_U32 },
4087+
[RTA_IP_PROTO] = { .type = NLA_U8 },
4088+
[RTA_SPORT] = { .type = NLA_U16 },
4089+
[RTA_DPORT] = { .type = NLA_U16 },
40864090
};
40874091

40884092
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,
47954799
else
47964800
fl6.flowi6_uid = iif ? INVALID_UID : current_uid();
47974801

4802+
if (tb[RTA_SPORT])
4803+
fl6.fl6_sport = nla_get_be16(tb[RTA_SPORT]);
4804+
4805+
if (tb[RTA_DPORT])
4806+
fl6.fl6_dport = nla_get_be16(tb[RTA_DPORT]);
4807+
4808+
if (tb[RTA_IP_PROTO]) {
4809+
err = rtm_getroute_parse_ip_proto(tb[RTA_IP_PROTO],
4810+
&fl6.flowi6_proto, extack);
4811+
if (err)
4812+
goto errout;
4813+
}
4814+
47984815
if (iif) {
47994816
struct net_device *dev;
48004817
int flags = 0;

0 commit comments

Comments
 (0)