From patchwork Fri Aug 10 11:21:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 956211 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=alphalink.fr Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41n2lD45fvz9s5b for ; Fri, 10 Aug 2018 21:22:00 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727513AbeHJNv1 (ORCPT ); Fri, 10 Aug 2018 09:51:27 -0400 Received: from zimbra.alphalink.fr ([217.15.80.77]:35562 "EHLO zimbra.alphalink.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727335AbeHJNv1 (ORCPT ); Fri, 10 Aug 2018 09:51:27 -0400 Received: from localhost (localhost [127.0.0.1]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 0EBAB2B5202B; Fri, 10 Aug 2018 13:21:56 +0200 (CEST) Received: from zimbra.alphalink.fr ([127.0.0.1]) by localhost (mail-2-cbv2.admin.alphalink.fr [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id AOUXcVTB6qDE; Fri, 10 Aug 2018 13:21:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id C6D9C2B520EA; Fri, 10 Aug 2018 13:21:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail-2-cbv2.admin.alphalink.fr Received: from zimbra.alphalink.fr ([127.0.0.1]) by localhost (mail-2-cbv2.admin.alphalink.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id iCERGHm6XrTo; Fri, 10 Aug 2018 13:21:54 +0200 (CEST) Received: from c-dev-0.admin.alphalink.fr (94-84-15-217.reverse.alphalink.fr [217.15.84.94]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 9AF5A2B5202B; Fri, 10 Aug 2018 13:21:54 +0200 (CEST) Received: by c-dev-0.admin.alphalink.fr (Postfix, from userid 1000) id 7156F6007B; Fri, 10 Aug 2018 13:21:54 +0200 (CEST) Date: Fri, 10 Aug 2018 13:21:54 +0200 From: Guillaume Nault To: netdev@vger.kernel.org Cc: James Chapman Subject: [PATCH net-next 0/8] l2tp: rework pppol2tp ioctl handling Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mutt-Fcc: =Sent User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The current ioctl() handling code can be simplified. It tests for non-relevant conditions and uselessly holds sockets. Once useless code is removed, it becomes even simpler to let pppol2tp_ioctl() handle commands directly, rather than dispatch them to pppol2tp_tunnel_ioctl() or pppol2tp_session_ioctl(). That is the approach taken by this series. Patch #1 and #2 define helper functions aimed at simplifying the rest of the patch set. Patch #3 drops useless tests in pppol2p_ioctl() and avoid holding a refcount on the socket. Patches #4, #5 and #6 are the core of the series. They let pppol2tp_ioctl() handle all ioctls and drop the tunnel and session specific functions. Then patch #6 brings a little bit of consolidation. Finally, patch #7 takes advantage of the simplified code to make pppol2tp sockets compatible with dev_ioctl(). Certainly not a killer feature, but it is trivial and it is always nice to see l2tp getting better integration with the rest of the stack. Guillaume Nault (8): l2tp: define l2tp_tunnel_uses_xfrm() l2tp: split l2tp_session_get() l2tp: simplify pppol2tp_ioctl() l2tp: handle PPPIOC[GS]MRU and PPPIOC[GS]FLAGS in pppol2tp_ioctl() l2tp: remove pppol2tp_tunnel_ioctl() l2tp: remove pppol2tp_session_ioctl() l2tp: zero out stats in pppol2tp_copy_stats() l2tp: let pppol2tp_ioctl() fallback to dev_ioctl() include/uapi/linux/ppp-ioctl.h | 2 +- net/l2tp/l2tp_core.c | 50 +++---- net/l2tp/l2tp_core.h | 25 +++- net/l2tp/l2tp_ip.c | 2 +- net/l2tp/l2tp_ip6.c | 2 +- net/l2tp/l2tp_netlink.c | 11 +- net/l2tp/l2tp_ppp.c | 240 +++++++++++---------------------- 7 files changed, 133 insertions(+), 199 deletions(-)