Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'l2tpeth-info'

Guillaume Nault says:

====================
l2tp: add informations about l2tpeth interfaces in /sys

Patch #1 lets userspace retrieve the naming scheme of an l2tpeth
interface, using /sys/class/net/<iface>/name_assign_type.

Patch #2 adds the DEVTYPE field in /sys/class/net/<iface>/uevent so
that userspace can reliably know if a device is an l2tpeth interface.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+11 -2
+11 -2
net/l2tp/l2tp_eth.c
··· 130 130 .ndo_set_mac_address = eth_mac_addr, 131 131 }; 132 132 133 + static struct device_type l2tpeth_type = { 134 + .name = "l2tpeth", 135 + }; 136 + 133 137 static void l2tp_eth_dev_setup(struct net_device *dev) 134 138 { 139 + SET_NETDEV_DEVTYPE(dev, &l2tpeth_type); 135 140 ether_setup(dev); 136 141 dev->priv_flags &= ~IFF_TX_SKB_SHARING; 137 142 dev->features |= NETIF_F_LLTX; ··· 263 258 264 259 static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg) 265 260 { 261 + unsigned char name_assign_type; 266 262 struct net_device *dev; 267 263 char name[IFNAMSIZ]; 268 264 struct l2tp_tunnel *tunnel; ··· 287 281 goto out; 288 282 } 289 283 strlcpy(name, cfg->ifname, IFNAMSIZ); 290 - } else 284 + name_assign_type = NET_NAME_USER; 285 + } else { 291 286 strcpy(name, L2TP_ETH_DEV_NAME); 287 + name_assign_type = NET_NAME_ENUM; 288 + } 292 289 293 290 session = l2tp_session_create(sizeof(*spriv), tunnel, session_id, 294 291 peer_session_id, cfg); ··· 300 291 goto out; 301 292 } 302 293 303 - dev = alloc_netdev(sizeof(*priv), name, NET_NAME_UNKNOWN, 294 + dev = alloc_netdev(sizeof(*priv), name, name_assign_type, 304 295 l2tp_eth_dev_setup); 305 296 if (!dev) { 306 297 rc = -ENOMEM;