svn commit: r241428 - stable/9/usr.sbin/ip6addrctl

Eitan Adler eadler at FreeBSD.org
Wed Oct 10 21:30:26 UTC 2012


Author: eadler
Date: Wed Oct 10 21:30:26 2012
New Revision: 241428
URL: http://svn.freebsd.org/changeset/base/241428

Log:
  MFC r241134:
  	Fix alignment related warnings reported by gcc
  	Switch from old style arguments to modern C
  	remove WARNS as a result
  
  	tested with "make universe"
  
  Approved by:	cperciva (implicit)

Modified:
  stable/9/usr.sbin/ip6addrctl/Makefile
  stable/9/usr.sbin/ip6addrctl/ip6addrctl.c
Directory Properties:
  stable/9/usr.sbin/ip6addrctl/   (props changed)

Modified: stable/9/usr.sbin/ip6addrctl/Makefile
==============================================================================
--- stable/9/usr.sbin/ip6addrctl/Makefile	Wed Oct 10 21:29:00 2012	(r241427)
+++ stable/9/usr.sbin/ip6addrctl/Makefile	Wed Oct 10 21:30:26 2012	(r241428)
@@ -3,6 +3,4 @@
 PROG=	ip6addrctl
 MAN=	ip6addrctl.8
 
-WARNS?=	2
-
 .include <bsd.prog.mk>

Modified: stable/9/usr.sbin/ip6addrctl/ip6addrctl.c
==============================================================================
--- stable/9/usr.sbin/ip6addrctl/ip6addrctl.c	Wed Oct 10 21:29:00 2012	(r241427)
+++ stable/9/usr.sbin/ip6addrctl/ip6addrctl.c	Wed Oct 10 21:30:26 2012	(r241428)
@@ -71,12 +71,10 @@ static void plen2mask(struct sockaddr_in
 static void set_policy(void);
 static void add_policy(char *, char *, char *);
 static void delete_policy(char *);
-static void flush_policy();
+static void flush_policy(void);
 
 int
-main(argc, argv)
-	int argc;
-	char *argv[];
+main(int argc, char *argv[])
 {
 	TAILQ_INIT(&policyhead);
 
@@ -107,11 +105,11 @@ main(argc, argv)
 }
 
 static void
-get_policy()
+get_policy(void)
 {
 	int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_ADDRCTLPOLICY };
 	size_t l;
-	char *buf;
+	struct in6_addrpolicy *buf;
 	struct in6_addrpolicy *pol, *ep;
 
 	if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) {
@@ -131,8 +129,8 @@ get_policy()
 		/* NOTREACHED */
 	}
 
-	ep = (struct in6_addrpolicy *)(buf + l);
-	for (pol = (struct in6_addrpolicy *)buf; pol + 1 <= ep; pol++) {
+	ep = buf + l/sizeof(*buf);
+	for (pol = buf; pol + 1 <= ep; pol++) {
 		struct policyqueue *new;
 
 		if ((new = malloc(sizeof(*new))) == NULL)
@@ -145,7 +143,7 @@ get_policy()
 }
 
 static void
-dump_policy()
+dump_policy(void)
 {
 	size_t addrlen;
 	char addrbuf[NI_MAXHOST];
@@ -201,8 +199,7 @@ dump_policy()
 	} while (0);
 
 static void
-make_policy_fromfile(conf)
-	char *conf;
+make_policy_fromfile(char *conf)
 {
 	char line[_POSIX2_LINE_MAX], *cp;
 	char *addrstr;
@@ -257,9 +254,7 @@ make_policy_fromfile(conf)
 }
 
 static int
-parse_prefix(prefix0, pol)
-	const char *prefix0;
-	struct in6_addrpolicy *pol;
+parse_prefix(const char *prefix0, struct in6_addrpolicy *pol)
 {
 	int e = 0, plen;
 	char *prefix, *plenstr;
@@ -299,11 +294,9 @@ parse_prefix(prefix0, pol)
 }
 
 static void
-plen2mask(mask, plen)
-	struct sockaddr_in6 *mask;
-	int plen;
+plen2mask(struct sockaddr_in6 *mask, int plen)
 {
-	u_char *cp = (char *)&mask->sin6_addr;
+	u_char *cp = (unsigned char *)&mask->sin6_addr;
 
 	memset(mask, 0, sizeof(*mask));
 	mask->sin6_family = AF_INET6; /* just in case */
@@ -316,7 +309,7 @@ plen2mask(mask, plen)
 }
 
 static void
-set_policy()
+set_policy(void)
 {
 	struct policyqueue *ent;
 	int s;
@@ -334,8 +327,7 @@ set_policy()
 }
 
 static int
-mask2plen(mask)
-	struct sockaddr_in6 *mask;
+mask2plen(struct sockaddr_in6 *mask)
 {
 	int masklen, final = 0;
 	u_char *p, *lim;
@@ -394,8 +386,7 @@ mask2plen(mask)
 }
 
 static void
-add_policy(prefix, prec, label)
-	char *prefix, *prec, *label;
+add_policy(char *prefix, char *prec, char *label)
 {
 	struct in6_addrpolicy p;
 	int s;
@@ -416,8 +407,7 @@ add_policy(prefix, prec, label)
 }
 
 static void
-delete_policy(prefix)
-	char *prefix;
+delete_policy(char *prefix)
 {
 	struct in6_addrpolicy p;
 	int s;
@@ -436,7 +426,7 @@ delete_policy(prefix)
 }
 
 static void
-flush_policy()
+flush_policy(void)
 {
 	struct policyqueue *ent;
 	int s;
@@ -454,7 +444,7 @@ flush_policy()
 }
 
 static void
-usage()
+usage(void)
 {
 	fprintf(stderr, "usage: ip6addrctl [show]\n");
 	fprintf(stderr, "       ip6addrctl add "


More information about the svn-src-stable-9 mailing list