mirror of
https://github.com/systemd/systemd.git
synced 2024-12-18 22:53:40 +08:00
udev: refuse invalid ifname earlier
This commit is contained in:
parent
b4d885f0e8
commit
068b0f7728
@ -17,6 +17,7 @@
|
||||
#include "fd-util.h"
|
||||
#include "fs-util.h"
|
||||
#include "format-util.h"
|
||||
#include "netif-naming-scheme.h"
|
||||
#include "netlink-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
@ -848,6 +849,12 @@ static int rename_netif(UdevEvent *event) {
|
||||
if (r < 0)
|
||||
return log_device_error_errno(dev, r, "Failed to get ifindex: %m");
|
||||
|
||||
if (naming_scheme_has(NAMING_REPLACE_STRICTLY) &&
|
||||
!ifname_valid(event->name)) {
|
||||
log_device_warning(dev, "Invalid network interface name, ignoring: %s", event->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set ID_RENAMING boolean property here, and drop it in the corresponding move uevent later. */
|
||||
r = device_add_property(dev, "ID_RENAMING", "1");
|
||||
if (r < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user