Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
ee92dcc3
Commit
ee92dcc3
authored
Jul 30, 2015
by
Wei-Chun Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assign ip address to br
Signed-off-by:
Wei-Chun Chao
<
weichunc@plumgrid.com
>
parent
7d5c9870
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
1 deletion
+8
-1
examples/distributed_bridge/main.py
examples/distributed_bridge/main.py
+1
-1
examples/distributed_bridge/tunnel.py
examples/distributed_bridge/tunnel.py
+5
-0
examples/distributed_bridge/tunnel_mesh.py
examples/distributed_bridge/tunnel_mesh.py
+2
-0
No files found.
examples/distributed_bridge/main.py
View file @
ee92dcc3
...
...
@@ -32,7 +32,7 @@ class TunnelSimulation(Simulation):
host_info
.
append
(
self
.
_create_ns
(
"host%d"
%
i
,
ipaddr
=
ipaddr
,
disable_ipv6
=
True
))
if
multicast
:
cmd
=
[
"python"
,
"tunnel.py"
]
cmd
=
[
"python"
,
"tunnel.py"
,
str
(
i
)
]
else
:
cmd
=
[
"python"
,
"tunnel_mesh.py"
,
str
(
num_hosts
),
str
(
i
)]
p
=
NSPopen
(
host_info
[
i
][
0
].
nl
.
netns
,
cmd
,
stdin
=
PIPE
)
...
...
examples/distributed_bridge/tunnel.py
View file @
ee92dcc3
...
...
@@ -2,6 +2,7 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
from
sys
import
argv
from
bpf
import
BPF
from
builtins
import
input
from
ctypes
import
c_int
,
c_uint
...
...
@@ -12,6 +13,8 @@ from pyroute2 import IPRoute, NetNS, IPDB, NSPopen
from
socket
import
htons
,
AF_INET
from
threading
import
Thread
host_id
=
int
(
argv
[
1
])
b
=
BPF
(
src_file
=
"tunnel.c"
)
ingress_fn
=
b
.
load_func
(
"handle_ingress"
,
BPF
.
SCHED_CLS
)
egress_fn
=
b
.
load_func
(
"handle_egress"
,
BPF
.
SCHED_CLS
)
...
...
@@ -60,6 +63,8 @@ def run():
ifc_gc
.
append
(
v
.
ifname
)
ifc_gc
.
append
(
br
.
ifname
)
vni2if
[
c_uint
(
vni
)]
=
c_int
(
v
.
index
)
ipaddr
=
"99.1.%d.%d/24"
%
(
i
,
host_id
+
1
)
br
.
add_ip
(
ipaddr
)
try
:
run
()
...
...
examples/distributed_bridge/tunnel_mesh.py
View file @
ee92dcc3
...
...
@@ -67,6 +67,8 @@ def run():
br
.
add_port
(
v
)
br
.
up
()
ifc_gc
.
append
(
v
.
ifname
)
ipaddr
=
"99.1.%d.%d/24"
%
(
i
,
host_id
+
1
)
br
.
add_ip
(
ipaddr
)
ifc_gc
.
append
(
br
.
ifname
)
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment