Package: ifupdown-extra
Version: 0.32
Severity: normal
Tags: ipv6 patch

Dear Maintainer,

When adding package "ifup-extra" on a fresh installation of Debian 11, 
I started getting error messages referring to "wlan0" at ifup time.
This was unexpected as this system had no interface named "wlan0"
at the time.

An easy grep revealed that /etc/network/if-up.d/10check-duplicate-ip6
had a hard-coded reference to network interface "wlan0" where a 
variable was supposed to be used.

Here's a patch to fix it:

--- 10check-duplicate-ip6.old   2021-08-17 18:22:03.029055558 +0300
+++ 10check-duplicate-ip6       2021-08-17 18:22:53.037696969 +0300
@@ -70,7 +70,7 @@ do_ndisc() {
 
 # First determine physical interface in case aliased interfaces are used
         real_iface=$(echo "$IFACE" | sed -e 's|:[[:digit:]]\+||')
-        link_address=$(ip link show wlan0 | grep link | awk '{print 
toupper($2)}')
+        link_address=$(ip link show "$real_iface" | grep link | awk '{print 
toupper($2)}')
 
         if [ -z "`ip link show $real_iface up`" ]; then
             return

-- System Information:
Debian Release: 11.0
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 5.10.0-8-686 (SMP w/1 CPU thread)
Locale: LANG=en_US.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages ifupdown-extra depends on:
ii  bind9-host [host]    1:9.16.15-1
ii  curl                 7.74.0-1.3+b1
ii  dpkg                 1.20.9
ii  iproute2             5.10.0-4
ii  iputils-arping       3:20210202-1
ii  iputils-ping [ping]  3:20210202-1
ii  lsb-base             11.1.0
ii  net-tools            1.60+git20181103.0eebece-1
ii  netcat-openbsd       1.217-3

Versions of packages ifupdown-extra recommends:
ii  ethtool  1:5.9-1
ii  ndisc6   1.0.4-2

ifupdown-extra suggests no packages.

-- Configuration Files:
/etc/network/if-up.d/10check-duplicate-ip6 changed:
DEFAULT=/etc/default/network-test
[ -r "$DEFAULT" ] && . $DEFAULT
[ "$DO_ARPING" = "no" ]  && exit 0
NDISC=/usr/bin/ndisc6
[ ! -x "$NDISC" ] && exit 0 # Silent exit if ndisc is not installed
DO_SYSLOG=${DO_SYSLOG:-yes}
VERBOSITY=${VERBOSITY:-0}
LC_ALL=C
export LC_ALL
if [ "$DO_SYSLOG" = "yes" ] ; then
        OUTPUT="logger -i -p daemon.err -s"
else
        OUTPUT="echo"
fi
do_ndisc() {
        real_iface=$(echo "$IFACE" | sed -e 's|:[[:digit:]]\+||')
        link_address=$(ip link show $real_iface | grep link | awk '{print 
toupper($2)}')
        if [ -z "`ip link show $real_iface up`" ]; then
            return
        fi
        for ADDR in $IF_ADDRESS; do
        # Only check IP address if it is IPv6
            if echo ${ADDR} | grep -q ":" ; then
                [ "$VERBOSITY" -eq 1 ] && $OUTPUT "DEBUG: Sending arp pings 
through $real_iface (for $IFACE) to detect other systems using $ADDR"
                dup_link_address=$($NDISC -q $ADDR $real_iface)
                if [ $? -eq 0 ] ; then
                    # If the link address is the same as our address this is 
not a problem
                    # (ndisc returns it in at least Wireless interfaces), only 
report if the link 
                    # address does not match
                    if [ "$link_address" != "$dup_link_address" ] ; then
                        $OUTPUT "ERROR: Duplicate address $ADDR assigned in the 
network where $real_iface is connected to."
                    fi
                fi
            fi
        done
}
find_ip6() {
       export IF_ADDRESS
       IF_ADDRESS=$(ip addr show "$IFACE" 2>/dev/null | sed -rne 
's|^[[:blank:]]*inet6[[:blank:]]+([^/]+)/.*|\1|p')
       return 0
}
if [ -z "$IFACE" ] ; then
    echo "ERROR: Do not know what interface to check. IFACE environment 
variable is not defined!" >&2
    exit 1
fi
case $IFACE in
        sl* | ww* | lo*) exit 0 ;;
        *) ;;
esac
[ -z "$IF_ADDRESS" ] && find_ip6
[ -z "$IF_ADDRESS" ] && exit 0
do_ndisc 
exit 0


-- no debconf information

Reply via email to