lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 11 Dec 2020 21:35:56 -0800
From:   Pravin Shelar <pravin.ovn@...il.com>
To:     Jonas Bonn <jonas@...rbonn.se>
Cc:     Linux Kernel Network Developers <netdev@...r.kernel.org>,
        Pablo Neira Ayuso <pablo@...filter.org>, laforge@...monks.org
Subject: Re: [PATCH net-next v2 07/12] gtp: use ephemeral source port

On Fri, Dec 11, 2020 at 4:29 AM Jonas Bonn <jonas@...rbonn.se> wrote:
>
> All GTP traffic is currently sent from the same source port.  This makes
> everything look like one big flow which is difficult to balance across
> network resources.
>
> From 3GPP TS 29.281:
> "...the UDP Source Port or the Flow Label field... should be set dynamically
> by the sending GTP-U entity to help balancing the load in the transport
> network."
>
> Signed-off-by: Jonas Bonn <jonas@...rbonn.se>
> ---
>  drivers/net/gtp.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
> index 4a3a52970856..236ebbcb37bf 100644
> --- a/drivers/net/gtp.c
> +++ b/drivers/net/gtp.c
> @@ -477,7 +477,7 @@ static int gtp_xmit_ip4(struct sk_buff *skb, struct net_device *dev)
>         __be32 saddr;
>         struct iphdr *iph;
>         int headroom;
> -       __be16 port;
> +       __be16 sport, port;
>         int r;
>
>         /* Read the IP destination address and resolve the PDP context.
> @@ -527,6 +527,10 @@ static int gtp_xmit_ip4(struct sk_buff *skb, struct net_device *dev)
>                 return -EMSGSIZE;
>         }
>
> +       sport = udp_flow_src_port(sock_net(pctx->sk), skb,
> +                       0, USHRT_MAX,
> +                       true);
> +
why use_eth is true for this is L3 GTP devices, Am missing something?

>         /* Ensure there is sufficient headroom. */
>         r = skb_cow_head(skb, headroom);
>         if (unlikely(r))
> @@ -545,7 +549,7 @@ static int gtp_xmit_ip4(struct sk_buff *skb, struct net_device *dev)
>                             iph->tos,
>                             ip4_dst_hoplimit(&rt->dst),
>                             0,
> -                           port, port,
> +                           sport, port,
>                             !net_eq(sock_net(pctx->sk),
>                                     dev_net(pctx->dev)),
>                             false);
> --
> 2.27.0
>

Powered by blists - more mailing lists