Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
multicast-study
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
multicast-study
Commits
9128913c
Commit
9128913c
authored
Apr 29, 2022
by
Kirill Smelkov
Committed by
Léo-Paul Géneau
Apr 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
de0fc816
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
namespace_demo/tmcast.py
namespace_demo/tmcast.py
+5
-4
namespace_demo/topo-B-A-C.sh
namespace_demo/topo-B-A-C.sh
+20
-0
No files found.
namespace_demo/tmcast.py
View file @
9128913c
...
...
@@ -4,10 +4,11 @@
from
__future__
import
print_function
import
sys
,
struct
,
time
import
sys
,
time
from
socket
import
socket
,
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
,
SOL_SOCKET
,
\
SO_REUSEADDR
,
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
IP_MULTICAST_TTL
,
IP_MULTICAST_LOOP
,
\
inet_aton
,
INADDR_ANY
from
struct
import
pack
from
golang
import
b
,
u
from
golang
import
sync
,
context
...
...
@@ -23,7 +24,7 @@ def mjoin_tx(group, port, ttl=2):
sk
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
)
# set ttl and default destination address (for tx)
sk
.
setsockopt
(
IPPROTO_IP
,
IP_MULTICAST_TTL
,
ttl
)
sk
.
setsockopt
(
IPPROTO_IP
,
IP_MULTICAST_TTL
,
pack
(
'b'
,
ttl
)
)
sk
.
connect
((
group
,
port
))
# so that what we send is received locally as well
...
...
@@ -36,10 +37,10 @@ def mjoin_rx(group, port):
sk
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
)
sk
.
setsockopt
(
SOL_SOCKET
,
SO_REUSEADDR
,
1
)
sk
.
bind
((
''
,
port
))
sk
.
bind
((
group
,
port
))
# join the group (for rx)
mreq
=
struct
.
pack
(
"4sl"
,
inet_aton
(
group
),
INADDR_ANY
)
mreq
=
pack
(
"4sl"
,
inet_aton
(
group
),
INADDR_ANY
)
sk
.
setsockopt
(
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
mreq
)
return
sk
...
...
namespace_demo/topo-B-A-C.sh
0 → 100644
View file @
9128913c
#!/bin/bash
# topo B-A-C creates the following network topology:
#
#
# netns=B netns=A netns=C
#
# B --- br0 --- A --- br1 --- C
# b1 a1 a2 c1
#
# should be run under unshare -mrun .
# use nsenter --net={A,B,C} to enter into network namespace of A/B/C.
touch
A B C
ip
link
add br0
type
bridge
# vlan_filtering 1 mcast_snooping 0
ip
link
add
type
a1 veth peer b1
ip
link set
b1 master br0
ip
link set
a1 up
ip
link set
b1 up
ip
link set
br0 up
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