Git Product home page Git Product logo

Comments (7)

yonghong-song avatar yonghong-song commented on May 14, 2024

Zaafar,

Could you show the exact steps you reach the problem? Where did you get the
kernel 4.2.0-999-generic (Build Date 03/Sep/2015)?
Multiple different ways exist for installation of bcc. More details will
enable us to reproduce/resolve the issue.

Thanks,

Yonghong

On Tue, Sep 8, 2015 at 1:34 AM, zaafar [email protected] wrote:

I am using Ubuntu 14.04 with kernel 4.2.0-999-generic (Build Date
03/Sep/2015) and when I try to execute the distributed-bridge code using
the root account I receive following error. Weird part about this error is
that if I reboot the machine and execute the distributed-bridge code it
will work fine in the first attempt only however, on all substituent
executions it will give following error.

/usr/share/bcc/examples/distributed_bridge/tunnel.c:31:25: error: variable
has incomplete type 'struct bpf_tunnel_key'
struct bpf_tunnel_key tkey = {};
^
/usr/share/bcc/examples/distributed_bridge/tunnel.c:31:10: note: forward
declaration of 'struct bpf_tunnel_key'
struct bpf_tunnel_key tkey = {};
^
/usr/share/bcc/examples/distributed_bridge/tunnel.c:32:3: warning:
implicit declaration of function 'bpf_skb_get_tunnel_key' is invalid in C99
[-Wimplicit-function-declaration]
bpf_skb_get_tunnel_key(skb, &tkey, sizeof(tkey), 0);
^
/usr/share/bcc/examples/distributed_bridge/tunnel.c:61:25: error: variable
has incomplete type 'struct bpf_tunnel_key'
struct bpf_tunnel_key tkey = {};
^
/usr/share/bcc/examples/distributed_bridge/tunnel.c:61:10: note: forward
declaration of 'struct bpf_tunnel_key'
struct bpf_tunnel_key tkey = {};
^
/usr/share/bcc/examples/distributed_bridge/tunnel.c:66:5: warning:
implicit declaration of function 'bpf_skb_set_tunnel_key' is invalid in C99
[-Wimplicit-function-declaration]
bpf_skb_set_tunnel_key(skb, &tkey, sizeof(tkey), 0);
^
/usr/share/bcc/examples/distributed_bridge/tunnel.c:69:27: error: variable
has incomplete type 'struct bpf_tunnel_key'
struct bpf_tunnel_key tkey = {};
^
/usr/share/bcc/examples/distributed_bridge/tunnel.c:61:10: note: forward
declaration of 'struct bpf_tunnel_key'
struct bpf_tunnel_key tkey = {};
^
2 warnings and 3 errors generated.
Traceback (most recent call last):
File "tunnel.py", line 18, in
b = BPF(src_file="tunnel.c")
File "/usr/lib/python3/dist-packages/bcc/init.py", line 298, in init
raise Exception("Failed to compile BPF module %s" % src_file)
Exception: Failed to compile BPF module tunnel.c
Validating connectivity

Also, where is the "struct bpf_tunnel_key" defined?

Zaafar


Reply to this email directly or view it on GitHub
#190.

from bcc.

zaafar avatar zaafar commented on May 14, 2024

Yonghong,

I installed "ubuntu-14.04.3-desktop-amd64" on the virtualbox vm and updated it fully using apt-get. After that I updated the kernel to 4.2.0-999 using following script.

rm -rf *.deb
PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/daily/2015-09-08-unstable/
VER=4.2.0-999
REL=201509072200
wget ${PREFIX}/linux-headers-${VER}-generic_${VER}.${REL}_amd64.deb
wget ${PREFIX}/linux-headers-${VER}_${VER}.${REL}_all.deb
wget ${PREFIX}/linux-image-${VER}-generic_${VER}.${REL}_amd64.deb
sudo dpkg -i linux-*${VER}.${REL}*.deb

After installing the kernel, it gives me following output with <uname -a> command

Linux zaafar-VirtualBox 4.2.0-999-generic #201509072200 SMP Tue Sep 8 02:02:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

In order to install LLVM and bcc I followed the steps given in install.md (Ubuntu from source)

https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---from-source

After installing bcc I installed the required python modules in order to run the distributed-bridge code via following commands

sudo pip install pyroute2
sudo pip install future
sudo pip install netaddr

After that I run following command in order to execute the distributed-bridge code

sudo python main.py

Following is the error i am getting

LLVM ERROR: Program used external function 'bpf_skb_get_tunnel_key' which could not be resolved!

from bcc.

yonghong-song avatar yonghong-song commented on May 14, 2024

Zaafar,

This is kernel version issue. In helpers.h
(/usr/share/bcc/include/bcc/helpers.h):

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
static u64 (_bpf_get_cgroup_classid)(void *ctx) =
(void *) BPF_FUNC_get_cgroup_classid;
static u64 (_bpf_skb_vlan_push)(void _ctx, u16 proto, u16 vlan_tci) =
(void *) BPF_FUNC_skb_vlan_push;
static u64 (_bpf_skb_vlan_pop)(void _ctx) =
(void *) BPF_FUNC_skb_vlan_pop;
static int (_bpf_skb_get_tunnel_key)(void _ctx, void *to, u32 size, u64
flags) =
(void *) BPF_FUNC_skb_get_tunnel_key;
static int (_bpf_skb_set_tunnel_key)(void *ctx, void *from, u32 size, u64
flags) =
(void *) BPF_FUNC_skb_set_tunnel_key;
#endif

It is because of the kernel you downloaded do not support the above
functionality yet.
It will be available in 4.3.

If you want to experiment with the distributed bridge, you need to use the
latest net-next tree:
https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next
(It still use version 4.2.0, you need manually change the above helpers.h
to check against 4.2.0,
but all the functionality is there.)

The change has also been pulled into latest Linus tree,
https://github.com/torvalds/linux

Let me know if you are not able to experiment.

On Wed, Sep 9, 2015 at 5:23 AM, zaafar [email protected] wrote:

Yonghong,

I installed "ubuntu-14.04.3-desktop-amd64" on the virtualbox vm and
updated it fully using apt-get. After that I updated the kernel to
4.2.0-999 using following script.

rm -rf .deb
PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/daily/2015-09-08-unstable/
VER=4.2.0-999
REL=201509072200 http://kernel.ubuntu.com/~kernel-ppa/mainline/daily/2015-09-08-unstable/VER=4.2.0-999REL=201509072200
wget ${PREFIX}/linux-headers-${VER}-generic
${VER}.${REL}amd64.deb
wget ${PREFIX}/linux-headers-${VER}
${VER}.${REL}all.deb
wget ${PREFIX}/linux-image-${VER}-generic
${VER}.${REL}amd64.deb
sudo dpkg -i linux-
${VER}.${REL}*.deb

After installing the kernel, it gives me following output with <uname -a>
command

Linux zaafar-VirtualBox 4.2.0-999-generic #201509072200 SMP Tue Sep 8
02:02:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

In order to install LLVM and bcc I followed the steps given in install.md
(Ubuntu from source)

https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---from-source

After installing bcc I installed the required python modules in order to
run the distributed-bridge code via following commands

sudo pip install pyroute2
sudo pip install future
sudo pip install netaddr

After that I run following command in order to execute the
distributed-bridge code

sudo python main.py

Following is the error i am getting

LLVM ERROR: Program used external function 'bpf_skb_get_tunnel_key' which
could not be resolved!


Reply to this email directly or view it on GitHub
#190 (comment).

from bcc.

affansyed avatar affansyed commented on May 14, 2024

Just to followup (and possibly I will try and update the bridge example with a README), with 4.2 kernel we cannot hope to run the distributed bridge example. (I also observed similar failure while running vlan learning example, and sure enough skb related bpf calls are present there as well).

In your comment above, when you say all the functionality is there, you mean to say we first download the kernel from latest net-next tree and then rebuild it first?

from bcc.

yonghong-song avatar yonghong-song commented on May 14, 2024

Yes. build the kernel and install it like the below:
make defconfig
make -j4
sudo make modules_install install
reboot

The following is a link which is useful to install or remove a new kernel
either through packaging or through manual install.
http://community.linuxmint.com/tutorial/view/1718

On Wed, Sep 9, 2015 at 10:52 AM, affansyed [email protected] wrote:

Just to followup (and possibly I will try and update the bridge example
with a README), with 4.2 kernel we cannot hope to run the distributed
bridge example. (I also observed similar failure while running vlan
learning example, and sure enough skb related bpf calls are present there
as well).

In your comment above, when you say all the functionality is there, you
mean to say we first download the kernel from latest net-next tree and then
rebuild it first?


Reply to this email directly or view it on GitHub
#190 (comment).

from bcc.

zaafar avatar zaafar commented on May 14, 2024

Thank you Yonghong, This does solve my issue.

Regards,
Zaafar

from bcc.

affansyed avatar affansyed commented on May 14, 2024

Just to further elaborate -- on investigating the following mainline kernel version supports both the bridge and vlan learning code.

PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/daily/2015-09-08-unstable/
VER=4.2.0-999
REL=201509072200

I am going to pull and put in a change request for the install.md to reflect this

from bcc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.