Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 207068 Details for
Bug 271896
sys-apps/baselayout-1 support for building custom bonds via sysfs
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
revised sysfs support for bonding patch
bonding.sh.diff2 (text/plain), 4.82 KB, created by
Lorand Kelemen
on 2009-10-14 10:30:40 UTC
(
hide
)
Description:
revised sysfs support for bonding patch
Filename:
MIME Type:
Creator:
Lorand Kelemen
Created:
2009-10-14 10:30:40 UTC
Size:
4.82 KB
patch
obsolete
>--- bonding.sh.orig 2009-10-14 13:27:40.000000000 +0200 >+++ bonding.sh 2009-10-14 13:33:54.000000000 +0200 >@@ -15,7 +15,7 @@ > # > # Expose variables that can be configured > bonding_expose() { >- variables slaves >+ variables slaves bonding > } > > # bool bonding_check_installed(void) >@@ -23,6 +23,7 @@ > # Returns 0 if ifenslave is installed, otherwise 1 > bonding_check_installed() { > [[ -x /sbin/ifenslave ]] && return 0 >+ [[ -f /sys/class/net/bonding_masters ]] && return 0 > ${1:-false} && eerror "For link aggregation (bonding) support, emerge net-misc/ifenslave" > return 1 > } >@@ -38,8 +39,8 @@ > # > # Bonds the interface > bonding_pre_start() { >- local iface="$1" s= ifvar=$(bash_variable "$1") >- local -a slaves=() >+ local iface="$1" s= ifvar=$(bash_variable "$1") b= retval=0 >+ local -a slaves=() bonding=() > > slaves="slaves_${ifvar}[@]" > [[ -z ${!slaves} ]] && return 0 >@@ -48,6 +49,48 @@ > # Support space seperated slaves > [[ ${#slaves[@]} == 1 ]] && slaves=( ${slaves} ) > >+ bonding="bonding_${ifvar}[@]" >+ bonding=( "${!bonding}" ) >+ >+ # Support space seperated bonding options >+ [[ ${#bonding[@]} == 1 ]] && bonding=( ${bonding} ) >+ >+ # Check for bonding support, otherwise load module >+ if test ! -d /proc/net/bonding ; then >+ if modprobe bonding ; then >+ # Loading the bonding module can automatically create bonds >+ # We don't want that. >+ if [ -d /sys/class/net/${iface} ] ; then >+ einfo "Bringing ${iface} down, as bonding probably created it" >+ interface_down "${iface}" && { >+ ebegin "Waiting 5 seconds for bonding to settle"; >+ sleep 5; >+ eend 0; >+ } >+ fi >+ else >+ eerror "Cannot load the bonding module" >+ return 1 >+ fi >+ fi >+ >+ # Check for bonding_ifvar config >+ if test -n ${bonding} ; then >+ if test -f /sys/class/net/bonding_masters ; then >+ # Create bond >+ echo "+${iface}" > /sys/class/net/bonding_masters 2> /dev/null >+ # Wait for bond to settle >+ sleep 4 >+ # Set options >+ for b in "${bonding[@]}" ; do >+ echo ${b/*=/} > /sys/class/net/${iface}/bonding/${b/=*/} 2> /dev/null >+ done >+ else >+ # Complain if bonding_masters doesn't exist >+ eerror "bonding module older than 3.0.0 (or bonding not available), sysfs support not available" >+ fi >+ fi >+ > interface_exists "${iface}" true || return 1 > > if ! bonding_exists "${iface}" ; then >@@ -67,7 +110,7 @@ > # Must force the slaves to a particular state before adding them > for s in "${slaves[@]}" ; do > interface_del_addresses "${s}" >- interface_up "${s}" >+ test -n ${bonding} && interface_down "${s}" || interface_up "${s}" > done > > # now force the master to up >@@ -75,8 +118,21 @@ > > # finally add in slaves > eoutdent >- /sbin/ifenslave "${iface}" ${slaves[@]} >/dev/null >- eend $? >+ if test -n ${bonding} ; then >+ for s in "${slaves[@]}" ; do >+ echo "+${s}" > /sys/class/net/${iface}/bonding/slaves >+ ret=$? >+ [[ ${retval} = 0 ]] && retval=${ret} >+ done >+ # Set options again, as some don't work earlier >+ for b in "${bonding[@]}" ; do >+ echo ${b/*=/} > /sys/class/net/${iface}/bonding/${b/=*/} 2> /dev/null >+ done >+ else >+ /sbin/ifenslave "${iface}" ${slaves[@]} >/dev/null >+ retval=$? >+ fi >+ eend $retval > > return 0 #important > } >@@ -103,7 +159,13 @@ > eindent > einfo "${slaves}" > eoutdent >- /sbin/ifenslave -d "${iface}" ${slaves} >+ if test -n "$(cat /sys/class/net/bonding_masters)" ; then >+ for s in ${slaves}; do >+ echo "-${s}" > /sys/class/net/${iface}/bonding/slaves >+ done >+ else >+ /sbin/ifenslave -d "${iface}" ${slaves} >+ fi > > # reset all slaves > for s in ${slaves}; do >@@ -112,6 +174,9 @@ > interface_down "${s}" > fi > done >+ echo "-${iface}" > /sys/class/net/bonding_masters >+ # Wait for bond to settle >+ sleep 4 > > eend 0 > return 0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 271896
:
192998
|
207068
|
207118
|
207326
|
207575