From owner-freebsd-net@FreeBSD.ORG Sat Jan 8 01:50:49 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5B7B1065697 for ; Sat, 8 Jan 2011 01:50:49 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 6ABED8FC08 for ; Sat, 8 Jan 2011 01:50:49 +0000 (UTC) Received: by qyk8 with SMTP id 8so15246qyk.13 for ; Fri, 07 Jan 2011 17:50:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Br1WkCZEj5V9P7yZRMh6i9xKak9ztjaYNWo9VF52hb8=; b=lGXpv4BDfOhsqFT4/jbFmaggeto//9LNLFwwyMQbVpiVrLkK1h/mt7Ifpsj34wlWzu /XHRTuxk5JhKABZA4EV/e6zegkIa949H6oUGuH0w97SYrmkTQtqRckHH9wEgOdNdZMEd 5aXw7TG2hvSGImgB6f7pByMygm6Wg6jCwCNNY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=VuL8859Khjg3EpWs8M8eNBYrXRnvRh2WuQvSzrQ6zDxbEBE0T9qFG2ZNVSgY3lhGTx Kfml1ukdf8VSm8QHyyqtN9zyNSl2llUbwzM5J9IvvMd0yzsUlPuqFDhsSNdm3ryufQAL cX//br4mpooej/X8mXwAE/d4CJklrTOmBo4p4= MIME-Version: 1.0 Received: by 10.229.185.1 with SMTP id cm1mr22957905qcb.81.1294449997362; Fri, 07 Jan 2011 17:26:37 -0800 (PST) Received: by 10.229.39.147 with HTTP; Fri, 7 Jan 2011 17:26:37 -0800 (PST) In-Reply-To: <4D27AF1D.2030505@acm.poly.edu> References: <4D27AF1D.2030505@acm.poly.edu> Date: Sat, 8 Jan 2011 04:26:37 +0300 Message-ID: From: Sergey Kandaurov To: Boris Kochergin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-net@freebsd.org Subject: Re: NDP Ethernet address display X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jan 2011 01:50:49 -0000 On 8 January 2011 03:26, Boris Kochergin wrote: > Hi. I noticed that ndp(8) doesn't zero-pad Ethernet addresses, which is > inconsistent with arp(8): > > # ndp -an > ... > 2001:470:897b::1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0:30:48:b1:1b:9c= =A0 =A0 em0 permanent R > > # arp -an > ... > ? (128.238.9.201) at 00:30:48:b1:1b:9c on em0 permanent [ethernet] > > As everything else I can think of zero-pads them, this makes it a little > annoying to grep for addresses, etc. Is this intentional? It is the case = in > 7.x through CURRENT and the fix is quite simple: > > --- /usr/src/usr.sbin/ndp/ndp.c.orig =A0 =A02011-01-07 19:16:17.000000000= -0500 > +++ /usr/src/usr.sbin/ndp/ndp.c 2011-01-07 19:15:36.000000000 -0500 > @@ -828,7 +828,7 @@ > > =A0 =A0 =A0 =A0if (sdl->sdl_alen) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cp =3D (u_char *)LLADDR(sdl); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 snprintf(hbuf, sizeof(hbuf), "%x:%x:%x:%x:%= x:%x", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 snprintf(hbuf, sizeof(hbuf), > "%02x:%02x:%02x:%02x:%02x:%02x", > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cp[0], cp[1], cp[2], cp[3], cp[4],= cp[5]); > =A0 =A0 =A0 =A0} else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0snprintf(hbuf, sizeof(hbuf), "(incomplete)= "); > Or rather use getnameinfo() for that as NetBSD/KAME does, and NetBSD's getnameinfo() AF_LINK support was merged at 6.3 time. (See ndp.c#rev1.87 at KAME, ndp.c#rev1.35 at NetBSD). --=20 wbr, pluknet