| Server IP : 103.75.185.95 / Your IP : 216.73.217.162 Web Server : nginx/1.30.0 System : Linux cs-linux-20260509085757017 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : cuuhootoxema ( 1215) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /etc/network/if-up.d/ |
Upload File : |
#!/bin/sh
[ "$VERBOSITY" = 1 ] && set -x
[ "$ADDRFAM" = meta ] && exit 0
sysfs()
{
# Called with :
# $1 = basename of the file in bonding/ to write to.
# $2 = value to write. Won't write if $2 is empty.
if [ "$2" ] ; then
echo "$2" > "/sys/class/net/$IFACE/master/bonding/$1"
return $?
fi
return 0
}
# If the stanza bond-give-a-chance is set for a slave interface,
# then force $IFACE to be the primary for some time, then restore the primary to its previous value.
# This stanza is designed to workaround a bug in wpa_supplicant, when used with bonding :
# wpa_supplicant expects Wi-Fi authentication packets on the bond interface, but also sends Wi-Fi authentication packets on the bond interface.
# If the active interface is not the Wi-Fi interface at the time wpa_supplicant tries to authenticate, the Wi-Fi AP won't receive anything, causing the authentication to fail.
# In order for the Wi-Fi authentication to succeed, one needs to give a chance to the Wi-Fi interface to send authentication packets.
# "bond-give-a-chance 10" will set the Wi-Fi interface as the primary interface for 10 seconds, then restore the previous primary interface.
# This is supposed to be enough to give a chance to Wi-Fi to authenticate properly.
if [ "$IF_BOND_GIVE_A_CHANCE" ] ; then
read -r primary < "/sys/class/net/$IFACE/master/bonding/primary"
# Set the temporary primary.
sysfs primary "$IFACE"
# Wait for the link to be setup, but not longer that $IF_BOND_GIVE_A_CHANGE seconds.
while [ "$IF_BOND_GIVE_A_CHANCE" -gt 0 ] ; do
if ip link show "$IFACE" | grep -sq 'state UP'; then
break
fi
sleep 1
IF_BOND_GIVE_A_CHANCE=$((IF_BOND_GIVE_A_CHANCE - 1))
done
# Restore the previous primary.
sysfs primary "$primary"
fi