svn commit: r253522 - in user/attilio/vmcontention: etc lib/libc/arm/gen lib/libfetch release sbin/route sys/arm/include sys/compat/freebsd32 sys/dev/drm2/i915 sys/fs/fuse sys/fs/nfs sys/kern sys/m...
Attilio Rao
attilio at FreeBSD.org
Sun Jul 21 17:14:44 UTC 2013
Author: attilio
Date: Sun Jul 21 17:14:43 2013
New Revision: 253522
URL: http://svnweb.freebsd.org/changeset/base/253522
Log:
MFC
Added:
user/attilio/vmcontention/sys/mips/atheros/ar934x_chip.c
- copied unchanged from r253521, head/sys/mips/atheros/ar934x_chip.c
user/attilio/vmcontention/sys/mips/atheros/ar934x_chip.h
- copied unchanged from r253521, head/sys/mips/atheros/ar934x_chip.h
user/attilio/vmcontention/sys/mips/conf/AR934X_BASE
- copied unchanged from r253521, head/sys/mips/conf/AR934X_BASE
user/attilio/vmcontention/sys/mips/conf/AR934X_BASE.hints
- copied unchanged from r253521, head/sys/mips/conf/AR934X_BASE.hints
user/attilio/vmcontention/sys/mips/conf/DB120
- copied unchanged from r253521, head/sys/mips/conf/DB120
user/attilio/vmcontention/sys/mips/conf/DB120.hints
- copied unchanged from r253521, head/sys/mips/conf/DB120.hints
Modified:
user/attilio/vmcontention/etc/network.subr
user/attilio/vmcontention/lib/libc/arm/gen/sigsetjmp.S
user/attilio/vmcontention/lib/libfetch/http.c
user/attilio/vmcontention/release/Makefile
user/attilio/vmcontention/sbin/route/route.c
user/attilio/vmcontention/sys/arm/include/atomic.h
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_misc.c
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_proto.h
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscall.h
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscalls.c
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_sysent.c
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_systrace_args.c
user/attilio/vmcontention/sys/compat/freebsd32/syscalls.master
user/attilio/vmcontention/sys/dev/drm2/i915/i915_gem.c
user/attilio/vmcontention/sys/fs/fuse/fuse_internal.h
user/attilio/vmcontention/sys/fs/fuse/fuse_kernel.h
user/attilio/vmcontention/sys/fs/nfs/nfs_commonsubs.c
user/attilio/vmcontention/sys/kern/kern_time.c
user/attilio/vmcontention/sys/mips/atheros/ar71xx_chip.c
user/attilio/vmcontention/sys/mips/atheros/ar71xx_cpudef.h
user/attilio/vmcontention/sys/mips/atheros/ar71xx_gpio.c
user/attilio/vmcontention/sys/mips/atheros/ar71xx_setup.c
user/attilio/vmcontention/sys/mips/atheros/ar724x_chip.c
user/attilio/vmcontention/sys/mips/atheros/ar91xx_chip.c
user/attilio/vmcontention/sys/mips/atheros/ar933x_chip.c
user/attilio/vmcontention/sys/mips/atheros/files.ar71xx
user/attilio/vmcontention/sys/mips/atheros/uart_bus_ar71xx.c
user/attilio/vmcontention/sys/mips/atheros/uart_bus_ar933x.c
user/attilio/vmcontention/sys/mips/atheros/uart_cpu_ar71xx.c
user/attilio/vmcontention/sys/mips/atheros/uart_cpu_ar933x.c
user/attilio/vmcontention/sys/netinet/sctp_asconf.c
user/attilio/vmcontention/sys/sys/syscallsubr.h
user/attilio/vmcontention/usr.bin/fetch/fetch.1
Directory Properties:
user/attilio/vmcontention/ (props changed)
user/attilio/vmcontention/lib/libc/ (props changed)
user/attilio/vmcontention/sbin/ (props changed)
user/attilio/vmcontention/sys/ (props changed)
Modified: user/attilio/vmcontention/etc/network.subr
==============================================================================
--- user/attilio/vmcontention/etc/network.subr Sun Jul 21 16:59:44 2013 (r253521)
+++ user/attilio/vmcontention/etc/network.subr Sun Jul 21 17:14:43 2013 (r253522)
@@ -113,9 +113,18 @@ ifconfig_up()
# backward compatibility: $ipv6_enable
case $ipv6_enable in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
- if ! checkyesno ipv6_gateway_enable; then
- _ipv6_opts="${_ipv6_opts} accept_rtadv"
- fi
+ case $1 in
+ bridge[0-9]*)
+ # No accept_rtadv by default on if_bridge(4)
+ # to avoid a conflict with the member
+ # interfaces.
+ ;;
+ *)
+ if ! checkyesno ipv6_gateway_enable; then
+ _ipv6_opts="${_ipv6_opts} accept_rtadv"
+ fi
+ ;;
+ esac
;;
esac
@@ -550,9 +559,18 @@ ipv6_autoconfif()
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
if checkyesno ipv6_gateway_enable; then
return 1
- else
- return 0
fi
+ case $1 in
+ bridge[0-9]*)
+ # No accept_rtadv by default on if_bridge(4)
+ # to avoid a conflict with the member
+ # interfaces.
+ return 1
+ ;;
+ *)
+ return 0
+ ;;
+ esac
;;
esac
@@ -721,9 +739,14 @@ ifalias()
#
ifalias_expand_addr()
{
+ local _af _action
- afexists $1 || return
- ifalias_expand_addr_$1 $2 $3
+ _af=$1
+ _action=$2
+ shift 2
+
+ afexists $_af || return
+ ifalias_expand_addr_$_af $_action $*
}
# ifalias_expand_addr_inet action addr
@@ -731,19 +754,34 @@ ifalias_expand_addr()
#
ifalias_expand_addr_inet()
{
- local _action _arg _cidr _cidr_addr
+ local _action _arg _cidr _cidr_addr _exargs
local _ipaddr _plen _range _iphead _iptail _iplow _iphigh _ipcount
local _retstr _c
_action=$1
_arg=$2
+ shift 2
+ _exargs=$*
_retstr=
- case $_action:$_arg in
- *:*--*) return ;; # invalid
- tmp:*) echo $_arg && return ;; # already expanded
- tmp:*-*) _action="alias" ;; # to be expanded
- *:*-*) ;; # to be expanded
- *:*) echo inet $_arg && return ;; # already expanded
+ case $_action:$_arg:$_exargs in
+ *:*--*) return ;; # invalid
+ tmp:*[0-9]-[0-9]*:*) # to be expanded
+ _action="alias"
+ ;;
+ *:*[0-9]-[0-9]*:*) # to be expanded
+ ;;
+ tmp:*:*netmask*) # already expanded w/ netmask option
+ echo ${_arg%/[0-9]*} $_exargs && return
+ ;;
+ tmp:*:*) # already expanded w/o netmask option
+ echo $_arg $_exargs && return
+ ;;
+ *:*:*netmask*) # already expanded w/ netmask option
+ echo inet ${_arg%/[0-9]*} $_exargs && return
+ ;;
+ *:*:*) # already expanded w/o netmask option
+ echo inet $_arg $_exargs && return
+ ;;
esac
for _cidr in $_arg; do
@@ -796,7 +834,7 @@ ifalias_expand_addr_inet()
done
for _c in $_retstr; do
- ifalias_expand_addr_inet $_action $_c
+ ifalias_expand_addr_inet $_action $_c $_exargs
done
}
@@ -805,20 +843,35 @@ ifalias_expand_addr_inet()
#
ifalias_expand_addr_inet6()
{
- local _action _arg _cidr _cidr_addr
+ local _action _arg _cidr _cidr_addr _exargs
local _ipaddr _plen _ipleft _ipright _iplow _iphigh _ipcount
local _ipv4part
local _retstr _c
_action=$1
_arg=$2
+ shift 2
+ _exargs=$*
_retstr=
- case $_action:$_arg in
- *:*--*) return ;; # invalid
- tmp:*) echo $_arg && return ;;
- tmp:*-*) _action="alias" ;;
- *:*-*) ;;
- *:*) echo inet6 $_arg && return ;;
+ case $_action:$_arg:$_exargs in
+ *:*--*:*) return ;; # invalid
+ tmp:*[0-9a-zA-Z]-[0-9a-zA-Z]*:*)# to be expanded
+ _action="alias"
+ ;;
+ *:*[0-9a-zA-Z]-[0-9a-zA-Z]*:*) # to be expanded
+ ;;
+ tmp:*:*prefixlen*) # already expanded w/ prefixlen option
+ echo ${_arg%/[0-9]*} $_exargs && return
+ ;;
+ tmp:*:*) # already expanded w/o prefixlen option
+ echo $_arg $_exargs && return
+ ;;
+ *:*:*prefixlen*) # already expanded w/ prefixlen option
+ echo inet6 ${_arg%/[0-9]*} $_exargs && return
+ ;;
+ *:*:*) # already expanded w/o prefixlen option
+ echo inet6 $_arg $_exargs && return
+ ;;
esac
for _cidr in $_arg; do
@@ -872,7 +925,7 @@ ifalias_expand_addr_inet6()
fi
for _c in $_retstr; do
- ifalias_expand_addr_inet6 $_action $_c
+ ifalias_expand_addr_inet6 $_action $_c $_exargs
done
else
# v4mapped/v4compat should handle as an IPv4 alias
@@ -888,7 +941,7 @@ ifalias_expand_addr_inet6()
_retstr=`ifalias_expand_addr_inet \
tmp ${_ipv4part}${_plen:+/}${_plen}`
for _c in $_retstr; do
- ifalias_expand_addr_inet $_action $_c
+ ifalias_expand_addr_inet $_action $_c $_exargs
done
fi
done
Modified: user/attilio/vmcontention/lib/libc/arm/gen/sigsetjmp.S
==============================================================================
--- user/attilio/vmcontention/lib/libc/arm/gen/sigsetjmp.S Sun Jul 21 16:59:44 2013 (r253521)
+++ user/attilio/vmcontention/lib/libc/arm/gen/sigsetjmp.S Sun Jul 21 17:14:43 2013 (r253522)
@@ -57,8 +57,10 @@ ENTRY(sigsetjmp)
WEAK_ALIAS(__siglongjmp, siglongjmp)
ENTRY(siglongjmp)
- ldr r2, .L_setjmp_magic
- ldr r3, [r0]
- teq r2, r3
+ ldr r2, .L_setjmp_magic /* load magic */
+ ldr r3, [r0] /* get magic from jmp_buf */
+ bic r3, r3, #(_JB_MAGIC__SETJMP ^ _JB_MAGIC__SETJMP_VFP)
+ /* ignore VFP-ness of magic */
+ teq r2, r3 /* magic correct? */
beq PIC_SYM(_C_LABEL(_longjmp), PLT)
b PIC_SYM(_C_LABEL(longjmp), PLT)
Modified: user/attilio/vmcontention/lib/libfetch/http.c
==============================================================================
--- user/attilio/vmcontention/lib/libfetch/http.c Sun Jul 21 16:59:44 2013 (r253521)
+++ user/attilio/vmcontention/lib/libfetch/http.c Sun Jul 21 17:14:43 2013 (r253522)
@@ -1581,7 +1581,7 @@ http_request(struct url *URL, const char
if (verbose)
fetch_info("requesting %s://%s%s",
url->scheme, host, url->doc);
- if (purl) {
+ if (purl && strcasecmp(URL->scheme, SCHEME_HTTPS) != 0) {
http_cmd(conn, "%s %s://%s%s HTTP/1.1",
op, url->scheme, host, url->doc);
} else {
Modified: user/attilio/vmcontention/release/Makefile
==============================================================================
--- user/attilio/vmcontention/release/Makefile Sun Jul 21 16:59:44 2013 (r253521)
+++ user/attilio/vmcontention/release/Makefile Sun Jul 21 17:14:43 2013 (r253522)
@@ -4,7 +4,7 @@
#
# User-driven targets:
# cdrom: Builds release CD-ROM media (release.iso)
-# memstick: Builds memory stick image (memstick)
+# memstick: Builds memory stick image (memstick.img)
# ftp: Sets up FTP distribution area (ftp)
# release: Build all media and FTP distribution area
# install: Copies all release media into ${DESTDIR}
@@ -73,8 +73,8 @@ RELEASE_TARGETS+= cdrom
IMAGES+= release.iso bootonly.iso
.endif
.if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
-RELEASE_TARGETS+= memstick
-IMAGES+= memstick
+RELEASE_TARGETS+= memstick.img
+IMAGES+= memstick.img
.endif
.include <bsd.obj.mk>
@@ -167,7 +167,8 @@ release.iso: system
bootonly.iso: bootonly
sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly
-memstick: system
+memstick: memstick.img
+memstick.img: system
sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET}
packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
@@ -191,7 +192,7 @@ clean:
rm -f *.txz MANIFEST
rm -f system
rm -rf release bootonly
- rm -f release.iso bootonly.iso memstick
+ rm -f release.iso bootonly.iso memstick.img
install:
.if defined(DESTDIR) && !empty(DESTDIR)
Modified: user/attilio/vmcontention/sbin/route/route.c
==============================================================================
--- user/attilio/vmcontention/sbin/route/route.c Sun Jul 21 16:59:44 2013 (r253521)
+++ user/attilio/vmcontention/sbin/route/route.c Sun Jul 21 17:14:43 2013 (r253522)
@@ -120,7 +120,6 @@ static void set_metric(char *, int);
static int set_sofib(int);
static void sockaddr(char *, struct sockaddr *, size_t);
static void sodump(struct sockaddr *, const char *);
-extern char *iso_ntoa(void);
struct fibl {
TAILQ_ENTRY(fibl) fl_next;
@@ -136,7 +135,7 @@ static int fiboptlist_range(const char *
static void usage(const char *) __dead2;
-void
+static void
usage(const char *cp)
{
if (cp != NULL)
@@ -445,7 +444,7 @@ retry:
(void)printf("Examining routing table from sysctl\n");
seqno = 0; /* ??? */
for (next = buf; next < lim; next += rtm->rtm_msglen) {
- rtm = (struct rt_msghdr *)next;
+ rtm = (struct rt_msghdr *)(void *)next;
if (verbose)
print_rtmsg(rtm, rtm->rtm_msglen);
if ((rtm->rtm_flags & RTF_GATEWAY) == 0)
@@ -490,14 +489,12 @@ retry:
return (error);
}
-const char *
+static const char *
routename(struct sockaddr *sa)
{
+ struct sockaddr_dl *sdl;
const char *cp;
- static char line[MAXHOSTNAMELEN + 1];
-#ifdef INET
- struct hostent *hp;
-#endif
+ static char line[NI_MAXHOST];
static char domain[MAXHOSTNAMELEN + 1];
static int first = 1, n;
@@ -511,73 +508,94 @@ routename(struct sockaddr *sa)
domain[0] = '\0';
}
- if (sa->sa_len == 0) {
- strcpy(line, "default");
- return (line);
- }
+ /* If the address is zero-filled, use "default". */
+ if (sa->sa_len == 0 && nflag == 0)
+ return ("default");
+#if defined(INET) || defined(INET6)
switch (sa->sa_family) {
#ifdef INET
case AF_INET:
- {
- struct in_addr in;
-
- in = ((struct sockaddr_in *)sa)->sin_addr;
- cp = NULL;
- if (in.s_addr == INADDR_ANY || sa->sa_len < 4)
- cp = "default";
- if (cp == NULL && !nflag) {
- hp = gethostbyaddr((char *)&in, sizeof (struct in_addr),
- AF_INET);
- if (hp != NULL) {
- char *cptr;
- cptr = strchr(hp->h_name, '.');
- if (cptr != NULL &&
- strcmp(cptr + 1, domain) == 0)
- *cptr = '\0';
- cp = hp->h_name;
- }
- }
- if (cp != NULL) {
- strncpy(line, cp, sizeof(line) - 1);
- line[sizeof(line) - 1] = '\0';
- } else
- (void)sprintf(line, "%s", inet_ntoa(in));
+ /* If the address is zero-filled, use "default". */
+ if (nflag == 0 &&
+ ((struct sockaddr_in *)(void *)sa)->sin_addr.s_addr ==
+ INADDR_ANY)
+ return("default");
break;
+#endif
+#ifdef INET6
+ case AF_INET6:
+ /* If the address is zero-filled, use "default". */
+ if (nflag == 0 &&
+ IN6_IS_ADDR_UNSPECIFIED(&((struct sockaddr_in6 *)(void *)sa)->sin6_addr))
+ return("default");
+ break;
+#endif
}
+#endif
+ switch (sa->sa_family) {
+#if defined(INET) || defined(INET6)
+#ifdef INET
+ case AF_INET:
#endif
#ifdef INET6
case AF_INET6:
+#endif
{
- struct sockaddr_in6 sin6; /* use static var for safety */
- int niflags = 0;
-
- memset(&sin6, 0, sizeof(sin6));
- memcpy(&sin6, sa, sa->sa_len);
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- sin6.sin6_family = AF_INET6;
- if (nflag)
- niflags |= NI_NUMERICHOST;
- if (getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len,
- line, sizeof(line), NULL, 0, niflags) != 0)
+ struct sockaddr_storage ss;
+ int error;
+ char *p;
+
+ memset(&ss, 0, sizeof(ss));
+ if (sa->sa_len == 0)
+ ss.ss_family = sa->sa_family;
+ else
+ memcpy(&ss, sa, sa->sa_len);
+ /* Expand sa->sa_len because it could be shortened. */
+ if (sa->sa_family == AF_INET)
+ ss.ss_len = sizeof(struct sockaddr_in);
+ else if (sa->sa_family == AF_INET6)
+ ss.ss_len = sizeof(struct sockaddr_in6);
+ error = getnameinfo((struct sockaddr *)&ss, ss.ss_len,
+ line, sizeof(line), NULL, 0,
+ (nflag == 0) ? 0 : NI_NUMERICHOST);
+ if (error) {
+ warnx("getnameinfo(): %s", gai_strerror(error));
strncpy(line, "invalid", sizeof(line));
+ }
+
+ /* Remove the domain part if any. */
+ p = strchr(line, '.');
+ if (p != NULL && strcmp(p + 1, domain) == 0)
+ *p = '\0';
return (line);
+ break;
}
#endif
-
case AF_APPLETALK:
(void)snprintf(line, sizeof(line), "atalk %s",
- atalk_ntoa(((struct sockaddr_at *)sa)->sat_addr));
+ atalk_ntoa(((struct sockaddr_at *)(void *)sa)->sat_addr));
break;
case AF_LINK:
- return (link_ntoa((struct sockaddr_dl *)sa));
+ sdl = (struct sockaddr_dl *)(void *)sa;
+
+ if (sdl->sdl_nlen == 0 &&
+ sdl->sdl_alen == 0 &&
+ sdl->sdl_slen == 0) {
+ n = snprintf(line, sizeof(line), "link#%d",
+ sdl->sdl_index);
+ if (n > (int)sizeof(line))
+ line[0] = '\0';
+ return (line);
+ } else
+ return (link_ntoa(sdl));
break;
default:
{
- u_short *sp = (u_short *)sa;
+ u_short *sp = (u_short *)(void *)sa;
u_short *splim = sp + ((sa->sa_len + 1) >> 1);
char *cps = line + sprintf(line, "(%d)", sa->sa_family);
char *cpe = line + sizeof(line);
@@ -597,9 +615,10 @@ routename(struct sockaddr *sa)
* Return the name of the network whose address is given.
* The address is assumed to be that of a net, not a host.
*/
-const char *
+static const char *
netname(struct sockaddr *sa)
{
+ struct sockaddr_dl *sdl;
static char line[MAXHOSTNAMELEN + 1];
int n;
#ifdef INET
@@ -614,7 +633,7 @@ netname(struct sockaddr *sa)
{
struct in_addr in;
- in = ((struct sockaddr_in *)sa)->sin_addr;
+ in = ((struct sockaddr_in *)(void *)sa)->sin_addr;
i = in.s_addr = ntohl(in.s_addr);
if (in.s_addr == 0)
cp = "default";
@@ -664,16 +683,27 @@ netname(struct sockaddr *sa)
case AF_APPLETALK:
(void)snprintf(line, sizeof(line), "atalk %s",
- atalk_ntoa(((struct sockaddr_at *)sa)->sat_addr));
+ atalk_ntoa(((struct sockaddr_at *)(void *)sa)->sat_addr));
break;
case AF_LINK:
- return (link_ntoa((struct sockaddr_dl *)sa));
+ sdl = (struct sockaddr_dl *)(void *)sa;
+
+ if (sdl->sdl_nlen == 0 &&
+ sdl->sdl_alen == 0 &&
+ sdl->sdl_slen == 0) {
+ n = snprintf(line, sizeof(line), "link#%d",
+ sdl->sdl_index);
+ if (n > (int)sizeof(line))
+ line[0] = '\0';
+ return (line);
+ } else
+ return (link_ntoa(sdl));
break;
default:
{
- u_short *sp = (u_short *)sa->sa_data;
+ u_short *sp = (u_short *)(void *)sa->sa_data;
u_short *splim = sp + ((sa->sa_len + 1)>>1);
char *cps = line + sprintf(line, "af %d:", sa->sa_family);
char *cpe = line + sizeof(line);
@@ -823,35 +853,35 @@ newroute(int argc, char **argv)
case K_IFA:
if (!--argc)
usage(NULL);
- getaddr(RTA_IFA, *++argv, 0, nrflags);
+ getaddr(RTAX_IFA, *++argv, 0, nrflags);
break;
case K_IFP:
if (!--argc)
usage(NULL);
- getaddr(RTA_IFP, *++argv, 0, nrflags);
+ getaddr(RTAX_IFP, *++argv, 0, nrflags);
break;
case K_GENMASK:
if (!--argc)
usage(NULL);
- getaddr(RTA_GENMASK, *++argv, 0, nrflags);
+ getaddr(RTAX_GENMASK, *++argv, 0, nrflags);
break;
case K_GATEWAY:
if (!--argc)
usage(NULL);
- getaddr(RTA_GATEWAY, *++argv, 0, nrflags);
+ getaddr(RTAX_GATEWAY, *++argv, 0, nrflags);
gateway = *argv;
break;
case K_DST:
if (!--argc)
usage(NULL);
- if (getaddr(RTA_DST, *++argv, &hp, nrflags))
+ if (getaddr(RTAX_DST, *++argv, &hp, nrflags))
nrflags |= F_ISHOST;
dest = *argv;
break;
case K_NETMASK:
if (!--argc)
usage(NULL);
- getaddr(RTA_NETMASK, *++argv, 0, nrflags);
+ getaddr(RTAX_NETMASK, *++argv, 0, nrflags);
/* FALLTHROUGH */
case K_NET:
nrflags |= F_FORCENET;
@@ -886,13 +916,13 @@ newroute(int argc, char **argv)
} else {
if ((rtm_addrs & RTA_DST) == 0) {
dest = *argv;
- if (getaddr(RTA_DST, *argv, &hp, nrflags))
+ if (getaddr(RTAX_DST, *argv, &hp, nrflags))
nrflags |= F_ISHOST;
} else if ((rtm_addrs & RTA_GATEWAY) == 0) {
gateway = *argv;
- getaddr(RTA_GATEWAY, *argv, &hp, nrflags);
+ getaddr(RTAX_GATEWAY, *argv, &hp, nrflags);
} else {
- getaddr(RTA_NETMASK, *argv, 0, nrflags);
+ getaddr(RTAX_NETMASK, *argv, 0, nrflags);
nrflags |= F_FORCENET;
}
}
@@ -1103,7 +1133,7 @@ inet6_makenetandmask(struct sockaddr_in6
* returning 1 if a host address, 0 if a network address.
*/
static int
-getaddr(int which, char *str, struct hostent **hpp, int nrflags)
+getaddr(int idx, char *str, struct hostent **hpp, int nrflags)
{
struct sockaddr *sa;
#if defined(INET)
@@ -1128,39 +1158,22 @@ getaddr(int which, char *str, struct hos
aflen = sizeof(struct sockaddr_dl);
#endif
}
- rtm_addrs |= which;
+#ifndef INET
+ hpp = NULL;
+#endif
+ rtm_addrs |= (1 << idx);
- switch (which) {
- case RTA_DST:
- sa = (struct sockaddr *)&so[RTAX_DST];
- break;
- case RTA_GATEWAY:
- sa = (struct sockaddr *)&so[RTAX_GATEWAY];
- break;
- case RTA_NETMASK:
- sa = (struct sockaddr *)&so[RTAX_NETMASK];
- break;
- case RTA_GENMASK:
- sa = (struct sockaddr *)&so[RTAX_GENMASK];
- break;
- case RTA_IFA:
- sa = (struct sockaddr *)&so[RTAX_IFA];
- break;
- case RTA_IFP:
- sa = (struct sockaddr *)&so[RTAX_IFP];
- break;
- default:
+ if (idx > RTAX_MAX)
usage("internal error");
- /*NOTREACHED*/
- }
+ sa = (struct sockaddr *)&so[idx];
sa->sa_family = af;
sa->sa_len = aflen;
- switch (which) {
- case RTA_GATEWAY:
+ switch (idx) {
+ case RTAX_GATEWAY:
if (nrflags & F_INTERFACE) {
struct ifaddrs *ifap, *ifa;
- struct sockaddr_dl *sdl0 = (struct sockaddr_dl *)sa;
+ struct sockaddr_dl *sdl0 = (struct sockaddr_dl *)(void *)sa;
struct sockaddr_dl *sdl = NULL;
if (getifaddrs(&ifap))
@@ -1173,7 +1186,7 @@ getaddr(int which, char *str, struct hos
if (strcmp(str, ifa->ifa_name) != 0)
continue;
- sdl = (struct sockaddr_dl *)ifa->ifa_addr;
+ sdl = (struct sockaddr_dl *)(void *)ifa->ifa_addr;
}
/* If we found it, then use it */
if (sdl != NULL) {
@@ -1188,7 +1201,7 @@ getaddr(int which, char *str, struct hos
return(1);
}
break;
- case RTA_IFP:
+ case RTAX_IFP:
sa->sa_family = AF_LINK;
break;
}
@@ -1196,10 +1209,10 @@ getaddr(int which, char *str, struct hos
/*
* Default is net 0.0.0.0/0
*/
- switch (which) {
- case RTA_DST:
+ switch (idx) {
+ case RTAX_DST:
forcenet++;
- getaddr(RTA_NETMASK, str, 0, nrflags);
+ getaddr(RTAX_NETMASK, str, 0, nrflags);
break;
}
return (0);
@@ -1212,7 +1225,7 @@ getaddr(int which, char *str, struct hos
int ecode;
q = NULL;
- if (which == RTA_DST && (q = strchr(str, '/')) != NULL)
+ if (idx == RTAX_DST && (q = strchr(str, '/')) != NULL)
*q = '\0';
memset(&hints, 0, sizeof(hints));
hints.ai_family = sa->sa_family;
@@ -1225,16 +1238,15 @@ getaddr(int which, char *str, struct hos
freeaddrinfo(res);
if (q != NULL)
*q++ = '/';
- if (which == RTA_DST)
- return (inet6_makenetandmask((struct sockaddr_in6 *)sa,
- q));
+ if (idx == RTAX_DST)
+ return (inet6_makenetandmask((struct sockaddr_in6 *)(void *)sa, q));
return (0);
}
#endif /* INET6 */
case AF_APPLETALK:
{
- struct sockaddr_at *sat = (struct sockaddr_at *)sa;
+ struct sockaddr_at *sat = (struct sockaddr_at *)(void *)sa;
if (!atalk_aton(str, &sat->sat_addr))
errx(EX_NOHOST, "bad address: %s", str);
@@ -1242,7 +1254,7 @@ getaddr(int which, char *str, struct hos
return(forcehost || sat->sat_addr.s_node != 0);
}
case AF_LINK:
- link_addr(str, (struct sockaddr_dl *)sa);
+ link_addr(str, (struct sockaddr_dl *)(void *)sa);
return (1);
case PF_ROUTE:
@@ -1256,13 +1268,13 @@ getaddr(int which, char *str, struct hos
}
#ifdef INET
- sin = (struct sockaddr_in *)sa;
+ sin = (struct sockaddr_in *)(void *)sa;
if (hpp == NULL)
hpp = &hp;
*hpp = NULL;
q = strchr(str,'/');
- if (q != NULL && which == RTA_DST) {
+ if (q != NULL && idx == RTAX_DST) {
*q = '\0';
if ((val = inet_network(str)) != INADDR_NONE) {
inet_makenetandmask(val, sin,
@@ -1272,10 +1284,10 @@ getaddr(int which, char *str, struct hos
}
*q = '/';
}
- if ((which != RTA_DST || forcenet == 0) &&
+ if ((idx != RTAX_DST || forcenet == 0) &&
inet_aton(str, &sin->sin_addr)) {
val = sin->sin_addr.s_addr;
- if (which != RTA_DST || forcehost ||
+ if (idx != RTAX_DST || forcehost ||
inet_lnaof(sin->sin_addr) != INADDR_ANY)
return (1);
else {
@@ -1283,7 +1295,7 @@ getaddr(int which, char *str, struct hos
goto netdone;
}
}
- if (which == RTA_DST && forcehost == 0 &&
+ if (idx == RTAX_DST && forcehost == 0 &&
((val = inet_network(str)) != INADDR_NONE ||
((np = getnetbyname(str)) != NULL && (val = np->n_net) != 0))) {
netdone:
@@ -1388,7 +1400,7 @@ retry2:
}
lim = buf + needed;
for (next = buf; next < lim; next += rtm->rtm_msglen) {
- rtm = (struct rt_msghdr *)next;
+ rtm = (struct rt_msghdr *)(void *)next;
print_rtmsg(rtm, rtm->rtm_msglen);
}
}
@@ -1438,7 +1450,7 @@ monitor(int argc, char *argv[])
n = read(s, msg, 2048);
now = time(NULL);
(void)printf("\ngot message of size %d on %s", n, ctime(&now));
- print_rtmsg((struct rt_msghdr *)msg, n);
+ print_rtmsg((struct rt_msghdr *)(void *)msg, n);
}
}
@@ -1579,7 +1591,7 @@ print_rtmsg(struct rt_msghdr *rtm, size_
rtm->rtm_version);
return;
}
- if (rtm->rtm_type < sizeof(msgtypes) / sizeof(msgtypes[0]))
+ if (rtm->rtm_type < nitems(msgtypes))
(void)printf("%s: ", msgtypes[rtm->rtm_type]);
else
(void)printf("unknown type %d: ", rtm->rtm_type);
@@ -1664,12 +1676,11 @@ badlen:
static void
print_getmsg(struct rt_msghdr *rtm, int msglen, int fib)
{
- struct sockaddr *dst = NULL, *gate = NULL, *mask = NULL;
- struct sockaddr_dl *ifp = NULL;
- struct sockaddr *sa;
+ struct sockaddr *sp[RTAX_MAX];
char *cp;
int i;
+ memset(sp, 0, sizeof(sp));
(void)printf(" route to: %s\n",
routename((struct sockaddr *)&so[RTAX_DST]));
if (rtm->rtm_version != RTM_VERSION) {
@@ -1680,6 +1691,7 @@ print_getmsg(struct rt_msghdr *rtm, int
if (rtm->rtm_msglen > msglen) {
warnx("message length mismatch, in packet %d, returned %d",
rtm->rtm_msglen, msglen);
+ return;
}
if (rtm->rtm_errno) {
errno = rtm->rtm_errno;
@@ -1687,54 +1699,37 @@ print_getmsg(struct rt_msghdr *rtm, int
return;
}
cp = ((char *)(rtm + 1));
- if (rtm->rtm_addrs)
- for (i = 1; i; i <<= 1)
- if (i & rtm->rtm_addrs) {
- sa = (struct sockaddr *)cp;
- switch (i) {
- case RTA_DST:
- dst = sa;
- break;
- case RTA_GATEWAY:
- gate = sa;
- break;
- case RTA_NETMASK:
- mask = sa;
- break;
- case RTA_IFP:
- if (sa->sa_family == AF_LINK &&
- ((struct sockaddr_dl *)sa)->sdl_nlen)
- ifp = (struct sockaddr_dl *)sa;
- break;
- }
- cp += SA_SIZE(sa);
- }
- if (dst && mask)
- mask->sa_family = dst->sa_family; /* XXX */
- if (dst)
- (void)printf("destination: %s\n", routename(dst));
- if (mask) {
- int savenflag = nflag;
-
- nflag = 1;
- (void)printf(" mask: %s\n", routename(mask));
- nflag = savenflag;
- }
- if (gate && rtm->rtm_flags & RTF_GATEWAY)
- (void)printf(" gateway: %s\n", routename(gate));
+ 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)
+ 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])
+ (void)printf("destination: %s\n", routename(sp[RTAX_DST]));
+ if (sp[RTAX_NETMASK])
+ (void)printf(" mask: %s\n", routename(sp[RTAX_NETMASK]));
+ if (sp[RTAX_GATEWAY] && (rtm->rtm_flags & RTF_GATEWAY))
+ (void)printf(" gateway: %s\n", routename(sp[RTAX_GATEWAY]));
if (fib >= 0)
(void)printf(" fib: %u\n", (unsigned int)fib);
- if (ifp)
+ if (sp[RTAX_IFP])
(void)printf(" interface: %.*s\n",
- ifp->sdl_nlen, ifp->sdl_data);
+ ((struct sockaddr_dl *)(void *)sp[RTAX_IFP])->sdl_nlen,
+ ((struct sockaddr_dl *)(void *)sp[RTAX_IFP])->sdl_data);
(void)printf(" flags: ");
printb(rtm->rtm_flags, routeflags);
#define lock(f) ((rtm->rtm_rmx.rmx_locks & __CONCAT(RTV_,f)) ? 'L' : ' ')
#define msec(u) (((u) + 500) / 1000) /* usec to msec */
-
- printf("\n%s\n", "\
- recvpipe sendpipe ssthresh rtt,msec mtu weight expire");
+ printf("\n%9s %9s %9s %9s %9s %10s %9s\n", "recvpipe",
+ "sendpipe", "ssthresh", "rtt,msec", "mtu ", "weight", "expire");
printf("%8ld%c ", rtm->rtm_rmx.rmx_recvpipe, lock(RPIPE));
printf("%8ld%c ", rtm->rtm_rmx.rmx_sendpipe, lock(SPIPE));
printf("%8ld%c ", rtm->rtm_rmx.rmx_ssthresh, lock(SSTHRESH));
@@ -1785,8 +1780,8 @@ pmsg_addrs(char *cp, int addrs, size_t l
(void)printf("\nsockaddrs: ");
printb(addrs, addrnames);
putchar('\n');
- for (i = 1; i != 0; i <<= 1)
- if (i & addrs) {
+ for (i = 0; i < RTAX_MAX; i++)
+ if (addrs & (1 << i)) {
sa = (struct sockaddr *)cp;
if (len == 0 || len < SA_SIZE(sa)) {
(void)printf(errfmt, __func__, len);
@@ -1846,24 +1841,24 @@ sodump(struct sockaddr *sa, const char *
switch (sa->sa_family) {
case AF_LINK:
(void)printf("%s: link %s; ", which,
- link_ntoa((struct sockaddr_dl *)sa));
+ link_ntoa((struct sockaddr_dl *)(void *)sa));
break;
#ifdef INET
case AF_INET:
(void)printf("%s: inet %s; ", which,
- inet_ntoa(((struct sockaddr_in *)sa)->sin_addr));
+ inet_ntoa(((struct sockaddr_in *)(void *)sa)->sin_addr));
break;
#endif
#ifdef INET6
case AF_INET6:
(void)printf("%s: inet6 %s; ", which, inet_ntop(sa->sa_family,
- &((struct sockaddr_in6 *)sa)->sin6_addr, nbuf,
+ &((struct sockaddr_in6 *)(void *)sa)->sin6_addr, nbuf,
sizeof(nbuf)));
break;
#endif
case AF_APPLETALK:
(void)printf("%s: atalk %s; ", which,
- atalk_ntoa(((struct sockaddr_at *)sa)->sat_addr));
+ atalk_ntoa(((struct sockaddr_at *)(void *)sa)->sat_addr));
break;
}
(void)fflush(stdout);
Modified: user/attilio/vmcontention/sys/arm/include/atomic.h
==============================================================================
--- user/attilio/vmcontention/sys/arm/include/atomic.h Sun Jul 21 16:59:44 2013 (r253521)
+++ user/attilio/vmcontention/sys/arm/include/atomic.h Sun Jul 21 17:14:43 2013 (r253522)
@@ -52,8 +52,8 @@
#define dsb() __asm __volatile("dsb" : : : "memory")
#define dmb() __asm __volatile("dmb" : : : "memory")
#elif defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \
- defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) || \
- defined (__ARM_ARCH_6ZK__)
+ defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6T2__) || \
+ defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)
#define isb() __asm __volatile("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory")
#define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory")
#define dmb() __asm __volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory")
@@ -81,11 +81,12 @@
* out of asm.h so it can be used in both asm and C code. - kientzle@
*/
#if defined (__ARM_ARCH_7__) || \
- defined (__ARM_ARCH_7A__) || \
- defined (__ARM_ARCH_6__) || \
- defined (__ARM_ARCH_6J__) || \
- defined (__ARM_ARCH_6K__) || \
- defined (__ARM_ARCH_6Z__) || \
+ defined (__ARM_ARCH_7A__) || \
+ defined (__ARM_ARCH_6__) || \
+ defined (__ARM_ARCH_6J__) || \
+ defined (__ARM_ARCH_6K__) || \
+ defined (__ARM_ARCH_6T2__) || \
+ defined (__ARM_ARCH_6Z__) || \
defined (__ARM_ARCH_6ZK__)
static __inline void
__do_dmb(void)
@@ -137,6 +138,7 @@ atomic_set_32(volatile uint32_t *address
"orr %0, %0, %3\n"
"strex %1, %0, [%2]\n"
"cmp %1, #0\n"
+ "it ne\n"
"bne 1b\n"
: "=&r" (tmp), "+r" (tmp2)
, "+r" (address), "+r" (setmask) : : "cc", "memory");
@@ -152,6 +154,7 @@ atomic_set_long(volatile u_long *address
"orr %0, %0, %3\n"
"strex %1, %0, [%2]\n"
"cmp %1, #0\n"
+ "it ne\n"
"bne 1b\n"
: "=&r" (tmp), "+r" (tmp2)
, "+r" (address), "+r" (setmask) : : "cc", "memory");
@@ -167,6 +170,7 @@ atomic_clear_32(volatile uint32_t *addre
"bic %0, %0, %3\n"
"strex %1, %0, [%2]\n"
"cmp %1, #0\n"
+ "it ne\n"
"bne 1b\n"
: "=&r" (tmp), "+r" (tmp2)
,"+r" (address), "+r" (setmask) : : "cc", "memory");
@@ -181,6 +185,7 @@ atomic_clear_long(volatile u_long *addre
"bic %0, %0, %3\n"
"strex %1, %0, [%2]\n"
"cmp %1, #0\n"
+ "it ne\n"
"bne 1b\n"
: "=&r" (tmp), "+r" (tmp2)
,"+r" (address), "+r" (setmask) : : "cc", "memory");
@@ -193,12 +198,14 @@ atomic_cmpset_32(volatile u_int32_t *p,
__asm __volatile("1: ldrex %0, [%1]\n"
"cmp %0, %2\n"
+ "it ne\n"
"movne %0, #0\n"
"bne 2f\n"
"strex %0, %3, [%1]\n"
"cmp %0, #0\n"
- "bne 1b\n"
+ "ite eq\n"
"moveq %0, #1\n"
+ "bne 1b\n"
"2:"
: "=&r" (ret)
,"+r" (p), "+r" (cmpval), "+r" (newval) : : "cc",
@@ -213,12 +220,14 @@ atomic_cmpset_long(volatile u_long *p, v
__asm __volatile("1: ldrex %0, [%1]\n"
"cmp %0, %2\n"
+ "itt ne\n"
"movne %0, #0\n"
"bne 2f\n"
"strex %0, %3, [%1]\n"
"cmp %0, #0\n"
- "bne 1b\n"
+ "ite eq\n"
"moveq %0, #1\n"
+ "bne 1b\n"
"2:"
: "=&r" (ret)
,"+r" (p), "+r" (cmpval), "+r" (newval) : : "cc",
@@ -270,6 +279,7 @@ atomic_add_32(volatile u_int32_t *p, u_i
"add %0, %0, %3\n"
"strex %1, %0, [%2]\n"
"cmp %1, #0\n"
+ "it ne\n"
"bne 1b\n"
: "=&r" (tmp), "+r" (tmp2)
,"+r" (p), "+r" (val) : : "cc", "memory");
@@ -284,6 +294,7 @@ atomic_add_long(volatile u_long *p, u_lo
"add %0, %0, %3\n"
"strex %1, %0, [%2]\n"
"cmp %1, #0\n"
+ "it ne\n"
"bne 1b\n"
: "=&r" (tmp), "+r" (tmp2)
,"+r" (p), "+r" (val) : : "cc", "memory");
@@ -298,6 +309,7 @@ atomic_subtract_32(volatile u_int32_t *p
"sub %0, %0, %3\n"
"strex %1, %0, [%2]\n"
"cmp %1, #0\n"
+ "it ne\n"
"bne 1b\n"
: "=&r" (tmp), "+r" (tmp2)
,"+r" (p), "+r" (val) : : "cc", "memory");
@@ -312,6 +324,7 @@ atomic_subtract_long(volatile u_long *p,
"sub %0, %0, %3\n"
"strex %1, %0, [%2]\n"
"cmp %1, #0\n"
+ "it ne\n"
"bne 1b\n"
: "=&r" (tmp), "+r" (tmp2)
,"+r" (p), "+r" (val) : : "cc", "memory");
@@ -338,6 +351,7 @@ atomic_fetchadd_32(volatile uint32_t *p,
"add %1, %0, %4\n"
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list