From: Roopa Prabhu <ro...@cumulusnetworks.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.

Reply via email to