Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1258375rdb; Fri, 22 Dec 2023 23:13:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtDrLvN+D6H1OxeW9R5hoTKoc3GlsMj8+VdI5KyzsJTqA3XbhfWVtcPQSX2yIEaTczul+/ X-Received: by 2002:a05:620a:126f:b0:775:cf6d:a468 with SMTP id b15-20020a05620a126f00b00775cf6da468mr2695868qkl.49.1703315633404; Fri, 22 Dec 2023 23:13:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703315633; cv=none; d=google.com; s=arc-20160816; b=HdjbBRPILTbTWmLGuIopjw9akWHqyNKovbAt3QQVN9X0iKBNRtg+if7o7eOiUDwaLd s2uQkP9lvXOnsA9DbDRaUIxfudWUqNj4CUYDWggJ1EStrIewXuvsgSak2a5NA/vi5ndH 6yGa9SaCliP5vY9Ef9EKdZYo9lWl3/C8fkxTGM+VsCeLKZi+SbOJCTwswk9n7POw7VxU JSPZWIQk1Ls2AH3NtiBZ8/kzCyGspPHjLGfjiS4XURqAb7t9+qYsxa15+YJDQDPMPx75 sdMm6fh4825srZpSsoNzhg3xQh6PWQhdz5GTMONgLAUdzyFNMFFatPZZbKctdsfsyDLB /j/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=squQ29LS3om98KbFUvaUmQ9St+SmyXFv/Z9gYa40yWE=; fh=5JkJdU87H+XrC8syQM4F2TIDiUfQybyeIxjz4vMaZnw=; b=pIKvwA/vnUuqkvzW5Pr0JAfH7StI5lVJcwpVTQ/agedYh1NDzPSOC7DFPiQF3OFMQu EwJUuFccRY3yanw2JTE0ax5Q59oSdCKUfZDhKzVFIIzJiEeA91dpVwVss4yBb9hAx6Ci ujbOfi28TcbjytQNoEkWxyZDjn7bNJ/LI87Gm5eiUesynkADus4ChwcVS6rUy3mNUfHg 43Dol8yCBjXmx2zG9AEfQBUokAkjE+INAyAgHvhoUxyvNjUmcUV8o0DTX3fF6McEPcRr O8V8+MeaVITaVJa0+uW2kmrT862XtJN0V4jOTOvnbSqLqGsWuivfSlli8wAgrL/BzJa0 mBmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Er/ksrzK"; spf=pass (google.com: domain of linux-kernel+bounces-10331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10331-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ea19-20020a05620a489300b0077f60a93b5esi6455393qkb.649.2023.12.22.23.13.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 23:13:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Er/ksrzK"; spf=pass (google.com: domain of linux-kernel+bounces-10331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10331-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D9961C21F40 for ; Sat, 23 Dec 2023 07:13:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACBEE9466; Sat, 23 Dec 2023 07:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Er/ksrzK" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A9AF944C for ; Sat, 23 Dec 2023 07:13:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703315623; 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=squQ29LS3om98KbFUvaUmQ9St+SmyXFv/Z9gYa40yWE=; b=Er/ksrzKzu8YpxGXJ5Ykqf7M6wVRKjGFPoc/B2y1xx4bU0/JqUKQY8BLs70xy7IROMfKUx wl34Cqj3BKuFze4XuhkTujzTHA0lUsJUuZPsGfDDU8iCyK8YGhB1jTh3MWzyjDlqmnFw7/ 5F8Uj2eEhNEuRkdkN5osQmGL43tzp0U= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-292-NoRbDWZ5MO6ZCpYjbf3_-g-1; Sat, 23 Dec 2023 02:13:41 -0500 X-MC-Unique: NoRbDWZ5MO6ZCpYjbf3_-g-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a1f99db3dd0so122281766b.0 for ; Fri, 22 Dec 2023 23:13:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703315620; x=1703920420; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=squQ29LS3om98KbFUvaUmQ9St+SmyXFv/Z9gYa40yWE=; b=Lg9QocBov8pVcVjRRUj5VWiEcOfzdr++iBIAAxY6gOhIbN2MgGLt4S0QTeCfDMtYuG 6yNqv+eP+ZB6+MsFF1+HDfJel7nQTqUIP7FXUkzzlvyJK/+Q9ODX8rlph+9lM0j4mF/I JyX1E+QWJAHsFPmoBI0P2mseAZHxU6/sRf95KU50kPUIXUGZciigvP/Po8wa1z5wuBKp WqlW8IAHCo/jyWfksfXOB83Zx9bV571UAwgFi5GReDbWW7i/da0E+mMEbRPKT/NMF4su +dVUCpWOyqDVqAeQa3ht5ZTO8KELjOpgepMQAWMdWoEspLSx6EOZIqZGmQCfJ/0jad/H 8ibw== X-Gm-Message-State: AOJu0YwyZaMQVLzdC1lLZzLR29f0xAeXG5QHWNnhTwmy6A42vL7D3Pz5 ZS0hyLH+BqLtorF8xmhyhWeMayENGJn8yd5b91ckAR9+GMokxeTOsA1fl/xBXb22REKaIPfskH5 YcgtDrGx1KYmFuimXVbidI3pFq/PBkcH3w6Ni3tPoj0E+ezaW X-Received: by 2002:a17:906:1407:b0:a24:20f:d63a with SMTP id p7-20020a170906140700b00a24020fd63amr1383531ejc.97.1703315620197; Fri, 22 Dec 2023 23:13:40 -0800 (PST) X-Received: by 2002:a17:906:1407:b0:a24:20f:d63a with SMTP id p7-20020a170906140700b00a24020fd63amr1383516ejc.97.1703315619891; Fri, 22 Dec 2023 23:13:39 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1696847920-31125-1-git-send-email-shradhagupta@linux.microsoft.com> In-Reply-To: From: Ani Sinha Date: Sat, 23 Dec 2023 12:43:28 +0530 Message-ID: Subject: Re: [PATCH v8] hv/hv_kvp_daemon:Support for keyfile based connection profile To: Shradha Gupta Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Michael Kelley , Olaf Hering , Shradha Gupta Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Oct 13, 2023 at 3:06=E2=80=AFPM Ani Sinha wro= te: > > > > > On 09-Oct-2023, at 4:08 PM, Shradha Gupta wrote: > > > > Ifcfg config file support in NetworkManger is deprecated. This patch > > provides support for the new keyfile config format for connection > > profiles in NetworkManager. The patch modifies the hv_kvp_daemon code > > to generate the new network configuration in keyfile > > format(.ini-style format) along with a ifcfg format configuration. > > The ifcfg format configuration is also retained to support easy > > backward compatibility for distro vendors. These configurations are > > stored in temp files which are further translated using the > > hv_set_ifconfig.sh script. This script is implemented by individual > > distros based on the network management commands supported. > > For example, RHEL's implementation could be found here: > > https://gitlab.com/redhat/centos-stream/src/hyperv-daemons/-/blob/c9s/h= v_set_ifconfig.sh > > Debian's implementation could be found here: > > https://github.com/endlessm/linux/blob/master/debian/cloud-tools/hv_set= _ifconfig > > > > The next part of this support is to let the Distro vendors consume > > these modified implementations to the new configuration format. > > > > Tested-on: Rhel9(Hyper-V, Azure)(nm and ifcfg files verified) > > Was this patch tested with ipv6? We are seeing a mix of ipv6 and ipv4 add= resses in ipv6 section: There is also another issue which is kind of a design problem that existed from the get go but now is exposed since keyfile support was added. Imagine we configure both ipv6 and ipv4 and some interfaces have ipv4 addresses and some have ipv6. getifaddres() call in kvp_get_ip_info() will return a linked list per interface. The code sets ip_buffer->addr_family based on the address family of the address set for the interface. We use this to determine which section in the keyfile to use, ipv6 or ipv4. However, once we make this decision, we are locked in. The issue here is that kvp_process_ip_address() that extracts the IP addresses concatenate the addresses in a single buffer separating the IPs with ";". Thus across interfaces, the buffer can contain both ipv4 and ipv6 addresses separated by ";" if both v4 and v6 are configured. This is problematic as the addr_family can be either ipv4 or ipv6 but not both. Essentially, we can have a situation that for a single addr_family in hv_kvp_ipaddr_value struct, the ip_addr member can be a buffer containing both ipv6 and ipv4 addresses. Notice that process_ip_string() handles this by iterating through the string and for each ip extracted, it individually determines if the IP is a v6 or a v4 and adds "IPV6ADDR" or "IPADDR" to the ifcfg file accordingly. process_ip_string_nm() does not do that and solely makes the determination based on is_ipv6 values which is based on a single addr_family value above. Thus, it cannot possibly know whether the specific IP address extracted from the string is a v4 or v6. Unlike for ifcfg files, fir nm keyfiles, we need to add v4 and v6 addresses in specific sections and we cannot mix the two. So we need to make two passes. One for v4 and one for v6 and then add IPs in the respective sections. This issue needs to be looked into and unless it's resolved, we cannot support both ipv4 and ipv6 addresses at the same time. Thoughts?