svn commit: r243856 - head/usr.bin/rctl

2012-12-04 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Dec  4 09:02:49 2012
New Revision: 243856
URL: http://svnweb.freebsd.org/changeset/base/243856

Log:
  Remove superfluous paragraph macro.

Modified:
  head/usr.bin/rctl/rctl.8

Modified: head/usr.bin/rctl/rctl.8
==
--- head/usr.bin/rctl/rctl.8Tue Dec  4 08:46:32 2012(r243855)
+++ head/usr.bin/rctl/rctl.8Tue Dec  4 09:02:49 2012(r243856)
@@ -180,7 +180,6 @@ Display resource usage information for j
 .Pp
 Display all the rules applicable to process with PID 512:
 .Dl Nm Fl l Ar process:512
-.Pp
 .Sh SEE ALSO
 .Xr rctl.conf 5
 .Sh HISTORY
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243857 - in head/sys/dev: age alc ale an ath bce bfe bge bm bwi bwn bxe cas ce cm cp cs ctau cx cxgb cxgb/sys cxgbe cxgbe/tom dc de e1000 ed en ep et ex fatm fe firewire fxp gem gxemul...

2012-12-04 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec  4 09:32:43 2012
New Revision: 243857
URL: http://svnweb.freebsd.org/changeset/base/243857

Log:
  Mechanically substitute flags from historic mbuf allocator with
  malloc(9) flags in sys/dev.

Modified:
  head/sys/dev/age/if_age.c
  head/sys/dev/alc/if_alc.c
  head/sys/dev/ale/if_ale.c
  head/sys/dev/an/if_an.c
  head/sys/dev/ath/if_ath_rx.c
  head/sys/dev/ath/if_ath_rx_edma.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/bce/if_bce.c
  head/sys/dev/bfe/if_bfe.c
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bm/if_bm.c
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/cas/if_cas.c
  head/sys/dev/ce/if_ce.c
  head/sys/dev/cm/smc90cx6.c
  head/sys/dev/cp/if_cp.c
  head/sys/dev/cs/if_cs.c
  head/sys/dev/ctau/if_ct.c
  head/sys/dev/cx/if_cx.c
  head/sys/dev/cxgb/cxgb_main.c
  head/sys/dev/cxgb/cxgb_sge.c
  head/sys/dev/cxgb/sys/uipc_mvec.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_ddp.c
  head/sys/dev/cxgbe/tom/t4_listen.c
  head/sys/dev/dc/if_dc.c
  head/sys/dev/de/if_de.c
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/e1000/if_lem.c
  head/sys/dev/ed/if_ed.c
  head/sys/dev/en/midway.c
  head/sys/dev/ep/if_ep.c
  head/sys/dev/et/if_et.c
  head/sys/dev/ex/if_ex.c
  head/sys/dev/fatm/if_fatm.c
  head/sys/dev/fe/if_fe.c
  head/sys/dev/firewire/fwohci.c
  head/sys/dev/firewire/if_fwe.c
  head/sys/dev/firewire/if_fwip.c
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/gem/if_gem.c
  head/sys/dev/gxemul/ether/if_gx.c
  head/sys/dev/hatm/if_hatm_intr.c
  head/sys/dev/hatm/if_hatm_tx.c
  head/sys/dev/hifn/hifn7751.c
  head/sys/dev/hme/if_hme.c
  head/sys/dev/ie/if_ie.c
  head/sys/dev/if_ndis/if_ndis.c
  head/sys/dev/ipw/if_ipw.c
  head/sys/dev/iwi/if_iwi.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/ixgb/if_ixgb.c
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/ixgbe/ixv.c
  head/sys/dev/jme/if_jme.c
  head/sys/dev/le/lance.c
  head/sys/dev/lge/if_lge.c
  head/sys/dev/lmc/if_lmc.c
  head/sys/dev/malo/if_malo.c
  head/sys/dev/mge/if_mge.c
  head/sys/dev/mn/if_mn.c
  head/sys/dev/msk/if_msk.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/mxge/if_mxge.c
  head/sys/dev/my/if_my.c
  head/sys/dev/nfe/if_nfe.c
  head/sys/dev/nge/if_nge.c
  head/sys/dev/nve/if_nve.c
  head/sys/dev/nxge/if_nxge.c
  head/sys/dev/oce/oce_if.c
  head/sys/dev/patm/if_patm_intr.c
  head/sys/dev/patm/if_patm_rx.c
  head/sys/dev/patm/if_patm_tx.c
  head/sys/dev/pcn/if_pcn.c
  head/sys/dev/pdq/pdq_freebsd.h
  head/sys/dev/pdq/pdq_ifsubr.c
  head/sys/dev/pdq/pdqvar.h
  head/sys/dev/qlxgb/qla_os.c
  head/sys/dev/ral/rt2560.c
  head/sys/dev/ral/rt2661.c
  head/sys/dev/ral/rt2860.c
  head/sys/dev/re/if_re.c
  head/sys/dev/rt/if_rt.c
  head/sys/dev/safe/safe.c
  head/sys/dev/sbni/if_sbni.c
  head/sys/dev/sf/if_sf.c
  head/sys/dev/sfxge/sfxge_dma.c
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sge/if_sge.c
  head/sys/dev/sis/if_sis.c
  head/sys/dev/sk/if_sk.c
  head/sys/dev/smc/if_smc.c
  head/sys/dev/sn/if_sn.c
  head/sys/dev/snc/dp83932.c
  head/sys/dev/ste/if_ste.c
  head/sys/dev/stge/if_stge.c
  head/sys/dev/ti/if_ti.c
  head/sys/dev/tl/if_tl.c
  head/sys/dev/tsec/if_tsec.c
  head/sys/dev/tx/if_tx.c
  head/sys/dev/txp/if_txp.c
  head/sys/dev/ubsec/ubsec.c
  head/sys/dev/usb/misc/udbp.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_usie.c
  head/sys/dev/usb/net/uhso.c
  head/sys/dev/usb/net/usb_ethernet.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/dev/vge/if_vge.c
  head/sys/dev/virtio/network/if_vtnet.c
  head/sys/dev/vr/if_vr.c
  head/sys/dev/vte/if_vte.c
  head/sys/dev/vx/if_vx.c
  head/sys/dev/vxge/vxge.c
  head/sys/dev/wb/if_wb.c
  head/sys/dev/wi/if_wi.c
  head/sys/dev/wl/if_wl.c
  head/sys/dev/wpi/if_wpi.c
  head/sys/dev/wtap/if_wtap.c
  head/sys/dev/wtap/plugins/visibility.c
  head/sys/dev/xe/if_xe.c
  head/sys/dev/xen/netfront/netfront.c
  head/sys/dev/xl/if_xl.c

Modified: head/sys/dev/age/if_age.c
==
--- head/sys/dev/age/if_age.c   Tue Dec  4 09:02:49 2012(r243856)
+++ head/sys/dev/age/if_age.c   Tue Dec  4 09:32:43 2012(r243857)
@@ -1521,7 +1521,7 @@ age_encap(struct age_softc *sc, struct m
 
if (M_WRITABLE(m) == 0) {
/* Get a writable copy. */
-   m = m_dup(*m_head, M_DONTWAIT);
+   m = m_dup(*m_head, M_NOWAIT);
/* Release original mbufs. */
m_freem(*m_head);
if (m == NULL) {
@@ -1599,7 +1599,7 @@ age_encap(struct age_softc *sc, struct m
error =  bus_dmamap_load_mbuf_sg(sc->age_cdata.age_tx_tag, map,
*m_head, txsegs, &nsegs, 0);
 

svn commit: r243858 - head/lib/libc/sys

2012-12-04 Thread Kevin Lo
Author: kevlo
Date: Tue Dec  4 09:53:09 2012
New Revision: 243858
URL: http://svnweb.freebsd.org/changeset/base/243858

Log:
  Document that bind(2) can fail with EAFNOSUPPORT.
  
  Reviewed by:  glebius

Modified:
  head/lib/libc/sys/bind.2

Modified: head/lib/libc/sys/bind.2
==
--- head/lib/libc/sys/bind.2Tue Dec  4 09:32:43 2012(r243857)
+++ head/lib/libc/sys/bind.2Tue Dec  4 09:53:09 2012(r243858)
@@ -94,6 +94,8 @@ is not a socket.
 The specified address is not available from the local machine.
 .It Bq Er EADDRINUSE
 The specified address is already in use.
+.It Bq Er EAFNOSUPPORT
+Addresses in the specified address family cannot be used with this socket.
 .It Bq Er EACCES
 The requested address is protected, and the current user
 has inadequate permission to access it.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r243019 - head/sbin/route

2012-12-04 Thread Gleb Smirnoff
  Xin,

On Mon, Dec 03, 2012 at 11:47:32AM -0800, Xin LI wrote:
X> It seems that this commit breaks the following commands like this:
X> 
X> route add -net 10.8/16 10.2.0.1

  Thanks for report. Do you agree with attached patch?

-- 
Totus tuus, Glebius.
Index: route.c
===
--- route.c	(revision 243858)
+++ route.c	(working copy)
@@ -1033,6 +1033,13 @@
 	rtm_addrs |= RTA_NETMASK;
 
 	/*
+	 * MSB of net should be meaningful. 0/0 is exception.
+	 */
+	if (net > 0)
+		while ((net & 0xff00) == 0)
+			net <<= 8;
+
+	/*
 	 * If no /xx was specified we must calculate the
 	 * CIDR address.
 	 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r243859 - head/sbin/route

2012-12-04 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec  4 10:24:50 2012
New Revision: 243859
URL: http://svnweb.freebsd.org/changeset/base/243859

Log:
  No need to be root when running with -t or -d.

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==
--- head/sbin/route/route.c Tue Dec  4 09:53:09 2012(r243858)
+++ head/sbin/route/route.c Tue Dec  4 10:24:50 2012(r243859)
@@ -365,7 +365,7 @@ flushroutes(int argc, char *argv[])
struct fibl *fl;
int error;
 
-   if (uid != 0 && !debugonly) {
+   if (uid != 0 && !debugonly && !tflag) {
errx(EX_NOPERM, "must be root to alter routing table");
}
shutdown(s, SHUT_RD); /* Don't want to read back our messages */
@@ -727,7 +727,7 @@ newroute(int argc, char **argv)
const char *dest, *gateway, *errmsg;
int key, error, flags, nrflags, fibnum;
 
-   if (uid != 0) {
+   if (uid != 0 && !debugonly && !tflag) {
errx(EX_NOPERM, "must be root to alter routing table");
}
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243860 - head/sbin/route

2012-12-04 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec  4 11:10:01 2012
New Revision: 243860
URL: http://svnweb.freebsd.org/changeset/base/243860

Log:
  Flush stdout after RTM_IFANNOUNCE message.
  
  PR:   bin/151600
  Submitted by: Eric van Gyzen 

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==
--- head/sbin/route/route.c Tue Dec  4 10:24:50 2012(r243859)
+++ head/sbin/route/route.c Tue Dec  4 11:10:01 2012(r243860)
@@ -1632,6 +1632,7 @@ print_rtmsg(struct rt_msghdr *rtm, size_
break;
}
printf("\n");
+   fflush(stdout);
break;
 
default:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243861 - head/libexec/rtld-elf

2012-12-04 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Dec  4 12:39:26 2012
New Revision: 243861
URL: http://svnweb.freebsd.org/changeset/base/243861

Log:
  Change /usr/libexec/ld-elf.so.1 to point at ../../libexec/ld-elf.so.1
  instead of /libexec/ld-elf.so.1. Below in the Makefile we execute
  'chflags noschg ${DESTDIR}/usr/libexec/ld-elf.so.1', which follows
  symlink and removes 'schg' flag from system's /libexec/ld-elf.so.1
  instead of the one in DESTDIR. It is also more friendly to use
  replative paths in symlink in case of jail/chroot environments.
  
  Obtained from:WHEEL Systems
  MFC after:2 weeks

Modified:
  head/libexec/rtld-elf/Makefile

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Tue Dec  4 11:10:01 2012
(r243860)
+++ head/libexec/rtld-elf/Makefile  Tue Dec  4 12:39:26 2012
(r243861)
@@ -27,7 +27,7 @@ LDFLAGS+= -nostdlib -e .rtld_start
 WARNS?=2
 INSTALLFLAGS=  -C -b
 PRECIOUSPROG=
-BINDIR=/libexec
+BINDIR=../../libexec
 SYMLINKS=  ${BINDIR}/${PROG} /usr/libexec/${PROG}
 MLINKS=rtld.1 ld-elf.so.1.1 \
rtld.1 ld.so.1
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243862 - head/libexec/rtld-elf

2012-12-04 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Dec  4 12:51:33 2012
New Revision: 243862
URL: http://svnweb.freebsd.org/changeset/base/243862

Log:
  Do not change entire BINDIR, it might be needed later, just change
  symlink target.
  
  MFC after:2 weeks

Modified:
  head/libexec/rtld-elf/Makefile

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Tue Dec  4 12:39:26 2012
(r243861)
+++ head/libexec/rtld-elf/Makefile  Tue Dec  4 12:51:33 2012
(r243862)
@@ -27,8 +27,8 @@ LDFLAGS+= -nostdlib -e .rtld_start
 WARNS?=2
 INSTALLFLAGS=  -C -b
 PRECIOUSPROG=
-BINDIR=../../libexec
-SYMLINKS=  ${BINDIR}/${PROG} /usr/libexec/${PROG}
+BINDIR=/libexec
+SYMLINKS=  ../..${BINDIR}/${PROG} /usr/libexec/${PROG}
 MLINKS=rtld.1 ld-elf.so.1.1 \
rtld.1 ld.so.1
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243863 - head/share/man/man9

2012-12-04 Thread Konstantin Belousov
Author: kib
Date: Tue Dec  4 14:07:17 2012
New Revision: 243863
URL: http://svnweb.freebsd.org/changeset/base/243863

Log:
  Fix typo.
  
  Submitted by: bjk
  MFC after:3 days

Modified:
  head/share/man/man9/taskqueue.9

Modified: head/share/man/man9/taskqueue.9
==
--- head/share/man/man9/taskqueue.9 Tue Dec  4 12:51:33 2012
(r243862)
+++ head/share/man/man9/taskqueue.9 Tue Dec  4 14:07:17 2012
(r243863)
@@ -183,7 +183,7 @@ scheduling.
 If the
 .Va ticks
 argument is negative, the already scheduled enqueueing is not re-scheduled.
-Otherwise, the task is schedules for enqueueing in the future,
+Otherwise, the task is scheduled for enqueueing in the future,
 after the absolute value of
 .Va ticks
 is passed.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243864 - head/libexec/rtld-elf

2012-12-04 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Dec  4 14:36:01 2012
New Revision: 243864
URL: http://svnweb.freebsd.org/changeset/base/243864

Log:
  Use absolute path for /usr/libexec/ld-elf.so.1 symlink.
  
  Requested by: kan, kib
  
  Use -h flags for chflags, so we won't remove 'schg' flag from system's
  /libexec/ld-elf.so.1.
  
  MFC after:2 weeks

Modified:
  head/libexec/rtld-elf/Makefile

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Tue Dec  4 14:07:17 2012
(r243863)
+++ head/libexec/rtld-elf/Makefile  Tue Dec  4 14:36:01 2012
(r243864)
@@ -28,7 +28,7 @@ WARNS?=   2
 INSTALLFLAGS=  -C -b
 PRECIOUSPROG=
 BINDIR=/libexec
-SYMLINKS=  ../..${BINDIR}/${PROG} /usr/libexec/${PROG}
+SYMLINKS=  ${BINDIR}/${PROG} /usr/libexec/${PROG}
 MLINKS=rtld.1 ld-elf.so.1.1 \
rtld.1 ld.so.1
 
@@ -62,7 +62,7 @@ SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Sy
 # Fixup the existing binary that's there so we can symlink over it.
 beforeinstall:
 .if exists(${DESTDIR}/usr/libexec/${PROG})
-   -chflags noschg ${DESTDIR}/usr/libexec/${PROG}
+   -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG}
 .endif
 
 .PATH: ${.CURDIR}/${RTLD_ARCH}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243865 - head/lib/libc/gen

2012-12-04 Thread Jilles Tjoelker
Author: jilles
Date: Tue Dec  4 16:54:43 2012
New Revision: 243865
URL: http://svnweb.freebsd.org/changeset/base/243865

Log:
  libc: Use the new 'e' fopen() mode option to simplify fstab.c.
  
  No functional change is intended.

Modified:
  head/lib/libc/gen/fstab.c

Modified: head/lib/libc/gen/fstab.c
==
--- head/lib/libc/gen/fstab.c   Tue Dec  4 14:36:01 2012(r243864)
+++ head/lib/libc/gen/fstab.c   Tue Dec  4 16:54:43 2012(r243865)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -255,8 +254,6 @@ getfsfile(const char *name)
 int
 setfsent(void)
 {
-   int fd;
-
if (_fs_fp) {
rewind(_fs_fp);
LineNo = 0;
@@ -268,18 +265,11 @@ setfsent(void)
else
setfstab(getenv("PATH_FSTAB"));
}
-   fd = _open(path_fstab, O_RDONLY | O_CLOEXEC);
-   if (fd == -1) {
-   error(errno);
-   return (0);
-   }
-   _fs_fp = fdopen(fd, "r");
-   if (_fs_fp  != NULL) {
+   if ((_fs_fp = fopen(path_fstab, "re")) != NULL) {
LineNo = 0;
return (1);
}
error(errno);
-   _close(fd);
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243866 - in head: sbin/ifconfig sbin/route sys/net

2012-12-04 Thread Hiroki Sato
Author: hrs
Date: Tue Dec  4 17:12:23 2012
New Revision: 243866
URL: http://svnweb.freebsd.org/changeset/base/243866

Log:
  - Fix LOR in sa6_recoverscope() in rt_msg2()[1].
  - Check V_deembed_scopeid before checking if sa_family == AF_INET6.
  - Fix scope id handing in route(8)[2] and ifconfig(8).
  
  Reported by:  rpaulo[1], Mateusz Guzik[1], peter[2]

Modified:
  head/sbin/ifconfig/af_inet6.c
  head/sbin/route/route.c
  head/sys/net/rtsock.c

Modified: head/sbin/ifconfig/af_inet6.c
==
--- head/sbin/ifconfig/af_inet6.c   Tue Dec  4 16:54:43 2012
(r243865)
+++ head/sbin/ifconfig/af_inet6.c   Tue Dec  4 17:12:23 2012
(r243866)
@@ -251,8 +251,9 @@ in6_status(int s __unused, const struct 
if ((flags6 & IN6_IFF_TEMPORARY) != 0)
printf("temporary ");
 
-if (sin->sin6_scope_id)
-   printf("scopeid 0x%x ", sin->sin6_scope_id);
+   if (((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id)
+   printf("scopeid 0x%x ",
+   ((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id);
 
if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) {
printf("pltime ");

Modified: head/sbin/route/route.c
==
--- head/sbin/route/route.c Tue Dec  4 16:54:43 2012(r243865)
+++ head/sbin/route/route.c Tue Dec  4 17:12:23 2012(r243866)
@@ -1208,6 +1208,16 @@ getaddr(int which, char *str, struct hos
exit(1);
}
memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6));
+#ifdef __KAME__
+   if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) ||
+   IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr) ||
+   IN6_IS_ADDR_MC_NODELOCAL(&su->sin6.sin6_addr)) &&
+   su->sin6.sin6_scope_id) {
+   *(u_int16_t *)&su->sin6.sin6_addr.s6_addr[2] =
+   htons(su->sin6.sin6_scope_id);
+   su->sin6.sin6_scope_id = 0;
+   }
+#endif
freeaddrinfo(res);
if (q != NULL)
*q++ = '/';

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Tue Dec  4 16:54:43 2012(r243865)
+++ head/sys/net/rtsock.c   Tue Dec  4 17:12:23 2012(r243866)
@@ -804,28 +804,31 @@ route_output(struct mbuf *m, struct sock
}
info.rti_info[RTAX_DST] = rt_key(rt);
 #ifdef INET6
-   switch (rt_key(rt)->sa_family) {
-   case AF_INET6:
-   if (V_deembed_scopeid == 0)
+   if (V_deembed_scopeid) {
+   switch (rt_key(rt)->sa_family) {
+   case AF_INET6:
+   sin6 = (struct sockaddr_in6 *)&ss_dst;
+   bcopy(rt_key(rt), sin6, sizeof(*sin6));
+   if (sa6_recoverscope(sin6) == 0)
+   info.rti_info[RTAX_DST] =
+   (struct sockaddr *)sin6;
break;
-   sin6 = (struct sockaddr_in6 *)&ss_dst;
-   bcopy(rt_key(rt), sin6, sizeof(*sin6));
-   if (sa6_recoverscope(sin6) == 0)
-   info.rti_info[RTAX_DST] =
-   (struct sockaddr *)sin6;
-   break;
+   }
}
 #endif
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
 #ifdef INET6
-   switch (rt->rt_gateway->sa_family) {
-   case AF_INET6:
-   sin6 = (struct sockaddr_in6 *)&ss_gw;
-   bcopy(rt->rt_gateway, sin6, sizeof(*sin6));
-   if (sa6_recoverscope(sin6) == 0)
-   info.rti_info[RTAX_GATEWAY] =
-   (struct sockaddr *)sin6;
-   break;
+   if (V_deembed_scopeid) {
+   switch (rt->rt_gateway->sa_family) {
+   case AF_INET6:
+   sin6 = (struct sockaddr_in6 *)&ss_gw;
+   bcopy(rt->rt_gateway, sin6,
+   sizeof(*sin6));
+   if (sa6_recoverscope(sin6) == 0)
+   info.r

Re: svn commit: r243019 - head/sbin/route

2012-12-04 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 12/04/12 02:22, Gleb Smirnoff wrote:
> Xin,
> 
> On Mon, Dec 03, 2012 at 11:47:32AM -0800, Xin LI wrote: X> It seems
> that this commit breaks the following commands like this: X> X>
> route add -net 10.8/16 10.2.0.1
> 
> Thanks for report. Do you agree with attached patch?

Looks good and passed my test cases, thanks!

Cheers,
- -- 
Xin LI https://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
-BEGIN PGP SIGNATURE-

iQEcBAEBCAAGBQJQvlUMAAoJEG80Jeu8UPuzzXoH/AnWrpU4NMmZhtcoscwnDZXC
27V25380BfpKKxk5eRIJ+yht0C2SRu5c9LPsJdNBmzFrLKwET7LuZVxS1xjE6UeF
SFoxL1xcN3DZIhuXBAhxPtOE7Hrykc555oh/WiDVOr3mRLDXR1uF+yRailzTgXn+
+sEQbHTnV5bjYN3Bnh/tzBfUvCtSCUm/EXxTi5z5coUbSbqSuIB6EKa0/gJW12l0
cbc6DkD41v7g2l7oB2HLh73VUJB1nU63PWEaf/awY6TSafs5H+8asnDw9738pXPQ
vfwOXulS6D8FGA0gw2q4KRJRN5HZ1kYgwpXTEiX6fXvcz/Ppo/5KD714zCX7rvY=
=tI3B
-END PGP SIGNATURE-
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243867 - head/sbin/route

2012-12-04 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec  4 20:05:01 2012
New Revision: 243867
URL: http://svnweb.freebsd.org/changeset/base/243867

Log:
  Fix fallout from r243019, which broke parsing of shortened network
  prefixes.
  
  Reported and tested by:   delphij

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==
--- head/sbin/route/route.c Tue Dec  4 17:12:23 2012(r243866)
+++ head/sbin/route/route.c Tue Dec  4 20:05:01 2012(r243867)
@@ -1033,6 +1033,13 @@ inet_makenetandmask(u_long net, struct s
rtm_addrs |= RTA_NETMASK;
 
/*
+* MSB of net should be meaningful. 0/0 is exception.
+*/
+   if (net > 0)
+   while ((net & 0xff00) == 0)
+   net <<= 8;
+
+   /*
 * If no /xx was specified we must calculate the
 * CIDR address.
 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243868 - head/sys/kern

2012-12-04 Thread Konstantin Belousov
Author: kib
Date: Tue Dec  4 20:49:04 2012
New Revision: 243868
URL: http://svnweb.freebsd.org/changeset/base/243868

Log:
  Do not allocate buffer of the 255 bytes length on the stack.
  
  Reported and tested by:   sig6...@gmail.com
  MFC after:1 week

Modified:
  head/sys/kern/vfs_mountroot.c

Modified: head/sys/kern/vfs_mountroot.c
==
--- head/sys/kern/vfs_mountroot.c   Tue Dec  4 20:05:01 2012
(r243867)
+++ head/sys/kern/vfs_mountroot.c   Tue Dec  4 20:49:04 2012
(r243868)
@@ -672,10 +672,11 @@ parse_mount_dev_present(const char *dev)
return (error != 0) ? 0 : 1;
 }
 
+#defineERRMSGL 255
 static int
 parse_mount(char **conf)
 {
-   char errmsg[255];
+   char *errmsg;
struct mntarg *ma;
char *dev, *fs, *opts, *tok;
int delay, error, timeout;
@@ -707,7 +708,7 @@ parse_mount(char **conf)
printf("Trying to mount root from %s:%s [%s]...\n", fs, dev,
(opts != NULL) ? opts : "");
 
-   bzero(errmsg, sizeof(errmsg));
+   errmsg = malloc(ERRMSGL, M_TEMP, M_WAITOK | M_ZERO);
 
if (vfs_byname(fs) == NULL) {
strlcpy(errmsg, "unknown file system", sizeof(errmsg));
@@ -734,7 +735,7 @@ parse_mount(char **conf)
ma = mount_arg(ma, "fstype", fs, -1);
ma = mount_arg(ma, "fspath", "/", -1);
ma = mount_arg(ma, "from", dev, -1);
-   ma = mount_arg(ma, "errmsg", errmsg, sizeof(errmsg));
+   ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL);
ma = mount_arg(ma, "ro", NULL, 0);
ma = parse_mountroot_options(ma, opts);
error = kernel_mount(ma, MNT_ROOTFS);
@@ -748,11 +749,13 @@ parse_mount(char **conf)
printf(".\n");
}
free(fs, M_TEMP);
+   free(errmsg, M_TEMP);
if (opts != NULL)
free(opts, M_TEMP);
/* kernel_mount can return -1 on error. */
return ((error < 0) ? EDOOFUS : error);
 }
+#undef ERRMSGL
 
 static int
 vfs_mountroot_parse(struct sbuf *sb, struct mount *mpdevfs)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243869 - head/sys/kern

2012-12-04 Thread Konstantin Belousov
Author: kib
Date: Tue Dec  4 20:49:39 2012
New Revision: 243869
URL: http://svnweb.freebsd.org/changeset/base/243869

Log:
  Fix a race between kern_setitimer() and realitexpire(), where the
  callout is started before kern_setitimer() acquires process mutex, but
  looses a race and kern_setitimer() gets the process mutex before the
  callout.  Then, assuming that new specified struct itimerval has
  it_interval zero, but it_value non-zero, the callout, after it starts
  executing again, clears p->p_realtimer.it_value, but kern_setitimer()
  already rescheduled the callout.
  
  As the result of the race, both p_realtimer is zero, and the callout
  is rescheduled. Then, in the exit1(), the exit code sees that it_value
  is zero and does not even try to stop the callout. This allows the
  struct proc to be reused and eventually the armed callout is
  re-initialized.  The consequence is the corrupted callwheel tailq.
  
  Use process mutex to interlock the callout start, which fixes the race.
  
  Reported and tested by:   pho
  Reviewed by:  jhb
  MFC after:2 weeks

Modified:
  head/sys/kern/init_main.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_time.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Tue Dec  4 20:49:04 2012(r243868)
+++ head/sys/kern/init_main.c   Tue Dec  4 20:49:39 2012(r243869)
@@ -498,7 +498,7 @@ proc0_init(void *dummy __unused)
strncpy(p->p_comm, "kernel", sizeof (p->p_comm));
strncpy(td->td_name, "swapper", sizeof (td->td_name));
 
-   callout_init(&p->p_itcallout, CALLOUT_MPSAFE);
+   callout_init_mtx(&p->p_itcallout, &p->p_mtx, 0);
callout_init_mtx(&p->p_limco, &p->p_mtx, 0);
callout_init(&td->td_slpcallout, CALLOUT_MPSAFE);
 

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Tue Dec  4 20:49:04 2012(r243868)
+++ head/sys/kern/kern_fork.c   Tue Dec  4 20:49:39 2012(r243869)
@@ -591,7 +591,7 @@ do_fork(struct thread *td, int flags, st
LIST_INIT(&p2->p_children);
LIST_INIT(&p2->p_orphans);
 
-   callout_init(&p2->p_itcallout, CALLOUT_MPSAFE);
+   callout_init_mtx(&p2->p_itcallout, &p2->p_mtx, 0);
 
/*
 * If PF_FORK is set, the child process inherits the

Modified: head/sys/kern/kern_time.c
==
--- head/sys/kern/kern_time.c   Tue Dec  4 20:49:04 2012(r243868)
+++ head/sys/kern/kern_time.c   Tue Dec  4 20:49:39 2012(r243869)
@@ -788,13 +788,11 @@ realitexpire(void *arg)
struct timeval ctv, ntv;
 
p = (struct proc *)arg;
-   PROC_LOCK(p);
kern_psignal(p, SIGALRM);
if (!timevalisset(&p->p_realtimer.it_interval)) {
timevalclear(&p->p_realtimer.it_value);
if (p->p_flag & P_WEXIT)
wakeup(&p->p_itcallout);
-   PROC_UNLOCK(p);
return;
}
for (;;) {
@@ -806,7 +804,6 @@ realitexpire(void *arg)
timevalsub(&ntv, &ctv);
callout_reset(&p->p_itcallout, tvtohz(&ntv) - 1,
realitexpire, p);
-   PROC_UNLOCK(p);
return;
}
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243875 - head/sys/boot/i386/efi

2012-12-04 Thread Rui Paulo
Author: rpaulo
Date: Wed Dec  5 04:22:53 2012
New Revision: 243875
URL: http://svnweb.freebsd.org/changeset/base/243875

Log:
  Remove dead code that clang refuses to compile.

Modified:
  head/sys/boot/i386/efi/exec.c

Modified: head/sys/boot/i386/efi/exec.c
==
--- head/sys/boot/i386/efi/exec.c   Wed Dec  5 02:47:06 2012
(r243874)
+++ head/sys/boot/i386/efi/exec.c   Wed Dec  5 04:22:53 2012
(r243875)
@@ -46,14 +46,4 @@ __v86int()
 void
 __exec(caddr_t addr, ...)
 {
-   /* XXX this is wrong */
-   __asm __volatile("movl %cr0, %eax");
-   __asm __volatile("andl $0x7fff, %eax");
-   __asm __volatile("mov %eax, %cr0");
-   __asm __volatile("xorl %eax, %eax");
-   __asm __volatile("mov %eax, %cr3");
-   __asm __volatile("movl %cr0, %eax");
-   __asm __volatile("andl $0xfffe, %eax");
-   __asm __volatile("movl %eax, %cr0");
-   __asm __volatile("jmp %0" :: "r" (addr));
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"