From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8910 Path: news.gmane.org!not-for-mail From: Timo Teras Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCHv2] properly handle point-to-point interfaces in getifaddrs() Date: Sat, 21 Nov 2015 11:14:46 +0200 Message-ID: <20151121111446.6d23921c@vostro> References: <1447756429-2304-2-git-send-email-jow@openwrt.org> <1447965790-8151-1-git-send-email-jow@openwrt.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1448097310 21493 80.91.229.3 (21 Nov 2015 09:15:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Nov 2015 09:15:10 +0000 (UTC) Cc: musl@lists.openwall.com To: Jo-Philipp Wich Original-X-From: musl-return-8923-gllmg-musl=m.gmane.org@lists.openwall.com Sat Nov 21 10:15:09 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1a04GD-0006oP-If for gllmg-musl@m.gmane.org; Sat, 21 Nov 2015 10:15:09 +0100 Original-Received: (qmail 32478 invoked by uid 550); 21 Nov 2015 09:15:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 32454 invoked from network); 21 Nov 2015 09:15:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Zp3UwrorMeqRtvyispgDxXKdv7+Zn1gmKgYnJ0Mgyyo=; b=xgtM6qlkFd/EpG6fA94uUEfCQEcENYF/Qi8WdIOKuQIIFNGvQaIpqE7K6SPA9D1HWy zjBDudMwtS2bEXTbxOcwefrWKX+sNOoef4zOquXAQm2cErc91gz16bpWWVCCWCmGYq62 os1afpuLLqyVbu9/+oMYQTFe2D0ChErrJGmLOvhDYetRFMK7aX2nK1AKSSBJzdI5ad2O qfoNPNWk/uMoXPcEJJfx4m5fi8blN13FWc7iO0wRDGVqZ+ygTbNNZVBv2PehtNK0YrNU njNgJONc53LBKOOsov0sYcApLgzpiB1sTIdJ1Iac6Xlw9SF7FvpSW3rrj17UT+gY5G/Z 02Ww== X-Received: by 10.25.23.42 with SMTP id n42mr7868070lfi.42.1448097293748; Sat, 21 Nov 2015 01:14:53 -0800 (PST) Original-Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= In-Reply-To: <1447965790-8151-1-git-send-email-jow@openwrt.org> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-alpine-linux-musl) Xref: news.gmane.org gmane.linux.lib.musl.general:8910 Archived-At: On Thu, 19 Nov 2015 21:43:10 +0100 Jo-Philipp Wich wrote: > With point-to-point interfaces, the IFA_ADDRESS netlink attribute > contains the peer address while an extra attribute IFA_LOCAL carries > the actual local interface address. >=20 > Both the glibc and uclibc implementations of getifaddrs() handle this > case by moving the ifa_addr contents to the broadcast/remote address > union and overwriting ifa_addr upon receipt of an IFA_LOCAL attribute. >=20 > This patch adds the same special treatment logic of IFA_LOCAL to > musl's implementation of getifaddrs() in order to align its behaviour > with that of uclibc and musl. >=20 > Signed-off-by: Jo-Philipp Wich > --- > Changelog v2: > * Handle IFA_LOCAL, IFA_ADDRESS in arbritary order > * Remove misleading comment for IFA_BROADCAST, no such attribute on > ptp links --- > src/network/getifaddrs.c | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) I wrote the code before looking into how ptp links are reported, and just assumed it'd be somehow consistent. But IFA_ADDRESS indeed is the peer for ptp links. How nicely inconsistent from kernel side ;) Seems iproute2 basically does: 1. If IFA_LOCAL not set, copy IFA_ADDRESS to it 2. If IFA_ADDRESS is not set, copy IFA_LOCAL to it 3. Print IFA_LOCAL as local address 4. Print IFA_ADDRESS as peer address if it's not equal to IFA_LOCAL So this looks right to me. Acked-by: Timo Ter=C3=A4s