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: <CAPWQB7H_O_L2_Jfewb4UuBoh+fst64cmJqdh2KtjHYoZeC4t+A@mail.gmail.com>
Date:   Tue, 1 Nov 2016 20:50:10 -0700
From:   Joe Stringer <joe@....org>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     netdev <netdev@...r.kernel.org>, wangnan0@...wei.com, ast@...com
Subject: Re: [PATCH net-next 2/3] tools lib bpf: Sync with samples/bpf/libbpf

On 1 November 2016 at 19:52, Daniel Borkmann <daniel@...earbox.net> wrote:
> On 10/31/2016 07:39 PM, Joe Stringer wrote:
>>
>> Extend the tools/ version of libbpf to include all of the functionality
>> provided in the samples/bpf version.
>>
>> Signed-off-by: Joe Stringer <joe@....org>
>> ---
>>   tools/lib/bpf/bpf.c    | 139 +++++++++++++++++++++++++++------
>>   tools/lib/bpf/bpf.h    | 208
>> +++++++++++++++++++++++++++++++++++++++++++++++--
>>   tools/lib/bpf/libbpf.c |   3 +-
>>   3 files changed, 317 insertions(+), 33 deletions(-)
>>
> [...]
>
>> +int open_raw_sock(const char *name)
>> +{
>> +       struct sockaddr_ll sll;
>> +       int sock;
>> +
>> +       sock = socket(PF_PACKET, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC,
>> +                     htons(ETH_P_ALL));
>> +       if (sock < 0) {
>> +               printf("cannot create raw socket\n");
>> +               return -1;
>> +       }
>> +
>> +       memset(&sll, 0, sizeof(sll));
>> +       sll.sll_family = AF_PACKET;
>> +       sll.sll_ifindex = if_nametoindex(name);
>> +       sll.sll_protocol = htons(ETH_P_ALL);
>> +       if (bind(sock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
>> +               printf("bind to %s: %s\n", name, strerror(errno));
>> +               close(sock);
>> +               return -1;
>> +       }
>> +
>> +       return sock;
>> +}
>> +
>> +int perf_event_open(struct perf_event_attr *attr, int pid, int cpu,
>> +                   int group_fd, unsigned long flags)
>> +{
>> +       return syscall(__NR_perf_event_open, attr, pid, cpu,
>> +                      group_fd, flags);
>>   }
>
>
> I'm actually wondering, above bits are not really libbpf related. Maybe
> these should go elsewhere into some other misc header file just for the
> samples to use?

True, I started this patch by just copying the whole file over to
tools/lib/bpf so this came with it. I can bring it back to the samples
directory in v2.

>> diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
>> index e8ba54087497..227edb23c022 100644
>> --- a/tools/lib/bpf/bpf.h
>> +++ b/tools/lib/bpf/bpf.h
>> @@ -23,16 +23,208 @@
>>
>>   #include <linux/bpf.h>
>>
>> +struct bpf_insn;
>> +
>
>
> Isn't that already defined in the above uapi bpf.h anyway?

Yup, I'll drop this bit.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ