Lines 40-45
Link Here
|
40 |
|
40 |
|
41 |
slaves="slaves_${ifvar}[@]" |
41 |
slaves="slaves_${ifvar}[@]" |
42 |
[[ -z ${!slaves} ]] && return 0 |
42 |
[[ -z ${!slaves} ]] && return 0 |
|
|
43 |
slaves=( "${!slaves}" ) |
44 |
|
45 |
# Support space seperated slaves |
46 |
[[ ${#slaves[@]} == 1 ]] && slaves=( ${slaves} ) |
43 |
|
47 |
|
44 |
interface_exists "${iface}" true || return 1 |
48 |
interface_exists "${iface}" true || return 1 |
45 |
|
49 |
|
Lines 50-66
Link Here
|
50 |
|
54 |
|
51 |
ebegin "Adding slaves to ${iface}" |
55 |
ebegin "Adding slaves to ${iface}" |
52 |
eindent |
56 |
eindent |
53 |
einfo "${!slaves}" |
57 |
einfo "${slaves[@]}" |
54 |
|
58 |
|
55 |
# Check that our slaves exist |
59 |
# Check that our slaves exist |
56 |
for s in "${!slaves}" ; do |
60 |
for s in "${slaves[@]}" ; do |
57 |
interface_exists "${s}" && continue |
61 |
interface_exists "${s}" && continue |
58 |
ewarn "interface ${s} does not exist" |
62 |
ewarn "interface ${s} does not exist" |
59 |
return 1 |
63 |
return 1 |
60 |
done |
64 |
done |
61 |
|
65 |
|
62 |
# Must force the slaves to a particular state before adding them |
66 |
# Must force the slaves to a particular state before adding them |
63 |
for s in "${!slaves}" ; do |
67 |
for s in "${slaves[@]}" ; do |
64 |
interface_del_addresses "${s}" |
68 |
interface_del_addresses "${s}" |
65 |
interface_up "${s}" |
69 |
interface_up "${s}" |
66 |
done |
70 |
done |
Lines 70-76
Link Here
|
70 |
|
74 |
|
71 |
# finally add in slaves |
75 |
# finally add in slaves |
72 |
eoutdent |
76 |
eoutdent |
73 |
/sbin/ifenslave "${iface}" "${!slaves}" >/dev/null |
77 |
eval /sbin/ifenslave "${iface}" "${slaves[@]}" >/dev/null |
74 |
eend $? |
78 |
eend $? |
75 |
|
79 |
|
76 |
return 0 #important |
80 |
return 0 #important |
Lines 87-93
Link Here
|
87 |
! bonding_exists "${iface}" && return 0 |
91 |
! bonding_exists "${iface}" && return 0 |
88 |
|
92 |
|
89 |
# don't trust the config, get the active list instead |
93 |
# don't trust the config, get the active list instead |
90 |
slaves=$( sed -n -e 's/^Slave Interface: //p' "/proc/net/bonding/${iface}" ) |
94 |
slaves="$( \ |
|
|
95 |
sed -n -e 's/^Slave Interface: //p' /proc/net/bonding/${iface} | xargs \ |
96 |
)" |
91 |
[[ -z ${slaves} ]] && return 0 |
97 |
[[ -z ${slaves} ]] && return 0 |
92 |
|
98 |
|
93 |
# remove all slaves |
99 |
# remove all slaves |
Lines 95-101
Link Here
|
95 |
eindent |
101 |
eindent |
96 |
einfo "${slaves}" |
102 |
einfo "${slaves}" |
97 |
eoutdent |
103 |
eoutdent |
98 |
/sbin/ifenslave -d "${iface}" ${slaves} &>${devnull} |
104 |
/sbin/ifenslave -d "${iface}" ${slaves} |
99 |
|
105 |
|
100 |
# reset all slaves |
106 |
# reset all slaves |
101 |
for s in ${slaves}; do |
107 |
for s in ${slaves}; do |