Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5124243rwe; Tue, 18 Apr 2023 02:19:48 -0700 (PDT) X-Google-Smtp-Source: AKy350Ye0FK8x5imO4c7x+I7Zjw1yJASNEulDSUOkHEDR6gf0aYH6j/HzKj0KQxXe5y5JXFdT7dS X-Received: by 2002:a05:6a20:6a10:b0:f0:86ce:d02c with SMTP id p16-20020a056a206a1000b000f086ced02cmr2250647pzk.16.1681809588213; Tue, 18 Apr 2023 02:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681809588; cv=none; d=google.com; s=arc-20160816; b=ML7F0ygokwnhKHQ6msKPJGNt0ecsrWkPQcwqe+fa+KzfUyEwzZgjkl0DJBsVN2ap10 nFFS67Qz1exaPO0aZ1yp+8TGz595cfjZY1mQnOpuWkDhyMCjTS4YEIzw38UsmuO32vBW VskLIxdpdUdcDFvCeAkyGEdBhbx29Q2gTyC+TbJBu+cH+6ameCB1gGTejiru79dMpMu8 rZe86CqY+BEzzKX/czO0Qzp+Mwaz4rgypXvqDWA3ibBMm/mU7yHYMV5KDDgn20tdARpQ w65QlU8EIcCrusKstu7gdBBcaoP7SkNHbeffqHUvuifTGVghS1NrsQsJVgwVy69pkj57 fcBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:organization:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=kJQ9jmZ/d9S7yPxc9cB+7AMcnSzC8OdpSrbGyp36J9k=; b=UHi+wBTA4HRkBELgaW7beSDxT8PrNvCyLOavNbnybZYUuEIsBS1OwWGKuJ5gD3snqI ScrV5KlJNZ+wJEOj4K7UxNPWAAYkbUADs/AH1eFD1n0AuM4CIRduMSB12ALGA/Uq4qUc y1bwQCVTG8BGiqKrJlf/xmpwwKEt41mISm23oHL0yX7a+hVo2rpXhSpkqTijpfUjImu+ wChiFiuuI2fiwWh0zv2bMxRnbyvbjQZ/wQ9sTXsdai1/tfO1BDYz+ekJ102UN/Ir3UGO L9Q2tVMBz5YdyQUcNj3VflVhzLC2LlGdjljYg3jFTgRQ5k/D5esoXmmaHu7HveXlZ783 qt3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r2-20020a63ce42000000b0050bebc3e35bsi14311547pgi.766.2023.04.18.02.19.27; Tue, 18 Apr 2023 02:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230411AbjDRJLy (ORCPT + 99 others); Tue, 18 Apr 2023 05:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjDRJLv (ORCPT ); Tue, 18 Apr 2023 05:11:51 -0400 Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AF6B10E0; Tue, 18 Apr 2023 02:11:50 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 175AE20180; Tue, 18 Apr 2023 11:11:49 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bKQ3-A0V8pgX; Tue, 18 Apr 2023 11:11:48 +0200 (CEST) Received: from begin.home (apoitiers-658-1-118-253.w92-162.abo.wanadoo.fr [92.162.65.253]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id B380620177; Tue, 18 Apr 2023 11:11:48 +0200 (CEST) Received: from samy by begin.home with local (Exim 4.96) (envelope-from ) id 1pohNM-00BMWM-0m; Tue, 18 Apr 2023 11:11:48 +0200 Date: Tue, 18 Apr 2023 11:11:48 +0200 From: Samuel Thibault To: Guillaume Nault Cc: James Chapman , tparkin@katalix.com, edumazet@google.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, corbet@lwn.net, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PPPoL2TP: Add more code snippets Message-ID: <20230418091148.hh3b52zceacduex6@begin> Mail-Followup-To: Samuel Thibault , Guillaume Nault , James Chapman , tparkin@katalix.com, edumazet@google.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, corbet@lwn.net, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230416220704.xqk4q6uwjbujnqpv@begin> <20230418085323.h6xij7w6d2o4kxxi@begin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Guillaume Nault, le mar. 18 avril 2023 11:06:51 +0200, a ecrit: > On Tue, Apr 18, 2023 at 10:53:23AM +0200, Samuel Thibault wrote: > > Guillaume Nault, le mar. 18 avril 2023 10:34:03 +0200, a ecrit: > > > On Mon, Apr 17, 2023 at 12:07:04AM +0200, Samuel Thibault wrote: > > > > sax.sa_family = AF_PPPOX; > > > > sax.sa_protocol = PX_PROTO_OL2TP; > > > > sax.pppol2tp.fd = tunnel_fd; > > > > @@ -406,12 +407,64 @@ Sample userspace code: > > > > /* session_fd is the fd of the session's PPPoL2TP socket. > > > > * tunnel_fd is the fd of the tunnel UDP / L2TPIP socket. > > > > */ > > > > - fd = connect(session_fd, (struct sockaddr *)&sax, sizeof(sax)); > > > > - if (fd < 0 ) { > > > > + ret = connect(session_fd, (struct sockaddr *)&sax, sizeof(sax)); > > > > + if (ret < 0 ) { > > > > > > Now you also need to close session_fd. > > > > ? No, we need it for PPPIOCGCHAN, and also PPPIOCGL2TPSTATS. > > connect() failed. You can't do anything with this socket. Ah, you were talking about the failure case, ok. > > > > +The ppp interface can then be configured as usual with SIOCSIFMTU, > > > > +SIOCSIFADDR, SIOCSIFDSTADDR, SIOCSIFNETMASK, and activated by setting IFF_UP > > > > +with SIOCSIFFLAGS > > > > + > > > > + - Tunnel switching is supported by bridging channels:: > > > > > > This is a PPP feature not an L2TP one. > > > > > > PPPIOCBRIDGECHAN's description > > > belongs to Documentation/networking/ppp_generic.rst, where it's already > > > documented. > > > > Yes but that's hard to find out when you're looking from the L2TP end. > > That's why I proposed linking to ppp_generic.rst. Yes, but it's still not obvious to L2TP people that it's a ppp channel that you have to bridge. Really, having that 20-line snippet available would have saved me some head-scratching time. Samuel