From owner-svn-src-head@FreeBSD.ORG Wed Jul 24 04:05:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2909789E; Wed, 24 Jul 2013 04:05:49 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1AE152763; Wed, 24 Jul 2013 04:05:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6O45mo7094916; Wed, 24 Jul 2013 04:05:48 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6O45mD9094915; Wed, 24 Jul 2013 04:05:48 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201307240405.r6O45mD9094915@svn.freebsd.org> From: Hiroki Sato Date: Wed, 24 Jul 2013 04:05:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253589 - head/sbin/route X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jul 2013 04:05:49 -0000 Author: hrs Date: Wed Jul 24 04:05:48 2013 New Revision: 253589 URL: http://svnweb.freebsd.org/changeset/base/253589 Log: Fix a bug in cp += SA_SIZE() in RTA_* loop. This could prevent RTA_IFP from displaying correctly in route get subcommand. Spotted by: dim Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Wed Jul 24 02:01:01 2013 (r253588) +++ head/sbin/route/route.c Wed Jul 24 04:05:48 2013 (r253589) @@ -1699,16 +1699,15 @@ print_getmsg(struct rt_msghdr *rtm, int return; } cp = ((char *)(rtm + 1)); - for (i = 0; i < RTAX_MAX; i++) { - if (rtm->rtm_addrs & (1 << i)) + for (i = 0; i < RTAX_MAX; i++) + if (rtm->rtm_addrs & (1 << i)) { sp[i] = (struct sockaddr *)cp; - cp += SA_SIZE((struct sockaddr *)cp); - } - if (rtm->rtm_addrs & RTA_IFP) { - if (sp[RTAX_IFP]->sa_family != AF_LINK || - ((struct sockaddr_dl *)(void *)sp[RTAX_IFP])->sdl_nlen == 0) + cp += SA_SIZE((struct sockaddr *)cp); + } + if ((rtm->rtm_addrs & RTA_IFP) && + (sp[RTAX_IFP]->sa_family != AF_LINK || + ((struct sockaddr_dl *)(void *)sp[RTAX_IFP])->sdl_nlen == 0)) sp[RTAX_IFP] = NULL; - } if (sp[RTAX_DST] && sp[RTAX_NETMASK]) sp[RTAX_NETMASK]->sa_family = sp[RTAX_DST]->sa_family; /* XXX */ if (sp[RTAX_DST])