All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [iovisor-dev] Running Prototype-kernel package
       [not found] <CAErYV9HG9H=62DL49qY1iewshx3NcMqAq6u3O=RsYEWdZp3Hjw@mail.gmail.com>
@ 2017-06-01 15:45 ` Y Song
  2017-06-01 16:59 ` Jesper Dangaard Brouer
  1 sibling, 0 replies; 5+ messages in thread
From: Y Song @ 2017-06-01 15:45 UTC (permalink / raw)
  To: Adel Fuchs
  Cc: Jesper Dangaard Brouer, xdp-newbies, Tom Herbert via iovisor-dev

On Thu, Jun 1, 2017 at 7:45 AM, Adel Fuchs via iovisor-dev
<iovisor-dev@lists.iovisor.org> wrote:
> Hi Jesper,
>
> Thank you so much for your help. I need to run an eBPF programs that
> filters packets according to IP address or port. I'm trying to run the
> prototype-kernel package but encounter problems.
> I went over the "getting started" tutorial, but I couldn'f find a
> tutorial which explains how to actually run the samples. So this is
> what I did:
>
> clang -O2 -Wall -target bpf -c xdp_ddos01_blacklist_cmdline.c -o
> xdp_ddos01_blacklist_cmdline

Just looked at the code. This seems a control plane application.
You should not compile with "-target bpf". You should just use the
default host one if you are intending to run on that host.
You can also use gcc here.

Yonghong

>
> First, I got an error saying:
> ./libbpf.h:12:10: fatal error: 'bpf/bpf.h' file not found
> #include <bpf/bpf.h>
>
> So I added it manually. Then I got this big error:
>
> fatal error: error in backend: Cannot select: 0x562f4957d270: ch,glue
> = BPFISD::CALL 0x562f49581238,
>       TargetExternalSymbol:i64'__divdf3', Register:i64 %R1,
> Register:i64 %R2, 0x562f49581238:1
>   0x562f49580bb8: i64 = TargetExternalSymbol'__divdf3'
>   0x562f4957d618: i64 = Register %R1
>   0x562f49581510: i64 = Register %R2
>   0x562f49581238: ch,glue = CopyToReg 0x562f495816b0, Register:i64
> %R2, 0x562f49580f60, 0x562f495816b0:1
>     0x562f49581510: i64 = Register %R2
>     0x562f49580f60: i64,ch,glue = CopyFromReg 0x562f49581578,
> Register:i64 %R0, 0x562f49581578:1
>       0x562f4957da90: i64 = Register %R0
>       0x562f49581578: ch,glue = callseq_end 0x562f4957db60,
> TargetConstant:i64<0>, TargetConstant:i64<0>, 0x562f4957db60:1
>         0x562f4957d6e8: i64 = TargetConstant<0>
>         0x562f4957d6e8: i64 = TargetConstant<0>
>         0x562f4957db60: ch,glue = BPFISD::CALL 0x562f4957d750,
> TargetExternalSymbol:i64'__divdf3', Register:i64 %R1, Register:i64
> %R2, 0x562f4957d750:1
>           0x562f49580bb8: i64 = TargetExternalSymbol'__divdf3'
>           0x562f4957d618: i64 = Register %R1
>           0x562f49581510: i64 = Register %R2
>           0x562f4957d750: ch,glue = CopyToReg 0x562f49581648,
> Register:i64 %R2, Constant:i64<4741671816366391296>, 0x562f49581648:1
>             0x562f49581510: i64 = Register %R2
>             0x562f49580ef8: i64 = Constant<4741671816366391296>
>             0x562f49581648: ch,glue = CopyToReg 0x562f495808e0,
> Register:i64 %R1, 0x562f4957d478
>               0x562f4957d618: i64 = Register %R1
>               0x562f4957d478: i64,ch,glue = CopyFromReg
> 0x562f49581370, Register:i64 %R0, 0x562f49581370:1
>                 0x562f4957da90: i64 = Register %R0
>                 0x562f49581370: ch,glue = callseq_end 0x562f49580c88,
> TargetConstant:i64<0>, TargetConstant:i64<0>, 0x562f49580c88:1
>                   0x562f4957d6e8: i64 = TargetConstant<0>
>                   0x562f4957d6e8: i64 = TargetConstant<0>
>                   0x562f49580c88: ch,glue = BPFISD::CALL
> 0x562f49581030, TargetExternalSymbol:i64'__floatundidf', Register:i64
> %R1, 0x562f49581030:1
>
>
>
>     0x562f495816b0: ch,glue = CopyToReg 0x562f4957dd00, Register:i64
> %R1, 0x562f4957dd68
>       0x562f4957d618: i64 = Register %R1
>       0x562f4957dd68: i64,ch,glue = CopyFromReg 0x562f4957d7b8,
> Register:i64 %R0, 0x562f4957d7b8:1
>         0x562f4957da90: i64 = Register %R0
>         0x562f4957d7b8: ch,glue = callseq_end 0x562f49580e28,
> TargetConstant:i64<0>, TargetConstant:i64<0>, 0x562f49580e28:1
>           0x562f4957d6e8: i64 = TargetConstant<0>
>           0x562f4957d6e8: i64 = TargetConstant<0>
>           0x562f49580e28: ch,glue = BPFISD::CALL 0x562f4957da28,
> TargetExternalSymbol:i64'__floatundidf', Register:i64 %R1,
> 0x562f4957da28:1
>             0x562f4957d410: i64 = TargetExternalSymbol'__floatundidf'
>             0x562f4957d618: i64 = Register %R1
>             0x562f4957da28: ch,glue = CopyToReg 0x562f49580e90,
> Register:i64 %R1, 0x562f4957d680
>               0x562f4957d618: i64 = Register %R1
>               0x562f4957d680: i64 = sub 0x562f49580a80, 0x562f49580dc0
>                 0x562f49580a80: i64,ch = CopyFromReg 0x562f494f79b0,
> Register:i64 %vreg50
>                   0x562f49581718: i64 = Register %vreg50
>                 0x562f49580dc0: i64,ch = CopyFromReg 0x562f494f79b0,
> Register:i64 %vreg48
>                   0x562f49581440: i64 = Register %vreg48
> In function: main
> clang: error: clang frontend command failed with exit code 70 (use -v
> to see invocation)
> clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1)
> Target: bpf
> Thread model: posix
> InstalledDir: /usr/bin
> clang: note: diagnostic msg: PLEASE submit a bug report to
> http://llvm.org/bugs/ and include the crash backtrace, preprocessed
> source, and associated run script.
> clang: note: diagnostic msg:
> ********************
>
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang: note: diagnostic msg: /tmp/xdp_ddos01_blacklist_cmdline-80c621.c
> clang: note: diagnostic msg: /tmp/xdp_ddos01_blacklist_cmdline-80c621.sh
> clang: note: diagnostic msg:
>
> ********************
>
> Could you please help me run these samples? Could you please guide me
> to the right sample that I need and tell me how to run it?
> Note that I was able to run a simple XDP program on this computer, so
> I think that it is configured all right...
>
> Thanks a lot
> Adel
>
> _______________________________________________
> iovisor-dev mailing list
> iovisor-dev@lists.iovisor.org
> https://lists.iovisor.org/mailman/listinfo/iovisor-dev
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Running Prototype-kernel package
       [not found] <CAErYV9HG9H=62DL49qY1iewshx3NcMqAq6u3O=RsYEWdZp3Hjw@mail.gmail.com>
  2017-06-01 15:45 ` [iovisor-dev] Running Prototype-kernel package Y Song
@ 2017-06-01 16:59 ` Jesper Dangaard Brouer
  2017-06-01 19:11   ` Jesper Dangaard Brouer
  1 sibling, 1 reply; 5+ messages in thread
From: Jesper Dangaard Brouer @ 2017-06-01 16:59 UTC (permalink / raw)
  To: Adel Fuchs; +Cc: xdp-newbies, iovisor-dev, brouer


On Thu, 1 Jun 2017 17:45:03 +0300 Adel Fuchs <adelfuchs@gmail.com> wrote:

> Thank you so much for your help. I need to run an eBPF programs that
> filters packets according to IP address or port. I'm trying to run the
> prototype-kernel package but encounter problems.

The prototype-kernel github repo[1] is actually originally meant for
developing real kernel module.  I guess, I should/could have placed the
eBPF/XDP examples[3] in another github repo.

[1] https://github.com/netoptimizer/prototype-kernel
[2] http://netoptimizer.blogspot.dk/2014/11/announce-github-repo-prototype-kernel.html
[3] https://github.com/netoptimizer/prototype-kernel/tree/master/kernel/samples/bpf

> I went over the "getting started" tutorial, but I couldn'f find a
> tutorial which explains how to actually run the samples. So this is
> what I did:
> 
> clang -O2 -Wall -target bpf -c xdp_ddos01_blacklist_cmdline.c -o
> xdp_ddos01_blacklist_cmdline

Don't do this... as you found out all the included path are screwed
this way.  There is a Makefile in the directory[3] kernel/samples/bpf,
so simply chdir into this dir and run 'make'.  Just like you would do
in the kernel tree[4].

[4] https://github.com/torvalds/linux/blob/master/samples/bpf/README.rst

[...] 
> Could you please help me run these samples? Could you please guide me
> to the right sample that I need and tell me how to run it?
> Note that I was able to run a simple XDP program on this computer, so
> I think that it is configured all right...

I've also been touring with a tutorial talk, see latest here[5]

[5] http://people.netfilter.org/hawk/presentations/LLC2017/XDP_DDoS_protecting_LLC2017.pdf

I guess, I'll update the documentation a bit after your feedback,
thanks.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Running Prototype-kernel package
  2017-06-01 16:59 ` Jesper Dangaard Brouer
@ 2017-06-01 19:11   ` Jesper Dangaard Brouer
  2017-06-05 12:14     ` Adel Fuchs
  0 siblings, 1 reply; 5+ messages in thread
From: Jesper Dangaard Brouer @ 2017-06-01 19:11 UTC (permalink / raw)
  To: Adel Fuchs; +Cc: xdp-newbies, iovisor-dev, brouer

On Thu, 1 Jun 2017 18:59:34 +0200
Jesper Dangaard Brouer <brouer@redhat.com> wrote:

> I guess, I'll update the documentation a bit after your feedback,

Done, updated the documentation in the prototype-kernel github repo.

See three top commits in this link:
 https://github.com/netoptimizer/prototype-kernel/commits/7db5539438fa7

The prototype-kernel doc is rendered here:
 https://prototype-kernel.readthedocs.io/en/latest/index.html
 https://prototype-kernel.readthedocs.io/en/latest/prototype-kernel/index.html
 
-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Running Prototype-kernel package
  2017-06-01 19:11   ` Jesper Dangaard Brouer
@ 2017-06-05 12:14     ` Adel Fuchs
  2017-06-05 13:10       ` Adel Fuchs
  0 siblings, 1 reply; 5+ messages in thread
From: Adel Fuchs @ 2017-06-05 12:14 UTC (permalink / raw)
  To: Jesper Dangaard Brouer, xdp-newbies, iovisor-dev

Hi Jesper,

First of all, thanks for updating the prototype-kernel packet. It works!

I tried to switch to white list and it worked. Though, as a result,
there is no way to ping the machine and get a response. I assume that
this occurs because the white list blocks protocols from lower levels,
such as ARP.
Do you know how to solve this problem? (enabling ARP and other
protocols from lower levels somehow...?)

Thanks,
Adel

On Thu, Jun 1, 2017 at 10:11 PM, Jesper Dangaard Brouer
<brouer@redhat.com> wrote:
> On Thu, 1 Jun 2017 18:59:34 +0200
> Jesper Dangaard Brouer <brouer@redhat.com> wrote:
>
>> I guess, I'll update the documentation a bit after your feedback,
>
> Done, updated the documentation in the prototype-kernel github repo.
>
> See three top commits in this link:
>  https://github.com/netoptimizer/prototype-kernel/commits/7db5539438fa7
>
> The prototype-kernel doc is rendered here:
>  https://prototype-kernel.readthedocs.io/en/latest/index.html
>  https://prototype-kernel.readthedocs.io/en/latest/prototype-kernel/index.html
>
> --
> Best regards,
>   Jesper Dangaard Brouer
>   MSc.CS, Principal Kernel Engineer at Red Hat
>   LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Running Prototype-kernel package
  2017-06-05 12:14     ` Adel Fuchs
@ 2017-06-05 13:10       ` Adel Fuchs
  0 siblings, 0 replies; 5+ messages in thread
From: Adel Fuchs @ 2017-06-05 13:10 UTC (permalink / raw)
  To: Jesper Dangaard Brouer, xdp-newbies, iovisor-dev

I think that I solved it. I changed the code of xdp_ddos01_blacklist_kern.c:

case ETH_P_ARP:  return XDP_PASS   instead of break.

Works! :-)



On Mon, Jun 5, 2017 at 3:14 PM, Adel Fuchs <adelfuchs@gmail.com> wrote:
> Hi Jesper,
>
> First of all, thanks for updating the prototype-kernel packet. It works!
>
> I tried to switch to white list and it worked. Though, as a result,
> there is no way to ping the machine and get a response. I assume that
> this occurs because the white list blocks protocols from lower levels,
> such as ARP.
> Do you know how to solve this problem? (enabling ARP and other
> protocols from lower levels somehow...?)
>
> Thanks,
> Adel
>
> On Thu, Jun 1, 2017 at 10:11 PM, Jesper Dangaard Brouer
> <brouer@redhat.com> wrote:
>> On Thu, 1 Jun 2017 18:59:34 +0200
>> Jesper Dangaard Brouer <brouer@redhat.com> wrote:
>>
>>> I guess, I'll update the documentation a bit after your feedback,
>>
>> Done, updated the documentation in the prototype-kernel github repo.
>>
>> See three top commits in this link:
>>  https://github.com/netoptimizer/prototype-kernel/commits/7db5539438fa7
>>
>> The prototype-kernel doc is rendered here:
>>  https://prototype-kernel.readthedocs.io/en/latest/index.html
>>  https://prototype-kernel.readthedocs.io/en/latest/prototype-kernel/index.html
>>
>> --
>> Best regards,
>>   Jesper Dangaard Brouer
>>   MSc.CS, Principal Kernel Engineer at Red Hat
>>   LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-05 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAErYV9HG9H=62DL49qY1iewshx3NcMqAq6u3O=RsYEWdZp3Hjw@mail.gmail.com>
2017-06-01 15:45 ` [iovisor-dev] Running Prototype-kernel package Y Song
2017-06-01 16:59 ` Jesper Dangaard Brouer
2017-06-01 19:11   ` Jesper Dangaard Brouer
2017-06-05 12:14     ` Adel Fuchs
2017-06-05 13:10       ` Adel Fuchs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.