Skip to content

Fix skbtracer.c #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix skbtracer.c #1

wants to merge 1 commit into from

Conversation

MatheMatrix
Copy link

add KBUILD_MODNAME
fix dropstack

add KBUILD_MODNAME
fix dropstack
@MatheMatrix
Copy link
Author

without patch:

[root@dev1-4 skbtracer]# python skbtracer.py
In file included from /virtual/main.c:9:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/inet_sock.h:26:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sock.h:64:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/filter.h:25:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sch_generic.h:21:
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/flow_offload.h:314:4: error: use of undeclared identifier 'KBUILD_MODNAME'
                        NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported");
                        ^
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/netlink.h:96:27: note: expanded from macro 'NL_SET_ERR_MSG_MOD'
        NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
                                 ^
In file included from /virtual/main.c:9:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/inet_sock.h:26:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sock.h:64:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/filter.h:25:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sch_generic.h:21:
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/flow_offload.h:314:4: error: expected ';' at end of declaration
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/netlink.h:96:42: note: expanded from macro 'NL_SET_ERR_MSG_MOD'
        NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
                                                ^
In file included from /virtual/main.c:9:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/inet_sock.h:26:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sock.h:64:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/filter.h:25:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sch_generic.h:21:
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/flow_offload.h:348:3: error: use of undeclared identifier 'KBUILD_MODNAME'
                NL_SET_ERR_MSG_MOD(extack, "Driver supports only default HW stats type \"any\"");
                ^
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/netlink.h:96:27: note: expanded from macro 'NL_SET_ERR_MSG_MOD'
        NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
                                 ^
In file included from /virtual/main.c:9:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/inet_sock.h:26:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sock.h:64:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/filter.h:25:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sch_generic.h:21:
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/flow_offload.h:348:3: error: expected ';' at end of declaration
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/netlink.h:96:42: note: expanded from macro 'NL_SET_ERR_MSG_MOD'
        NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
                                                ^
In file included from /virtual/main.c:9:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/inet_sock.h:26:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sock.h:64:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/filter.h:25:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sch_generic.h:21:
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/flow_offload.h:352:3: error: use of undeclared identifier 'KBUILD_MODNAME'
                NL_SET_ERR_MSG_MOD(extack, "Driver does not support selected HW stats type");
                ^
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/netlink.h:96:27: note: expanded from macro 'NL_SET_ERR_MSG_MOD'
        NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
                                 ^
In file included from /virtual/main.c:9:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/inet_sock.h:26:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sock.h:64:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/filter.h:25:
In file included from /lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/sch_generic.h:21:
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/net/flow_offload.h:352:3: error: expected ';' at end of declaration
/lib/modules/4.18.0-240.15.1.el7.x86_64/build/include/linux/netlink.h:96:42: note: expanded from macro 'NL_SET_ERR_MSG_MOD'
        NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
                                                ^
6 errors generated.
Traceback (most recent call last):
  File "skbtracer.py", line 295, in <module>
    b = BPF(text=bpf_text)
  File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 325, in __init__
    raise Exception("Failed to compile BPF text")
Exception: Failed to compile BPF text

with patch:

[root@dev1-4 skbtracer]# python skbtracer.py -c 1
time       NETWORK_NS   CPU    INTERFACE          DEST_MAC     IP_LEN PKT_INFO                                 TRACE_INFO
[17:42:35 ][4026531992] 0      nil                000000000000 216    T_ACK,PSH:10.0.31.77:22->172.21.0.120:54155 ffff9b36d81c9e40.0:ip_output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant