Skip to content

Commit

Permalink
Preserve IFS in __stop_legacy_networking (#366)
Browse files Browse the repository at this point in the history
__stop_legacy_networking sets IFS to ',' without restoring it. This
confuses subsequent variable expansions in the function and does not
release IPv6 resources for jails with multiple IPv6 aliases.

(cherry picked from commit 9cf580d)
  • Loading branch information
rfc1459 authored and Brandon Schneider committed Jul 26, 2016
1 parent 3963ccc commit 6189eac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ioc-network
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ __stop_legacy_networking () {
ip6_addr=$(echo $ip6_addr | sed "s/DEFAULT|/$default_iface|/g")

if [ "$ip4_addr" != "none" ] ; then
local oIFS=$IFS
local IFS=','
for ip in $ip4_addr ; do
local iface="$(echo $ip | \
Expand All @@ -232,9 +233,11 @@ __stop_legacy_networking () {

ifconfig $iface $ip4 -alias
done
local IFS=$oIFS
fi

if [ "$ip6_addr" != "none" ] ; then
local oIFS=$IFS
local IFS=','
for ip6 in $ip6_addr ; do
local iface="$(echo $ip6 | \
Expand All @@ -244,5 +247,6 @@ __stop_legacy_networking () {
awk 'BEGIN { FS = "/" } ; { print $1 }')"
ifconfig $iface inet6 $ip6 -alias
done
local IFS=$oIFS
fi
}

0 comments on commit 6189eac

Please sign in to comment.