From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF96BC4320A for ; Mon, 2 Aug 2021 13:43:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C544560F6D for ; Mon, 2 Aug 2021 13:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233742AbhHBNnf (ORCPT ); Mon, 2 Aug 2021 09:43:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59589 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233719AbhHBNne (ORCPT ); Mon, 2 Aug 2021 09:43:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627911804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=10E0KbDcNF3xBbVH8wjtzXO09PrLbKBJPWy5SH+LtDM=; b=WsBx5YkfjPkfswURjuiUcghF3MG0w7gtyysYutwqughefwtP6HIRx4pCsKLpY7IAnsuRe5 xewJWmIytvbZ+i1YjY3cRLlFd6QNk06+pqyTPbQ4/8qa2mx3K2q0dGcb8z5td2i3I93aDd Hw3ROlt9gbRpK1CoUQASbTCRWkJHcQQ= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270-K8xyxR3eOtuo5HSDY87Mwg-1; Mon, 02 Aug 2021 09:43:23 -0400 X-MC-Unique: K8xyxR3eOtuo5HSDY87Mwg-1 Received: by mail-wr1-f70.google.com with SMTP id p12-20020a5d68cc0000b02901426384855aso6475700wrw.11 for ; Mon, 02 Aug 2021 06:43:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=10E0KbDcNF3xBbVH8wjtzXO09PrLbKBJPWy5SH+LtDM=; b=s5Xq56LB51K0d+YfBVmkEilHZX2tiGAI2Tj+rNW4tI6QIUKpmEBh3gvyXd4h8UHDxU laDftkQQxKYHAXgVnHRsVWWY7KR0wG7BJ5oFv7+g0vc1IYbKrxHHZ1R969IwFarzNtn5 +JTBIPxGeFrZB+dhYT/ZaG/PVnznqBoWTynSn3WezN2wUZlT7v4C9uq862N7T3aXX5aC HZV/Rv4Ipfr7FCz0vVfKEq2bLXMv5/HIP3FnTFo+COWciMXTvw5dX9Dunerl2K575HjI veETBwsQcjD06XL/9KV7kBdGiRnXDyp0OsrAsYYj2hh7tyWmu7Fb+LLkJhzGudLGzsem yHzg== X-Gm-Message-State: AOAM532ticjV11zYoxlt8gji+ZhV3t1QKg5AqUrgsqCLCu083gulbUKo 4yjXeDRviE/p+wOdd1dAA0pDZapLCT7eOlUrJWHR1FbD7w//bSqyi/suJvaZ/GaXDP0YJEOyOs7 zeV+LLrLQfhpCjHk8HNKeOC/z X-Received: by 2002:a5d:6d8c:: with SMTP id l12mr7607052wrs.290.1627911802420; Mon, 02 Aug 2021 06:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqlT6pmqx3O86acE7/FPgrql7S7TmLq+6UU6RuIU5lnEOJUjY+xHnA5ouKs2ESuJaT7LzhCQ== X-Received: by 2002:a5d:6d8c:: with SMTP id l12mr7607042wrs.290.1627911802287; Mon, 02 Aug 2021 06:43:22 -0700 (PDT) Received: from pc-32.home (2a01cb058918ce00dd1a5a4f9908f2d5.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:dd1a:5a4f:9908:f2d5]) by smtp.gmail.com with ESMTPSA id h11sm6835219wmq.34.2021.08.02.06.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 06:43:21 -0700 (PDT) Date: Mon, 2 Aug 2021 15:43:20 +0200 From: Guillaume Nault To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: How to find out name or id of newly created interface Message-ID: <20210802134320.GB3756@pc-32.home> References: <20210731203054.72mw3rbgcjuqbf4j@pali> <20210802100238.GA3756@pc-32.home> <20210802105825.td57b5rd3d6xfxfo@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210802105825.td57b5rd3d6xfxfo@pali> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 02, 2021 at 12:58:25PM +0200, Pali Rohár wrote: > On Monday 02 August 2021 12:02:38 Guillaume Nault wrote: > > > > So the proper solution is to implement NLM_F_ECHO support for > > RTM_NEWLINK messages (RTM_NEWROUTE is an example of netlink handler > > that supports NLM_F_ECHO, see rtmsg_fib()). > > Do you know if there is some workaround / other solution which can be > used by userspace applications now? And also with stable kernels (which > obviously do not receive this new NLM_F_ECHO support for RTM_NEWLINK)? I unfortunately can't think of any clean solution. It might be possible to create the new interface with attributes very unlikely to be used by external programs and retrieve the interface name and id by monitoring link creation messages (like 'ip monitor' does). But at this point it's probably easier to just set the interface name and retry with a different name every time it conflicted with an existing device. Maybe someone else could propose less hacky solutions, but I really can't think of anything else apart from implementing NLM_F_ECHO.