diff -Nru ifenslave-2.10ubuntu1/debian/changelog ifenslave-2.10ubuntu3/debian/changelog --- ifenslave-2.10ubuntu1/debian/changelog 2020-06-10 15:46:23.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/changelog 2020-07-29 11:10:22.000000000 +0000 @@ -1,30 +1,9 @@ -ifenslave (2.10ubuntu1) groovy; urgency=low +ifenslave (2.10ubuntu3) groovy; urgency=medium - * Merge from Debian unstable. Remaining changes: - - Upstart event based bond bringup: - + Drop ethernet+wifi example - + Drop two_ethernet example - + Update ethernet+hotplug_wifi example - + Update two_hotplug_ethernet example - + Update pre-up and post-down scripts for event bringup - + Update README.Debian examples - - Update scripts to use /run/network/ifstate instead of - /etc/network/run/ifstate + * Revert 2.10ubuntu1, back to 2.9ubuntu1, as 2.10ubuntu1 is miss-merged. + * Do not reintroduce transitional package. - -- Steve Langasek Wed, 10 Jun 2020 08:46:23 -0700 - -ifenslave (2.10) unstable; urgency=medium - - * Drop the transitional ifenslave-2.6 packages. Closes: #878601 - * Update Vcs-* links to point to Salsa. - * Add support for tlb_dynamic_lb: Closes: #926881 - * Remove the ifenslave binary, use iproute2 instead. - * Fix typo in bonding example. Closes: #914308 - * Bump Standards-Version. - * Remove debian/compat, use Build-Depends: debhelper-compat instead. - * Set Rules-Requires-Root: no. - - -- Guus Sliepen Sun, 26 Apr 2020 21:09:15 +0200 + -- Dimitri John Ledkov Wed, 29 Jul 2020 12:10:22 +0100 ifenslave (2.9ubuntu1) bionic; urgency=low diff -Nru ifenslave-2.10ubuntu1/debian/ifenslave.8 ifenslave-2.10ubuntu3/debian/ifenslave.8 --- ifenslave-2.10ubuntu1/debian/ifenslave.8 1970-01-01 00:00:00.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/ifenslave.8 2016-09-27 22:47:49.000000000 +0000 @@ -0,0 +1,63 @@ +.Dd 2012-07-13 +.Dt IFENSLAVE 8 +.Os "Debian GNU/Linux" +.\" Manual page created by Guus Sliepen +.Sh NAME +.Nm ifenslave +.Nd Attach and detach slave network devices to a bonding device. +.Sh SYNOPSIS +.Nm +.Op Fl acdfhuvV +.Op Fl -all-interfaces +.Op Fl -change-active +.Op Fl -detach +.Op Fl -force +.Op Fl -help +.Op Fl -usage +.Op Fl -verbose +.Op Fl -version +.Ar master +.Ar slave +.No ... +.Sh DESCRIPTION +.Nm +is a tool to attach and detach slave network devices to a bonding device. +A bonding device will act like a normal Ethernet network device to the kernel, +but will send out the packets via the slave devices using a simple round-robin scheduler. +This allows for simple load-balancing, +identical to "channel bonding" or "trunking" techniques used in switches. +.Pp +The kernel must have support for bonding devices for +.Nm +to be useful. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl a, -all-interfaces +Show information about all interfaces. +.It Fl c, -change-active +Change active slave. +.It Fl d, -detach +Removes slave interfaces from the bonding device. +.It Fl f, -force +Force actions to be taken if one of the specified interfaces appears not to belong to an Ethernet device. +.It Fl h, -help +Display a help message and exit. +.It Fl u, -usage +Show usage information and exit. +.It Fl v, -verbose +Print warning and debug messages. +.It Fl V, -version +Show version information and exit. +.El +.Pp +If no options are given, the default action will be to enslave interfaces. +.Sh EXAMPLE +The following example shows how to setup a bonding device and +enslave two real Ethernet devices to it: +.Bd -literal +# modprobe bonding +# ifconfig bond0 192.168.0.1 netmask 255.255.0.0 +# ifenslave bond0 eth0 eth1 +.Ed +.Sh AUTHOR +.An Guus Sliepen Aq guus@debian.org diff -Nru ifenslave-2.10ubuntu1/debian/ifenslave.if-pre-up ifenslave-2.10ubuntu3/debian/ifenslave.if-pre-up --- ifenslave-2.10ubuntu1/debian/ifenslave.if-pre-up 2020-06-10 15:46:16.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/ifenslave.if-pre-up 2018-03-16 23:04:23.000000000 +0000 @@ -6,10 +6,36 @@ add_master() { - # Return if $IFACE is already a bonding interface. - [ -f "/sys/class/net/$IFACE/bonding/slaves" ] && return + # Return if $BOND_MASTER is already a bonding interface. + [ -f "/sys/class/net/$BOND_MASTER/bonding/slaves" ] && return - ip link add dev "$IFACE" type bond + # If the bonding module is not yet loaded, load it. + if [ ! -r /sys/class/net/bonding_masters ]; then + modprobe -q bonding + + FAILED=1 + echo "Waiting for bonding kernel module to be ready (will timeout after 5s)" + count=0 + while [ "$count" -lt "50" ]; do + if [ -r /sys/class/net/bonding_masters ]; then + FAILED=0 + break + fi + sleep 0.1 + count=$(($count+1)) + done + + if [ "$FAILED" = "1" ]; then + echo "/sys/class/net/bonding_masters doesn't exist. Unable to create $BOND_MASTER" + exit 1 + fi + + fi + + # Create the master interface. + if ! grep -sq "\\<$BOND_MASTER\\>" /sys/class/net/bonding_masters; then + echo "+$BOND_MASTER" > /sys/class/net/bonding_masters + fi } sysfs_change_down() @@ -17,7 +43,7 @@ # Called with : # $1 = basename of the file in bonding/ to write to. # $2 = value to write. Won't write if $2 is empty. - if [ -n "$2" ] ; then + if [ "$2" ] ; then # If the value we plan to write is different from the current one... if ! grep -sq "\\<$2\\>" "/sys/class/net/$BOND_MASTER/bonding/$1" ; then # ...and the master is up... @@ -35,7 +61,7 @@ # Called with : # $1 = basename of the file in bonding/ to write to. # $2 = value to write. Won't write if $2 is empty. - if [ -n "$2" ] ; then + if [ "$2" ] ; then echo "$2" > "/sys/class/net/$BOND_MASTER/bonding/$1" return $? fi @@ -119,25 +145,19 @@ [ "$VERBOSITY" = 1 ] && v=-v for slave in $BOND_SLAVES ; do - if ifquery --state $slave 2>/dev/null || [ -n "IFUPDOWN_$IFACE" ]; then - # Skipping interface that's already up or being configured - continue + if ( [ "$AUTOIF" ] && ifquery --state $slave ) ; then + echo "Not enslaving interface $slave since it is already configured" else - if ifquery -l $slave 2>/dev/null; then - ifup $slave + # Ensure $slave is down. + ip link set "$slave" down 2>/dev/null + if ! sysfs_add slaves "$slave" 2>/dev/null ; then + echo "Failed to enslave $slave to $BOND_MASTER. Is $BOND_MASTER ready and a bonding interface ?" >&2 else -<<<<<<< ifenslave-2.9ubuntu1 (ubuntu) # Bring up slave if it is the target of an allow-bondX stanza. # This is useful to bring up slaves that need extra setup. if [ -z "$(which ifquery)" ] || ifquery --allow \"$BOND_MASTER\" --list | grep -q $slave; then ifup $v --allow "$BOND_MASTER" "$slave" fi -======= - ip link set "$slave" down 2>/dev/null - if ! sysfs_add slaves "$slave" 2>/dev/null ; then - echo "Failed to enslave $slave to $IFACE." >&2 - fi ->>>>>>> ifenslave-2.10 (debian) fi fi done @@ -156,6 +176,10 @@ # num_unsol_na can be set anytime. sysfs num_unsol_na "$IF_BOND_NUM_UNSOL_NA" + # xmit_hash_policy can be set anytime. + # Changing xmit_hash_policy requires $BOND_MASTER to be down. + sysfs_change_down xmit_hash_policy "$IF_BOND_XMIT_HASH_POLICY" + # arp_ip_target must be set before arp_interval. sysfs_add arp_ip_target "$IF_BOND_ARP_IP_TARGET" sysfs arp_interval "$IF_BOND_ARP_INTERVAL" @@ -172,10 +196,6 @@ # Mode should be set after miimon or arp_interval, to avoid a warning in syslog. sysfs_change_down mode "$IF_BOND_MODE" - # Requires $BOND_MASTER to be down and mode to be configured - sysfs_change_down xmit_hash_policy "$IF_BOND_XMIT_HASH_POLICY" - sysfs_change_down tlb_dynamic_lb "$IF_BOND_TLB_DYNAMIC_LB" - # packets_per_slave allowed for mode balance-rr only. sysfs packets_per_slave "$IF_BOND_PACKETS_PER_SLAVE" @@ -186,91 +206,23 @@ # Changing lacp_rate requires $BOND_MASTER to be down. sysfs_change_down lacp_rate "$IF_BOND_LACP_RATE" -<<<<<<< ifenslave-2.9ubuntu1 (ubuntu) # Finally bring the bond up, note that without a slave it won't be usable though ip link set dev $BOND_MASTER up -======= - # queue_id must be set after enslavement. - for iface_queue_id in $IF_BOND_QUEUE_ID - do - sysfs iface_queue_id $iface_queue_id - done - - # active_slave must be set after mode and after enslavement. - # The slave must be up and the underlying link must be up too. - # FIXME: We should have a way to write an empty string to active_slave, to set the active_slave to none. - if [ -n "$IF_BOND_ACTIVE_SLAVE" ] ; then - if [ "$IF_BOND_ACTIVE_SLAVE" = "none" ] ; then - sysfs active_slave "" - else - # Need to force interface up before. Bonding will refuse to activate a down interface. - if ifquery -l $IF_BOND_ACTIVE_SLAVE 2>/dev/null ; then - ifup $IF_BOND_ACTIVE_SLAVE - else - ip link set "$IF_BOND_ACTIVE_SLAVE" up - fi - sysfs active_slave "$IF_BOND_ACTIVE_SLAVE" - fi - fi -} - -setup_primary() { - # primary must be set after mode (because only supported in some modes) and after enslavement. - # The first slave in bond-primary found in current slaves becomes the primary. - # If no slave in bond-primary is found, then the primary does not change. - for slave in $IF_BOND_PRIMARY ; do - if grep -sq "\\<$slave\\>" "/sys/class/net/$BOND_MASTER/bonding/slaves" ; then - sysfs primary "$slave" - break - fi - done - - # primary_reselect should be set after mode (it is only supported in some modes), after enslavement - # and after primary. This is currently (2.6.35-rc1) not enforced by the bonding driver, but it is - # probably safer to do it in that order. - sysfs primary_reselect "$IF_BOND_PRIMARY_RESELECT" ->>>>>>> ifenslave-2.10 (debian) -} - -setup_master() { - add_master - early_setup_master - setup_master - enslave_slaves - setup_primary -} - -setup_slave() { - # Require the bond master to have an iface stanza - if ! ifstate -l "$IF_BOND_MASTER" 2>/dev/null ; then - echo "No iface stanza found for master $IF_BOND_MASTER" >&2 - exit 1 - fi - - # Ensure the master is up or being configured - if [ -z "IFENSLAVE_$IF_BOND_MASTER" ] ; then - ifquery --state "$IF_BOND_MASTER" 2>/dev/null || ifup "$IF_BOND_MASTER" - fi - - # Enslave it to the master - ip link set "$slave" down 2>/dev/null - if ! sysfs_add slaves "$slave" 2>/dev/null ; then - echo "Failed to enslave $slave to $BOND_MASTER." >&2 - fi - - setup_primary } # Option slaves deprecated, replaced by bond-slaves, but still supported for backward compatibility. IF_BOND_SLAVES=${IF_BOND_SLAVES:-$IF_SLAVES} -if [ -n "$IF_BOND_MASTER" ] ; then - setup_slave "$IFACE" -elif [ -n "$IF_BOND_SLAVES" -o -n "$IF_BOND_MODE" ] ; then - setup_master "$IFACE" +if [ "$IF_BOND_MASTER" ] ; then + BOND_MASTER="$IF_BOND_MASTER" + BOND_SLAVES="$IFACE" +else + if [ "$IF_BOND_SLAVES" ] ; then + BOND_MASTER="$IFACE" + BOND_SLAVES="$IF_BOND_SLAVES" + fi fi -<<<<<<< ifenslave-2.9ubuntu1 (ubuntu) # Exit if nothing to do... [ -z "$BOND_MASTER$BOND_SLAVES" ] && exit @@ -331,6 +283,4 @@ # when all the slaves are up BOND_SLAVES=$IFACE late_setup_master fi -======= ->>>>>>> ifenslave-2.10 (debian) exit 0 diff -Nru ifenslave-2.10ubuntu1/debian/ifenslave.install ifenslave-2.10ubuntu3/debian/ifenslave.install --- ifenslave-2.10ubuntu1/debian/ifenslave.install 1970-01-01 00:00:00.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/ifenslave.install 2016-09-27 22:47:49.000000000 +0000 @@ -0,0 +1 @@ +ifenslave sbin/ diff -Nru ifenslave-2.10ubuntu1/debian/ifenslave.links ifenslave-2.10ubuntu3/debian/ifenslave.links --- ifenslave-2.10ubuntu1/debian/ifenslave.links 1970-01-01 00:00:00.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/ifenslave.links 2016-09-27 22:47:49.000000000 +0000 @@ -0,0 +1,2 @@ +/sbin/ifenslave /sbin/ifenslave-2.6 +/usr/share/man/man8/ifenslave.8 /usr/share/man/man8/ifenslave-2.6.8 diff -Nru ifenslave-2.10ubuntu1/debian/ifenslave.manpages ifenslave-2.10ubuntu3/debian/ifenslave.manpages --- ifenslave-2.10ubuntu1/debian/ifenslave.manpages 1970-01-01 00:00:00.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/ifenslave.manpages 2016-09-27 22:47:49.000000000 +0000 @@ -0,0 +1 @@ +debian/*.8 diff -Nru ifenslave-2.10ubuntu1/debian/NEWS ifenslave-2.10ubuntu3/debian/NEWS --- ifenslave-2.10ubuntu1/debian/NEWS 2018-05-08 20:49:43.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/NEWS 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -ifenslave (2.10) UNRELEASED; urgency=medium - - This version of the ifenslave package no longer provides /sbin/ifenslave. The - /sbin/ip command from the iproute2 package supports creating bonding masters - and enslaving other interfaces to it. - - -- Guus Sliepen Tue, 08 May 2018 22:47:07 +0200 diff -Nru ifenslave-2.10ubuntu1/debian/README.Debian ifenslave-2.10ubuntu3/debian/README.Debian --- ifenslave-2.10ubuntu1/debian/README.Debian 2020-04-26 20:44:07.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/README.Debian 2016-09-27 22:47:49.000000000 +0000 @@ -1,18 +1,14 @@ ifenslave for Debian ---------------------- -This package used to provide a program named ifenslave that could be used to -manually configure a bond interface and enslave other interfaces to it. -However, since a while now the "ip" command supports creating a bond interface: +The ifenslave program distributed with the Linux kernel sources has not always +been up to date, and several modified versions have been floating around. The +latest kernels now contain an updated version though, but the best way to +configure bonding is via the files in /sys/class/net/$master/bonding/. This +Debian package therefore does not contain the binary from the kernel sources, +but provides a shell script with identical functionality. - ip link add bond0 type bond - -And enslaving another interface to it: - - ip link set eth1 master bond0 - -This package no longer ships with the program named "ifenslave", it only -provides hooks for ifupdown to support network bonding in several ways: +You can also enslave interfaces using Debian's /etc/network/interfaces file: - You can specify in the stanza of a bonding interface which slaves it has. @@ -90,14 +86,15 @@ subdirectories of /sys. For the expected effects of writing into bonding-related /sys files, please read -the Linux kernel bonding documentation, which can be found here: - -https://www.kernel.org/doc/Documentation/networking/bonding.txt +the bonding documentation (Documentation/networking/bonding.txt) in the linux +Kernel source tree. If you think that a bond-* option should exist to write into a bonding-related *writable* file in /sys, but no bond-* option exists for that, please report a bug against the ifenslave package. +Last checked for kernel version 2.6.35-rc1. + * bond-active-slave: Write into /sys/class/net//bonding/active_slave Also force the slave to be up. @@ -202,9 +199,6 @@ be ignored. You must not add a + sign in front of the slave interface names. -* bond-tlb-dynamic-lb: - Write into /sys/class/net//bonding/tlb_dynamic_lb - * bond-updelay: Write into /sys/class/net//bonding/updelay diff -Nru ifenslave-2.10ubuntu1/debian/source/options ifenslave-2.10ubuntu3/debian/source/options --- ifenslave-2.10ubuntu1/debian/source/options 1970-01-01 00:00:00.000000000 +0000 +++ ifenslave-2.10ubuntu3/debian/source/options 2016-09-27 22:47:49.000000000 +0000 @@ -0,0 +1 @@ +compression = "xz" diff -Nru ifenslave-2.10ubuntu1/ifenslave ifenslave-2.10ubuntu3/ifenslave --- ifenslave-2.10ubuntu1/ifenslave 1970-01-01 00:00:00.000000000 +0000 +++ ifenslave-2.10ubuntu3/ifenslave 2016-09-27 22:47:49.000000000 +0000 @@ -0,0 +1,122 @@ +#!/bin/sh + +# Copyright (C) 2012-2013 Guus Sliepen +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +version() { + echo 'ifenslave.sh version 2 (2013-05-05)' + echo 'Copyright (c) 2012-2013 Guus Sliepen ' + exit 0 +} + +usage() { + echo 'Usage: ifenslave [-acdfhuvV] ...' + exit 0 +} + +error() { + echo "$@" >&2 + exit 1 +} + +all_interfaces() { + # I guess this was a debugging feature. + ip link show + exit 0 +} + +# Parse options + +while true; do + if [ "$1" = "-a" -o "$1" = "--all-interfaces" ]; then + all_interfaces + elif [ "$1" = "-c" -o "$1" = "--change-active" ]; then + CHANGE_ACTIVE=1; shift + elif [ "$1" = "-d" -o "$1" = "--detach" ]; then + DETACH=1; shift + elif [ "$1" = "-f" -o "$1" = "--force" ]; then + FORCE=1; shift + elif [ "$1" = "-h" -o "$1" = "--help" ]; then + exec man 8 ifenslave + elif [ "$1" = "-u" -o "$1" = "--usage" ]; then + usage + elif [ "$1" = "-v" -o "$1" = "--verbose" ]; then + VERBOSE=1; shift + elif [ "$1" = "-V" -o "$1" = "--version" ]; then + version + elif [ "$1" = "--" ]; then + shift + break + else + break + fi +done + +# Check that we have enough arguments remaining. + +[ -z "$2" ] && error "Not enough arguments" + +master="$1" +shift + +# Check that the master is really a bonding interface. + +[ -d "/sys/class/net/$master" ] || error "$master: no such interface" +[ -d "/sys/class/net/$master/bonding" ] || error "$master: is not a bonding interface" + +# Do we need to change the active interface? + +if [ "$CHANGE_ACTIVE" = 1 ]; then + [ -z "$2" ] || error 'You can only set one interface to be the active slave!' + [ "$VERBOSE" = 1 ] && echo "Changing active slave of $master to $slave" + echo "$1" >"/sys/class/net/$master/bonding/active_slave" || error "$master: could not set $slave to active slave" + exit 0 +fi + +# Otherwise, loop over all slaves and either attach or detach them. + +for slave in "$@"; do + [ -d "/sys/class/net/$slave" ] || error "$slave: no such interface" + + if [ -z "$DETACH" ]; then + if [ -h "/sys/class/net/$master/slave_$slave" ] || + [ -h "/sys/class/net/$master/lower_$slave" ]; then + echo "$slave: already enslaved to $master" >&2 + continue + fi + + read type <"/sys/class/net/$slave/type" + if [ -z "$FORCE" -a "$type" != "1" ]; then + error "$slave: does not appear to be an Ethernet interface (use -f to force)" + fi + + [ "$VERBOSE" = 1 ] && echo "Adding slave $slave to master $master" + ip link set "$slave" down + echo "+$slave" >"/sys/class/net/$master/bonding/slaves" || error "$slave: could not add interface" + else + if [ ! -h "/sys/class/net/$master/slave_$slave" ] && + [ ! -h "/sys/class/net/$master/lower_$slave" ]; then + echo "$slave: is not enslaved to $master" >&2 + continue + fi + + [ "$VERBOSE" = 1 ] && echo "Detaching slave $slave from master $master" + echo "-$slave" >"/sys/class/net/$master/bonding/slaves" || error "$slave: could not detach interface" + fi +done + +exit 0