Do not reroll IFP_TO_IA

2013-09-05 Thread Martin Pieuchot
Diff below makes use of IFP_TO_IA() instead of rolling our own copy.

For now there's no functional change, but I'd like to get this in so
that once our multicast code can stop relying on global lists, we only
need to modify the macro.

ok?

Index: netinet/in_pcb.c
===
RCS file: /home/ncvs/src/sys/netinet/in_pcb.c,v
retrieving revision 1.139
diff -u -p -r1.139 in_pcb.c
--- netinet/in_pcb.c1 Jun 2013 13:25:40 -   1.139
+++ netinet/in_pcb.c5 Sep 2013 08:52:10 -
@@ -794,13 +794,10 @@ in_selectsrc(struct sockaddr_in *sin, st
if (IN_MULTICAST(sin->sin_addr.s_addr) && mopts != NULL) {
struct ifnet *ifp;
 
-   if (mopts->imo_multicast_ifp != NULL) {
-   ifp = mopts->imo_multicast_ifp;
-   TAILQ_FOREACH(ia, &in_ifaddr, ia_list)
-   if (ia->ia_ifp == ifp &&
-   rtable_l2(rtableid) == ifp->if_rdomain)
-   break;
-   if (ia == 0) {
+   ifp = mopts->imo_multicast_ifp;
+   if (ifp != NULL && ifp->if_rdomain == rtable_l2(rtableid)) {
+   IFP_TO_IA(ifp, ia);
+   if (ia == NULL) {
*errorp = EADDRNOTAVAIL;
return NULL;
}



Re: [NEW] ugold(4) driver for Microdia's USB TEMPer variant (take 3)

2013-09-05 Thread Martin Pieuchot
On 05/09/13(Thu) 05:23, SASANO Takayoshi wrote:
> Hi all,
> 
> Here is the driver for Microdia's USB TEMPer, take 3.
> 
> http://www.uaa.org.uk/gomitext/2013/20130905/20130905.diff
> 
> Thanks to mpi@ and testers of tech@.
> 
> man is not yet, sorry.

I'm ok with your diff, here's a man. I can commit it once your diff
is in if it's ok.

Index: Makefile
===
RCS file: /home/ncvs/src/share/man/man4/Makefile,v
retrieving revision 1.555
diff -u -p -r1.555 Makefile
--- Makefile4 Sep 2013 19:39:18 -   1.555
+++ Makefile5 Sep 2013 09:10:30 -
@@ -57,7 +57,8 @@ MAN=  aac.4 ac97.4 acphy.4 \
tlphy.4 thmc.4 tqphy.4 trm.4 trunk.4 tsl.4 tty.4 tun.4 twe.4 txp.4 \
txphy.4 uaudio.4 uark.4 uath.4 uberry.4 ubsa.4 ubsec.4 ubt.4 \
ucom.4 uchcom.4 ucycom.4 udav.4 udcf.4 udfu.4 udl.4 udp.4 udsbr.4 \
-   uftdi.4 ugen.4 uguru.4 uhci.4 uhid.4 uhidev.4 uipaq.4 uk.4 ukbd.4 \
+   uftdi.4 ugen.4 ugold.4 uguru.4 uhci.4 uhid.4 uhidev.4 uipaq.4 uk.4 \
+   ukbd.4 \
ukphy.4 ulpt.4 umass.4 umbg.4 umct.4 umidi.4 umodem.4 ums.4 umsm.4 \
unix.4 uow.4 uoaklux.4 uoakrh.4 uoakv.4 \
upgt.4 upl.4 uplcom.4 ural.4 urio.4 url.4 urlphy.4 \
Index: ugold.4
===
RCS file: ugold.4
diff -N ugold.4
--- /dev/null   1 Jan 1970 00:00:00 -
+++ ugold.4 5 Sep 2013 09:10:30 -
@@ -0,0 +1,46 @@
+.\"$OpenBSD$
+.\"
+.\" Copyright (c) 2009 Yojiro UO 
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate$
+.Dt UGOLD 4
+.Os
+.Sh NAME
+.Nm ugold
+.Nd TEMPer Gold HID temperature sensor
+.Sh SYNOPSIS
+.Cd "ugold* at uhidev?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for pcsensors TEMPer gold devices.
+The following devices are supported by the
+.Nm
+driver:
+.Bl -column "RDing TEMPer1V1.2" "1 Temperature" -offset indent
+.It Em "Device" Ta Em "Sensors"
+.It Li "RDing TEMPer1V1.2" Ta "1 Temperature"
+.El
+.Pp
+The driver possesses a collection of sensor values which are
+made available through the
+.Xr sysctl 8
+interface.
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr uhidev 4 ,
+.Xr uthum 4 ,
+.Xr sensorsd 8 ,
+.Xr sysctl 8



Re: in_var.h incudes in6_var.h

2013-09-05 Thread Henning Brauer
* Martin Pieuchot  [2013-09-02 12:12]:
> On 30/08/13(Fri) 21:50, Alexander Bluhm wrote:
> > Hi,
> > 
> > The file netinet/in_var.h includes netinet6/in6_var.h.  This creates
> > a bunch of useless dependencies.  For an upcomming change in in6_var.h
> > I would like to split that up.
> > 
> > Is this a good idea? comments/ok?
> 
> I like the idea but we should be careful about ports assuming that
> in_var.h includes in6_var.h even if there's no RFC requirement.

indeed, that needs to be checked. otherwise ok.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services GmbH, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/



Re: Unify and document usbd_transfer(9)

2013-09-05 Thread Martin Pieuchot
On 17/05/13(Fri) 20:19, Martin Pieuchot wrote:
> On 14/05/13(Tue) 16:09, Marcus Glocker wrote:
> > On Fri, May 10, 2013 at 09:44:53AM +0200, Martin Pieuchot wrote:
> > > [...] 
> > > 
> > > This diff gets rid of the two badly named functions: usbd_bulk_transfer()
> > > & usbd_intr_transfer() and makes use of the usbd_setup_xfer(9) + 
> > > usbd_transfer(9) combination.  These functions were badly named because
> > > they are identical wrappers to submit a synchronous transfer.  There are
> > > however two small functional differences with this diff:
> > > 
> > >  - previously a custom name for the wait channel was given to tlseep(9)
> > >while sleeping for I/O. Now it will be "usbsyn" for all USB
> > >synchronous transfers.
> > > 
> > >  - previously the priority given to tlseep(9) was PZERO. Now it will be
> > >PRIBIO like for all USB synchronous transfers. But this shouldn't make
> > >a difference in practice, because the only priority between the two,
> > >PVFS, is unused. 
> > > 
> > > This diff also includes a new manual for the above mentioned functions.
> > > I'd like to document as much functions of our USB stack as possible to
> > > make sure driver porter/writer understand how it works.
> 
> Updated diff with two minors tweaks to make sure that:
> 
>   - no information is leaked to userland when USBD_SHORT_XFER_OK is set
> for ugen(4) reads 
> 
>   - do not bother checking for the actual transfered length for reads
> in urio(4), USBD_SHORT_XFER_OK being not set, an error is returned
> if actlen < len.
> 
> Plus includes some tweaks for the manpage by jmc@

Here's a new version of the diff that includes:

  - Remove the usbscanner(4) part since ajacoutot@ sent it to the Attic

  - Call usbd_clear_endpoint_stall() when an error occurred during the
transfer to match the previous behavior.

  - Abort the pipe in case tsleep() returned an error and the transfer
is still not done, from NetBSD via miod@

  - Remove the handling of USBD_INTERRUPTED from urio which looks like
a bad copy/paste of ugen, because its doesn't tsleep() with PCATCH.

  - Update the status of the transfer to match the error code tsleep()
returned.

Last version has been tested by various people, I don't expect any
regression, but don't hesitate to give it a shot and report back.

ok?


Index: sys/dev/usb/ugen.c
===
RCS file: /home/ncvs/src/sys/dev/usb/ugen.c,v
retrieving revision 1.72
diff -u -p -r1.72 ugen.c
--- sys/dev/usb/ugen.c  17 May 2013 09:09:11 -  1.72
+++ sys/dev/usb/ugen.c  5 Sep 2013 10:23:37 -
@@ -478,7 +478,7 @@ ugen_do_read(struct ugen_softc *sc, int 
struct usbd_xfer *xfer;
usbd_status err;
int s;
-   int error = 0;
+   int flags, error = 0;
u_char buffer[UGEN_CHUNK];
 
DPRINTFN(5, ("%s: ugenread: %d\n", sc->sc_dev.dv_xname, endpt));
@@ -546,15 +546,18 @@ ugen_do_read(struct ugen_softc *sc, int 
xfer = usbd_alloc_xfer(sc->sc_udev);
if (xfer == 0)
return (ENOMEM);
+   flags = USBD_SYNCHRONOUS;
+   if (sce->state & UGEN_SHORT_OK)
+   flags |= USBD_SHORT_XFER_OK;
+   if (sce->timeout == 0)
+   flags |= USBD_CATCH;
while ((n = min(UGEN_BBSIZE, uio->uio_resid)) != 0) {
DPRINTFN(1, ("ugenread: start transfer %d bytes\n",n));
-   tn = n;
-   err = usbd_bulk_transfer(
- xfer, sce->pipeh,
- sce->state & UGEN_SHORT_OK ?
- USBD_SHORT_XFER_OK : 0,
- sce->timeout, buf, &tn, "ugenrb");
+   usbd_setup_xfer(xfer, sce->pipeh, 0, buf, n,
+   flags, sce->timeout, NULL);
+   err = usbd_transfer(xfer);
if (err) {
+   usbd_clear_endpoint_stall(sce->pipeh);
if (err == USBD_INTERRUPTED)
error = EINTR;
else if (err == USBD_TIMEOUT)
@@ -563,6 +566,7 @@ ugen_do_read(struct ugen_softc *sc, int 
error = EIO;
break;
}
+   usbd_get_xfer_status(xfer, NULL, NULL, &tn, NULL);
DPRINTFN(1, ("ugenread: got %d bytes\n", tn));
error = uiomove(buf, tn, uio);
if (error || tn < n)
@@ -640,7 +644,7 @@ ugen_do_write(struct ugen_softc *sc, int
 {
struct ugen_endpoint *sce = &sc->sc_endpoints[endpt][OUT];
u_int32_t n;
-   int error = 0;
+   int flags, error = 0;
char buf[UGEN_BBSIZE];
struct usbd_xfer *xfer;
 

remove commented-out kerb-related entries in sshd_config

2013-09-05 Thread Stuart Henderson
KerbV support was removed but the sample config entries remain.
Should we remove them?


Index: sshd_config
===
RCS file: /cvs/src/usr.bin/ssh/sshd_config,v
retrieving revision 1.90
diff -u -p -r1.90 sshd_config
--- sshd_config 16 May 2013 04:09:14 -  1.90
+++ sshd_config 5 Sep 2013 12:28:25 -
@@ -72,16 +72,6 @@ AuthorizedKeysFile   .ssh/authorized_keys
 # Change to no to disable s/key passwords
 #ChallengeResponseAuthentication yes
 
-# Kerberos options
-#KerberosAuthentication no
-#KerberosOrLocalPasswd yes
-#KerberosTicketCleanup yes
-#KerberosGetAFSToken no
-
-# GSSAPI options
-#GSSAPIAuthentication no
-#GSSAPICleanupCredentials yes
-
 #AllowAgentForwarding yes
 #AllowTcpForwarding yes
 #GatewayPorts no



Re: remove commented-out kerb-related entries in sshd_config

2013-09-05 Thread Antoine Jacoutot
On Thu, Sep 05, 2013 at 01:30:24PM +0100, Stuart Henderson wrote:
> KerbV support was removed but the sample config entries remain.
> Should we remove them?

What about the client config and the man pages?

> Index: sshd_config
> ===
> RCS file: /cvs/src/usr.bin/ssh/sshd_config,v
> retrieving revision 1.90
> diff -u -p -r1.90 sshd_config
> --- sshd_config   16 May 2013 04:09:14 -  1.90
> +++ sshd_config   5 Sep 2013 12:28:25 -
> @@ -72,16 +72,6 @@ AuthorizedKeysFile .ssh/authorized_keys
>  # Change to no to disable s/key passwords
>  #ChallengeResponseAuthentication yes
>  
> -# Kerberos options
> -#KerberosAuthentication no
> -#KerberosOrLocalPasswd yes
> -#KerberosTicketCleanup yes
> -#KerberosGetAFSToken no
> -
> -# GSSAPI options
> -#GSSAPIAuthentication no
> -#GSSAPICleanupCredentials yes
> -
>  #AllowAgentForwarding yes
>  #AllowTcpForwarding yes
>  #GatewayPorts no
> 

-- 
Antoine



Re: remove commented-out kerb-related entries in sshd_config

2013-09-05 Thread Jason McIntyre
On Thu, Sep 05, 2013 at 03:40:28PM +0200, Antoine Jacoutot wrote:
> On Thu, Sep 05, 2013 at 01:30:24PM +0100, Stuart Henderson wrote:
> > KerbV support was removed but the sample config entries remain.
> > Should we remove them?
> 
> What about the client config and the man pages?
> 

there has been a bit of dicsussion about the man pages. in the end, i
decided to do nothing for now. the code is still there, so for anyone
turning it on, the documentation will be useful.

we did consider removing the doc part, or adding a note to the effect of
"off by default". in the end no solution seemed entirely wonderful.

i did also think along the lines of adding the doc part to a rolled in
version for portable, but no one seemed keen.

jmc



Re: useradd with empty -k doesn't chown/chmod new home directory

2013-09-05 Thread Craig R. Skinner
On 2013-08-31 Sat 11:18 AM |, Kenneth R Westerback wrote:
> 
> This makes sense to me. ok krw@
> 
>  Ken
> 

ping?
-- 
Craig Skinner | http://twitter.com/Craig_Skinner | http://linkd.in/yGqkv7



Re: Do not reroll IFP_TO_IA

2013-09-05 Thread Alexander Bluhm
On Thu, Sep 05, 2013 at 10:54:53AM +0200, Martin Pieuchot wrote:
> Diff below makes use of IFP_TO_IA() instead of rolling our own copy.
> 
> For now there's no functional change, but I'd like to get this in so
> that once our multicast code can stop relying on global lists, we only
> need to modify the macro.
> 
> ok?

The old code did run into the EADDRNOTAVAIL case, if the routing
domain did not match.  Now you don't return.

I think you need someting like this;

ifp = mopts->imo_multicast_ifp;
if (ifp != NULL) {
IFP_TO_IA(ifp, ia);
if (ia == NULL ||
ifp->if_rdomain != rtable_l2(rtableid)) {
*errorp = EADDRNOTAVAIL;
return NULL;
}

bluhm


> 
> Index: netinet/in_pcb.c
> ===
> RCS file: /home/ncvs/src/sys/netinet/in_pcb.c,v
> retrieving revision 1.139
> diff -u -p -r1.139 in_pcb.c
> --- netinet/in_pcb.c  1 Jun 2013 13:25:40 -   1.139
> +++ netinet/in_pcb.c  5 Sep 2013 08:52:10 -
> @@ -794,13 +794,10 @@ in_selectsrc(struct sockaddr_in *sin, st
>   if (IN_MULTICAST(sin->sin_addr.s_addr) && mopts != NULL) {
>   struct ifnet *ifp;
>  
> - if (mopts->imo_multicast_ifp != NULL) {
> - ifp = mopts->imo_multicast_ifp;
> - TAILQ_FOREACH(ia, &in_ifaddr, ia_list)
> - if (ia->ia_ifp == ifp &&
> - rtable_l2(rtableid) == ifp->if_rdomain)
> - break;
> - if (ia == 0) {
> + ifp = mopts->imo_multicast_ifp;
> + if (ifp != NULL && ifp->if_rdomain == rtable_l2(rtableid)) {
> + IFP_TO_IA(ifp, ia);
> + if (ia == NULL) {
>   *errorp = EADDRNOTAVAIL;
>   return NULL;
>   }



osfp pfctl and states

2013-09-05 Thread sven falempin
openBSDs,

Reading pfctl manual and net/pfvar.h i didnt find the ospf information
inside a states entry .
So i assume it is not possible to recover the fingerprint of a state trough
the ioctl.
Unless
- i didnt read enough (help is welcome)
- creatorId is something i hould look into.

or i have to patch i want to have the SYN fingerprint saved into states if
possible.

Maybe there's another way ?

Best regards.

-- 
-
() ascii ribbon campaign - against html e-mail
/\


diff: /etc/rc.d/spamd rc_reload=NO

2013-09-05 Thread Craig R. Skinner
Doesn't seem to reload once chrooted:

$ sudo /etc/rc.d/spamd -d reload
doing rc_read_runfile
doing rc_check
spamd
doing rc_reload
Sep  5 19:57:54 oak spamd[22335]: greyreader failed (Error 0)
doing rc_wait reload
doing rc_check
doing rc_check
...
..
.
doing rc_check
(failed)





Index: spamd
===
RCS file: /cvs/src/etc/rc.d/spamd,v
retrieving revision 1.2
diff -u -r1.2 spamd
--- spamd   8 Jul 2011 02:15:34 -   1.2
+++ spamd   5 Sep 2013 19:19:54 -
@@ -7,6 +7,7 @@
 . /etc/rc.d/rc.subr
 
 pexp="spamd: \[priv\]"
+rc_reload=NO
 
 rc_pre() {
[ X"${spamd_black}" != X"NO" ] && \



Cheers,
-- 
Craig Skinner | http://twitter.com/Craig_Skinner | http://linkd.in/yGqkv7



Re: [NEW] ugold(4) driver for Microdia's USB TEMPer variant (take 3)

2013-09-05 Thread SASANO Takayoshi
Hello,

I commited ugold(4) driver code.

> I'm ok with your diff, here's a man. I can commit it once your diff
> is in if it's ok.

Thank you for writing man, but authors in header is still yuo@.
Others are ok.

Here is fixed version, please commit.

Best regards,


Index: share/man/man4/Makefile
===
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.554
diff -u -p -r1.554 Makefile
--- share/man/man4/Makefile 20 Aug 2013 14:27:32 -  1.554
+++ share/man/man4/Makefile 5 Sep 2013 19:58:45 -
@@ -57,7 +57,8 @@ MAN=  aac.4 ac97.4 acphy.4 \
tlphy.4 thmc.4 tqphy.4 trm.4 trunk.4 tsl.4 tty.4 tun.4 twe.4 txp.4 \
txphy.4 uaudio.4 uark.4 uath.4 uberry.4 ubsa.4 ubsec.4 ubt.4 \
ucom.4 uchcom.4 ucycom.4 udav.4 udcf.4 udfu.4 udl.4 udp.4 udsbr.4 \
-   uftdi.4 ugen.4 uguru.4 uhci.4 uhid.4 uhidev.4 uipaq.4 uk.4 ukbd.4 \
+   uftdi.4 ugen.4 ugold.4 uguru.4 uhci.4 uhid.4 uhidev.4 uipaq.4 uk.4 \
+   ukbd.4 \
ukphy.4 ulpt.4 umass.4 umbg.4 umct.4 umidi.4 umodem.4 ums.4 umsm.4 \
unix.4 uow.4 uoaklux.4 uoakrh.4 uoakv.4 \
upgt.4 upl.4 uplcom.4 ural.4 urio.4 url.4 urlphy.4 \
Index: share/man/man4/ugold.4
===
RCS file: share/man/man4/ugold.4
diff -N share/man/man4/ugold.4
--- /dev/null   1 Jan 1970 00:00:00 -
+++ share/man/man4/ugold.4  5 Sep 2013 19:58:45 -
@@ -0,0 +1,47 @@
+.\"$OpenBSD$
+.\"
+.\" Copyright (c) 2013 Takayoshi SASANO 
+.\" Copyright (c) 2013 Martin Pieuchot 
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate$
+.Dt UGOLD 4
+.Os
+.Sh NAME
+.Nm ugold
+.Nd TEMPer Gold HID temperature sensor
+.Sh SYNOPSIS
+.Cd "ugold* at uhidev?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for pcsensors TEMPer gold devices.
+The following devices are supported by the
+.Nm
+driver:
+.Bl -column "RDing TEMPer1V1.2" "1 Temperature" -offset indent
+.It Em "Device" Ta Em "Sensors"
+.It Li "RDing TEMPer1V1.2" Ta "1 Temperature"
+.El
+.Pp
+The driver possesses a collection of sensor values which are
+made available through the
+.Xr sysctl 8
+interface.
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr uhidev 4 ,
+.Xr uthum 4 ,
+.Xr sensorsd 8 ,
+.Xr sysctl 8

-- 
SASANO Takayoshi 



Re: Introduce rt_msg() (was nd6_rtmsg)

2013-09-05 Thread Alexander Bluhm
On Mon, Sep 02, 2013 at 12:43:51PM +0200, Martin Pieuchot wrote:
> Diff below is just a small refactoring of two similar code chunks to
> inform user processes that something changed regarding a route.
> 
> I'd like to get this in because it removes one use of rt_addrinfo in
> netinet6.
> 
> There's no functional change, ok?

Less code is always good.  OK bluhm@

> 
> Index: net/route.c
> ===
> RCS file: /home/ncvs/src/sys/net/route.c,v
> retrieving revision 1.145
> diff -u -p -r1.145 route.c
> --- net/route.c   28 Aug 2013 06:58:57 -  1.145
> +++ net/route.c   2 Sep 2013 10:18:59 -
> @@ -346,17 +345,7 @@ rtalloc1(struct sockaddr *dst, int flags
>   goto miss;
>   }
>   /* Inform listeners of the new route */
> - bzero(&info, sizeof(info));
> - info.rti_info[RTAX_DST] = rt_key(rt);
> - info.rti_info[RTAX_NETMASK] = rt_mask(rt);
> - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
> - if (rt->rt_ifp != NULL) {
> - info.rti_info[RTAX_IFP] =
> - 
> TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
> - info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
> - }
> - rt_missmsg(RTM_ADD, &info, rt->rt_flags,
> - rt->rt_ifp, 0, tableid);
> + rt_msg(rt, RTM_ADD, tableid);
>   } else
>   rt->rt_refcnt++;
>   } else {
> @@ -410,6 +399,25 @@ rtfree(struct rtentry *rt)
>   Free(rt_key(rt));
>   pool_put(&rtentry_pool, rt);
>   }
> +}
> +
> +/* tell the change to user processes watching the routing socket. */
> +void
> +rt_msg(struct rtentry *rt, int cmd, u_int tableid)
> +{
> + struct rt_addrinfo info;
> +
> + bzero(&info, sizeof(info));
> + info.rti_info[RTAX_DST] = rt_key(rt);
> + info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
> + info.rti_info[RTAX_NETMASK] = rt_mask(rt);
> + if (rt->rt_ifp != NULL) {
> + info.rti_info[RTAX_IFP] =
> + TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
> + info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
> + }
> +
> + rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_ifp, 0, tableid);
>  }
>  
>  void
> Index: net/route.h
> ===
> RCS file: /home/ncvs/src/sys/net/route.h,v
> retrieving revision 1.78
> diff -u -p -r1.78 route.h
> --- net/route.h   19 Sep 2012 16:14:01 -  1.78
> +++ net/route.h   2 Sep 2013 10:18:59 -
> @@ -369,6 +369,7 @@ void   rt_ifmsg(struct ifnet *);
>  void  rt_ifannouncemsg(struct ifnet *, int);
>  void  rt_maskedcopy(struct sockaddr *,
>   struct sockaddr *, struct sockaddr *);
> +void  rt_msg(struct rtentry *, int, u_int);
>  void  rt_missmsg(int, struct rt_addrinfo *, int, struct ifnet *, int,
>   u_int);
>  void  rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
> Index: netinet6/nd6_rtr.c
> ===
> RCS file: /home/ncvs/src/sys/netinet6/nd6_rtr.c,v
> retrieving revision 1.72
> diff -u -p -r1.72 nd6_rtr.c
> --- netinet6/nd6_rtr.c1 Jul 2013 14:22:20 -   1.72
> +++ netinet6/nd6_rtr.c2 Sep 2013 10:18:59 -
> @@ -70,7 +70,6 @@ void pfxrtr_add(struct nd_prefix *, stru
>  void pfxrtr_del(struct nd_pfxrouter *);
>  struct nd_pfxrouter *find_pfxlist_reachable_router(struct nd_prefix *);
>  void defrouter_delreq(struct nd_defrouter *);
> -void nd6_rtmsg(int, struct rtentry *);
>  void purge_detached(struct ifnet *);
>  
>  void in6_init_address_ltimes(struct nd_prefix *, struct in6_addrlifetime *);
> @@ -410,26 +409,6 @@ nd6_ra_input(struct mbuf *m, int off, in
>  /*
>   * default router list processing sub routines
>   */
> -
> -/* tell the change to user processes watching the routing socket. */
> -void
> -nd6_rtmsg(int cmd, struct rtentry *rt)
> -{
> - struct rt_addrinfo info;
> -
> - bzero((caddr_t)&info, sizeof(info));
> - info.rti_info[RTAX_DST] = rt_key(rt);
> - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
> - info.rti_info[RTAX_NETMASK] = rt_mask(rt);
> - if (rt->rt_ifp) {
> - info.rti_info[RTAX_IFP] =
> - TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
> - info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
> - }
> -
> - rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_ifp, 0, 0);
> -}
> -
>  void
>  defrouter_addreq(struct nd_defrouter *new)
>  {
> @@ -459,7 +438,7 @@ defrouter_addreq(struct nd_defrouter *ne
>   error = rtrequest1(RTM_ADD, &info, RTP_DEFAULT, &newrt,
>   new->ifp->if_rdomain);
>   if (newrt) {
> - nd6_rtmsg(RTM_ADD, newrt)

Re: useradd with empty -k doesn't chown/chmod new home directory

2013-09-05 Thread Todd C. Miller
I changed my mind and decided it is better to just move the chown
and chmod out of copydotfiles() and add an explicit check for skeldir
set to the empty string.  Much as I would like to prettify the
user.c code it is a losing battle so here is a minimal diff.

 - todd

Index: usr.sbin/user/user.c
===
RCS file: /home/cvs/openbsd/src/usr.sbin/user/user.c,v
retrieving revision 1.95
diff -u -r1.95 user.c
--- usr.sbin/user/user.c2 Apr 2013 05:04:47 -   1.95
+++ usr.sbin/user/user.c5 Sep 2013 20:47:23 -
@@ -290,6 +290,8 @@
DIR *dirp;
int n;
 
+   if (*skeldir != '\0')
+   return 0;
if ((dirp = opendir(skeldir)) == NULL) {
warn("can't open source . files dir `%s'", skeldir);
return 0;
@@ -308,8 +310,6 @@
(void) asystem("cd %s && %s -rw -pe %s . %s",
skeldir, PAX, (verbose) ? "-v" : "", dir);
}
-   (void) asystem("%s -R -P %u:%u %s", CHOWN, uid, gid, dir);
-   (void) asystem("%s -R u+w %s", CHMOD, dir);
return n;
 }
 
@@ -1177,6 +1177,9 @@
err(EXIT_FAILURE, "can't mkdir `%s'", home);
}
(void) copydotfiles(up->u_skeldir, up->u_uid, gid, 
home);
+   (void) asystem("%s -R -P %u:%u %s", CHOWN, up->u_uid,
+   gid, home);
+   (void) asystem("%s -R u+w %s", CHMOD, home);
}
}
if (strcmp(up->u_primgrp, "=uid") == 0 &&



kassert socket, inpcb, tcpcb

2013-09-05 Thread Alexander Bluhm
Hi,

I have a core dump from a not quite OpenBSD 5.2 crash.  There the
pointers to socket, inpcb, tcpcb on the stack of tcp_input() and
tcp_output() look very inconsistent.  Especially the so->so_pcb is
NULL, which can only happen after the inp has been detached.  The
whole thing reminds me of the old panic: pool_do_get(inpcbpl): free
list modified.

http://marc.info/?l=openbsd-bugs&m=132630237316970&w=2

To get more information, I would like to add some asserts that
guarantee the consistency of the socket, inpcb, tcpcb linking.  I
suspect that we might have a freed inp stored in the pcbhashes.

ok?

bluhm

Index: netinet/tcp_input.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_input.c,v
retrieving revision 1.267
diff -u -p -u -p -r1.267 tcp_input.c
--- netinet/tcp_input.c 13 Aug 2013 09:52:53 -  1.267
+++ netinet/tcp_input.c 5 Sep 2013 21:20:22 -
@@ -641,6 +641,8 @@ findpcb:
goto dropwithreset_ratelim;
}
}
+   KASSERT(sotoinpcb(inp->inp_socket) == inp);
+   KASSERT(intotcpcb(inp)->t_inpcb == inp);
 
/* Check the minimum TTL for socket. */
if (inp->inp_ip_minttl && inp->inp_ip_minttl > ip->ip_ttl)
Index: netinet/udp_usrreq.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.165
diff -u -p -u -p -r1.165 udp_usrreq.c
--- netinet/udp_usrreq.c31 Jul 2013 15:41:52 -  1.165
+++ netinet/udp_usrreq.c5 Sep 2013 21:20:50 -
@@ -592,6 +592,7 @@ udp_input(struct mbuf *m, ...)
return;
}
}
+   KASSERT(sotoinpcb(inp->inp_socket) == inp);
 
 #if NPF > 0
/* The statekey has finished finding the inp, it is no longer needed. */



Re: ntpd jump ahead

2013-09-05 Thread Barry Grumbine
Non-VM use case: The BeagleBone Black has no RTC, so -j could be
useful for cheap little ARM development boards.


On Wed, Sep 4, 2013 at 5:58 AM, Reyk Floeter  wrote:
>
> On Wed, Sep 04, 2013 at 08:45:25AM -0400, Ted Unangst wrote:
> > > Bah.  I tend to turn ntpd off and rely on the internal clock
> > > synchronization of the hypervisor.  But fixing ntpd inside VMs would
> > > probably be a big win.
> >
> > Can you explain what you do? I have a vmt timedelta sensor that shows
> > host time, but how do you sync the openbsd clock to that?
> >
>
> let the host sync the system clock and hope that it doesn't run off
> ... but you're right, having a working ntpd would be much better.
>
> > > I don't like the fact that it would require another button.  Couldn't
> > > ntpd just detect this automatically?  Maybe by detecting that it is
> > > running inside a VM, or by whatever else?
> >
> > I think there is resistance to anything that treats VM differently. I
> > tend to agree. This is a more generic problem of the clock failing to
> > keep up, and can affect real hardware as well.
>
> Can you freeze and continue any other non-VM system?  Is it comparable
> with suspend/resume?  If not, than it is a special case that could be
> handled without being scared about a "VM-specific" option.  For
> example: The timedelta sensor could tell userland that it "might
> jump".  ntpd would pick it up from vmt automatically.
>
> I think that adding another button is worse.  It is already annoying
> to decide if I want to run ntpd with -s or not.  Now it would add -j
> and -s.  What combination is the best for my system?  Who knows?
>
> Reyk
>



Re: useradd with empty -k doesn't chown/chmod new home directory

2013-09-05 Thread Alexander Hall


"Todd C. Miller"  wrote:
>I changed my mind and decided it is better to just move the chown
>and chmod out of copydotfiles() and add an explicit check for skeldir
>set to the empty string.  Much as I would like to prettify the
>user.c code it is a losing battle so here is a minimal diff.
>
> - todd
>
>Index: usr.sbin/user/user.c
>===
>RCS file: /home/cvs/openbsd/src/usr.sbin/user/user.c,v
>retrieving revision 1.95
>diff -u -r1.95 user.c
>--- usr.sbin/user/user.c   2 Apr 2013 05:04:47 -   1.95
>+++ usr.sbin/user/user.c   5 Sep 2013 20:47:23 -
>@@ -290,6 +290,8 @@
>   DIR *dirp;
>   int n;
> 
>+  if (*skeldir != '\0')
>+  return 0;

Woot?

/A

>   if ((dirp = opendir(skeldir)) == NULL) {
>   warn("can't open source . files dir `%s'", skeldir);
>   return 0;
>@@ -308,8 +310,6 @@
>   (void) asystem("cd %s && %s -rw -pe %s . %s",
>   skeldir, PAX, (verbose) ? "-v" : "", dir);
>   }
>-  (void) asystem("%s -R -P %u:%u %s", CHOWN, uid, gid, dir);
>-  (void) asystem("%s -R u+w %s", CHMOD, dir);
>   return n;
> }
> 
>@@ -1177,6 +1177,9 @@
>   err(EXIT_FAILURE, "can't mkdir `%s'", home);
>   }
>   (void) copydotfiles(up->u_skeldir, up->u_uid, gid, 
> home);
>+  (void) asystem("%s -R -P %u:%u %s", CHOWN, up->u_uid,
>+  gid, home);
>+  (void) asystem("%s -R u+w %s", CHMOD, home);
>   }
>   }
>   if (strcmp(up->u_primgrp, "=uid") == 0 &&