* [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys
@ 2017-04-24 12:16 Guillaume Nault
2017-04-24 12:16 ` [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c Guillaume Nault
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Guillaume Nault @ 2017-04-24 12:16 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
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(-)
--
2.11.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c
2017-04-24 12:16 [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys Guillaume Nault
@ 2017-04-24 12:16 ` Guillaume Nault
2017-04-25 10:40 ` James Chapman
2017-04-24 12:16 ` [PATCH net-next 2/2] l2tp: define "l2tpeth" device type Guillaume Nault
2017-04-25 15:42 ` [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Guillaume Nault @ 2017-04-24 12:16 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
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 <g.nault@alphalink.fr>
---
net/l2tp/l2tp_eth.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index b722d559c544..5e44b3cc1212 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -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;
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] l2tp: define "l2tpeth" device type
2017-04-24 12:16 [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys Guillaume Nault
2017-04-24 12:16 ` [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c Guillaume Nault
@ 2017-04-24 12:16 ` Guillaume Nault
2017-04-25 10:41 ` James Chapman
2017-04-25 15:42 ` [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Guillaume Nault @ 2017-04-24 12:16 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
Export type of l2tpeth interfaces to userspace
(/sys/class/net/<iface>/uevent).
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_eth.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 5e44b3cc1212..59aba8aeac03 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -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;
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c
2017-04-24 12:16 ` [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c Guillaume Nault
@ 2017-04-25 10:40 ` James Chapman
0 siblings, 0 replies; 6+ messages in thread
From: James Chapman @ 2017-04-25 10:40 UTC (permalink / raw)
To: netdev; +Cc: Guillaume Nault
On 24/04/17 13:16, Guillaume Nault wrote:
> 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 <g.nault@alphalink.fr>
Acked-by: James Chapman <jchapman@katalix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 2/2] l2tp: define "l2tpeth" device type
2017-04-24 12:16 ` [PATCH net-next 2/2] l2tp: define "l2tpeth" device type Guillaume Nault
@ 2017-04-25 10:41 ` James Chapman
0 siblings, 0 replies; 6+ messages in thread
From: James Chapman @ 2017-04-25 10:41 UTC (permalink / raw)
To: netdev; +Cc: Guillaume Nault
On 24/04/17 13:16, Guillaume Nault wrote:
> Export type of l2tpeth interfaces to userspace
> (/sys/class/net/<iface>/uevent).
>
> Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Acked-by: James Chapman <jchapman@katalix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys
2017-04-24 12:16 [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys Guillaume Nault
2017-04-24 12:16 ` [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c Guillaume Nault
2017-04-24 12:16 ` [PATCH net-next 2/2] l2tp: define "l2tpeth" device type Guillaume Nault
@ 2017-04-25 15:42 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-04-25 15:42 UTC (permalink / raw)
To: g.nault; +Cc: netdev, jchapman
From: Guillaume Nault <g.nault@alphalink.fr>
Date: Mon, 24 Apr 2017 14:16:04 +0200
> 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!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-04-25 15:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-24 12:16 [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys Guillaume Nault
2017-04-24 12:16 ` [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c Guillaume Nault
2017-04-25 10:40 ` James Chapman
2017-04-24 12:16 ` [PATCH net-next 2/2] l2tp: define "l2tpeth" device type Guillaume Nault
2017-04-25 10:41 ` James Chapman
2017-04-25 15:42 ` [PATCH net-next 0/2] l2tp: add informations about l2tpeth interfaces in /sys 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).