mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-02 11:27:48 +00:00
ipq807x: update ifname rename patches
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -0,0 +1,60 @@
|
|||||||
|
From: Andy Ren <andy.ren@getcruise.com>
|
||||||
|
Date: Mon, 7 Nov 2022 09:42:42 -0800
|
||||||
|
Subject: [PATCH] net/core: Allow live renaming when an interface is up
|
||||||
|
|
||||||
|
Allow a network interface to be renamed when the interface
|
||||||
|
is up.
|
||||||
|
|
||||||
|
As described in the netconsole documentation [1], when netconsole is
|
||||||
|
used as a built-in, it will bring up the specified interface as soon as
|
||||||
|
possible. As a result, user space will not be able to rename the
|
||||||
|
interface since the kernel disallows renaming of interfaces that are
|
||||||
|
administratively up unless the 'IFF_LIVE_RENAME_OK' private flag was set
|
||||||
|
by the kernel.
|
||||||
|
|
||||||
|
The original solution [2] to this problem was to add a new parameter to
|
||||||
|
the netconsole configuration parameters that allows renaming of
|
||||||
|
the interface used by netconsole while it is administratively up.
|
||||||
|
However, during the discussion that followed, it became apparent that we
|
||||||
|
have no reason to keep the current restriction and instead we should
|
||||||
|
allow user space to rename interfaces regardless of their administrative
|
||||||
|
state:
|
||||||
|
|
||||||
|
1. The restriction was put in place over 20 years ago when renaming was
|
||||||
|
only possible via IOCTL and before rtnetlink started notifying user
|
||||||
|
space about such changes like it does today.
|
||||||
|
|
||||||
|
2. The 'IFF_LIVE_RENAME_OK' flag was added over 3 years ago in version
|
||||||
|
5.2 and no regressions were reported.
|
||||||
|
|
||||||
|
3. In-kernel listeners to 'NETDEV_CHANGENAME' do not seem to care about
|
||||||
|
the administrative state of interface.
|
||||||
|
|
||||||
|
Therefore, allow user space to rename running interfaces by removing the
|
||||||
|
restriction and the associated 'IFF_LIVE_RENAME_OK' flag. Help in
|
||||||
|
possible triage by emitting a message to the kernel log that an
|
||||||
|
interface was renamed while UP.
|
||||||
|
|
||||||
|
[1] https://www.kernel.org/doc/Documentation/networking/netconsole.rst
|
||||||
|
[2] https://lore.kernel.org/netdev/20221102002420.2613004-1-andy.ren@getcruise.com/
|
||||||
|
|
||||||
|
Signed-off-by: Andy Ren <andy.ren@getcruise.com>
|
||||||
|
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
|
||||||
|
Reviewed-by: David Ahern <dsahern@kernel.org>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
|
||||||
|
Index: linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d/net/core/dev.c
|
||||||
|
===================================================================
|
||||||
|
--- linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d.orig/net/core/dev.c
|
||||||
|
+++ linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d/net/core/dev.c
|
||||||
|
@@ -1125,7 +1125,8 @@ int dev_change_name(struct net_device *d
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldname[0] && !strchr(oldname, '%'))
|
||||||
|
- netdev_info(dev, "renamed from %s\n", oldname);
|
||||||
|
+ netdev_info(dev, "renamed from %s%s\n", oldname,
|
||||||
|
+ dev->flags & IFF_UP ? " (while UP)" : "");
|
||||||
|
|
||||||
|
old_assign_type = dev->name_assign_type;
|
||||||
|
dev->name_assign_type = NET_NAME_RENAMED;
|
||||||
@@ -44,18 +44,11 @@ Reviewed-by: David Ahern <dsahern@kernel.org>
|
|||||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
---
|
---
|
||||||
|
|
||||||
--- a/net/core/dev.c
|
Index: linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d/net/core/dev.c
|
||||||
+++ b/net/core/dev.c
|
===================================================================
|
||||||
@@ -1152,8 +1152,6 @@ int dev_change_name(struct net_device *d
|
--- linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d.orig/net/core/dev.c
|
||||||
BUG_ON(!dev_net(dev));
|
+++ linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d/net/core/dev.c
|
||||||
|
@@ -1125,7 +1125,8 @@ int dev_change_name(struct net_device *d
|
||||||
net = dev_net(dev);
|
|
||||||
- if (dev->flags & IFF_UP)
|
|
||||||
- return -EBUSY;
|
|
||||||
|
|
||||||
write_seqcount_begin(&devnet_rename_seq);
|
|
||||||
|
|
||||||
@@ -1171,7 +1169,8 @@ int dev_change_name(struct net_device *d
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldname[0] && !strchr(oldname, '%'))
|
if (oldname[0] && !strchr(oldname, '%'))
|
||||||
|
|||||||
Reference in New Issue
Block a user