Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GNS3_unikernel_testbed
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NGUYEN Do Duc Anh
GNS3_unikernel_testbed
Commits
e8a33796
Commit
e8a33796
authored
1 month ago
by
NGUYEN Do Duc Anh
Browse files
Options
Downloads
Patches
Plain Diff
undo deploy from bpg since scapy not always catch
parent
f1ee75e3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ubuntu_base/op_ebpf.c
+14
-14
14 additions, 14 deletions
ubuntu_base/op_ebpf.c
ubuntu_base/opportunistic_node.py
+14
-14
14 additions, 14 deletions
ubuntu_base/opportunistic_node.py
with
28 additions
and
28 deletions
ubuntu_base/op_ebpf.c
+
14
−
14
View file @
e8a33796
...
...
@@ -58,7 +58,7 @@ struct FirewallRequest
// entry.inter_val, pkt_dst, entry.cmd_val
//
BPF_QUEUE(queue, struct FirewallRequest, 10240);
BPF_QUEUE
(
queue
,
struct
FirewallRequest
,
10240
);
int
op_ebpf
(
struct
xdp_md
*
ctx
)
{
...
...
@@ -137,19 +137,19 @@ int op_ebpf(struct xdp_md *ctx)
// bpf_trace_printk("Count %d", (__u32)option_count);
// bpf_trace_printk("ID %u, Inter %u, CMD %u", (__u32)id_val, (__u32)inter_val, (__u32)cmd_val);
//
if (cmd_val == DROP)
//
{
//
if (id_val == MY_NODE_ID)
//
{
//
struct FirewallRequest req = {};
//
req.ip_dst = addition_info; // Store as __u32 (network byte order)
//
req.entry_inter_val = inter_val;
//
req.entry_cmd_val = DROP;
//
//
queue.push(&req, 0);
//
}
//
}
if
(
cmd_val
==
REGISTER
)
if
(
cmd_val
==
DROP
)
{
if
(
id_val
==
MY_NODE_ID
)
{
struct
FirewallRequest
req
=
{};
req
.
ip_dst
=
addition_info
;
// Store as __u32 (network byte order)
req
.
entry_inter_val
=
inter_val
;
req
.
entry_cmd_val
=
DROP
;
queue
.
push
(
&
req
,
0
);
}
}
else
if
(
cmd_val
==
REGISTER
)
{
__u16
id_val_2nd
=
bpf_ntohs
((
__u16
)(
addition_info
>>
16
));
if
(
id_val_2nd
==
0
)
...
...
This diff is collapsed.
Click to expand it.
ubuntu_base/opportunistic_node.py
+
14
−
14
View file @
e8a33796
...
...
@@ -116,21 +116,21 @@ def start_process_from_queue():
print
(
"
Attach the ebpf program at
"
,
inter_name
)
try
:
#
request_queue = b[b'queue']
#
request_queue
=
b
[
b
'
queue
'
]
while
True
:
b
.
trace_print
()
#
try:
#
req = request_queue.pop()
#
entry_inter_val, ip_dst, entry_cmd_val = struct.unpack("III", req)
#
ip_dst_le = struct.unpack("<I", struct.pack(">I", ip_dst))[0] # Convert to little-endian
#
ip_str = socket.inet_ntoa(struct.pack("!I", ip_dst_le))
#
#
# print(f"Entry: {entry_inter_val}, IP: {ip_str}, Cmd: {entry_cmd_val}")
#
FirewallOpportunistic.firewall_queue.put((entry_inter_val, ip_str, entry_cmd_val))
#
# time.sleep(1)
#
except KeyError:
#
continue
#
b.trace_print()
try
:
req
=
request_queue
.
pop
()
entry_inter_val
,
ip_dst
,
entry_cmd_val
=
struct
.
unpack
(
"
III
"
,
req
)
ip_dst_le
=
struct
.
unpack
(
"
<I
"
,
struct
.
pack
(
"
>I
"
,
ip_dst
))[
0
]
# Convert to little-endian
ip_str
=
socket
.
inet_ntoa
(
struct
.
pack
(
"
!I
"
,
ip_dst_le
))
# print(f"Entry: {entry_inter_val}, IP: {ip_str}, Cmd: {entry_cmd_val}")
FirewallOpportunistic
.
firewall_queue
.
put
((
entry_inter_val
,
ip_str
,
entry_cmd_val
))
# time.sleep(1)
except
KeyError
:
continue
except
Exception
as
e
:
print
(
f
"
ERROR
{
e
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment