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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL+tcoDKxNbhLTtL7i4WNGzEJxB1h1rAvYvmSvapnZjmdO=QuQ@mail.gmail.com>
Date: Thu, 13 Feb 2025 11:14:45 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: andrii@...nel.org, ast@...nel.org, bpf@...r.kernel.org, 
	daniel@...earbox.net, davem@...emloft.net, dsahern@...nel.org, 
	eddyz87@...il.com, edumazet@...gle.com, haoluo@...gle.com, horms@...nel.org, 
	john.fastabend@...il.com, jolsa@...nel.org, kpsingh@...nel.org, 
	kuba@...nel.org, martin.lau@...ux.dev, ncardwell@...gle.com, 
	netdev@...r.kernel.org, pabeni@...hat.com, sdf@...ichev.me, song@...nel.org, 
	yonghong.song@...ux.dev
Subject: Re: [PATCH net-next 2/3] bpf: add TCP_BPF_RTO_MAX for bpf_setsockopt

On Thu, Feb 13, 2025 at 10:32 AM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> From: Kuniyuki Iwashima <kuniyu@...zon.com>
> Date: Thu, 13 Feb 2025 11:25:01 +0900
> > > diff --git a/net/core/filter.c b/net/core/filter.c
> > > index 2ec162dd83c4..a21a147e0a86 100644
> > > --- a/net/core/filter.c
> > > +++ b/net/core/filter.c
> > > @@ -5303,6 +5303,12 @@ static int bpf_sol_tcp_setsockopt(struct sock *sk, int optname,
> > >                     return -EINVAL;
> > >             tp->bpf_sock_ops_cb_flags = val;
> > >             break;
> > > +   case TCP_BPF_RTO_MAX:
> > > +           if (val > TCP_RTO_MAX_SEC * MSEC_PER_SEC ||
> > > +               val < TCP_RTO_MAX_MIN_SEC * MSEC_PER_SEC)
> > > +                   return -EINVAL;
> > > +           inet_csk(sk)->icsk_rto_max = msecs_to_jiffies(val);
> > > +           break;
> > >     default:
> > >             return -EINVAL;
> > >     }
> >
> > You need not define TCP_BPF_RTO_MAX because TCP_RTO_MAX is not a
> > BPF specific option, and you can just reuse do_tcp_setsockopt(),
> > then bpf_getsockopt() also works.
> >
> > ---8<---
> > diff --git a/net/core/filter.c b/net/core/filter.c
> > index 2ec162dd83c4..77732f10097c 100644
> > --- a/net/core/filter.c
> > +++ b/net/core/filter.c
> > @@ -5382,6 +5382,7 @@ static int sol_tcp_sockopt(struct sock *sk, int optname,
> >       case TCP_USER_TIMEOUT:
> >       case TCP_NOTSENT_LOWAT:
> >       case TCP_SAVE_SYN:
> > +     case TCP_RTO_MAX:
>
> s/TCP_RTO_MAX/TCP_RTO_MAX_MS/ :)

Thanks for spotting this simpler approach. It works.

Thanks,
Jason

>
>
> >               if (*optlen != sizeof(int))
> >                       return -EINVAL;
> >               break;
> > ---8<---

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ