Re: [PATCH bpf-next 2/2] selftests/bpf: Ensure cgroup/connect{4,6} programs can bind unpriv ICMP ping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 2, 2022 at 4:52 PM YiFei Zhu <zhuyifei@xxxxxxxxxx> wrote:
>
> On Thu, Sep 1, 2022 at 10:55 PM Martin KaFai Lau <kafai@xxxxxx> wrote:
> >
> > On Thu, Sep 01, 2022 at 07:15:10PM +0000, YiFei Zhu wrote:
> > > diff --git a/tools/testing/selftests/bpf/prog_tests/connect_ping.c b/tools/testing/selftests/bpf/prog_tests/connect_ping.c
> > > new file mode 100644
> > > index 0000000000000..99b1a2f0c4921
> > > --- /dev/null
> > > +++ b/tools/testing/selftests/bpf/prog_tests/connect_ping.c
> > > @@ -0,0 +1,318 @@
> > > +// SPDX-License-Identifier: GPL-2.0-only
> > > +
> > > +/*
> > > + * Copyright 2022 Google LLC.
> > > + */
> > > +
> > > +#define _GNU_SOURCE
> > > +#include <sys/mount.h>
> > > +
> > > +#include <test_progs.h>
> > > +#include <cgroup_helpers.h>
> > > +#include <network_helpers.h>
> > > +
> > > +#include "connect_ping.skel.h"
> > > +
> > > +/* 2001:db8::1 */
> > > +#define BINDADDR_V6 { { { 0x20,0x01,0x0d,0xb8,0,0,0,0,0,0,0,0,0,0,0,1 } } }
> > > +const struct in6_addr bindaddr_v6 = BINDADDR_V6;
> > static
>
> ack.
>
> > > +
> > > +static bool write_sysctl(const char *sysctl, const char *value)
> > This has been copied >2 times now which probably shows it will
> > also be useful in the future.
> > Take this chance to move it to testing_helpers.{h,c}.
>
> ack.

I changed it to test_progs.c because this helper uses CHECK which is
provided by test_progs.h, and testing_helpers.c seems to be used
elsewhere (non-test_progs) too. Lmk if this is not a good alternative.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux