lizrice / lb-from-scratch

A very basic eBPF Load Balancer in a few lines of C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

make: *** [Makefile:10: xdp] Segmentation fault (core dumped)

mehedi-iut opened this issue · comments

When running Makefile I am getting this error
bpftool prog load xdp_lb_kern.o /sys/fs/bpf/xdp_lb make: *** [Makefile:10: xdp] Segmentation fault (core dumped)

I am just try to print message when packet arrive in eth0. I am following @lizrice youtube video step by step

Need help, can't find any solution in online

I resolved my issue by using this Dockerfile

FROM ubuntu:latest

RUN apt-get update && \
    apt-get install -y build-essential git cmake \
                       zlib1g-dev libevent-dev \
                       libelf-dev llvm \
                       clang libc6-dev-i386

RUN mkdir /src && \
    git init
WORKDIR /src

# Link asm/byteorder.h into eBPF
RUN ln -s /usr/include/x86_64-linux-gnu/asm/ /usr/include/asm

# Build libbpf as a static lib
RUN git clone https://github.com/libbpf/libbpf-bootstrap.git && \
    cd libbpf-bootstrap && \
    git submodule update --init --recursive

RUN cd libbpf-bootstrap/libbpf/src && \
    make BUILD_STATIC_ONLY=y && \
    make install BUILD_STATIC_ONLY=y LIBDIR=/usr/lib/x86_64-linux-gnu/

RUN cd libbpf-bootstrap/bpftool/src && \
    make && \
    make install

# Clones the linux kernel repo and use the latest linux kernel source BPF headers 
RUN git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git && \
    cp linux/include/uapi/linux/bpf* /usr/include/linux/```

please use this Dockerfile for lb container, it will solve issues