Re: [iovisor-dev] File descriptor leakage in BCC upon multiple load_func and unload_func calls

2018-03-14 Thread Mauricio Vasquez via iovisor-dev
100644 --- a/src/cc/libbpf.c +++ b/src/cc/libbpf.c @@ -408,6 +408,8 @@ int bpf_prog_compute_tag(const struct bpf_insn *insns, int prog_len, return -1; } *ptag = __builtin_bswap64(u.tag); + close(shafd); + close(shafd2); return 0; } On 03/14/2018 05:38 AM, Mauricio Vasquez via

[iovisor-dev] File descriptor leakage in BCC upon multiple load_func and unload_func calls

2018-03-13 Thread Mauricio Vasquez via iovisor-dev
Dear All, One of our applications is giving errors because there are many file descriptors open. After some debugging we found that bcc appears to be leaking file descriptors. Please considerer the following example where a very simple ebpf program is compiled and then it is loaded and unloa

Re: [iovisor-dev] handle pool of elements in eBPF maps

2018-02-28 Thread Mauricio Vasquez via iovisor-dev
Hello Teng, (Adding the list as dropped in last message) On 02/28/2018 02:37 AM, Teng Qin wrote: On Tue, Feb 27, 2018 at 12:27 PM, Mauricio Vasquez via iovisor-dev mailto:iovisor-dev@lists.iovisor.org>> wrote: Dear All, We know from our experience implementing network fun

[iovisor-dev] handle pool of elements in eBPF maps

2018-02-27 Thread Mauricio Vasquez via iovisor-dev
Dear All, We know from our experience implementing network functions in eBPF that some services require to keep pool of elements, for example addresses and ports in a NAT.  So far we haven't found a way to do it entirely in eBPF, we have implemented some workarounds as described in [1] (use an

Re: [iovisor-dev] Is this possible to attach eBPF programs to virtual interfaces?

2018-02-06 Thread Mauricio Vasquez via iovisor-dev
:1 ``` Please notice that I want to attach to veth1:1. Is that possible? Thanks, Mauricio On 02/06/2018 02:54 PM, Y Song wrote: On Tue, Feb 6, 2018 at 8:33 AM, Mauricio Vasquez via iovisor-dev wrote: Hello All, I tried to load a PROG_TYPE_SCHED_CLS eBPF program and attach it to a linux int

[iovisor-dev] Is this possible to attach eBPF programs to virtual interfaces?

2018-02-06 Thread Mauricio Vasquez via iovisor-dev
Hello All, I tried to load a PROG_TYPE_SCHED_CLS eBPF program and attach it to a linux interface, netlink fails because it is not able to find the interface. Those are the steps  I did: sudo ifconfig veth1:1 192.168.2.210/32 up ` #!/usr/bin/python # Copyright (c) PLUMgrid, Inc. # Licensed u

[iovisor-dev] How to compile C++ programs with libbcc

2017-11-22 Thread Mauricio Vasquez via iovisor-dev
Dear All, I have been using libbcc with a C++ application without problems for a while. However, when I tried this with bcc master I got some linker errors. Even with a basic example I get the same errors: test_overflow.cpp: #include #include const std::string BPF_PROGRAM1 = R"( BPF_TABLE

[iovisor-dev] multi-key eBPF map

2017-08-10 Thread Mauricio Vasquez via iovisor-dev
Dear All, We are implementing an eBPF program that uses a multi-key map, we create a structure containing all the fields used as keys. This approach works good until we perform operations on the map using all the keys, but for sure we are not able to perform operations on the map using a sub

Re: [iovisor-dev] BPF unrolled loop doesn't work and its workaround

2017-04-18 Thread Mauricio Vasquez via iovisor-dev
Hi William, On 04/18/2017 06:54 PM, William Tu via iovisor-dev wrote: Hi, I found that if the loop variable "int i" is used in the map lookup as below: #pragma clang loop unroll(full) for (i = 0; i < 8; ++i) { struct bpf_flow_keys *mask; mask = bpf_map_lookup_elem(&flow_mask

Re: [iovisor-dev] How to attach a BPF program to TC using C/C++

2017-04-04 Thread Mauricio Vasquez via iovisor-dev
On 04/03/2017 12:31 PM, Daniel Borkmann wrote: On 04/03/2017 03:40 PM, Mauricio Vasquez via iovisor-dev wrote: Dear All, I am trying to inject a BPF_PROG_TYPE_SCHED_ACT program and attach it to the TC using C++. Out of curiosity, why not .._SCHED_CLS program in direct-action mode (same

[iovisor-dev] How to attach a BPF program to TC using C/C++

2017-04-03 Thread Mauricio Vasquez via iovisor-dev
Dear All, I am trying to inject a BPF_PROG_TYPE_SCHED_ACT program and attach it to the TC using C++. I had no particular problems compiling and injecting the program, however I haven't been able to attach it to TC, I know that in go I can use the netlink library [1] or in python pyroute2 [2]

Re: [iovisor-dev] Problem with ebpf program array map

2017-03-02 Thread Mauricio Vasquez via iovisor-dev
On 02/28/2017 06:01 AM, Tanja Ulmen wrote: Hi Mauricio, thank you for the example program, it works and I get both outputs. Are you calling load_func() for the program in the .c file? Yes I'm calling load_func() for the program. My program is similar to the endToEndTest.py of the P4 fronten

Re: [iovisor-dev] IOVisor summit agenda

2017-02-24 Thread Mauricio Vasquez via iovisor-dev
Hello Deepa, Is there going to be someway to attend the summit remotely? Thanks, Mauricio On 02/23/2017 02:33 AM, Deepa Kalani via iovisor-dev wrote: Folks, Please find the agenda at the link below… https://docs.google.com/document/d/1tw3BlY0fq9yZYVakcuoXMLW1mL-KeB-zHUJGCUw8qfk/pub see you

Re: [iovisor-dev] Problem with ebpf program array map

2017-02-23 Thread Mauricio Vasquez via iovisor-dev
Hello Tanja, On 02/20/2017 09:53 AM, Tanja Ulmen via iovisor-dev wrote: Hi, I'm new to eBPF and bcc and I hope this is the right platform for my question. Welcome! I have the following problem while working with a bpf program array map: I have a C file that contains a program map like this

[iovisor-dev] Handling a set of free elements with current map implementations

2017-01-20 Thread Mauricio Vasquez via iovisor-dev
Hello, We are having some issues for handling the address pool of a DHCP server implemented with eBPF. We tried to implement it using a map containing all the available addresses, this map is filled at the beginning and then addresses are taken (and also released), however we cannot find a w

Re: [iovisor-dev] How to update the csum of a trimmed UDP packet?

2017-01-11 Thread Mauricio Vasquez via iovisor-dev
On 01/11/2017 05:32 PM, Daniel Borkmann wrote: On 01/11/2017 10:51 PM, Mauricio Vasquez wrote: Hi Daniel, On 01/10/2017 04:49 AM, Daniel Borkmann wrote: On 01/09/2017 04:48 PM, Mauricio Vasquez via iovisor-dev wrote: Hello, I am trying to implement an eBPF program that trims an UDP packet

Re: [iovisor-dev] How to update the csum of a trimmed UDP packet?

2017-01-11 Thread Mauricio Vasquez via iovisor-dev
makes sense or not to calculate it in the DHCP case. fulvio On 11/01/2017 22:51, Mauricio Vasquez via iovisor-dev wrote: Hi Daniel, On 01/10/2017 04:49 AM, Daniel Borkmann wrote: On 01/09/2017 04:48 PM, Mauricio Vasquez via iovisor-dev wrote: Hello, I am trying to implement an eBPF program

Re: [iovisor-dev] How to update the csum of a trimmed UDP packet?

2017-01-11 Thread Mauricio Vasquez via iovisor-dev
Hi Daniel, On 01/10/2017 04:49 AM, Daniel Borkmann wrote: On 01/09/2017 04:48 PM, Mauricio Vasquez via iovisor-dev wrote: Hello, I am trying to implement an eBPF program that trims an UDP packet to a predefined length. I am able to trim the packet (using the bpf_change_tail helper) and also

[iovisor-dev] How to update the csum of a trimmed UDP packet?

2017-01-09 Thread Mauricio Vasquez via iovisor-dev
Hello, I am trying to implement an eBPF program that trims an UDP packet to a predefined length. I am able to trim the packet (using the bpf_change_tail helper) and also to update the ip->len and udp->length fields. After changing the those fields I update the checksums using the bpf_[l3,l4]_

Re: [iovisor-dev] const qualifier for key argument in eBPF map access functions

2016-12-15 Thread Mauricio Vasquez via iovisor-dev
#L13 On 12/13/2016 09:23 PM, Alexei Starovoitov wrote: when you change the prototype to 'const void *' does it help compiler to unroll it? On Tue, Dec 13, 2016 at 12:06 PM, Mauricio Vasquez via iovisor-dev wrote: Hello, We are having some doubts about the use of the const q

Re: [iovisor-dev] Automatic Loop Unrolling not working with #pragma unroll

2016-12-13 Thread Mauricio Vasquez via iovisor-dev
Hello Thomas, On 12/08/2016 09:12 AM, Thomas Graf wrote: On 7 December 2016 at 22:06, Mauricio Vasquez via iovisor-dev wrote: BPF_TABLE("array", u32, struct rt_entry, routing_table, ROUTING_TABLE_DIM); static int handle_rx(void *skb, struct metadata *md) { u8 *cursor = 0; s

[iovisor-dev] const qualifier for key argument in eBPF map access functions

2016-12-13 Thread Mauricio Vasquez via iovisor-dev
Hello, We are having some doubts about the use of the const qualifier for the key argument in functions to access eBPF maps, both, from user space and within eBPF programs. According to our understanding the key is not modified when used to access the maps, however we noticed that in the bp

[iovisor-dev] Automatic Loop Unrolling not working with #pragma unroll

2016-12-07 Thread Mauricio Vasquez via iovisor-dev
Hello, We are implementing a basic version of a router. In order to perform the routing process we implemented a bounded loop that iterates over all routing table entries looking for a match. We also used the #pragma directives in order to let clang automatically unroll the loop, unfortunate