[Bug 784952] New: Interface names with > 15 chars produce wrong status messages upon start/stop
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952 https://bugzilla.novell.com/show_bug.cgi?id=784952#c0 Summary: Interface names with > 15 chars produce wrong status messages upon start/stop Classification: openSUSE Product: openSUSE 12.2 Version: Final Platform: All OS/Version: All Status: NEW Severity: Normal Priority: P5 - None Component: Network AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: doerges@pre-sense.de QAContact: qa-bugs@suse.de Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1 - No NetworkManager, but manual network configuration. - Example for an interface configuration that breaks: --- snip --- $ cat /etc/sysconfig/network/ifcfg-definitelytoolonginterfacename BOOTPROTO='static' STARTMODE='auto' TUNNEL='tap' TUNNEL_SET_GROUP='' TUNNEL_SET_OWNER='' TUNNEL_SET_PERSISTENT='yes' --- snap --- Reproducible: Always Steps to Reproduce: 1. Create a (tap) device like sketched above 2. rcnetwork restart Actual Results: Starting the interface produces a failure message, even if the interface is started okay. Expected Results: Status message should be correct. Either interface names that are too long should be entirely prohibited or the start/stop scripts should be able to deal with them. For me the following patches work, but I guess I didn't find all the relevant spots: --- snip --- /etc/sysconfig/network/scripts # diff -c functions.orig functions *** functions.orig Fri Oct 12 20:19:31 2012 --- functions Fri Oct 12 21:40:05 2012 *************** *** 100,106 **** } is_iface_available () { ! local IFNAME=${1} local IFTYPE=${2:-$INTERFACETYPE} test -z "$IFNAME" && return 1 test -d /sys/class/net/$IFNAME && return 0 --- 100,106 ---- } is_iface_available () { ! local IFNAME=$(echo ${1} | cut -c 1-15) local IFTYPE=${2:-$INTERFACETYPE} test -z "$IFNAME" && return 1 test -d /sys/class/net/$IFNAME && return 0 *************** *** 120,128 **** is_iface_up () { test -z "$1" && return 1 ! test -d /sys/class/net/$1 || return 1 ! case "`LC_ALL=POSIX ip link show $1 2>/dev/null`" in ! *$1*UP*) ;; *) return 1 ;; esac } --- 120,129 ---- is_iface_up () { test -z "$1" && return 1 ! ifname=$(echo $1 | cut -c 1-15) ! test -d /sys/class/net/$ifname || return 1 ! case "`LC_ALL=POSIX ip link show $ifname 2>/dev/null`" in ! *${ifname}*UP*) ;; *) return 1 ;; esac } *************** *** 143,154 **** } link_ready_check () { ! local c=`cat /sys/class/net/${1}/carrier 2>/dev/null` ! local d=`cat /sys/class/net/${1}/dormant 2>/dev/null` ! local o=`cat /sys/class/net/${1}/operstate 2>/dev/null` ! #debug "link ready ${1}: carrier=$c, dormant=$d, operstate=$o" ! if test -e "/sys/class/net/${1}/operstate" ; then # SLE 11 has carrier + operstate + dormant test "$d" = "0" || return 3 test "$c" = "1" || return 2 --- 144,156 ---- } link_ready_check () { ! ifname=`echo ${1} | cut -c 1-15` ! local c=`cat /sys/class/net/${ifname}/carrier 2>/dev/null` ! local d=`cat /sys/class/net/${ifname}/dormant 2>/dev/null` ! local o=`cat /sys/class/net/${ifname}/operstate 2>/dev/null` ! # debug "link ready ${ifname}: carrier=$c, dormant=$d, operstate=$o" ! if test -e "/sys/class/net/${ifname}/operstate" ; then # SLE 11 has carrier + operstate + dormant test "$d" = "0" || return 3 test "$c" = "1" || return 2 *************** *** 162,168 **** ipv6_addr_dad_check() { ! local iface="$1" word i local nodad=1 tentative=1 dadfailed=1 test -f "/sys/class/net/$iface/ifindex" || return 1 while read -a word ; do --- 164,170 ---- ipv6_addr_dad_check() { ! local iface="$(echo $1 | cut -c 1-15)" word i local nodad=1 tentative=1 dadfailed=1 test -f "/sys/class/net/$iface/ifindex" || return 1 while read -a word ; do *************** *** 241,247 **** } get_iface_type () { ! local IF=$1 TYPE test -n "$IF" || return 1 test -d /sys/class/net/$IF || return 2 case "`cat /sys/class/net/$IF/type`" in --- 243,249 ---- } get_iface_type () { ! local IF=$(echo $1 | cut -c 1-15) TYPE test -n "$IF" || return 1 test -d /sys/class/net/$IF || return 2 case "`cat /sys/class/net/$IF/type`" in /etc/sysconfig/network/scripts # diff -c link_wait.orig link_wait *** link_wait.orig Fri Oct 12 21:20:14 2012 --- link_wait Fri Oct 12 21:21:47 2012 *************** *** 112,124 **** } check_link_detected () { ! local c=`cat /sys/class/net/${1}/carrier 2>/dev/null` ! local d=`cat /sys/class/net/${1}/dormant 2>/dev/null` ! local o=`cat /sys/class/net/${1}/operstate 2>/dev/null` ! debug "link detection ${1}: carrier=$c, dormant=$d, operstate=$o" ! if test -e "/sys/class/net/${1}/operstate" ; then # SLE 11 has carrier + operstate + dormant test "$c" = "1" -a "$d" = "0" -a \ \( "$o" = "up" -o "$o" = "unknown" \) && return 0 --- 112,125 ---- } check_link_detected () { ! ifname=$(echo ${1} | cut -c 1-15) ! local c=`cat /sys/class/net/${ifname}/carrier 2>/dev/null` ! local d=`cat /sys/class/net/${ifname}/dormant 2>/dev/null` ! local o=`cat /sys/class/net/${ifname}/operstate 2>/dev/null` ! debug "link detection ${ifname}: carrier=$c, dormant=$d, operstate=$o" ! if test -e "/sys/class/net/${ifname}/operstate" ; then # SLE 11 has carrier + operstate + dormant test "$c" = "1" -a "$d" = "0" -a \ \( "$o" = "up" -o "$o" = "unknown" \) && return 0 --- snap --- -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c1
Christian Boltz
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c
Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c2
--- Comment #2 from Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c3
--- Comment #3 from Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c4
Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c5
--- Comment #5 from Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c6
Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c7
Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c8
--- Comment #8 from Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c9
Michal Filka
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c10
Martin Vidner
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c
Michal Filka
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c11
Marius Tomaschewski
The yast code is under review at https://github.com/yast/yast-network/pull/26
Marius, IFNAME_RX in comment 7 allows backslash in interface name. Just making sure, is that intentional?
No, the intention were to escape the dot, what is not needed in ".". Fixed.
What is the authority for valid interface names (other than we want our tools to be consistent)?
Well, the kernel basically allows almost almost everything usable as
file, that you can put into a \0 terminated "char ifname[16]" array.
It __expects__, that the name is constructed using something like "lt%d",
that is basically an identifier + number (vlan appends ".%d" with vlan_id,
...).
When the kernel allocates it itself, it formats it using a namespace and
"%d", e.g. "eth%d or "tap%d".
But it accepts whatever root requested and verifies only that it is
usable as file. Most of the code is in net/core/dev.c, e.g. verify
as file is:
bool dev_valid_name(const char *name)
{
if (*name == '\0')
return false;
if (strlen(name) >= IFNAMSIZ)
return false;
if (!strcmp(name, ".") || !strcmp(name, ".."))
return false;
while (*name) {
if (*name == '/' || isspace(*name))
return false;
name++;
}
return true;
}
The problem is, that most of the tools/scripts expect it is
<identifier like><number> .
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c12
Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c13
--- Comment #13 from Marius Tomaschewski
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c14
--- Comment #14 from Bernhard Wiedemann
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c15
--- Comment #15 from Martin Vidner
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c16
--- Comment #16 from Bernhard Wiedemann
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c17
--- Comment #17 from Bernhard Wiedemann
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c18
--- Comment #18 from Bernhard Wiedemann
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c19
--- Comment #19 from Bernhard Wiedemann
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c20
--- Comment #20 from Swamp Workflow Management
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c21
--- Comment #21 from Bernhard Wiedemann
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c22
--- Comment #22 from Swamp Workflow Management
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c23
Benjamin Brunner
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c
Swamp Workflow Management
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c24
Swamp Workflow Management
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=784952
https://bugzilla.novell.com/show_bug.cgi?id=784952#c
Swamp Workflow Management
participants (1)
-
bugzilla_noreply@novell.com