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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210830194545.rgwg3ks3alikeyzx@ast-mbp.dhcp.thefacebook.com>
Date:   Mon, 30 Aug 2021 12:45:45 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Dmitrii Banshchikov <me@...que.spb.ru>
Cc:     bpf@...r.kernel.org, ast@...nel.org, davem@...emloft.net,
        daniel@...earbox.net, andrii@...nel.org, kafai@...com,
        songliubraving@...com, yhs@...com, john.fastabend@...il.com,
        kpsingh@...nel.org, netdev@...r.kernel.org, rdna@...com
Subject: Re: [PATCH bpf-next v2 12/13] bpfilter: Add filter table

On Sun, Aug 29, 2021 at 10:36:07PM +0400, Dmitrii Banshchikov wrote:
>  /*
> - * # Generated by iptables-save v1.8.2 on Sat May  8 05:22:41 2021
> + *  Generated by iptables-save v1.8.2 on Sat May  8 05:22:41 2021
>   * *filter
...
> - * -A LOCAL -s 10.32.0.0/11 -j FROMDC
> - * -A LOCAL -s 10.144.0.0/12 -j FROMDC
> - * -A LOCAL -s 10.160.0.0/12 -j FROMDC
> - * -A LOCAL -s 10.0.0.0/12 -j FROMDC
> - * -A LOCAL -s 10.248.0.0/24 -j FROMDC
> - * -A LOCAL -s 10.232.0.0/16 -j FROMDC
> - * -A LOCAL -s 10.1.146.131/32 -p udp -m udp --dport 161 -j ACCEPT
> - * -A LOCAL -s 10.149.118.14/32 -p udp -m udp --dport 161 -j ACCEPT
> - * -A LOCAL -p icmp -j ACCEPT
> + * :INPUT ACCEPT [0:0]
> + * :FORWARD ACCEPT [0:0]
> + * :OUTPUT ACCEPT [0:0]
> + * -A INPUT -s 1.1.1.1/32 -d 2.2.2.2/32 -j DROP
> + * -A INPUT -s 2.2.0.0/16 -d 3.0.0.0/8 -j DROP
> + * -A INPUT -p udp -m udp --sport 100 --dport 500 -j DROP
>   * COMMIT
>   */

Patch 10 adds this test, but then patch 12 removes most of it?
Keep both?

Also hit this on my system with older glibc:

../net/bpfilter/codegen.c: In function ‘codegen_push_subprog’:
../net/bpfilter/codegen.c:67:4: warning: implicit declaration of function ‘reallocarray’ [-Wimplicit-function-declaration]
   67 |    reallocarray(codegen->subprogs, subprogs_max, sizeof(codegen->subprogs[0]));
      |    ^~~~~~~~~~~~
../net/bpfilter/codegen.c:66:12: warning: assignment to ‘struct codegen_subprog_desc **’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   66 |   subprogs =
      |            ^

In libbpf we have libbpf_reallocarray() for this reason.

Could you provide an example of generated bpf program?
And maybe add Documentation/bpf/bpfilter_design.rst ?

The tests don't build for me:
$ cd selftests/bpf/bpfilter; make
make: *** No rule to make target '-lelf', needed by '.../selftests/bpf/bpfilter/test_match'.  Stop.

The unit tests are great, btw. test_codegen is not end-to-end, right?
Could you add a full test with iptable command line?
or netns support is a prerequisite for it?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ