Skip to content

Commit bb8082f

Browse files
Guillaume Naultdavem330
authored andcommitted
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<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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6cdaf03 commit bb8082f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/net/ppp/ppp_generic.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,15 @@ static int ppp_nl_newlink(struct net *src_net, struct net_device *dev,
11031103
}
11041104

11051105
conf.file = file;
1106+
1107+
/* Don't use device name generated by the rtnetlink layer when ifname
1108+
* isn't specified. Let ppp_dev_configure() set the device name using
1109+
* the PPP unit identifer as suffix (i.e. ppp<unit_id>). This allows
1110+
* userspace to infer the device name using to the PPPIOCGUNIT ioctl.
1111+
*/
1112+
if (!tb[IFLA_IFNAME])
1113+
conf.ifname_is_set = false;
1114+
11061115
err = ppp_dev_configure(src_net, dev, &conf);
11071116

11081117
out_unlock:

0 commit comments

Comments
 (0)