Date: Wed, 24 Jul 2013 04:05:48 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253589 - head/sbin/route Message-ID: <201307240405.r6O45mD9094915@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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])
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307240405.r6O45mD9094915>