HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //proc/self/root/etc/network/if-up.d/ifenslave
#!/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 wifi authentication packets on the bond interface, but also sends wifi authentication packets on the bond interface.
# If the active interface is not the wifi interface at the time wpa_supplicant tries to authenticate, the wifi AP won't receive anything, causing the authentication to fail.

# In order for the wifi authentication to succeed, one needs to give a chance to the wifi interface to send authentication packets.
# "bond-give-a-chance 10" will set the wifi 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 wifi to authenticate properly.

if [ "$IF_BOND_GIVE_A_CHANCE" ] ; then
	read 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=`expr $IF_BOND_GIVE_A_CHANCE - 1`
	done
		
	# Restore the previous primary.
	sysfs primary "$primary"
fi