Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2829imu; Fri, 14 Dec 2018 13:16:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xp0iMcSRWaTYoXroy7H19B9jIk6mp1n9F339zwmAejk7O7dSQlOp8KTePKdwjNroKbjgz5 X-Received: by 2002:a63:d818:: with SMTP id b24mr842155pgh.174.1544822179683; Fri, 14 Dec 2018 13:16:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544822179; cv=none; d=google.com; s=arc-20160816; b=tmO/Xa+AIqxZVySxRsDAw0oPCf2aUtX9j6abUXICFXSIjyFvtp4bV57kLeLZb+xQWD V927Je6tfJapl3Koixk97sYNC9SRDEttxBGFQI1bMgxXqXBY4s5I4uWhfD8dzBmDe3Au tb+0eP4yA6K7ipTipqvn1f4D7EDamVUXovsGfvYNWZYELlHNGCl3tD0ExBnOsGu/E7O/ ZjS4+VEir/+XdNjwA0wKvuy9iQrS0djeR8EV+JHnYoymTdEgsWu8WejHN282EGX57o+p ZzrhfJ8dK0kK7R86xa0dJlcliFxahv0i8cmcUJiZaNuXhgh7hgTM/uwk13WfC68PydzZ VC1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ayXodJU59wzJNPigsWiwer1kLPrNiQ7AuIEJaBjTXl0=; b=PjS5/i+HPF3yCO2+mX+NwNGk6YjbiQH27QnZLzfzo1gNzP6diqiMF3X4zYwmcjgn+F 08DWV6qsfdaCTEyZXxgzdMRw9XsiVyhyRWjl5cnt2IuYJtWLPVSFTOwaGI04FLsqwRNZ Kr15T9w4X5Gly37W2GXyV2unTWRDo4WixoRQtsRA9tJrPsxlse2nhUx9OhvFC5RO1o1O tPM3AIRi8op8wuAnJmgf9HiVpWJPYjWk1NxdGcAviww5YuN4+Gf8oFMlBbfxHFjR4kjI h4sUkivX+fMqEe25OzO55/tHjMN61HZzXZYHFFVrvTdoaGZqnmpz6pT85N2v/3QNN+bO ol8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IZ7K5eYh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si4846308pfo.108.2018.12.14.13.16.03; Fri, 14 Dec 2018 13:16:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IZ7K5eYh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731082AbeLNVMp (ORCPT + 99 others); Fri, 14 Dec 2018 16:12:45 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44962 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730757AbeLNVMp (ORCPT ); Fri, 14 Dec 2018 16:12:45 -0500 Received: by mail-lf1-f68.google.com with SMTP id z13so5265448lfe.11 for ; Fri, 14 Dec 2018 13:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ayXodJU59wzJNPigsWiwer1kLPrNiQ7AuIEJaBjTXl0=; b=IZ7K5eYhQXgvgeAg4dskOoBR9E57dK95gTN9G1kY6rpSUv14fBp/LO+Ok7aA2XKdEv 8Pge5CEgun+aExl/4ol1Cmlzjm+C3Kk1pOwgedPky7InM/FM6bL5BZ3Pdu3QDYbIu1Wj 6RojxIqvXQur4MvHmep7ovuUHfc4OTrq08tYI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ayXodJU59wzJNPigsWiwer1kLPrNiQ7AuIEJaBjTXl0=; b=owSkd9yNYivMCPlVsZREHuwNwKE3ayFf9XfjL+aqYou5hD0XbVhL+3OgBpv6xT2GEf ZD9CzXcYvQmsYLSTIXnT0Uv/PVMRWVpHGb0XNj7Pq3cj9jcN22bDiXq9PfHz2ieVz21z YoHZz+DvvS09hWUak439XHyzuWZ1/sjukIBhzPobakbPv4YUd3wFzLRQsdEbV3FK2wuZ gdup5kkF/l7d4TuP4fazyO/WJgPbDHOf7lZAh2Kc5zC8MVIXZVtF83SECKopkJODigIH RxZ2Eox2FtHS8LT9MoWnBE6LrIuKDC8mhzagWJlGp5XSDjZKkbwNyNMcBZLoAZhQ2PTV GZow== X-Gm-Message-State: AA+aEWa0W43wAZCrkM1LbhyjcMjN/DlGuoV09Q4zMfvX16TLuk2ElA+i UIN2JLlKp9YxtSIo4AsXKHvZKA== X-Received: by 2002:a19:5f1e:: with SMTP id t30mr2576767lfb.76.1544821963322; Fri, 14 Dec 2018 13:12:43 -0800 (PST) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id k68-v6sm1046377ljb.35.2018.12.14.13.12.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 13:12:42 -0800 (PST) From: Sam Protsenko To: James Chapman , "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Guillaume Nault Subject: [PATCH 1/2] l2tp: Bring back ->flags to struct pppol2tp_session Date: Fri, 14 Dec 2018 23:12:41 +0200 Message-Id: <20181214211242.9721-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Flags field will be used in further commits (e.g. for keeping SC_COMP_PROT), so let's bring those back. This commit effectively reverts commit 1998b5ed9c9b ("l2tp: drop ->flags from struct pppol2tp_session"), with some cosmetic changes. Signed-off-by: Sam Protsenko --- net/l2tp/l2tp_ppp.c | 52 +++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index c03c6461f236..145435977b21 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -125,6 +125,7 @@ struct pppol2tp_session { * PPPoX socket */ struct sock *__sk; /* Copy of .sk, for cleanup */ struct rcu_head rcu; /* For asynchronous release */ + int flags; /* accessed by PPPIOCGFLAGS */ }; static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb); @@ -1074,44 +1075,60 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd, { struct pppol2tp_ioc_stats stats; struct l2tp_session *session; + struct pppol2tp_session *ps; int val; + bool is_tunnel; + + session = sock->sk->sk_user_data; + if (!session) + return -ENOTCONN; + + ps = l2tp_session_priv(session); + is_tunnel = !session->session_id && !session->peer_session_id; switch (cmd) { case PPPIOCGMRU: - case PPPIOCGFLAGS: - session = sock->sk->sk_user_data; - if (!session) - return -ENOTCONN; - /* Not defined for tunnels */ - if (!session->session_id && !session->peer_session_id) + if (is_tunnel) return -ENOSYS; if (put_user(0, (int __user *)arg)) return -EFAULT; break; + case PPPIOCGFLAGS: + /* Not defined for tunnels */ + if (is_tunnel) + return -ENOSYS; - case PPPIOCSMRU: - case PPPIOCSFLAGS: - session = sock->sk->sk_user_data; - if (!session) - return -ENOTCONN; + if (put_user(ps->flags, (int __user *)arg)) + return -EFAULT; + l2tp_info(session, L2TP_MSG_CONTROL, "%s: get flags=%d\n", + session->name, ps->flags); + break; + case PPPIOCSMRU: /* Not defined for tunnels */ - if (!session->session_id && !session->peer_session_id) + if (is_tunnel) return -ENOSYS; if (get_user(val, (int __user *)arg)) return -EFAULT; break; + case PPPIOCSFLAGS: + /* Not defined for tunnels */ + if (is_tunnel) + return -ENOSYS; - case PPPIOCGL2TPSTATS: - session = sock->sk->sk_user_data; - if (!session) - return -ENOTCONN; + if (get_user(val, (int __user *)arg)) + return -EFAULT; + ps->flags = val; + l2tp_info(session, L2TP_MSG_CONTROL, "%s: set flags=%d\n", + session->name, ps->flags); + break; + case PPPIOCGL2TPSTATS: /* Session 0 represents the parent tunnel */ - if (!session->session_id && !session->peer_session_id) { + if (is_tunnel) { u32 session_id; int err; @@ -1136,7 +1153,6 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd, if (copy_to_user((void __user *)arg, &stats, sizeof(stats))) return -EFAULT; break; - default: return -ENOIOCTLCMD; } -- 2.19.1