Date: Tue, 10 Dec 2013 13:34:28 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259171 - head/usr.sbin/ndp Message-ID: <201312101334.rBADYSlS052735@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Tue Dec 10 13:34:28 2013 New Revision: 259171 URL: http://svnweb.freebsd.org/changeset/base/259171 Log: Remove unused macro ADVANCE() and replace ROUNDUP() macro with ALIGN(). They aren't the same, but in our use cases ALIGN gives the same results. Modified: head/usr.sbin/ndp/ndp.c Modified: head/usr.sbin/ndp/ndp.c ============================================================================== --- head/usr.sbin/ndp/ndp.c Tue Dec 10 13:33:56 2013 (r259170) +++ head/usr.sbin/ndp/ndp.c Tue Dec 10 13:34:28 2013 (r259171) @@ -109,11 +109,6 @@ #include <unistd.h> #include "gmt2local.h" -/* packing rule for routing socket */ -#define ROUNDUP(a) \ - ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) -#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) - #define NEXTADDR(w, s) \ if (rtm->rtm_addrs & (w)) { \ bcopy((char *)&s, cp, sizeof(s)); cp += SA_SIZE(&s);} @@ -421,7 +416,7 @@ set(int argc, char **argv) /* NOTREACHED */ } sin = (struct sockaddr_in6 *)(rtm + 1); - sdl = (struct sockaddr_dl *)(ROUNDUP(sin->sin6_len) + (char *)sin); + sdl = (struct sockaddr_dl *)(ALIGN(sin->sin6_len) + (char *)sin); if (IN6_ARE_ADDR_EQUAL(&sin->sin6_addr, &sin_m.sin6_addr)) { if (sdl->sdl_family == AF_LINK && !(rtm->rtm_flags & RTF_GATEWAY)) { @@ -508,7 +503,7 @@ delete(char *host) /* NOTREACHED */ } sin = (struct sockaddr_in6 *)(rtm + 1); - sdl = (struct sockaddr_dl *)(ROUNDUP(sin->sin6_len) + (char *)sin); + sdl = (struct sockaddr_dl *)(ALIGN(sin->sin6_len) + (char *)sin); if (IN6_ARE_ADDR_EQUAL(&sin->sin6_addr, &sin_m.sin6_addr)) { if (sdl->sdl_family == AF_LINK && !(rtm->rtm_flags & RTF_GATEWAY)) { @@ -598,7 +593,7 @@ again:; rtm = (struct rt_msghdr *)next; sin = (struct sockaddr_in6 *)(rtm + 1); - sdl = (struct sockaddr_dl *)((char *)sin + ROUNDUP(sin->sin6_len)); + sdl = (struct sockaddr_dl *)((char *)sin + ALIGN(sin->sin6_len)); /* * Some OSes can produce a route that has the LINK flag but
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312101334.rBADYSlS052735>