From: Guillaume Nault Date: Tue, 9 Aug 2016 13:12:26 +0000 (+0200) Subject: ppp: build ifname using unit identifier for rtnl based devices X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bb8082f6913889418b69a54e57b4a39d7128a700;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ppp: build ifname using unit identifier for rtnl based devices Userspace programs generally need to know the name of the ppp devices they create. Both ioctl and rtnl interfaces use the ppp 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index f226db4616b7..70cfa06ccd40 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). 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: