diff mbox series

[net-next,3/6] l2tp: allow v2 netlink session create to pass ifname attribute

Message ID 20200930210707.10717-4-tparkin@katalix.com
State New
Headers show
Series l2tp: add ac/pppoe driver | expand

Commit Message

Tom Parkin Sept. 30, 2020, 9:07 p.m. UTC
Previously L2TP_ATTR_IFNAME was only applicable to an L2TPv3 session,
since it was only used by l2tp_eth.

In order to implement an AC_PPP pseudowire in an L2TPv2 tunnel, it will
be necessary to allow userspace to send an interface name in the session
create message.

Allow the attribute to be handled by l2tp_netlink for L2TPv2 sessions.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
---
 net/l2tp/l2tp_netlink.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 8ef1a579a2b1..2abfea82203d 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -604,10 +604,11 @@  static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
 			cfg.peer_cookie_len = len;
 			memcpy(&cfg.peer_cookie[0], nla_data(info->attrs[L2TP_ATTR_PEER_COOKIE]), len);
 		}
-		if (info->attrs[L2TP_ATTR_IFNAME])
-			cfg.ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]);
 	}
 
+	if (info->attrs[L2TP_ATTR_IFNAME])
+		cfg.ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]);
+
 	if (info->attrs[L2TP_ATTR_RECV_SEQ])
 		cfg.recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]);