From: Christoph Hellwig <hch@lst.de>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 3/4] appletalk: factor out a atrtr_ioctl_addrt helper
Date: Mon, 18 May 2020 08:28:07 +0200 [thread overview]
Message-ID: <20200518062808.756610-4-hch@lst.de> (raw)
In-Reply-To: <20200518062808.756610-1-hch@lst.de>
Add a helper than can be shared with the upcoming compat ioctl handler.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
net/appletalk/ddp.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index b41375d4d295d..4177a74f65436 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -867,6 +867,24 @@ static int atif_ioctl(int cmd, void __user *arg)
return copy_to_user(arg, &atreq, sizeof(atreq)) ? -EFAULT : 0;
}
+static int atrtr_ioctl_addrt(struct rtentry *rt)
+{
+ struct net_device *dev = NULL;
+
+ if (rt->rt_dev) {
+ char name[IFNAMSIZ];
+
+ if (copy_from_user(name, rt->rt_dev, IFNAMSIZ-1))
+ return -EFAULT;
+ name[IFNAMSIZ-1] = '\0';
+
+ dev = __dev_get_by_name(&init_net, name);
+ if (!dev)
+ return -ENODEV;
+ }
+ return atrtr_create(rt, dev);
+}
+
/* Routing ioctl() calls */
static int atrtr_ioctl(unsigned int cmd, void __user *arg)
{
@@ -882,19 +900,8 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg)
return atrtr_delete(&((struct sockaddr_at *)
&rt.rt_dst)->sat_addr);
- case SIOCADDRT: {
- struct net_device *dev = NULL;
- if (rt.rt_dev) {
- char name[IFNAMSIZ];
- if (copy_from_user(name, rt.rt_dev, IFNAMSIZ-1))
- return -EFAULT;
- name[IFNAMSIZ-1] = '\0';
- dev = __dev_get_by_name(&init_net, name);
- if (!dev)
- return -ENODEV;
- }
- return atrtr_create(&rt, dev);
- }
+ case SIOCADDRT:
+ return atrtr_ioctl_addrt(&rt);
}
return -EINVAL;
}
--
2.26.2
next prev parent reply other threads:[~2020-05-18 6:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-18 6:28 move the SIOCDELRT and SIOCADDRT compat_ioctl handlers v3 Christoph Hellwig
2020-05-18 6:28 ` [PATCH 1/4] ipv6: lift copy_from_user out of ipv6_route_ioctl Christoph Hellwig
2020-05-18 6:28 ` [PATCH 2/4] ipv6: move SIOCADDRT and SIOCDELRT handling into ->compat_ioctl Christoph Hellwig
2020-05-18 6:28 ` Christoph Hellwig [this message]
2020-05-18 6:28 ` [PATCH 4/4] ipv4,appletalk: " Christoph Hellwig
2020-05-19 0:35 ` move the SIOCDELRT and SIOCADDRT compat_ioctl handlers v3 David Miller
-- strict thread matches above, loose matches on Subject: below --
2020-05-15 13:19 move the SIOCDELRT and SIOCADDRT compat_ioctl handlers v2 Christoph Hellwig
2020-05-15 13:19 ` [PATCH 3/4] appletalk: factor out a atrtr_ioctl_addrt helper Christoph Hellwig
2020-05-14 14:45 move the SIOCDELRT and SIOCADDRT compat_ioctl handlers Christoph Hellwig
2020-05-14 14:45 ` [PATCH 3/4] appletalk: factor out a atrtr_ioctl_addrt helper Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200518062808.756610-4-hch@lst.de \
--to=hch@lst.de \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.