Skip to content

Commit 695ad87

Browse files
committed
Merge branch 'l2tp-l2tp_ppp-must-ignore-non-PPP-sessions'
Guillaume Nault says: ==================== l2tp: l2tp_ppp must ignore non-PPP sessions The original L2TP code was written for version 2 of the protocol, which could only carry PPP sessions. Then L2TPv3 generalised the protocol so that it could transport different kinds of pseudo-wires. But parts of the l2tp_ppp module still break in presence of non-PPP sessions. Assuming L2TPv2 tunnels can only transport PPP sessions is right, but l2tp_netlink failed to ensure that (fixed in patch 1). When retrieving a session from an arbitrary tunnel, l2tp_ppp needs to filter out non-PPP sessions (last occurrence fixed in patch 2). ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents eab9a2d + ecd012e commit 695ad87

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

net/l2tp/l2tp_netlink.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,12 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
553553
goto out_tunnel;
554554
}
555555

556+
/* L2TPv2 only accepts PPP pseudo-wires */
557+
if (tunnel->version == 2 && cfg.pw_type != L2TP_PWTYPE_PPP) {
558+
ret = -EPROTONOSUPPORT;
559+
goto out_tunnel;
560+
}
561+
556562
if (tunnel->version > 2) {
557563
if (info->attrs[L2TP_ATTR_DATA_SEQ])
558564
cfg.data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]);

net/l2tp/l2tp_ppp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ static int pppol2tp_tunnel_ioctl(struct l2tp_tunnel *tunnel,
12011201
l2tp_session_get(sock_net(sk), tunnel,
12021202
stats.session_id);
12031203

1204-
if (session) {
1204+
if (session && session->pwtype == L2TP_PWTYPE_PPP) {
12051205
err = pppol2tp_session_ioctl(session, cmd,
12061206
arg);
12071207
l2tp_session_dec_refcount(session);

0 commit comments

Comments
 (0)