FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
kernelscript/examples/packet_filter.ks at main · multikernel/kernelscript · GitHub
multikernel
/
kernelscript
Public
Notifications
You must be signed in to change notification settings
Fork
24
Star
508
Code
Issues
2
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
kernelscript
/
examples
/
packet_filter.ks
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (19 loc) · 523 Bytes
Breadcrumbs
kernelscript
/
examples
/
packet_filter.ks
Copy path
File metadata and controls
24 lines (19 loc) · 523 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
include
"xdp.kh"
@xdp fn packet_filter
(
ctx:
*
xdp_md
)
-
>
xdp_action {
var packet_size
=
ctx
-
>
data_end
-
ctx
-
>
data
if
(
packet_size
>
1500
)
{
return XDP_DROP
}
return XDP_PASS
}
fn main
()
-
>
i32 {
var prog
=
load
(
packet_filter
)
attach
(
prog,
"eth0"
,
0
)
print
(
"Packet filter attached to eth0"
)
print
(
"Filtering incoming packets..."
)
// In a real application, this would run indefinitely
// For demonstration, we detach after setup
detach
(
prog
)
print
(
"Packet filter detached"
)
return
0
}
Back
|
FazBrowse Home
|
New Git URL