mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
shared: check interface name validity in in_addr_port_ifindex_name_from_string_auto()
We don't try to resolve invalid ifnames as all. A different return code is used. This difference will be verified later in test_socket_address_parse() when socket_address_parse() is converted to use in_addr_port_ifindex_name_from_string_auto().
This commit is contained in:
parent
b16d17a68a
commit
c1f848d73c
@ -379,6 +379,10 @@ int in_addr_port_ifindex_name_from_string_auto(
|
||||
if (isempty(m + 1))
|
||||
return -EINVAL;
|
||||
|
||||
if (!ifname_valid_full(m + 1, IFNAME_VALID_ALTERNATIVE | IFNAME_VALID_NUMERIC))
|
||||
return -EINVAL; /* We want to return -EINVAL for syntactically invalid names,
|
||||
* and -ENODEV for valid but nonexistent interfaces. */
|
||||
|
||||
ifindex = resolve_interface(NULL, m + 1);
|
||||
if (ifindex < 0)
|
||||
return ifindex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user