![](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> .