linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ppp: build ifname using unit identifier for rtnl based devices
@ 2016-08-09 13:12 Guillaume Nault
  2016-08-09 22:06 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Guillaume Nault @ 2016-08-09 13:12 UTC (permalink / raw)
  To: netdev; +Cc: Paul Mackerras, linux-ppp

Userspace programs generally need to know the name of the ppp devices
they create. Both ioctl and rtnl interfaces use the ppp<suffix> sheme
to name them. But although the suffix used by the ioctl interface can
be known by userspace (it's the PPP unit identifier returned by the
PPPIOCGUNIT ioctl), the one used by the rtnl is only known by the
kernel.

This patch brings more consistency between ioctl and rtnl based ppp
devices by generating device names using the PPP unit identifer as
suffix in both cases. This way, userspace can always infer the name of
the devices they create.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
 drivers/net/ppp/ppp_generic.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index f226db4..70cfa06 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1103,6 +1103,15 @@ static int ppp_nl_newlink(struct net *src_net, struct net_device *dev,
 	}
 
 	conf.file = file;
+
+	/* Don't use device name generated by the rtnetlink layer when ifname
+	 * isn't specified. Let ppp_dev_configure() set the device name using
+	 * the PPP unit identifer as suffix (i.e. ppp<unit_id>). This allows
+	 * userspace to infer the device name using to the PPPIOCGUNIT ioctl.
+	 */
+	if (!tb[IFLA_IFNAME])
+		conf.ifname_is_set = false;
+
 	err = ppp_dev_configure(src_net, dev, &conf);
 
 out_unlock:
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] ppp: build ifname using unit identifier for rtnl based devices
  2016-08-09 13:12 [PATCH net-next] ppp: build ifname using unit identifier for rtnl based devices Guillaume Nault
@ 2016-08-09 22:06 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-08-09 22:06 UTC (permalink / raw)
  To: g.nault; +Cc: netdev, paulus, linux-ppp

From: Guillaume Nault <g.nault@alphalink.fr>
Date: Tue, 9 Aug 2016 15:12:26 +0200

> Userspace programs generally need to know the name of the ppp devices
> they create. Both ioctl and rtnl interfaces use the ppp<suffix> sheme
> to name them. But although the suffix used by the ioctl interface can
> be known by userspace (it's the PPP unit identifier returned by the
> PPPIOCGUNIT ioctl), the one used by the rtnl is only known by the
> kernel.
> 
> This patch brings more consistency between ioctl and rtnl based ppp
> devices by generating device names using the PPP unit identifer as
> suffix in both cases. This way, userspace can always infer the name of
> the devices they create.
> 
> Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-09 22:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-09 13:12 [PATCH net-next] ppp: build ifname using unit identifier for rtnl based devices Guillaume Nault
2016-08-09 22:06 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).