Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1242413pxv; Fri, 25 Jun 2021 08:28:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCeJakuW6EMtVzg3EWm+nOmJVpxwKhmlq98naW8j8iJvg2Gzye2YmMiQBMQsnUSupypEFF X-Received: by 2002:a92:6509:: with SMTP id z9mr7844260ilb.184.1624634911918; Fri, 25 Jun 2021 08:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624634911; cv=none; d=google.com; s=arc-20160816; b=xa7PAcc0vGhCl1WrDD37JuskgmyTK6GFKfHAvHdDjzfjTmW694L35pLuS3PBsv8UjB yxMHc/unNnq6T/ri8YG9ZMgEsDYOH2ZNZkwGXmNGE3f8m8/TZk3IO9p3W0CRxkcxvSQ/ EQTn1QLToOZEPwvhJtQUZdaLAsOHAot6tO+bdgn8kND4HxDLEiIWW9/2099NIF37GYoi YshLV2JMmfVbSkUGMtm+SyeBMTIazC6ZNz+GQmZopEPm+lXFrEfxeIAXv3UOLd9KOlY9 MPFpWjaiMukvsFeg/ZqxtyAJ/vOJMMlhnsOnCkIjwDp5ujlOOdSaBhIOsA09l007IeW8 apHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=miQ5O0SHdRxZ3/ueJkeEVFL9leEvXheovDZzOvVQaxs=; b=toJhf9gRymYFgR3/SQbAzZ4jmJS91vqjQanvsXWJPX/Pb+ssUpZqu2qPQNAh63pOYQ 0qKbC1oGD2m7nvKSBRX6g1jReFd235r1pfTjsGScT0cheF5b3L4zawevOm9+YrRW8b1/ FUS5aR+fxyzNpQHopECtLlgxUjRECuTuTWpbKmRAl+jpd/FtB+ycTdgU/bZ3X1vFtUFT 5ewOz+KVKTgoMu19Mzn8+KUKTzdu27dordx0XGxhfcpowLcheYXVz7ofOnuymIXYKiPC z8hI/r1gadGhOV506ackMAo2nIs1vmNxcktI8jvvP/iMHe7iDaZm/zwqVUzB2ZlVOlxq gGDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BTsUejnu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h41si6826174jaa.50.2021.06.25.08.28.18; Fri, 25 Jun 2021 08:28:31 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BTsUejnu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbhFYPaD (ORCPT + 99 others); Fri, 25 Jun 2021 11:30:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbhFYPaC (ORCPT ); Fri, 25 Jun 2021 11:30:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EA5116193F; Fri, 25 Jun 2021 15:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624634861; bh=lwR2g6gRk+aJ4xVmniL5GuaewpPGjDCLk9yE/FrMrt8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BTsUejnuJPzvuMHBjXJuP3F/q+Vl24rM4YE4aW0cU8bcpBo+uxdMY+JzNyfJhPjV5 OSjMNQ6dyGuNYCJHeWOxWyScxTD90ynDFjAX3hI2/cJ3xjt+XraKFhUDf6e1mg9M1C cb5+2sm6RVG4/smYydQWBfnZVXKu2LM/tJ5WkJMLcfVRvz2QgwHTzgL1XFi/ZE/HXy 7XMztvarBt0LrP1xL5aRgd0RxHXB7wiGjHorXggBS6LWOZD/WGVn/q5RPjV0Rqno9r isK02Y1xwzHhG959IYkj/DsqiOzZZCbRFcO/ej0vf76hmHQEeNmtzookjoxNHR2D8t MKex1lkplbZ4A== Received: by pali.im (Postfix) id 9D34FA7D; Fri, 25 Jun 2021 17:27:37 +0200 (CEST) Date: Fri, 25 Jun 2021 17:27:37 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Nicolas Dichtel Cc: Marek =?utf-8?B?QmVow7pu?= , netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Alexey Kuznetsov , Hideaki YOSHIFUJI , linux-kernel@vger.kernel.org, Andrew Lunn , Russell King , Stephen Hemminger , Phil Sutter Subject: Re: Issues during assigning addresses on point to point interfaces Message-ID: <20210625152737.6gslduccvguyrr77@pali> References: <20210606151008.7dwx5ukrlvxt4t3k@pali> <20210624124545.2b170258@dellmb> <20210625084031.c33yovvximtabmf4@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 25 June 2021 17:06:21 Nicolas Dichtel wrote: > Le 25/06/2021 à 10:40, Pali Rohár a écrit : > > On Thursday 24 June 2021 14:57:41 Nicolas Dichtel wrote: > >> Le 24/06/2021 à 12:45, Marek Behún a écrit : > >>> On Sun, 6 Jun 2021 17:10:08 +0200 > >>> Pali Rohár wrote: > >>> > >>>> Hello! > >>>> > >>>> Seems that there is a bug during assigning IP addresses on point to > >>>> point interfaces. > >>>> > >>>> Assigning just one local address works fine: > >>>> > >>>> ip address add fe80::6 dev ppp1 --> inet6 fe80::6/128 scope link > >>>> > >>>> Assigning both local and remote peer address also works fine: > >>>> > >>>> ip address add fe80::7 peer fe80::8 dev ppp1 ---> inet6 fe80::7 > >>>> peer fe80::8/128 scope link > >>>> > >>>> But trying to assign just remote peer address does not work. Moreover > >>>> "ip address" call does not fail, it returns zero but instead of > >>>> setting remote peer address, it sets local address: > >>>> > >>>> ip address add peer fe80::5 dev ppp1 --> inet6 fe80::5/128 scope > >>>> link > >>>> > >>> > >>> Adding some other people to Cc in order to get their opinions. > >>> > >>> It seems this bug is there from the beginning, from commit > >>> caeaba79009c2 ("ipv6: add support of peer address") > >>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=caeaba79009c2 > >>> > >>> Maybe some older user-space utilities use IFA_ADDRESS instead of > >>> IFA_LOCAL, and this was done in order to be compatible with them? > >> If I remember well, there was an issue in the uAPI. > >> IFA_LOCAL is supposed to be the address of the interface and IFA_ADDRESS is > >> supposed to be the endpoint of a point-to-point interface. > >> However, in case of IPv6, it was not the case. In netlink messages generated by > >> the kernel, IFA_ADDRESS was used instead of IFA_LOCAL. > >> The patch tried to keep the backward compatibility and the symmetry between msg > >> from userland and notification from the kernel. > > > > Hello Nicolas! > > > > See my original email where I put also rtnetlink packets (how strace see > > them). Seems that there is a bug in handling them (or bug in iproute2) > > as setting just peer (remote) IPv6 address is ignored: > > https://lore.kernel.org/netdev/20210606151008.7dwx5ukrlvxt4t3k@pali/ > > > > Do you have any idea if this is affected by that "issue in the uAPI"? > > And what is the way how to fix it? > What about forcing IFA_LOCAL address to :: in your case? It does not work. ip address returns error: $ sudo ip address add :: peer fe80::8 dev ppp0 RTNETLINK answers: Cannot assign requested address Here is strace output: sendmsg(3, { msg_name={ sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000 }, msg_namelen=12, msg_iov=[{ iov_base={ { len=64, type=RTM_NEWADDR, flags=NLM_F_REQUEST|NLM_F_ACK|NLM_F_EXCL|NLM_F_CREATE, seq=1624633811, pid=0 }, { ifa_family=AF_INET6, ifa_prefixlen=128, ifa_flags=0, ifa_scope=RT_SCOPE_UNIVERSE, ifa_index=if_nametoindex("ppp0") }, [ { { nla_len=20, nla_type=IFA_LOCAL }, inet_pton(AF_INET6, "::") }, { { nla_len=20, nla_type=IFA_ADDRESS }, inet_pton(AF_INET6, "fe80::8") } ] }, iov_len=64 }], msg_iovlen=1, msg_controllen=0, msg_flags=0 }, 0) = 64 recvmsg(3, { msg_name={ sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000 }, msg_namelen=12, msg_iov=[{ iov_base=NULL, iov_len=0 }], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_TRUNC }, MSG_PEEK|MSG_TRUNC) = 84 recvmsg(3, { msg_name={ sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000 }, msg_namelen=12, msg_iov=[{ iov_base={ { len=84, type=NLMSG_ERROR, flags=0, seq=1624633811, pid=3698 }, { error=-EADDRNOTAVAIL, msg={ { len=64, type=RTM_NEWADDR, flags=NLM_F_REQUEST|NLM_F_ACK|NLM_F_EXCL|NLM_F_CREATE, seq=1624633811, pid=0 }, { ifa_family=AF_INET6, ifa_prefixlen=128, ifa_flags=0, ifa_scope=RT_SCOPE_UNIVERSE, ifa_index=if_nametoindex("ppp0") }, [ { { nla_len=20, nla_type=IFA_LOCAL }, inet_pton(AF_INET6, "::") }, { { nla_len=20, nla_type=IFA_ADDRESS }, inet_pton(AF_INET6, "fe80::8") } ] } } }, iov_len=84 }], msg_iovlen=1, msg_controllen=0, msg_flags=0 }, 0) = 84