projects
/
rrq
/
subhost.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e0808dd
)
Fix to mac address and using explicit chroot (a needed on beowulf)
author
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Sat, 26 Feb 2022 23:28:36 +0000
(10:28 +1100)
committer
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Sat, 26 Feb 2022 23:28:36 +0000
(10:28 +1100)
control
patch
|
blob
|
history
diff --git
a/control
b/control
index f5831a267f8842a3d1090dece847d4d2501648c4..c2901f17570ac8e1615335fb96033b04c7c0e0f2 100755
(executable)
--- a/
control
+++ b/
control
@@
-47,17
+47,11
@@
BRIDGES="$BRIDGES"
EOF
}
EOF
}
-# map a string into a hexadecimal number with 10-digits by folding the given string into 9-digit ascii-code numbers and adding them
-hexfoldsum() {
- local V
- V="$(b2sum -l 40 <<< "$1" | sed 's/\(..\)/\1:/g')"
- echo "02:${V:0:14}"
-}
-
-# Generate a mac address for given interface by passing hostname,
-# subhost name and interface through 40-bit b2sum and with 02: prefix.
+# Generate a mac address for given arguments pass through 40-bit b2sum
+# and with 02: prefix.
macaddr() {
macaddr() {
- local V="$(b2sum -l 40 <<< "$(hostname)$NAME$1" | sed 's/\(..\)/\1:/g')"
+ local V="$(b2sum -l 40 <<< "$*" )"
+ V="$( sed 's/\(..\)/\1:/g' <<< "${V}aaaaaaaaaa")"
echo "02:${V:0:14}"
}
echo "02:${V:0:14}"
}
@@
-66,9
+60,12
@@
setup_network() {
E=0
ip netns add $NSNAME
for BRIDGE in ${BRIDGES[@]} ; do
E=0
ip netns add $NSNAME
for BRIDGE in ${BRIDGES[@]} ; do
- brctl show $BRIDGE >& /dev/null || brctl addbr $BRIDGE
IF=$NAME$E
IF=$NAME$E
- MAC=$(macaddr $IF)
+ B=( ${BRIDGE/:/ } )
+ BRIDGE="${B[0]}"
+ MAC="${B[1]}"
+ [ -z "$MAC" ] && MAC="$(macaddr "$(hostname)" "$NAME" "$IF")"
+ brctl show $BRIDGE >& /dev/null || brctl addbr $BRIDGE
ip link add $IF type veth peer name eth$E address $MAC netns $NSNAME
ip link set $IF up
[ -n "$BRIDGE" ] && brctl addif $BRIDGE $IF
ip link add $IF type veth peer name eth$E address $MAC netns $NSNAME
ip link set $IF up
[ -n "$BRIDGE" ] && brctl addif $BRIDGE $IF