]>
Commit | Line | Data |
---|---|---|
6aeb2f19 JB |
1 | --- open62541-1.3.3/plugins/ua_pubsub_ethernet.c.orig 2022-08-03 10:12:48.000000000 +0200 |
2 | +++ open62541-1.3.3/plugins/ua_pubsub_ethernet.c 2022-10-23 19:33:13.718556139 +0200 | |
3 | @@ -43,7 +43,7 @@ static UA_THREAD_LOCAL UA_Byte ReceiveMs | |
4 | #include <linux/if_link.h> | |
0ad170df | 5 | |
6aeb2f19 JB |
6 | #if defined __has_include |
7 | -# if __has_include(<bpf/bpf.h>) && __has_include(<bpf/libbpf.h>) && __has_include(<bpf/xsk.h>) | |
8 | +# if __has_include(<bpf/bpf.h>) && __has_include(<bpf/libbpf.h>) && __has_include(<xdp/xsk.h>) | |
9 | # define LIBBPF_EBPF | |
10 | /* Libbpf headers */ | |
11 | # include <bpf/bpf.h> | |
12 | @@ -51,7 +51,7 @@ static UA_THREAD_LOCAL UA_Byte ReceiveMs | |
0ad170df JB |
13 | # ifndef asm |
14 | # define asm __asm__ | |
0ad170df | 15 | # endif |
6aeb2f19 JB |
16 | -# include <bpf/xsk.h> |
17 | +# include <xdp/xsk.h> | |
0ad170df | 18 | # endif |
6aeb2f19 JB |
19 | #endif |
20 | #endif | |
21 | @@ -292,7 +292,7 @@ static xdpsock *xsk_configure(xdp_umem * | |
22 | ||
23 | if (!xdp_socket->umem) { | |
24 | UA_close(xsk_socket__fd(xdp_socket->xskfd)); | |
25 | - bpf_set_link_xdp_fd(ifindex, -1, xdp_flags); | |
26 | + bpf_xdp_attach(ifindex, -1, xdp_flags, NULL); | |
27 | UA_free(xskparam); | |
28 | UA_free(xdp_socket); | |
29 | return NULL; | |
30 | @@ -335,13 +335,13 @@ static xdpsock *xsk_configure(xdp_umem * | |
31 | (void)xsk_umem__delete(xdp_socket->umem->umem); | |
32 | UA_free(xdp_socket->umem); | |
33 | UA_close(xsk_socket__fd(xdp_socket->xskfd)); | |
34 | - bpf_set_link_xdp_fd(ifindex, -1, xdp_flags); | |
35 | + bpf_xdp_attach(ifindex, -1, xdp_flags, NULL); | |
36 | UA_free(xskparam); | |
37 | UA_free(xdp_socket); | |
38 | return NULL; | |
39 | } | |
40 | ||
41 | - ret = bpf_get_link_xdp_id(ifindex, &xdp_socket->bpf_prog_id, xdp_flags); | |
42 | + ret = bpf_xdp_query_id(ifindex, (int)xdp_flags, &xdp_socket->bpf_prog_id); | |
43 | if (ret) { | |
44 | UA_LOG_ERROR (UA_Log_Stdout, UA_LOGCATEGORY_SERVER, | |
45 | "PubSub Connection creation failed. Unable to retrieve XDP program."); | |
46 | @@ -349,7 +349,7 @@ static xdpsock *xsk_configure(xdp_umem * | |
47 | (void)xsk_umem__delete(xdp_socket->umem->umem); | |
48 | UA_free(xdp_socket->umem); | |
49 | UA_close(xsk_socket__fd(xdp_socket->xskfd)); | |
50 | - bpf_set_link_xdp_fd(ifindex, -1, xdp_flags); | |
51 | + bpf_xdp_attach(ifindex, -1, xdp_flags, NULL); | |
52 | UA_free(xskparam); | |
53 | UA_free(xdp_socket); | |
54 | return NULL; | |
55 | @@ -378,8 +378,8 @@ UA_PubSubChannelEthernetXDP_open(UA_PubS | |
56 | sockOptions->xdp_bind_flags); | |
57 | if(!channelDataEthernet->xdpsocket) { | |
58 | UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "XDP Socket configuration failed"); | |
59 | - bpf_set_link_xdp_fd(channelDataEthernet->ifindex, -1, | |
60 | - sockOptions->xdp_flags); | |
61 | + bpf_xdp_attach(channelDataEthernet->ifindex, -1, | |
62 | + sockOptions->xdp_flags, NULL); | |
63 | return UA_STATUSCODE_BADINTERNALERROR; | |
64 | } | |
65 | ||
66 | @@ -477,7 +477,7 @@ UA_PubSubChannelEthernetXDP_receive(UA_P | |
0ad170df JB |
67 | UA_UInt64 ret; |
68 | UA_UInt32 rcvd; | |
69 | UA_Byte *pkt, *buf; | |
70 | - ssize_t len; | |
71 | + size_t len; | |
72 | ||
73 | xdp_socket = channelDataEthernet->xdpsocket; | |
74 | message->length = 0; | |
6aeb2f19 JB |
75 | @@ -1283,7 +1283,7 @@ UA_PubSubChannelEthernet_close(UA_PubSub |
76 | xsk_socket__delete(channelDataEthernet->xdpsocket->xskfd); | |
77 | (void)xsk_umem__delete(channelDataEthernet->xdpsocket->umem->umem); | |
78 | /* Detach XDP program from the interface */ | |
79 | - bpf_set_link_xdp_fd(channelDataEthernet->ifindex, -1, channelDataEthernet->xdp_flags); | |
80 | + bpf_xdp_attach(channelDataEthernet->ifindex, -1, channelDataEthernet->xdp_flags, NULL); | |
81 | UA_free(channelDataEthernet->xdpsocket->umem->buffer); | |
82 | UA_free(channelDataEthernet->xdpsocket->umem); | |
83 | UA_free(channelDataEthernet->xdpsocket); | |
53eb630e JB |
84 | --- open62541-1.3.3/CMakeLists.txt.orig 2022-08-03 10:12:48.000000000 +0200 |
85 | +++ open62541-1.3.3/CMakeLists.txt 2022-10-24 21:15:11.600677093 +0200 | |
86 | @@ -1088,7 +1088,7 @@ if(UA_ENABLE_PUBSUB) | |
87 | list(APPEND default_plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_pubsub_ethernet.c) | |
88 | find_library(LIB_BPF bpf) | |
89 | if(LIB_BPF) | |
90 | - list(APPEND open62541_LIBRARIES bpf) | |
91 | + list(APPEND open62541_LIBRARIES xdp bpf) | |
92 | else() | |
93 | message("bpf library not found. XDP functionalities will not be available.") | |
94 | endif() |