Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pipework
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ else
}
fi

# This avoids segfault when pipework is called twice on the same container
[ -L /sys/class/net/${IFNAME}/upper_ph${NSPID}${CONTAINER_IFNAME} ] &&
echo "A bridge on ${CONTAINER_IFNAME} already exists for ${GUESTNAME}" &&
IFS=$(ls /sys/class/net/${IFNAME}/upper_ph${NSPID}* | sed "s/\/sys\/class\/net\/${IFNAME}\/upper_ph${NSPID}//g") &&
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so I think we shouldn't use IFS, since it's a built-in variable :-)

I'm not sure I understand the goal of that line... Can you explain what it does? It should list the content of a directory, but I don't understand why, sorry!

echo "$IFS\nare already taken" &&
exit 1

# Check if an incompatible VLAN device already exists
[ $IFTYPE = phys ] && [ "$VLAN" ] && [ -d /sys/class/net/$IFNAME.VLAN ] && {
[ -z "$(ip -d link show $IFNAME.$VLAN | grep "vlan.*id $VLAN")" ] && {
Expand Down