Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp470475imn; Thu, 28 Jul 2022 06:24:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tmSdB3DNPcHq2dre2awNc4c0GPQliQ8sIKcyWg/uyhlVzq3EYijgAShgQTfYhOHuy9MeQJ X-Received: by 2002:aa7:cf8c:0:b0:43c:8c3c:f7d0 with SMTP id z12-20020aa7cf8c000000b0043c8c3cf7d0mr10334582edx.278.1659014686518; Thu, 28 Jul 2022 06:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659014686; cv=none; d=google.com; s=arc-20160816; b=bNCMGomjjxD0GIZDs/NH3//xTTGhsUuMNKbpXC7TH1rBDa0pHsleJmpE91pNa+4rCK Bt053Y9MZrJGy9qAdNwn0LXJ4jOeQjNCSUQXv+00qQd9VVaNIw8S0pt/gGXlasg6/DxV ilCnLXuaXvI8bXT14lugjo+fXnWUU8XAP23UQUYSUZQSJWjs+AzAZEhpL7bS4Dd2uWuc gJp0xJ15QZsbcL30vavbqq5M3jCZt+iwMOeUmv72i8oAf3TOXp9i0m70HS1KUmOYBYMp WWu9Er9VCO2aHIKolGCZYR82rfhzeUO8Urm76pW7Mbw9Zdt+QSNzP0rlj9n8oMTNLtT0 5HtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IRO9xgSlBIIqF+gFlWl24ukH/G3G/wx7T+Evz1UrmeQ=; b=jiy2FsDN+LcEGrTzpAlqQrhCFItLgzVKpLn9MEbiVQUfykw4iHRd4X0Mj892ncXw2n 8z24FQmAJKJw1jDY3EfjxBqMB6tgf93yfQs9+Y051o3YVCWxm91Q95Yad7iVUj7OQTOh cxhvXyw9EH3qv9qDgPJpILwMGZFbtLr3+00pB8NRLK59YOV74e2CkCzBJ7PDmyMkoWHx jqF2E2qoAch9zXqjOas1caCm3b6oLCFZ9axk2+Gnarz3BX9bKFbfdZn53TssAYR0Bm6B voyjnG37frVtcxbko5P8da6KJ9wmBIkhtAWPRjDMvgsvRxhH1DdhQw32c7cIxAc4tICM nkkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=2v8LYbL1; 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 ht10-20020a170907608a00b0072b819f8cb7si748131ejc.270.2022.07.28.06.24.21; Thu, 28 Jul 2022 06:24:46 -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; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=2v8LYbL1; 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 S239111AbiG1NMX (ORCPT + 99 others); Thu, 28 Jul 2022 09:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236688AbiG1NMV (ORCPT ); Thu, 28 Jul 2022 09:12:21 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D066454CB9; Thu, 28 Jul 2022 06:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=IRO9xgSlBIIqF+gFlWl24ukH/G3G/wx7T+Evz1UrmeQ=; b=2v8LYbL1S0fEA+nX2ouKbLXvNY 4VZzX4JTfrTq/RXB6AlLQsqKxbL90iCabutlcb2dUsfAfe74l2MPy27WYvMmA3MNQNN1lM7ZaH2sr Qe4Vz8sUTyPTvToKxr3pTT9bcdZRoym19ctWzMJevUoZRM+WTsnpSUzpZFeL7Qrf+fDo=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oH3JI-00Bo54-Lv; Thu, 28 Jul 2022 15:12:16 +0200 Date: Thu, 28 Jul 2022 15:12:16 +0200 From: Andrew Lunn To: Antonio Quartulli Cc: netdev@vger.kernel.org, David Miller , Jakub Kicinski , linux-kernel@vger.kernel.org Subject: Re: [RFC 1/1] net: introduce OpenVPN Data Channel Offload (ovpn-dco) Message-ID: References: <20220719014704.21346-1-antonio@openvpn.net> <20220719014704.21346-2-antonio@openvpn.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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 On Thu, Jul 28, 2022 at 09:44:18AM +0200, Antonio Quartulli wrote: > Hi, > > On 19/07/2022 17:37, Andrew Lunn wrote: > > > +static int ovpn_net_change_mtu(struct net_device *dev, int new_mtu) > > > +{ > > > + if (new_mtu < IPV4_MIN_MTU || > > > + new_mtu + dev->hard_header_len > IP_MAX_MTU) > > > + return -EINVAL; > > > > If you set dev->min_mtu and dev->max_mtu, the core will validate this > > for you, see dev_validate_mtu(). > > Yeah, thanks for the pointer. > > > > > > +static int ovpn_get_link_ksettings(struct net_device *dev, > > > + struct ethtool_link_ksettings *cmd) > > > +{ > > > + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, 0); > > > + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, 0); > > > > These two should not be needed. Look at tun, veth etc, they don't set > > them. > > I found this in tun.c: > > 3512 ethtool_link_ksettings_zero_link_mode(cmd, supported); > 3513 ethtool_link_ksettings_zero_link_mode(cmd, advertising); > > Which seems a more appropriate version of my code, no? I would trace is backwards. Where is cmd coming from? In order to avoid unintentional information leaks, the core should be clearing any memory which gets passed to a driver which might optionally be filled in and then returned to user space. So take a look in net/ethtool, and see if there is a memset() or a kzalloc() etc. If it is already been zero'ed, you don't need this. Andrew