File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 88#include <linux/icmpv6.h>
99#include "bpf_helpers.h"
1010#include "bpf_endian.h"
11+ /* Defines xdp_stats_map from packet04 */
12+ #include "../common/xdp_stats_kern_user.h"
13+ #include "../common/xdp_stats_kern.h"
1114
1215/* Header cursor to keep track of current parsing position */
1316struct hdr_cursor {
@@ -63,6 +66,12 @@ int xdp_parser_func(struct xdp_md *ctx)
6366 void * data = (void * )(long )ctx -> data ;
6467 struct ethhdr * eth ;
6568
69+ /* Default action XDP_PASS, imply everything we couldn't parse, or that
70+ * we don't want to deal with, we just pass up the stack and let the
71+ * kernel deal with it.
72+ */
73+ __u32 action = XDP_PASS ; /* Default action */
74+
6675 /* These keep track of the next header type and iterator pointer */
6776 struct hdr_cursor nh ;
6877 int nh_type ;
@@ -80,13 +89,9 @@ int xdp_parser_func(struct xdp_md *ctx)
8089
8190 /* Assignment additions go below here */
8291
83- return XDP_DROP ;
84-
92+ action = XDP_DROP ;
8593out :
86- /* Everything we couldn't parse, or that we don't want to deal with, we
87- * just pass up the stack and let the kernel deal with it.
88- */
89- return XDP_PASS ;
94+ return xdp_stats_record_action (ctx , action ); /* read via xdp_stats */
9095}
9196
9297char _license [] SEC ("license" ) = "GPL" ;
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ int xdp_parser_func(struct xdp_md *ctx)
9999 * we don't want to deal with, we just pass up the stack and let the
100100 * kernel deal with it.
101101 */
102- __u32 action = XDP_PASS ; /* Default action */
102+ __u32 action = XDP_PASS ; /* Default action */
103103
104104 /* These keep track of the next header type and iterator pointer */
105105 struct hdr_cursor nh ;
You can’t perform that action at this time.
0 commit comments