Skip to content

Commit 949b0bd

Browse files
committed
Removed the XDP Test Extension
1 parent bd8e839 commit 949b0bd

34 files changed

+247
-10388
lines changed

ebpf-for-windows.sln

Lines changed: 205 additions & 205 deletions
Large diffs are not rendered by default.

include/ebpf_structs.h

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -139,40 +139,40 @@ typedef struct _ebpf_map_definition_in_file
139139

140140
typedef enum
141141
{
142-
BPF_FUNC_map_lookup_elem = 1, ///< \ref bpf_map_lookup_elem
143-
BPF_FUNC_map_update_elem = 2, ///< \ref bpf_map_update_elem
144-
BPF_FUNC_map_delete_elem = 3, ///< \ref bpf_map_delete_elem
145-
BPF_FUNC_map_lookup_and_delete_elem = 4, ///< \ref bpf_map_lookup_and_delete_elem
146-
BPF_FUNC_tail_call = 5, ///< \ref bpf_tail_call
147-
BPF_FUNC_get_prandom_u32 = 6, ///< \ref bpf_get_prandom_u32
148-
BPF_FUNC_ktime_get_boot_ns = 7, ///< \ref bpf_ktime_get_boot_ns
149-
BPF_FUNC_get_smp_processor_id = 8, ///< \ref bpf_get_smp_processor_id
150-
BPF_FUNC_ktime_get_ns = 9, ///< \ref bpf_ktime_get_ns
151-
BPF_FUNC_csum_diff = 10, ///< \ref bpf_csum_diff
152-
BPF_FUNC_ringbuf_output = 11, ///< \ref bpf_ringbuf_output
153-
BPF_FUNC_trace_printk2 = 12, ///< \ref bpf_trace_printk2 (but use \ref bpf_printk instead)
154-
BPF_FUNC_trace_printk3 = 13, ///< \ref bpf_trace_printk3 (but use \ref bpf_printk instead)
155-
BPF_FUNC_trace_printk4 = 14, ///< \ref bpf_trace_printk4 (but use \ref bpf_printk instead)
156-
BPF_FUNC_trace_printk5 = 15, ///< \ref bpf_trace_printk5 (but use \ref bpf_printk instead)
157-
BPF_FUNC_map_push_elem = 16, ///< \ref bpf_map_push_elem
158-
BPF_FUNC_map_pop_elem = 17, ///< \ref bpf_map_pop_elem
159-
BPF_FUNC_map_peek_elem = 18, ///< \ref bpf_map_peek_elem
160-
BPF_FUNC_get_current_pid_tgid = 19, ///< \ref bpf_get_current_pid_tgid
161-
BPF_FUNC_get_current_logon_id = 20, ///< \ref bpf_get_current_logon_id
162-
BPF_FUNC_is_current_admin = 21, ///< \ref bpf_is_current_admin
163-
BPF_FUNC_memcpy_s = 22, ///< \ref bpf_memcpy_s
164-
BPF_FUNC_memcmp_s = 23, ///< \ref bpf_memcmp_s
165-
BPF_FUNC_memset = 24, ///< \ref bpf_memset
166-
BPF_FUNC_memmove_s = 25, ///< \ref bpf_memmove_s
167-
BPF_FUNC_get_socket_cookie = 26, ///< \ref bpf_get_socket_cookie
168-
BPF_FUNC_strncpy_s = 27, ///< \ref bpf_strncpy_s
169-
BPF_FUNC_strncat_s = 28, ///< \ref bpf_strncat_s
170-
BPF_FUNC_strnlen_s = 29, ///< \ref bpf_strnlen_s
171-
BPF_FUNC_ktime_get_boot_ms = 30, ///< \ref bpf_ktime_get_boot_ms
172-
BPF_FUNC_ktime_get_ms = 31, ///< \ref bpf_ktime_get_ms
173-
BPF_FUNC_perf_event_output = 32, ///< \ref bpf_perf_event_output
174-
BPF_FUNC_get_current_process_start_key = 33, ///< \ref bpf_get_current_process_start_key
175-
BPF_FUNC_get_current_thread_create_time = 34, ///< \ref bpf_get_current_thread_create_time
142+
BPF_FUNC_map_lookup_elem = 1, ///< \ref bpf_map_lookup_elem
143+
BPF_FUNC_map_update_elem = 2, ///< \ref bpf_map_update_elem
144+
BPF_FUNC_map_delete_elem = 3, ///< \ref bpf_map_delete_elem
145+
BPF_FUNC_map_lookup_and_delete_elem = 4, ///< \ref bpf_map_lookup_and_delete_elem
146+
BPF_FUNC_tail_call = 5, ///< \ref bpf_tail_call
147+
BPF_FUNC_get_prandom_u32 = 6, ///< \ref bpf_get_prandom_u32
148+
BPF_FUNC_ktime_get_boot_ns = 7, ///< \ref bpf_ktime_get_boot_ns
149+
BPF_FUNC_get_smp_processor_id = 8, ///< \ref bpf_get_smp_processor_id
150+
BPF_FUNC_ktime_get_ns = 9, ///< \ref bpf_ktime_get_ns
151+
BPF_FUNC_csum_diff = 10, ///< \ref bpf_csum_diff
152+
BPF_FUNC_ringbuf_output = 11, ///< \ref bpf_ringbuf_output
153+
BPF_FUNC_trace_printk2 = 12, ///< \ref bpf_trace_printk2 (but use \ref bpf_printk instead)
154+
BPF_FUNC_trace_printk3 = 13, ///< \ref bpf_trace_printk3 (but use \ref bpf_printk instead)
155+
BPF_FUNC_trace_printk4 = 14, ///< \ref bpf_trace_printk4 (but use \ref bpf_printk instead)
156+
BPF_FUNC_trace_printk5 = 15, ///< \ref bpf_trace_printk5 (but use \ref bpf_printk instead)
157+
BPF_FUNC_map_push_elem = 16, ///< \ref bpf_map_push_elem
158+
BPF_FUNC_map_pop_elem = 17, ///< \ref bpf_map_pop_elem
159+
BPF_FUNC_map_peek_elem = 18, ///< \ref bpf_map_peek_elem
160+
BPF_FUNC_get_current_pid_tgid = 19, ///< \ref bpf_get_current_pid_tgid
161+
BPF_FUNC_get_current_logon_id = 20, ///< \ref bpf_get_current_logon_id
162+
BPF_FUNC_is_current_admin = 21, ///< \ref bpf_is_current_admin
163+
BPF_FUNC_memcpy_s = 22, ///< \ref bpf_memcpy_s
164+
BPF_FUNC_memcmp_s = 23, ///< \ref bpf_memcmp_s
165+
BPF_FUNC_memset = 24, ///< \ref bpf_memset
166+
BPF_FUNC_memmove_s = 25, ///< \ref bpf_memmove_s
167+
BPF_FUNC_get_socket_cookie = 26, ///< \ref bpf_get_socket_cookie
168+
BPF_FUNC_strncpy_s = 27, ///< \ref bpf_strncpy_s
169+
BPF_FUNC_strncat_s = 28, ///< \ref bpf_strncat_s
170+
BPF_FUNC_strnlen_s = 29, ///< \ref bpf_strnlen_s
171+
BPF_FUNC_ktime_get_boot_ms = 30, ///< \ref bpf_ktime_get_boot_ms
172+
BPF_FUNC_ktime_get_ms = 31, ///< \ref bpf_ktime_get_ms
173+
BPF_FUNC_perf_event_output = 32, ///< \ref bpf_perf_event_output
174+
BPF_FUNC_get_current_process_start_key = 33, ///< \ref bpf_get_current_process_start_key
175+
BPF_FUNC_get_current_thread_create_time = 34, ///< \ref bpf_get_current_thread_create_time
176176
} ebpf_helper_id_t;
177177

178178
// Cross-platform BPF program types.
@@ -249,16 +249,6 @@ enum bpf_prog_type
249249
*/
250250
BPF_PROG_TYPE_PROCESS,
251251

252-
/** @brief Program type for handling incoming packets as early as possible.
253-
*
254-
* **eBPF program prototype:** \ref xdp_hook_t
255-
*
256-
* **Attach type(s):** \ref BPF_XDP_TEST
257-
*
258-
* **Helpers available:** all helpers defined in bpf_helpers.h
259-
*/
260-
BPF_PROG_TYPE_XDP_TEST = 998,
261-
262252
/** @brief Program type for handling calls from the eBPF sample extension. Used for
263253
* testing.
264254
*
@@ -343,23 +333,17 @@ enum bpf_attach_type
343333
*/
344334
BPF_ATTACH_TYPE_SAMPLE,
345335

346-
/** @brief Attach type for handling incoming packets as early as possible.
347-
*
348-
* **Program type:** \ref BPF_PROG_TYPE_XDP_TEST
349-
*/
350-
BPF_XDP_TEST,
351-
352336
/** @brief Attach type for handling netevents.
353337
*
354338
* **Program type:** \ref BPF_PROG_TYPE_NETEVENT
355339
*/
356-
BPF_ATTACH_TYPE_NETEVENT,
340+
BPF_ATTACH_TYPE_NETEVENT = 10,
357341

358342
/** @brief Attach type for handling process creation/deletion events.
359343
*
360344
* **Program type:** \ref BPF_PROG_TYPE_PROCESS
361345
*/
362-
BPF_ATTACH_TYPE_PROCESS,
346+
BPF_ATTACH_TYPE_PROCESS = 11,
363347

364348
__MAX_BPF_ATTACH_TYPE,
365349
};

libs/ebpfnetsh/programs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ std::vector<struct bpf_object*> _ebpf_netsh_objects;
5353
bool
5454
_prog_type_supports_interface(bpf_prog_type prog_type)
5555
{
56-
return (prog_type == BPF_PROG_TYPE_XDP) || (prog_type == BPF_PROG_TYPE_XDP_TEST);
56+
return (prog_type == BPF_PROG_TYPE_XDP);
5757
}
5858

5959
bool

netebpfext/guid.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@
1010
#include "net_ebpf_ext_bind.h"
1111
#include "net_ebpf_ext_sock_addr.h"
1212
#include "net_ebpf_ext_sock_ops.h"
13-
#include "net_ebpf_ext_xdp.h"

netebpfext/net_ebpf_ext.c

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@
2121
#include "net_ebpf_ext_bind.h"
2222
#include "net_ebpf_ext_sock_addr.h"
2323
#include "net_ebpf_ext_sock_ops.h"
24-
#include "net_ebpf_ext_xdp.h"
2524

26-
#define SECONDSTO100NS(x) ((x)*10000000)
25+
#define SECONDSTO100NS(x) ((x) * 10000000)
2726
#define SUBLAYER_WEIGHT_MAXIMUM 0xFFFF
2827

2928
// Globals.
3029
NDIS_HANDLE _net_ebpf_ext_ndis_handle = NULL;
3130
NDIS_HANDLE _net_ebpf_ext_nbl_pool_handle = NULL;
3231
HANDLE _net_ebpf_ext_l2_injection_handle = NULL;
3332

34-
static bool _net_ebpf_xdp_providers_registered = false;
3533
static bool _net_ebpf_bind_providers_registered = false;
3634
static bool _net_ebpf_sock_addr_providers_registered = false;
3735
static bool _net_ebpf_sock_ops_providers_registered = false;
@@ -73,28 +71,6 @@ typedef struct _net_ebpf_ext_wfp_callout_state
7371
} net_ebpf_ext_wfp_callout_state_t;
7472

7573
static net_ebpf_ext_wfp_callout_state_t _net_ebpf_ext_wfp_callout_states[] = {
76-
// EBPF_HOOK_OUTBOUND_L2
77-
{
78-
&EBPF_HOOK_OUTBOUND_L2_CALLOUT,
79-
&FWPM_LAYER_OUTBOUND_MAC_FRAME_NATIVE,
80-
net_ebpf_ext_layer_2_classify,
81-
net_ebpf_ext_filter_change_notify,
82-
_net_ebpf_ext_flow_delete,
83-
L"L2 Outbound",
84-
L"L2 Outbound Callout for eBPF",
85-
FWP_ACTION_CALLOUT_TERMINATING,
86-
},
87-
// EBPF_HOOK_INBOUND_L2
88-
{
89-
&EBPF_HOOK_INBOUND_L2_CALLOUT,
90-
&FWPM_LAYER_INBOUND_MAC_FRAME_NATIVE,
91-
net_ebpf_ext_layer_2_classify,
92-
net_ebpf_ext_filter_change_notify,
93-
_net_ebpf_ext_flow_delete,
94-
L"L2 Inbound",
95-
L"L2 Inbound Callout for eBPF",
96-
FWP_ACTION_CALLOUT_TERMINATING,
97-
},
9874
// EBPF_HOOK_ALE_RESOURCE_ALLOC_V4
9975
{
10076
&EBPF_HOOK_ALE_RESOURCE_ALLOC_V4_CALLOUT,
@@ -986,17 +962,6 @@ net_ebpf_ext_register_providers()
986962

987963
NET_EBPF_EXT_LOG_ENTRY();
988964

989-
status = net_ebpf_ext_xdp_register_providers();
990-
if (!NT_SUCCESS(status)) {
991-
NET_EBPF_EXT_LOG_MESSAGE_NTSTATUS(
992-
NET_EBPF_EXT_TRACELOG_LEVEL_ERROR,
993-
NET_EBPF_EXT_TRACELOG_KEYWORD_EXTENSION,
994-
"net_ebpf_ext_xdp_register_providers failed.",
995-
status);
996-
goto Exit;
997-
}
998-
_net_ebpf_xdp_providers_registered = true;
999-
1000965
status = net_ebpf_ext_bind_register_providers();
1001966
if (!NT_SUCCESS(status)) {
1002967
NET_EBPF_EXT_LOG_MESSAGE_NTSTATUS(
@@ -1042,10 +1007,6 @@ net_ebpf_ext_unregister_providers()
10421007
{
10431008
NET_EBPF_EXT_LOG_ENTRY();
10441009

1045-
if (_net_ebpf_xdp_providers_registered) {
1046-
net_ebpf_ext_xdp_unregister_providers();
1047-
_net_ebpf_xdp_providers_registered = false;
1048-
}
10491010
if (_net_ebpf_bind_providers_registered) {
10501011
net_ebpf_ext_bind_unregister_providers();
10511012
_net_ebpf_bind_providers_registered = false;

netebpfext/net_ebpf_ext_program_info.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,6 @@ static const ebpf_context_descriptor_t _ebpf_xdp_test_context_descriptor = {
3434
EBPF_OFFSET_OF(xdp_md_t, data_end),
3535
EBPF_OFFSET_OF(xdp_md_t, data_meta)};
3636

37-
static const ebpf_program_type_descriptor_t _ebpf_xdp_test_program_type_descriptor = {
38-
EBPF_PROGRAM_TYPE_DESCRIPTOR_HEADER,
39-
"xdp_test",
40-
&_ebpf_xdp_test_context_descriptor,
41-
EBPF_PROGRAM_TYPE_XDP_TEST_GUID,
42-
BPF_PROG_TYPE_XDP_TEST,
43-
0};
44-
static const ebpf_program_info_t _ebpf_xdp_test_program_info = {
45-
EBPF_PROGRAM_INFORMATION_HEADER,
46-
&_ebpf_xdp_test_program_type_descriptor,
47-
EBPF_COUNT_OF(_xdp_test_ebpf_extension_helper_function_prototype),
48-
_xdp_test_ebpf_extension_helper_function_prototype};
49-
50-
static const ebpf_program_section_info_t _ebpf_xdp_test_section_info[] = {
51-
{{EBPF_PROGRAM_SECTION_INFORMATION_CURRENT_VERSION, EBPF_PROGRAM_SECTION_INFORMATION_CURRENT_VERSION_SIZE},
52-
L"xdp_test",
53-
&EBPF_PROGRAM_TYPE_XDP_TEST,
54-
&EBPF_ATTACH_TYPE_XDP_TEST,
55-
BPF_PROG_TYPE_XDP_TEST,
56-
BPF_XDP_TEST}};
57-
5837
// Bind program information.
5938
static const ebpf_context_descriptor_t _ebpf_bind_context_descriptor = {
6039
sizeof(bind_md_t), EBPF_OFFSET_OF(bind_md_t, app_id_start), EBPF_OFFSET_OF(bind_md_t, app_id_end), -1};

0 commit comments

Comments
 (0)