Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp721724pxk; Thu, 17 Sep 2020 14:30:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDXow9l8cKT0vrHBGN2Br96d+RLRHoatLSJCAOHlU7NXrXRF2G0hSojg5iIHnyJMuIT1uB X-Received: by 2002:aa7:d606:: with SMTP id c6mr35772373edr.370.1600378250198; Thu, 17 Sep 2020 14:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600378250; cv=none; d=google.com; s=arc-20160816; b=FSDSEYprD8UCsInLOFzpJ00RY8XQeL62J1muM/o+JFiH8uVyjRzxyr0vCT+uSz9pLF C3i4W/a+KpdqtISWV9KYWROTiRP6fMbueRKgwflUJdJicRKrg2RofgHiv7+T9l3vIFo5 +DnnVjqWUF0hGGhNpIObvAXoido5bTnjznrGOyrzYTo2/g/gcAEVb4NirT5Fq6BoYevI E68gaXUSpJbmZG1q3f+1lFfsNi6c5nyJTI+6v0Nh67wWX209fc9KnnczpJZjVoIhDT7y vEF1G6WN0RDntCL2rPo6igyy/9Ew1Za90InbKpGnqu+VZAPlIhq+KdO8vWZ4wWRW1A6t y+IQ== 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; bh=/c63M9CZkZ8gU5H1U4G3jrYPM/pzBVjF/26C2NOmA5k=; b=OgooAWLZVY1Vt0FRdNtUIy4h3PCvALXfLj1BN+Fm3S9iJXPNgYGWwP9cz8Jqn4D/Oj 6Y/v6LI/m8YYU/dkHQy6ZcdziJHWral/rS6MAVelfEUPn7Ffow+uwlr6zX3vFj+wU6+6 QuMLV8lvPsIpyDeFsVD8+E/bJfH3IQeuSLMLwukFZXhs4SChoK4P6Yg92fEW7Wz1YlYv 6GBpamembB4WWACgfs38GxJHYFRDBf4vg8CRKM5yMFjxT/ERDaX960bt5bEjm50Hpx08 gGBKQuBXVnboUFemYLw62nRah/Bhc1CSMuu5nNieM9Z7ut67Wlvl5OpzJRszej9+jv2L HZgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si925799ejb.204.2020.09.17.14.30.26; Thu, 17 Sep 2020 14:30:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726054AbgIQV3V (ORCPT + 99 others); Thu, 17 Sep 2020 17:29:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:33310 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725844AbgIQV3V (ORCPT ); Thu, 17 Sep 2020 17:29:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CA1E6B178; Thu, 17 Sep 2020 21:29:53 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id 962076074F; Thu, 17 Sep 2020 23:29:19 +0200 (CEST) Date: Thu, 17 Sep 2020 23:29:19 +0200 From: Michal Kubecek To: Andrew Lunn Cc: David Miller , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] ethtool: add and use message type for tunnel info reply Message-ID: <20200917212919.3n6f3zdegjeyhfud@lion.mk-sys.cz> References: <20200916230410.34FCE6074F@lion.mk-sys.cz> <20200917014151.GK3463198@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917014151.GK3463198@lunn.ch> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 03:41:51AM +0200, Andrew Lunn wrote: > On Thu, Sep 17, 2020 at 01:04:10AM +0200, Michal Kubecek wrote: > > Tunnel offload info code uses ETHTOOL_MSG_TUNNEL_INFO_GET message type (cmd > > field in genetlink header) for replies to tunnel info netlink request, i.e. > > the same value as the request have. This is a problem because we are using > > two separate enums for userspace to kernel and kernel to userspace message > > types so that this ETHTOOL_MSG_TUNNEL_INFO_GET (28) collides with > > ETHTOOL_MSG_CABLE_TEST_TDR_NTF which is what message type 28 means for > > kernel to userspace messages. > > > > > rskb = ethnl_reply_init(reply_len, req_info.dev, > > - ETHTOOL_MSG_TUNNEL_INFO_GET, > > + ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY, > > ETHTOOL_A_TUNNEL_INFO_HEADER, > > info, &reply_payload); > > Michal > > Maybe it would make sense to change the two enums from anonymous to > tagged. We can then make ethnl_reply_init() do type checking and > hopefully catch such problems earlier? This sounds like a good idea, it should prevent similar mistakes. > I just wonder if we then run into ABI problems? I don't think there would be a problem with ABI, binary representation of the values shouldn't change and ethnl_reply_init() is not even exported; ethtool_notify() which would also benefit from stricter type checking is exported but it is still kernel API which is not guaranteed to be stable. On the other hand, the enums are part of userspace API so I better take a closer look to make sure we don't run into some trouble there. Michal