l2tp: add informations about l2tpeth interfaces in /sys
Subsystems (2)
cover 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.
Guillaume Nault (2):
l2tp: set name_assign_type for devices created by l2tp_eth.c
l2tp: define "l2tpeth" device type
net/l2tp/l2tp_eth.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/2 l2tp: set name_assign_type for devices created by l2tp_eth.c
Export naming scheme used when creating l2tpeth interfaces (/sys/class/net/<iface>/name_assign_type). This let userspace know if the device's name has been generated automatically or defined manually.
--- net/l2tp/l2tp_eth.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/l2tp/l2tp_eth.c +6 -2
@@ -258,6 +258,7 @@ static void l2tp_eth_adjust_mtu(struct l2tp_tunnel *tunnel,static int l2tp_eth_create (struct net *net,u32 tunnel_id,u32 session_id,u32 peer_session_id,struct l2tp_session_cfg *cfg) { +unsigned char name_assign_type;struct net_device *dev;char name[IFNAMSIZ ];struct l2tp_tunnel *tunnel;
@@ -281,8 +282,11 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p goto out; }strlcpy (name, cfg->ifname,IFNAMSIZ ); - }else + name_assign_type =NET_NAME_USER ; + }else {strcpy (name,L2TP_ETH_DEV_NAME ); + name_assign_type =NET_NAME_ENUM ; + } session =l2tp_session_create (sizeof (*spriv), tunnel, session_id, peer_session_id, cfg);
@@ -291,7 +295,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p goto out; } - dev =alloc_netdev (sizeof (*priv), name,NET_NAME_UNKNOWN , + dev =alloc_netdev (sizeof (*priv), name, name_assign_type, l2tp_eth_dev_setup);if (!dev) { rc = -ENOMEM ;
Signature · 1 line
2.11.0
Re: [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c
Quoted 5 lines · Guillaume Nault
Export naming scheme used when creating l2tpeth interfaces (/sys/class/net/<iface>/name_assign_type). This let userspace know if the device's name has been generated automatically or defined manually.
Signed-off-by Guillaume Nault <[email protected]>
PATCH 2/2 l2tp: define "l2tpeth" device type
In reply to Guillaume NaultExport type of l2tpeth interfaces to userspace
(/sys/class/net/<iface>/uevent).
--- net/l2tp/l2tp_eth.c | 5 +++++ 1 file changed, 5 insertions(+)
net/l2tp/l2tp_eth.c +5 -0
@@ -130,8 +130,13 @@ static const struct net_device_ops l2tp_eth_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, }; +static struct device_type l2tpeth_type = { + .name ="l2tpeth" , +}; +static void l2tp_eth_dev_setup (struct net_device *dev) { +SET_NETDEV_DEVTYPE (dev, &l2tpeth_type);ether_setup (dev); dev->priv_flags &= ~IFF_TX_SKB_SHARING ; dev->features |=NETIF_F_LLTX ;
Signature · 1 line
2.11.0
Re: [PATCH net-next 2/2] l2tp: define "l2tpeth" device type
Quoted 4 lines · Guillaume Nault
Export type of l2tpeth interfaces to userspace
(/sys/class/net/<iface>/uevent).Signed-off-by Guillaume Nault <[email protected]>
David Miller
maintainerFrom: Guillaume Nault <[email protected]>
Date: Mon, 24 Apr 2017 14:16:04 +0200
Quoted 5 lines
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.
Looks great, series applied, thanks!