[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240911034608.43192-1-atlas.yu@canonical.com>
Date: Wed, 11 Sep 2024 11:46:08 +0800
From: Atlas Yu <atlas.yu@...onical.com>
To: atlas.yu@...onical.com,
kuba@...nel.org,
edumazet@...gle.com,
davem@...emloft.net,
pabeni@...hat.com
Cc: netdev@...r.kernel.org
Subject: [PATCH net v1] dev_ioctl: fix the type of ifr_flags
SIOCxIFFAGS call dev_get_flags/dev_change_flags under the hood, which
take a unsigned int flags instead of short. This mismatch makes it
impossible to get/set IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO that are
beyond 16 bits.
Signed-off-by: Atlas Yu <atlas.yu@...onical.com>
---
include/uapi/linux/if.h | 2 +-
net/core/dev_ioctl.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 797ba2c1562a..b612b6cd7446 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -244,7 +244,7 @@ struct ifreq {
struct sockaddr ifru_broadaddr;
struct sockaddr ifru_netmask;
struct sockaddr ifru_hwaddr;
- short ifru_flags;
+ unsigned int ifru_flags;
int ifru_ivalue;
int ifru_mtu;
struct ifmap ifru_map;
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 8592c052c0f4..4b317561e503 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -145,7 +145,7 @@ static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cm
switch (cmd) {
case SIOCGIFFLAGS: /* Get interface flags */
- ifr->ifr_flags = (short) dev_get_flags(dev);
+ ifr->ifr_flags = dev_get_flags(dev);
return 0;
case SIOCGIFMETRIC: /* Get the metric on the interface
--
2.43.0
Powered by blists - more mailing lists