[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180416.185855.2220085572245129235.davem@davemloft.net>
Date: Mon, 16 Apr 2018 18:58:55 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: roopa@...ulusnetworks.com
Cc: netdev@...r.kernel.org, dsa@...ulusnetworks.com
Subject: Re: [PATCH net-next 3/5] ipv4: support sport, dport and ip
protocol in RTM_GETROUTE
From: Roopa Prabhu <roopa@...ulusnetworks.com>
Date: Mon, 16 Apr 2018 13:41:36 -0700
> diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
> index 9b15005..7947252 100644
> --- a/include/uapi/linux/rtnetlink.h
> +++ b/include/uapi/linux/rtnetlink.h
> @@ -327,6 +327,9 @@ enum rtattr_type_t {
> RTA_PAD,
> RTA_UID,
> RTA_TTL_PROPAGATE,
> + RTA_SPORT,
> + RTA_DPORT,
> + RTA_IP_PROTO,
> __RTA_MAX
> };
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index ccb25d8..ae55711 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -2663,6 +2663,18 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, u32 table_id,
> from_kuid_munged(current_user_ns(), fl4->flowi4_uid)))
> goto nla_put_failure;
>
> + if (fl4->fl4_sport &&
> + nla_put_u16(skb, RTA_SPORT, ntohs(fl4->fl4_sport)))
> + goto nla_put_failure;
The addreeses are given over netlink in network byte order, so let's
be consistent and do the same for the ports et al. as well.
Thanks.
Powered by blists - more mailing lists