Giter VIP home page Giter VIP logo

Comments (4)

abulimov avatar abulimov commented on July 27, 2024

dnswatch requires libbpf 1.1.0 (as is stated in the readme, and evident from [email protected] version) , and Ubuntu 22.04 ships with version 0.5.

Can you verify that what you have installed is indeed libbpf 1.1.0 or later?

from dns.

cli0 avatar cli0 commented on July 27, 2024

Hello,
sorry for replying so late. You were right, libbpf 1.1.0 was missing, I had another version installed. I fixed that and installed the right library but now I got a follow up error.

$ make
bpftool btf dump file /sys/kernel/btf/vmlinux format c > bpf/vmlinux.h
clang -g -O2 -Wall -fpie -fno-stack-protector -I /usr/include/bpf -target bpf -D__TARGET_ARCH_x86 -I bpf  -c bpf/dnswatch.bpf.c -o snoop/out/dnswatch_bpf_probe_core.o
bpf/dnswatch.bpf.c:44:16: error: use of undeclared identifier 'BPF_MAP_TYPE_RINGBUF'
  __uint(type, BPF_MAP_TYPE_RINGBUF);
               ^
bpf/dnswatch.bpf.c:167:25: warning: incompatible pointer types passing 'unsigned long long *' to parameter of type 'struct pt_regs *' [-Wincompatible-pointer-types]
  return sendmsg_solver(ctx, 0, dport, sport);
                        ^~~
bpf/dnswatch.bpf.c:108:32: note: passing argument to parameter 'ctx' here
sendmsg_solver(struct pt_regs* ctx, char fn_id, u16 dport, u16 sport) {
                               ^
bpf/dnswatch.bpf.c:184:25: warning: incompatible pointer types passing 'unsigned long long *' to parameter of type 'struct pt_regs *' [-Wincompatible-pointer-types]
  return sendmsg_solver(ctx, 1, dport, sport);
                        ^~~
bpf/dnswatch.bpf.c:108:32: note: passing argument to parameter 'ctx' here
sendmsg_solver(struct pt_regs* ctx, char fn_id, u16 dport, u16 sport) {
                               ^
bpf/dnswatch.bpf.c:194:25: warning: incompatible pointer types passing 'unsigned long long *' to parameter of type 'struct pt_regs *' [-Wincompatible-pointer-types]
  return sendmsg_solver(ctx, 2, dport, dport);
                        ^~~
bpf/dnswatch.bpf.c:108:32: note: passing argument to parameter 'ctx' here
sendmsg_solver(struct pt_regs* ctx, char fn_id, u16 dport, u16 sport) {
                               ^
3 warnings and 1 error generated.
make: *** [Makefile:9: snoop/out/dnswatch_bpf_probe_core.o] Fehler 1

This one is tripping me up as well. If you have any idea how to navigate this, it would be very helpful. Looks like the code is missing a variable declaration...

from dns.

deathowl avatar deathowl commented on July 27, 2024

on a fresh VM i installed the deps and built dnswatch succesfully

root@scw-elated-fermi:~/dns/dnswatch# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
root@scw-elated-fermi:~/dns/dnswatch# make clean
rm -f snoop/out/dnswatch_bpf_probe_core.o
rm -f bpf/vmlinux.h
root@scw-elated-fermi:~/dns/dnswatch# make
bpftool btf dump file /sys/kernel/btf/vmlinux format c > bpf/vmlinux.h
clang -g -O2 -Wall -fpie -fno-stack-protector -I /usr/include/bpf -target bpf -D__TARGET_ARCH_x86 -I bpf  -c bpf/dnswatch.bpf.c -o snoop/out/dnswatch_bpf_probe_core.o
bpf/dnswatch.bpf.c:96:25: warning: incompatible pointer types passing 'unsigned long long *' to parameter of type 'struct pt_regs *' [-Wincompatible-pointer-types]
  return sendmsg_solver(ctx, 0, dport, sport);
                        ^~~
bpf/dnswatch.bpf.c:48:32: note: passing argument to parameter 'ctx' here
sendmsg_solver(struct pt_regs* ctx, char fn_id, u16 dport, u16 sport) {
                               ^
bpf/dnswatch.bpf.c:113:25: warning: incompatible pointer types passing 'unsigned long long *' to parameter of type 'struct pt_regs *' [-Wincompatible-pointer-types]
  return sendmsg_solver(ctx, 1, dport, sport);
                        ^~~
bpf/dnswatch.bpf.c:48:32: note: passing argument to parameter 'ctx' here
sendmsg_solver(struct pt_regs* ctx, char fn_id, u16 dport, u16 sport) {
                               ^
bpf/dnswatch.bpf.c:123:25: warning: incompatible pointer types passing 'unsigned long long *' to parameter of type 'struct pt_regs *' [-Wincompatible-pointer-types]
  return sendmsg_solver(ctx, 2, dport, dport);
                        ^~~
bpf/dnswatch.bpf.c:48:32: note: passing argument to parameter 'ctx' here
sendmsg_solver(struct pt_regs* ctx, char fn_id, u16 dport, u16 sport) {
                               ^
bpf/dnswatch.bpf.c:118:14: warning: variable 'sport' set but not used [-Wunused-but-set-variable]
  u16 dport, sport;
             ^
4 warnings generated.
CGO_LDFLAGS="-lbpf" CGO_CFLAGS="-I /usr/include/bpf  -I /usr/include/pcap" go build .
root@scw-elated-fermi:~/dns/dnswatch# ./dnswatch snoop
INFO[0000] PID     PNAME           TYPE  QNAME                                                                            RCODE

from dns.

abulimov avatar abulimov commented on July 27, 2024

No updates for half a year, the issue seems to be fixed.

from dns.

Related Issues (8)

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.