Re: [iovisor-dev] eBPF program to forward pkt from if-a to if-b

2017-12-26 Thread Avi Cohen (A) via iovisor-dev
Solved - by setting the interfaces to promisc


> -Original Message-
> From: Avi Cohen (A)
> Sent: Monday, 25 December, 2017 4:36 PM
> To: 'Daniel Borkmann'; Y Song
> Cc: iovisor-dev@lists.iovisor.org
> Subject: RE: [iovisor-dev] eBPF program to forward pkt from if-a to if-b
> 
> Thank you Daniel and Y. Song
> Now I can do bpf_redirect   for input-if-index X to output-if-index Y
> But when I try to run another BPF program to redirect to the opposite 
> direction
> Y to X I get an error message:
> Nlmsg error Device or resource busy
> WARN: link set xdp fd failed on 7 (7==X)
> 
> Question - is it possible to run bpf_redirect() on input interface X and 
> another
> bpf_redirect() on output interface X ?
> 
> Best Regards
> Avi
> 
> > -Original Message-
> > From: Daniel Borkmann [mailto:dan...@iogearbox.net]
> > Sent: Wednesday, 20 December, 2017 12:00 PM
> > To: Y Song; Avi Cohen (A)
> > Cc: iovisor-dev@lists.iovisor.org
> > Subject: Re: [iovisor-dev] eBPF program to forward pkt from if-a to
> > if-b
> >
> > On 12/20/2017 02:32 AM, Y Song via iovisor-dev wrote:
> > > There are a few examples under examples/networking with
> > > bpf_clone_redirect helper to redirect a packet from one interface to
> > > another.
> >
> > Right, and there's also bpf_redirect() directly out of cls_bpf where
> > you don't need to go and clone the skb.
> >
> > > Right socket_filter cannot modify packets, you may need to use a
> > > different one, e.g., cls_act type.
> > >
> > > On Mon, Dec 18, 2017 at 6:23 AM, Avi Cohen (A) via iovisor-dev
> > > <iovisor-dev@lists.iovisor.org> wrote:
> > >> Hello,
> > >> 1. I don't find under bcc/examples  a reference for forwarding
> > >> function . e,g,
> > capture pkt on if-a  look for any match and then forward to if-b.
> > >> Can you send a reference to a similar function. ?
> > >>
> > >> 2. in the module examples/networking/http-filter-simple.c - when I
> > >> try to
> > write to the packet I receive an exception - do I have to set the
> > socket tp other than SOCKET_FILTER ?
> > >>
> > >> Best Regards
> > >> Avi
> > >> ___
> > >> iovisor-dev mailing list
> > >> iovisor-dev@lists.iovisor.org
> > >> https://lists.iovisor.org/mailman/listinfo/iovisor-dev
> > > ___
> > > iovisor-dev mailing list
> > > iovisor-dev@lists.iovisor.org
> > > https://lists.iovisor.org/mailman/listinfo/iovisor-dev
> > >

___
iovisor-dev mailing list
iovisor-dev@lists.iovisor.org
https://lists.iovisor.org/mailman/listinfo/iovisor-dev


Re: [iovisor-dev] eBPF program to forward pkt from if-a to if-b

2017-12-25 Thread Avi Cohen (A) via iovisor-dev
Thank you Daniel and Y. Song
Now I can do bpf_redirect   for input-if-index X to output-if-index Y
But when I try to run another BPF program to redirect to the opposite direction 
Y to X
I get an error message: 
Nlmsg error Device or resource busy 
WARN: link set xdp fd failed on 7 (7==X)

Question - is it possible to run bpf_redirect() on input interface X and 
another bpf_redirect() on output interface X ?

Best Regards
Avi

> -Original Message-
> From: Daniel Borkmann [mailto:dan...@iogearbox.net]
> Sent: Wednesday, 20 December, 2017 12:00 PM
> To: Y Song; Avi Cohen (A)
> Cc: iovisor-dev@lists.iovisor.org
> Subject: Re: [iovisor-dev] eBPF program to forward pkt from if-a to if-b
> 
> On 12/20/2017 02:32 AM, Y Song via iovisor-dev wrote:
> > There are a few examples under examples/networking with
> > bpf_clone_redirect helper to redirect a packet from one interface to
> > another.
> 
> Right, and there's also bpf_redirect() directly out of cls_bpf where you don't
> need to go and clone the skb.
> 
> > Right socket_filter cannot modify packets, you may need to use a
> > different one, e.g., cls_act type.
> >
> > On Mon, Dec 18, 2017 at 6:23 AM, Avi Cohen (A) via iovisor-dev
> > <iovisor-dev@lists.iovisor.org> wrote:
> >> Hello,
> >> 1. I don't find under bcc/examples  a reference for forwarding function . 
> >> e,g,
> capture pkt on if-a  look for any match and then forward to if-b.
> >> Can you send a reference to a similar function. ?
> >>
> >> 2. in the module examples/networking/http-filter-simple.c - when I try to
> write to the packet I receive an exception - do I have to set the socket tp 
> other
> than SOCKET_FILTER ?
> >>
> >> Best Regards
> >> Avi
> >> ___
> >> iovisor-dev mailing list
> >> iovisor-dev@lists.iovisor.org
> >> https://lists.iovisor.org/mailman/listinfo/iovisor-dev
> > ___
> > iovisor-dev mailing list
> > iovisor-dev@lists.iovisor.org
> > https://lists.iovisor.org/mailman/listinfo/iovisor-dev
> >

___
iovisor-dev mailing list
iovisor-dev@lists.iovisor.org
https://lists.iovisor.org/mailman/listinfo/iovisor-dev


Re: [iovisor-dev] eBPF program to forward pkt from if-a to if-b

2017-12-20 Thread Daniel Borkmann via iovisor-dev
On 12/20/2017 02:32 AM, Y Song via iovisor-dev wrote:
> There are a few examples under examples/networking with
> bpf_clone_redirect helper to redirect a packet from one
> interface to another.

Right, and there's also bpf_redirect() directly out of cls_bpf where you
don't need to go and clone the skb.

> Right socket_filter cannot modify packets, you may need to use a
> different one, e.g., cls_act type.
> 
> On Mon, Dec 18, 2017 at 6:23 AM, Avi Cohen (A) via iovisor-dev
>  wrote:
>> Hello,
>> 1. I don't find under bcc/examples  a reference for forwarding function . 
>> e,g, capture pkt on if-a  look for any match and then forward to if-b.
>> Can you send a reference to a similar function. ?
>>
>> 2. in the module examples/networking/http-filter-simple.c - when I try to 
>> write to the packet I receive an exception - do I have to set the socket tp 
>> other than SOCKET_FILTER ?
>>
>> Best Regards
>> Avi
>> ___
>> iovisor-dev mailing list
>> iovisor-dev@lists.iovisor.org
>> https://lists.iovisor.org/mailman/listinfo/iovisor-dev
> ___
> iovisor-dev mailing list
> iovisor-dev@lists.iovisor.org
> https://lists.iovisor.org/mailman/listinfo/iovisor-dev
> 

___
iovisor-dev mailing list
iovisor-dev@lists.iovisor.org
https://lists.iovisor.org/mailman/listinfo/iovisor-dev


Re: [iovisor-dev] eBPF program to forward pkt from if-a to if-b

2017-12-19 Thread Y Song via iovisor-dev
There are a few examples under examples/networking with
bpf_clone_redirect helper to redirect a packet from one
interface to another.

Right socket_filter cannot modify packets, you may need to use a
different one, e.g., cls_act type.

On Mon, Dec 18, 2017 at 6:23 AM, Avi Cohen (A) via iovisor-dev
 wrote:
> Hello,
> 1. I don't find under bcc/examples  a reference for forwarding function . 
> e,g, capture pkt on if-a  look for any match and then forward to if-b.
> Can you send a reference to a similar function. ?
>
> 2. in the module examples/networking/http-filter-simple.c - when I try to 
> write to the packet I receive an exception - do I have to set the socket tp 
> other than SOCKET_FILTER ?
>
> Best Regards
> Avi
> ___
> iovisor-dev mailing list
> iovisor-dev@lists.iovisor.org
> https://lists.iovisor.org/mailman/listinfo/iovisor-dev
___
iovisor-dev mailing list
iovisor-dev@lists.iovisor.org
https://lists.iovisor.org/mailman/listinfo/iovisor-dev