From 9248e99dcc0cb1444060ee6037b8c7c2fcbdd184 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Wed, 13 Nov 2019 17:27:34 +0100 Subject: [PATCH] Fix interface rename error --- os_dep/linux/os_intfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 446d788..6739ca8 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1419,7 +1419,7 @@ static u8 is_rtw_ndev(struct net_device *ndev) static int rtw_ndev_notifier_call(struct notifier_block *nb, unsigned long state, void *ptr) { struct net_device *ndev; - _adapter *adapter; + _adapter *adapter = rtw_netdev_priv(ndev); if (ptr == NULL) return NOTIFY_DONE; @@ -1443,6 +1443,8 @@ static int rtw_ndev_notifier_call(struct notifier_block *nb, unsigned long state switch (state) { case NETDEV_CHANGENAME: rtw_adapter_proc_replace(ndev); + strncpy(adapter->old_ifname, ndev->name, IFNAMSIZ); + adapter->old_ifname[IFNAMSIZ-1] = 0; break; #ifdef CONFIG_NEW_NETDEV_HDL case NETDEV_PRE_UP :