[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1517139538-25746-1-git-send-email-xiangxia.m.yue@gmail.com>
Date: Sun, 28 Jan 2018 03:38:58 -0800
From: Tonghao Zhang <xiangxia.m.yue@...il.com>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, Tonghao Zhang <xiangxia.m.yue@...il.com>,
Al Viro <viro@...iv.linux.org.uk>
Subject: [PATCH] ipv4: Get the address of interface correctly.
When using ioctl to get address of interface, we can't
get it anymore. For example, the command is show as below.
# ifconfig eth0
In the patch ("03aef17bb79b3"), the devinet_ioctl does not
return a suitable value, even though we can find it in
the kernel. Then fix it now.
Fixes: 03aef17bb79b3 ("devinet_ioctl(): take copyin/copyout to caller")
Cc: Al Viro <viro@...iv.linux.org.uk>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
---
net/ipv4/devinet.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index e056c00..40f0017 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1048,18 +1048,22 @@ int devinet_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr)
switch (cmd) {
case SIOCGIFADDR: /* Get interface address */
+ ret = 0;
sin->sin_addr.s_addr = ifa->ifa_local;
break;
case SIOCGIFBRDADDR: /* Get the broadcast address */
+ ret = 0;
sin->sin_addr.s_addr = ifa->ifa_broadcast;
break;
case SIOCGIFDSTADDR: /* Get the destination address */
+ ret = 0;
sin->sin_addr.s_addr = ifa->ifa_address;
break;
case SIOCGIFNETMASK: /* Get the netmask for the interface */
+ ret = 0;
sin->sin_addr.s_addr = ifa->ifa_mask;
break;
--
1.8.3.1
Powered by blists - more mailing lists