Re: replace select with nanosleep in libc/termios/tcsendbreak.c

2014-10-09 Thread Philip Guenther
On Wed, Oct 8, 2014 at 10:22 PM, David Gwynne da...@gwynne.id.au wrote:
 deraadt points out i suck at grep.

 ok?

Sure.  Even has the same semantics if a signal is received.



atheros 9485

2014-10-09 Thread Kirill Bychkov
Index: pcidevs
===
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1746
diff -u -p -u -r1.1746 pcidevs
--- pcidevs 8 Oct 2014 07:41:27 -   1.1746
+++ pcidevs 9 Oct 2014 09:43:28 -
@@ -1835,6 +1835,7 @@ product ATHEROS AR93000x0030  AR9300
 product ATHEROS AR9485 0x0032  AR9485
 product ATHEROS AR9462 0x0034  AR9462
 product ATHEROS AR9565 0x0036  AR9565
+product ATHEROS AR9485 0x0037  AR9485
 product ATHEROS AR5210_AP  0x0207  AR5210
 product ATHEROS AR5212_IBM 0x1014  AR5212
 product ATHEROS AR5210_DEFAULT 0x1107  AR5210

OK?
BTW, this card is not fully supported. After adding it's ID to if_athn_pci.c
it gives me calibration error when I'm running `dhclient athn0`.
I can test diffs or send it to one of the developers.



Re: no respone on Passphrase after first boot on -current

2014-10-09 Thread Stefan Sperling
On Thu, Oct 09, 2014 at 06:23:17AM +0200, Jiri Navratil wrote:
 Hello,
 
 I bought acer TravelMate notebook TMB115-M-COEA to follow -current and
 partitipate on LibreSSL.
 
 I installed system from snapshot and used softraid0 crypto on whole sd0.
 
 After first boot I have Passsphrase prompt and I can't contine. It looks
 like keyboard is not working. No response after Enter. I assume, that
 I'm providing same password as during install. There is no response at
 all.
 
 Can I debug this somehow?
 
 I may install the machine again without crypto and then try to use softraid0 
 crypto on external drive, but not sure, if this can be helpfull for debuging 
 and reporting.
 
 Is there something next I can experiment with and provide something valuable
 here?
 
 Thank you,
 Jiri
 
 -- 
 Jiri Navratil, http://kouc.navratil.cz, +420 222 767 131

Did you try booting into the install media, select 'shell', and then
attaching your softraid crypto disk with bioctl? Does that work?

Can you provide a dmesg?



Re: atheros 9485

2014-10-09 Thread Stefan Sperling
On Thu, Oct 09, 2014 at 01:48:23PM +0400, Kirill Bychkov wrote:
 Index: pcidevs
 ===
 RCS file: /cvs/src/sys/dev/pci/pcidevs,v
 retrieving revision 1.1746
 diff -u -p -u -r1.1746 pcidevs
 --- pcidevs   8 Oct 2014 07:41:27 -   1.1746
 +++ pcidevs   9 Oct 2014 09:43:28 -
 @@ -1835,6 +1835,7 @@ product ATHEROS AR9300  0x0030  AR9300
  product ATHEROS AR9485   0x0032  AR9485
  product ATHEROS AR9462   0x0034  AR9462
  product ATHEROS AR9565   0x0036  AR9565
 +product ATHEROS AR9485   0x0037  AR9485
  product ATHEROS AR5210_AP0x0207  AR5210
  product ATHEROS AR5212_IBM   0x1014  AR5212
  product ATHEROS AR5210_DEFAULT   0x1107  AR5210
 
 OK?

I'm not sure about this.

AR9485 is already in there as 0x0032. According to FreeBSD's
ath_hal/ah_devid.h the ID 0x0037 maps to AR_PCIE... ?
Linux ath9k calls it: PCI-E AR/AR9485

 BTW, this card is not fully supported. After adding it's ID to if_athn_pci.c
 it gives me calibration error when I'm running `dhclient athn0`.
 I can test diffs or send it to one of the developers.

Yes, this is a known issue. I've been trying to hunt this down for a while.
Still no idea what's wrong with it.
AFAIK the ar9003.c and ar9380.c files contain code which was never
tested on real hardware by damien (see the CVS logs of these files).



Re: improving OpenBSD's gmac.c...

2014-10-09 Thread Christian Weisgerber
John-Mark Gurney:

 I also have an implementation of ghash that does a 4 bit lookup table
 version with the table split between cache lines in p4 at:
 https://p4db.freebsd.org/fileViewer.cgi?FSPC=//depot/projects/opencrypto/sys/opencrypto/gfmult.cREV=4
 
 This also has a version with does 4 blocks at a time getting a
 further speed up...

FWIW, I did a quick  dirty merge of this into the OpenBSD tree and
the speed of my test (net6501-50, tcpbench -u over esp aes-128-gmac)
almost doubled.

-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: replace select with poll in libc

2014-10-09 Thread Todd C. Miller
Two comments inline, otherwise OK.

 - todd

On Thu, 09 Oct 2014 14:52:50 +1000, David Gwynne wrote:

 Index: net/rcmd.c
 ===
 RCS file: /cvs/src/lib/libc/net/rcmd.c,v
 retrieving revision 1.56
 diff -u -p -r1.56 rcmd.c
 --- net/rcmd.c18 Nov 2009 07:43:22 -  1.56
 +++ net/rcmd.c9 Oct 2014 04:49:30 -
 @@ -46,6 +46,7 @@
  #include string.h
  #include syslog.h
  #include stdlib.h
 +#include poll.h
  
  int
  rcmd(char **ahost, int rport, const char *locuser, const char *remuser,
 @@ -63,7 +64,6 @@ rcmd_af(char **ahost, int porta, const c
   struct addrinfo hints, *res, *r;
   int error;
   struct sockaddr_storage from;
 - fd_set *readsp = NULL;
   sigset_t oldmask, mask;
   pid_t pid;
   int s, lport, timo;
 @@ -188,18 +188,14 @@ rcmd_af(char **ahost, int porta, const c
   write(s, , 1);
   lport = 0;
   } else {
 + struct pollfd pfd[2];
   char num[8];
   int s2 = rresvport_af(lport, af), s3;
   socklen_t len = sizeof(from);
 - int fdssize = howmany(MAX(s, s2)+1, NFDBITS) * sizeof(fd_mask);
  
   if (s2  0)
   goto bad;
 - readsp = (fd_set *)malloc(fdssize);
 - if (readsp == NULL) {
 - close(s2);
 - goto bad;
 - }
 +
   listen(s2, 1);
   (void)snprintf(num, sizeof(num), %d, lport);
   if (write(s, num, strlen(num)+1) != strlen(num)+1) {
 @@ -210,12 +206,15 @@ rcmd_af(char **ahost, int porta, const c
   goto bad;
   }
  again:
 - bzero(readsp, fdssize);
 - FD_SET(s, readsp);
 - FD_SET(s2, readsp);
 + memset(pfd, 0, sizeof(pfd));

This memset is not needed, poll(2) will zero revents as needed.
Unused poll structs just need to have their fd set to -1 (not 0).

 + pfd[0].fd = s;
 + pfd[0].events = POLLIN;
 + pfd[1].fd = s2;
 + pfd[1].events = POLLIN;
 +
   errno = 0;
 - if (select(MAX(s, s2) + 1, readsp, 0, 0, 0)  1 ||
 - !FD_ISSET(s2, readsp)) {
 + if (poll(pfd, 2, INFTIM)  1 ||
 + (pfd[1].revents  POLLIN) == 0) {

You need to check for POLLIN|POLLHUP for this to be equivalent to
the select version.

   if (errno != 0)
   (void)fprintf(stderr,
   rcmd: select (setting up stderr): %s\n,
 @@ -288,14 +287,11 @@ again:
   goto bad2;
   }
   sigprocmask(SIG_SETMASK, oldmask, NULL);
 - free(readsp);
   return (s);
  bad2:
   if (lport)
   (void)close(*fd2p);
  bad:
 - if (readsp)
 - free(readsp);
   (void)close(s);
   sigprocmask(SIG_SETMASK, oldmask, NULL);
   return (-1);
 



Re: replace select with nanosleep in libc/termios/tcsendbreak.c

2014-10-09 Thread Todd C. Miller
You should #include time.h for the nanosleep prototype.
Otherwise OK.

 - todd

On Thu, 09 Oct 2014 15:22:29 +1000, David Gwynne wrote:

 deraadt points out i suck at grep.
 
 ok?
 
 Index: termios/tcsendbreak.c
 ===
 RCS file: /cvs/src/lib/libc/termios/tcsendbreak.c,v
 retrieving revision 1.6
 diff -u -p -r1.6 tcsendbreak.c
 --- termios/tcsendbreak.c 5 Aug 2005 13:03:00 -   1.6
 +++ termios/tcsendbreak.c 9 Oct 2014 05:21:30 -
 @@ -43,13 +43,14 @@
  int
  tcsendbreak(int fd, int len)
  {
 - struct timeval sleepytime;
 + struct timespec sleepytime;
  
   sleepytime.tv_sec = 0;
 - sleepytime.tv_usec = 40;
 + sleepytime.tv_nsec = 4;
 +
   if (ioctl(fd, TIOCSBRK, 0) == -1)
   return (-1);
 - (void)select(0, 0, 0, 0, sleepytime);
 + (void)nanosleep(sleepytime, NULL);
   if (ioctl(fd, TIOCCBRK, 0) == -1)
   return (-1);
   return (0);
 



Re: atheros 9485

2014-10-09 Thread Kirill Bychkov
On Thu, October 9, 2014 14:02, Stefan Sperling wrote:
 On Thu, Oct 09, 2014 at 01:48:23PM +0400, Kirill Bychkov wrote:
 Index: pcidevs
 ===
 RCS file: /cvs/src/sys/dev/pci/pcidevs,v
 retrieving revision 1.1746
 diff -u -p -u -r1.1746 pcidevs
 --- pcidevs  8 Oct 2014 07:41:27 -   1.1746
 +++ pcidevs  9 Oct 2014 09:43:28 -
 @@ -1835,6 +1835,7 @@ product ATHEROS AR9300 0x0030  AR9300
  product ATHEROS AR9485  0x0032  AR9485
  product ATHEROS AR9462  0x0034  AR9462
  product ATHEROS AR9565  0x0036  AR9565
 +product ATHEROS AR9485  0x0037  AR9485
  product ATHEROS AR5210_AP   0x0207  AR5210
  product ATHEROS AR5212_IBM  0x1014  AR5212
  product ATHEROS AR5210_DEFAULT  0x1107  AR5210

 OK?

 I'm not sure about this.

 AR9485 is already in there as 0x0032. According to FreeBSD's
 ath_hal/ah_devid.h the ID 0x0037 maps to AR_PCIE... ?
 Linux ath9k calls it: PCI-E AR/AR9485

Missed that, sorry. It looks that there are a lot of names for this chip...
This card is AzureWave AW-NE195H. Some says it's Atheros AR and some -
that it's AR5B125...


 BTW, this card is not fully supported. After adding it's ID to if_athn_pci.c
 it gives me calibration error when I'm running `dhclient athn0`.
 I can test diffs or send it to one of the developers.

 Yes, this is a known issue. I've been trying to hunt this down for a while.
 Still no idea what's wrong with it.
 AFAIK the ar9003.c and ar9380.c files contain code which was never
 tested on real hardware by damien (see the CVS logs of these files).

I see.



Re: FIFO fd not marked readable after EOF

2014-10-09 Thread Todd C. Miller
Here is a better diff that passes the newly-updated regress test.
It does two extra things:

1) causes POLLHUP to be returned in revents on EOF

2) clears the EOF condition on read so when another writer
   connects we don't still have an EOF pending

Ultimately we should investigate using a separate named pipe
implementation instead of trying to emulate them using sockets.
Something like the FreeBSD approach of extending sys_pipe.c to
support named pipes is probably the way to go.

 - todd

Index: sys/miscfs/fifofs/fifo_vnops.c
===
RCS file: /cvs/src/sys/miscfs/fifofs/fifo_vnops.c,v
retrieving revision 1.41
diff -u -r1.41 fifo_vnops.c
--- sys/miscfs/fifofs/fifo_vnops.c  14 Sep 2014 14:17:26 -  1.41
+++ sys/miscfs/fifofs/fifo_vnops.c  9 Oct 2014 11:18:46 -
@@ -147,8 +147,8 @@
return (error);
}
fip-fi_readers = fip-fi_writers = 0;
+   wso-so_state |= SS_CANTSENDMORE;
wso-so_snd.sb_lowat = PIPE_BUF;
-   rso-so_state |= SS_CANTRCVMORE;
}
if (ap-a_mode  FREAD) {
fip-fi_readers++;
@@ -165,7 +165,7 @@
goto bad;
}
if (fip-fi_writers == 1) {
-   fip-fi_readsock-so_state = ~SS_CANTRCVMORE;
+   fip-fi_readsock-so_state = 
~(SS_CANTRCVMORE|SS_ISDISCONNECTED);
if (fip-fi_readers  0)
wakeup(fip-fi_readers);
}
@@ -224,6 +224,9 @@
ap-a_vp-v_fifoinfo-fi_writers == 0)
error = 0;
}
+   /* Clear EOF indicator so we have a clean slate for a new writer. */
+   if (error == 0)
+   rso-so_state = ~(SS_CANTRCVMORE|SS_ISDISCONNECTED);
return (error);
 }
 
@@ -287,24 +290,12 @@
 {
struct vop_poll_args *ap = v;
struct file filetmp;
-   short ostate;
int revents = 0;
 
if (ap-a_events  (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
-   /*
-* Socket and FIFO poll(2) semantics differ wrt EOF on read.
-* Unlike a normal socket, FIFOs don't care whether or not
-* SS_CANTRCVMORE is set.  To get the correct semantics we
-* must clear SS_CANTRCVMORE from so_state temporarily.
-*/
-   ostate = ap-a_vp-v_fifoinfo-fi_readsock-so_state;
-   if (ap-a_events  (POLLIN | POLLRDNORM))
-   ap-a_vp-v_fifoinfo-fi_readsock-so_state =
-   ~SS_CANTRCVMORE;
filetmp.f_data = ap-a_vp-v_fifoinfo-fi_readsock;
if (filetmp.f_data)
revents |= soo_poll(filetmp, ap-a_events, ap-a_p);
-   ap-a_vp-v_fifoinfo-fi_readsock-so_state = ostate;
}
if (ap-a_events  (POLLOUT | POLLWRNORM | POLLWRBAND)) {
filetmp.f_data = ap-a_vp-v_fifoinfo-fi_writesock;
@@ -344,8 +335,11 @@
socantsendmore(fip-fi_writesock);
}
if (ap-a_fflag  FWRITE) {
-   if (--fip-fi_writers == 0)
+   if (--fip-fi_writers == 0) {
+   /* SS_ISDISCONNECTED will result in POLLHUP */
+   fip-fi_readsock-so_state |= SS_ISDISCONNECTED;
socantrcvmore(fip-fi_readsock);
+   }
}
if (fip-fi_readers == 0  fip-fi_writers == 0) {
error1 = soclose(fip-fi_readsock);



Re: atheros 9485

2014-10-09 Thread Stefan Sperling
On Thu, Oct 09, 2014 at 03:53:19PM +0400, Kirill Bychkov wrote:
 On Thu, October 9, 2014 14:02, Stefan Sperling wrote:
  On Thu, Oct 09, 2014 at 01:48:23PM +0400, Kirill Bychkov wrote:
  Index: pcidevs
  ===
  RCS file: /cvs/src/sys/dev/pci/pcidevs,v
  retrieving revision 1.1746
  diff -u -p -u -r1.1746 pcidevs
  --- pcidevs8 Oct 2014 07:41:27 -   1.1746
  +++ pcidevs9 Oct 2014 09:43:28 -
  @@ -1835,6 +1835,7 @@ product ATHEROS AR9300   0x0030  AR9300
   product ATHEROS AR94850x0032  AR9485
   product ATHEROS AR94620x0034  AR9462
   product ATHEROS AR95650x0036  AR9565
  +product ATHEROS AR94850x0037  AR9485
   product ATHEROS AR5210_AP 0x0207  AR5210
   product ATHEROS AR5212_IBM0x1014  AR5212
   product ATHEROS AR5210_DEFAULT0x1107  AR5210
 
  OK?
 
  I'm not sure about this.
 
  AR9485 is already in there as 0x0032. According to FreeBSD's
  ath_hal/ah_devid.h the ID 0x0037 maps to AR_PCIE... ?
  Linux ath9k calls it: PCI-E AR/AR9485
 
 Missed that, sorry. It looks that there are a lot of names for this chip...
 This card is AzureWave AW-NE195H. Some says it's Atheros AR and some -
 that it's AR5B125...

I would suggest to settle on AR then, for now.



Re: armv7: banana pi, Allwinner A20 board

2014-10-09 Thread Jonathan Gray
Here are some updated images with the fix
for the interrupt controller on cortex a7/15.
http://marc.info/?l=openbsd-cvsm=141278003609690w=2

http://jsg.id.au/openbsd/armv7/bsd.SUNXI.umg
http://jsg.id.au/openbsd/armv7/bsd.rd.SUNXI.umg

Though it sounds like A20/sun7i handles the
timer in a different way to A10/sun4i, and there
is no driver in the tree for the 'gmac' Ethernet.

On Wed, Oct 08, 2014 at 11:11:48AM +0900, SASANO Takayoshi wrote:
 Hi, here is the log using bsd.SUNXI.umg instead of bsd.rd.SUNXI.img.
 (thanks to Theo)
 
 -c invokes UKC, but hangs up at there.
 
 --
 OpenBSD/sunxi booting ...
 arg0 0x0 arg1 0x10bb arg2 0x4100
 atag core flags 0 pagesize 0 rootdev 0
 atag cmdline [sd0i:/bsd -c]
 atag mem start 0x4000 size 0x4000
 bootfile: sd0i:/bsd
 bootargs: -c
 memory size derived from u-boot
 bootconf.mem[0].address = 4000 pages 262144/0x4000
 Allocating page tables
 freestart = 0x40b9a000, free_pages = 259174 (0x0003f466)
 IRQ stack: p0x40bc8000 v0xc0bc8000
 ABT stack: p0x40bc9000 v0xc0bc9000
 UND stack: p0x40bca000 v0xc0bca000
 SVC stack: p0x40bcb000 v0xc0bcb000
 Creating L1 page table at 0x40b9c000
 Mapping kernel
 Constructing L2 page tables
 undefined page pmap [ using 300196 bytes of bsd ELF symbol table ]
 Copyright (c) 1982, 1986, 1989, 1991, 1993
   The Regents of the University of California.  All rights reserved.
 Copyright (c) 1995-2014 OpenBSD. All rights reserved.  http://www.OpenBSD.org
 
 User Kernel Config
 UKC 
 
 -- 
 SASANO Takayoshi u...@mx5.nisiq.net



Fix CPU_INFO_FOREACH on powperc

2014-10-09 Thread Martin Pieuchot
If the macro is used before the secondary CPUs are running, it won't do
what you expect.

This makes profiling usable on macppc's GENERIC.MP.

Ok?

Index: include/cpu.h
===
RCS file: /cvs/src/sys/arch/powerpc/include/cpu.h,v
retrieving revision 1.57
diff -u -p -r1.57 cpu.h
--- include/cpu.h   8 Oct 2014 10:12:41 -   1.57
+++ include/cpu.h   9 Oct 2014 13:26:06 -
@@ -123,7 +123,7 @@ voidcpu_boot_secondary_processors(void)
 #define CPU_IS_PRIMARY(ci) ((ci)-ci_cpuid == 0)
 #define CPU_INFO_ITERATOR  int
 #define CPU_INFO_FOREACH(cii, ci)  \
-   for (cii = 0, ci = cpu_info[0]; cii  ncpus; cii++, ci++)
+   for (cii = 0, ci = cpu_info[0]; cii  ncpusfound; cii++, ci++)
 
 void cpu_unidle(struct cpu_info *);
 



rcctl(8): special services and flags

2014-10-09 Thread Patrik Lundin
Hello,

While working on rcctl(8) support for ansible I have run into a
situation I am not sure how to deal with.

Basically, if the user has supplied arguments we append
flags whatever the user requested and this works good.

If the user supplied no arguments, but there currently are flags set
in rc.conf.local we append an empty flags argument to reset the
default value.

The later behaviour causes a problem when modifying special services
like pf. When disabling pf a pf=NO is added to rc.conf.local as
expected, but when trying to enable it again it will fail because the
ansible module notices that flags are currently set (NO), and tries to
call rcctl enable pf flags which fails: 

---
# rcctl enable pf flags 
rcctl: pf is a special variable, cannot set flags
---

I am not sure how to deal with this properly since I do not want to
duplicate the _special_services variable in the module.

A possible solution to this would be to relax the flags check in rcctl,
so it only cares if there are actual flags supplied. See diff below for
a suggestion on how to deal with this which seems to work.

If I am going about this the wrong way any pointers are greatly
appreciated of course!

Regards,
Patrik Lundin

Index: rcctl.sh
===
RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
retrieving revision 1.38
diff -u -p -u -r1.38 rcctl.sh
--- rcctl.sh1 Sep 2014 18:01:55 -   1.38
+++ rcctl.sh9 Oct 2014 18:17:56 -
@@ -274,10 +274,14 @@ fi
 if [ -n $flag ]; then
if [ $flag = flags ]; then
if [ $action != enable ]; then
-   _rc_err ${0##*/}: \flags\ can only be set with 
\enable\
+   if [ -n $4 ]; then
+   _rc_err ${0##*/}: \flags\ can only be set 
with \enable\
+   fi
fi
if svc_is_special $svc; then
-   _rc_err ${0##*/}: \$svc\ is a special variable, 
cannot set \flags\
+   if [ -n $4 ]; then
+   _rc_err ${0##*/}: \$svc\ is a special 
variable, cannot set \flags\
+   fi
fi
if [ $4 = NO ]; then
_rc_err ${0##*/}: \flags NO\ contradicts \enable\



Re: improving OpenBSD's gmac.c...

2014-10-09 Thread Chris Cappuccio
Christian Weisgerber [na...@mips.inka.de] wrote:
 John-Mark Gurney:
 
  I also have an implementation of ghash that does a 4 bit lookup table
  version with the table split between cache lines in p4 at:
  https://p4db.freebsd.org/fileViewer.cgi?FSPC=//depot/projects/opencrypto/sys/opencrypto/gfmult.cREV=4
  
  This also has a version with does 4 blocks at a time getting a
  further speed up...
 
 FWIW, I did a quick  dirty merge of this into the OpenBSD tree and
 the speed of my test (net6501-50, tcpbench -u over esp aes-128-gmac)
 almost doubled.
 

That makes me horny.



Re: rcctl(8): special services and flags

2014-10-09 Thread Antoine Jacoutot
On Thu, Oct 09, 2014 at 09:02:14PM +0200, Patrik Lundin wrote:
 Hello,
 
 While working on rcctl(8) support for ansible I have run into a
 situation I am not sure how to deal with.
 
 Basically, if the user has supplied arguments we append
 flags whatever the user requested and this works good.
 
 If the user supplied no arguments, but there currently are flags set
 in rc.conf.local we append an empty flags argument to reset the
 default value.
 
 The later behaviour causes a problem when modifying special services
 like pf. When disabling pf a pf=NO is added to rc.conf.local as
 expected, but when trying to enable it again it will fail because the
 ansible module notices that flags are currently set (NO), and tries to
 call rcctl enable pf flags which fails: 

Why is ansible appending flags in the first place when no flags are configured?


 ---
 # rcctl enable pf flags 
 rcctl: pf is a special variable, cannot set flags
 ---
 
 I am not sure how to deal with this properly since I do not want to
 duplicate the _special_services variable in the module.
 
 A possible solution to this would be to relax the flags check in rcctl,
 so it only cares if there are actual flags supplied. See diff below for
 a suggestion on how to deal with this which seems to work.
 
 If I am going about this the wrong way any pointers are greatly
 appreciated of course!
 
 Regards,
 Patrik Lundin
 
 Index: rcctl.sh
 ===
 RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
 retrieving revision 1.38
 diff -u -p -u -r1.38 rcctl.sh
 --- rcctl.sh  1 Sep 2014 18:01:55 -   1.38
 +++ rcctl.sh  9 Oct 2014 18:17:56 -
 @@ -274,10 +274,14 @@ fi
  if [ -n $flag ]; then
   if [ $flag = flags ]; then
   if [ $action != enable ]; then
 - _rc_err ${0##*/}: \flags\ can only be set with 
 \enable\
 + if [ -n $4 ]; then
 + _rc_err ${0##*/}: \flags\ can only be set 
 with \enable\
 + fi
   fi
   if svc_is_special $svc; then
 - _rc_err ${0##*/}: \$svc\ is a special variable, 
 cannot set \flags\
 + if [ -n $4 ]; then
 + _rc_err ${0##*/}: \$svc\ is a special 
 variable, cannot set \flags\
 + fi
   fi
   if [ $4 = NO ]; then
   _rc_err ${0##*/}: \flags NO\ contradicts \enable\
 

-- 
Antoine



Re: rcctl(8): special services and flags

2014-10-09 Thread Ingo Schwarze
Hi Patrik,

Patrik Lundin wrote on Thu, Oct 09, 2014 at 09:02:14PM +0200:

 While working on rcctl(8) support for ansible I have run into a
 situation I am not sure how to deal with.
 
 Basically, if the user has supplied arguments we append
 flags whatever the user requested and this works good.
 
 If the user supplied no arguments, but there currently are flags set
 in rc.conf.local we append an empty flags argument to reset the
 default value.
 
 The later behaviour causes a problem when modifying special services
 like pf. When disabling pf a pf=NO is added to rc.conf.local as
 expected, but when trying to enable it again it will fail because the
 ansible module notices that flags are currently set (NO), and tries to
 call rcctl enable pf flags which fails: 
 
 ---
 # rcctl enable pf flags 
 rcctl: pf is a special variable, cannot set flags
 ---
 
 I am not sure how to deal with this properly since I do not want to
 duplicate the _special_services variable in the module.

Indeed, i'd consider that a bad idea.

Besides, i see your problem.  I don't see a good way either to
find out that for running a service without flags

 - both enable sshd and enable sshd flags works
 - only enable tftpd flags works, but enable tftpd sets an argument
 - only enable pf works, enable pf flags errors out

I agree that always allowing the flags keyword simplifies usage.

 A possible solution to this would be to relax the flags check in rcctl,
 so it only cares if there are actual flags supplied. See diff below for
 a suggestion on how to deal with this which seems to work.

The first half of the patch seems pointless to me.
Why do you want to allow disable foo flags?
Or am i overlooking something?

The second half is ok schwarze@ if Antoine wants to commit,
though i'd slightly prefer the simplified version given below.

Yours,
  Ingo


Index: rcctl.sh
===
RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
retrieving revision 1.38
diff -u -p -r1.38 rcctl.sh
--- rcctl.sh1 Sep 2014 18:01:55 -   1.38
+++ rcctl.sh9 Oct 2014 19:41:57 -
@@ -276,7 +276,7 @@ if [ -n $flag ]; then
if [ $action != enable ]; then
_rc_err ${0##*/}: \flags\ can only be set with 
\enable\
fi
-   if svc_is_special $svc; then
+   if svc_is_special $svc  [ -n $4 ]; then
_rc_err ${0##*/}: \$svc\ is a special variable, 
cannot set \flags\
fi
if [ $4 = NO ]; then


 Index: rcctl.sh
 ===
 RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
 retrieving revision 1.38
 diff -u -p -u -r1.38 rcctl.sh
 --- rcctl.sh  1 Sep 2014 18:01:55 -   1.38
 +++ rcctl.sh  9 Oct 2014 18:17:56 -
 @@ -274,10 +274,14 @@ fi
  if [ -n $flag ]; then
   if [ $flag = flags ]; then
   if [ $action != enable ]; then
 - _rc_err ${0##*/}: \flags\ can only be set with 
 \enable\
 + if [ -n $4 ]; then
 + _rc_err ${0##*/}: \flags\ can only be set 
 with \enable\
 + fi
   fi
   if svc_is_special $svc; then
 - _rc_err ${0##*/}: \$svc\ is a special variable, 
 cannot set \flags\
 + if [ -n $4 ]; then
 + _rc_err ${0##*/}: \$svc\ is a special 
 variable, cannot set \flags\
 + fi
   fi
   if [ $4 = NO ]; then
   _rc_err ${0##*/}: \flags NO\ contradicts \enable\



Re: rcctl(8): special services and flags

2014-10-09 Thread Patrik Lundin
On Thu, Oct 09, 2014 at 10:02:50PM +0200, Antoine Jacoutot wrote:
  
  The later behaviour causes a problem when modifying special services
  like pf. When disabling pf a pf=NO is added to rc.conf.local as
  expected, but when trying to enable it again it will fail because the
  ansible module notices that flags are currently set (NO), and tries to
  call rcctl enable pf flags which fails: 
 
 Why is ansible appending flags in the first place when no flags are 
 configured?
 

An example would be if the user started out with supplying -s to ntpd
and then changes his mind and removes the flag. The idea is to then call
rcctl with an empty flags argument to get the default set of flags
instead.

It was my understanding from the man page that this was the approriate
way to do it, am I mistaken?

Regards,
Patrik Lundin



Re: rcctl(8): special services and flags

2014-10-09 Thread Patrik Lundin
On Thu, Oct 09, 2014 at 10:04:44PM +0200, Ingo Schwarze wrote:
  A possible solution to this would be to relax the flags check in rcctl,
  so it only cares if there are actual flags supplied. See diff below for
  a suggestion on how to deal with this which seems to work.
 
 The first half of the patch seems pointless to me.
 Why do you want to allow disable foo flags?
 Or am i overlooking something?
 

I agree the first half may be pointless, I was only trying to be
symmetrical in the handling of the flags keyword so it works both ways:
---
# rcctl enable pf flags 
# rcctl disable pf flags
---

I don't feel strongly about this though, either way is fine for my
needs.


 The second half is ok schwarze@ if Antoine wants to commit,
 though i'd slightly prefer the simplified version given below.
 

Looks good to me :).

Regards,
Patrik Lundin



rcctl(8): Fetch default service flags

2014-10-09 Thread Patrik Lundin
Hello,

This is another question triggered by working on rcctl(8) support for 
the ansible service module.

The module wants to figure out if it should reset the flags in
rc.conf.local to the default set if no arguments are supplied by the 
user.

The problem with this is that there is no way to find out what the 
default flags are. This makes it hard to deal with a service like nfsd
where 'status' will return -tun 4 by default or whatever the user has 
set previously otherwise.

I noticed there is a function in rcctl already that finds this
out: svc_default_enabled_flags(). Being able to call this via some
argument to rcctl would solve my problem.

I am leaving out a diff because I have no idea what a good name for such
an argument would be, but just calling svc_default_enabled_flags $svc in the
script seems to return what I need.

Regards,
Patrik Lundin



Re: rcctl(8): special services and flags

2014-10-09 Thread Antoine Jacoutot
 An example would be if the user started out with supplying -s to ntpd
 and then changes his mind and removes the flag. The idea is to then call
 rcctl with an empty flags argument to get the default set of flags
 instead.
 
 It was my understanding from the man page that this was the approriate
 way to do it, am I mistaken?

Hmm actually that makes sense yes.
Let me sleep on it... ;-)

-- 
Antoine



Re: armv7: banana pi, Allwinner A20 board

2014-10-09 Thread SASANO Takayoshi
Hello,

Here is the log of new image.
Booting with -c option, UKC still hangs up.

I hope the log helps debugging.

Regards,

-- 
SASANO Takayoshi u...@mx5.nisiq.net

U-Boot SPL 2014.04-10694-g2ae8b32-dirty (Oct 01 2014 - 17:40:04)
Board: Bananapi
DRAM: 1024 MiB
CPU: 96000Hz, AXI/AHB/APB: 3/2/2
spl: not an uImage at 1600


U-Boot 2014.04-10694-g2ae8b32-dirty (Oct 01 2014 - 17:40:04) Allwinner 
Technology

CPU:   Allwinner A20 (SUN7I)
Board: Bananapi
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:serial
Out:   serial
Err:   serial
Net:   dwmac.1c5
Hit any key to stop autoboot:  0 
reading uEnv.txt
118 bytes read in 16 ms (6.8 KiB/s)
Loaded environment from uEnv.txt
Running uenvcmd ...
reading bsd.umg
7386560 bytes read in 364 ms (19.4 MiB/s)
## Booting kernel from Legacy Image at 6000 ...
   Image Name:   boot
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:7386496 Bytes = 7 MiB
   Load Address: 4080
   Entry Point:  4080
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...


OpenBSD/sunxi booting ...
arg0 0x0 arg1 0x10bb arg2 0x4100
atag core flags 0 pagesize 0 rootdev 0
atag cmdline [sd0i:/bsd -c]
atag mem start 0x4000 size 0x4000
bootfile: sd0i:/bsd
bootargs: -c
memory size derived from u-boot
bootconf.mem[0].address = 4000 pages 262144/0x4000
Allocating page tables
freestart = 0x40f0c000, free_pages = 258292 (0x0003f0f4)
IRQ stack: p0x40f3a000 v0xc0f3a000
ABT stack: p0x40f3b000 v0xc0f3b000
UND stack: p0x40f3c000 v0xc0f3c000
SVC stack: p0x40f3d000 v0xc0f3d000
Creating L1 page table at 0x40f0c000
Mapping kernel
Constructing L2 page tables
undefined page pmap [ using 170728 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2014 OpenBSD. All rights reserved.  http://www.OpenBSD.org

kernel does not support -c; continuing..
OpenBSD 5.6-current (RAMDISK-SUNXI) #1: Thu Oct  9 21:03:32 AEDT 2014
r...@armv7.jsg.id.au:/usr/src/sys/arch/armv7/compile/RAMDISK-SUNXI
real mem  = 1073741824 (1024MB)
avail mem = 1036165120 (988MB)
warning: no entropy supplied by boot loader
mainbus0 at root
cortex0 at mainbus0
ampintc0 at cortex0 nirq 160
cpu0 at mainbus0: ARM Cortex A7 rev 4 (ARMv7 core)
cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu0: 32KB(32b/l,2way) I-cache, 32KB(64b/l,4way) wr-back D-cache
sunxi0 at mainbus0: A20
sxipio0 at sunxi0
sxiccmu0 at sunxi0
sxitimer0 at sunxi0: ticktimer 100hz @ 32KHz
sxitimer1 at sunxi0: stattimer 128hz @ 32KHz
sxitimer2 at sunxi0: cntrtimer @ 32KHz
sxidog0 at sunxi0
sxirtc0 at sunxi0
sxiuart0 at sunxi0: console
sxiuart1 at sunxi0
sxiuart2 at sunxi0
sxiuart3 at sunxi0
sxiuart4 at sunxi0
sxiuart5 at sunxi0
sxiuart6 at sunxi0
sxiuart7 at sunxi0
sxie0 at sunxi0, address 02:99:03:c2:d2:6e
ukphy0 at sxie0 phy 0: Generic IEEE 802.3u media interface, rev. 5: OUI 
0x000732, model 0x0011
ukphy1 at sxie0 phy 1: Generic IEEE 802.3u media interface, rev. 5: OUI 
0x000732, model 0x0011
ahci0 at sunxi0 AHCI 1.1
pmap_fault_fixup: va c5544000 ftype 2 s pte 7ff9301e
panic: uvm_fault: fault on non-pageable map (0xc0e7f28c, 0xc5544000)
Stopped at  Debugger+0x4:   ldrbr15, [r15, r15, ror r15]!
panic+0x18
scp=0xc083a39c rlv=0xc08c2f54 (uvm_fault+0xca8)
rsp=0xc0f3eaec rfp=0xc0f3ec0c
uvm_fault+0xc
scp=0xc08c22b8 rlv=0xc08fe588 (data_abort_handler+0x248)
rsp=0xc0f3ec10 rfp=0xc0f3ec64
r10=0xc0f3ec68 r9=0xc0f3d000 r8=0x r7=0xc0e9f764
r6=0x0002 r5=0xc0ebc7b4 r4=0xc5544000
data_abort_handler+0xc
scp=0xc08fe34c rlv=0xc08fdd54 (address_exception_entry+0x50)
rsp=0xc0f3ec68 rfp=0xc0f3eccc
r10=0xc0ebd1b4 r9=0x0200 r8=0x014c r7=0x000a
r6=0x0009 r5=0xc5544e00 r4=0x0010
poison_mem+0xc
scp=0xc0835bb8 rlv=0xc081df20 (malloc+0x2ec)
rsp=0xc0f3ecd0 rfp=0xc0f3ed38
r5=0xc5544000 r4=0xc5544e00
malloc+0x10
scp=0xc081dc44 rlv=0xc08fcee8 (_bus_dmamap_create+0x40)
rsp=0xc0f3ed3c rfp=0xc0f3ed5c
r10=0x r9=0x7ff97000 r8=0x r7=0x0003
r6=0x0001 r5=0x0040 r4=0x0018
_bus_dmamap_create+0x10
scp=0xc08fceb8 rlv=0xc0804384 (ahci_port_alloc+0x34c)
rsp=0xc0f3ed60 rfp=0xc0f3edb0
r7=0xc553b300 r6=0xc548a200 r5=0xc5542000 r4=0x
ahci_port_alloc+0x10
scp=0xc0804048 rlv=0xc0804814 (ahci_attach+0x80)
rsp=0xc0f3edb4 rfp=0xc0f3ede8
r10=0xc0f3ee5c r9=0xc0f3ee5c r8=0x r7=0xc553b300
r6=0xc553b300 r5=0x0001 r4=0x
ahci_attach+0xc
scp=0xc08047a0 rlv=0xc0931fb0 (sxiahci_attach+0x480)
rsp=0xc0f3edec rfp=0xc0f3ee18
r6=0xc0904420 r5=0x r4=0xd1135000
sxiahci_attach+0x10
scp=0xc0931b40 rlv=0xc08309e0 (config_attach+0x1d4)
rsp=0xc0f3ee1c 

Add Logitech C310 to usbdevs

2014-10-09 Thread Jonathan Armani
Hi,

Diff add my Logitech Webcam C310 to usbdevs.
 
Bus 000 Device 003: ID 046d:081b Logitech, Inc. Webcam C310

ok ?


Index: usbdevs
===
RCS file: /cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.637
diff -u -p -r1.637 usbdevs
--- usbdevs 5 Oct 2014 08:32:39 -   1.637
+++ usbdevs 9 Oct 2014 20:56:21 -
@@ -2493,6 +2493,7 @@ product LOGITECH QUICKCAMWEB  0x0801  Quic
 product LOGITECH WEBCAMC2000x0802  Webcam C200
 product LOGITECH WEBCAMC5000x0807  Webcam C500
 product LOGITECH QUICKCAMPRO   0x0810  QuickCam Pro
+product LOGITECH WEBCAMC3100x081b  Webcam C310
 product LOGITECH HDPROC910 0x0821  HD Pro Webcam C910
 product LOGITECH QUICKCAMEXP   0x0840  QuickCam Express
 product LOGITECH QUICKCAM  0x0850  QuickCam
Index: usbdevs.h
===
RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v
retrieving revision 1.649
diff -u -p -r1.649 usbdevs.h
--- usbdevs.h   5 Oct 2014 08:33:13 -   1.649
+++ usbdevs.h   9 Oct 2014 20:56:23 -
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdevs.h,v 1.649 2014/10/05 08:33:13 mpi Exp $   */
+/* $OpenBSD$   */
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -2500,6 +2500,7 @@
 #defineUSB_PRODUCT_LOGITECH_WEBCAMC200 0x0802  /* Webcam C200 
*/
 #defineUSB_PRODUCT_LOGITECH_WEBCAMC500 0x0807  /* Webcam C500 
*/
 #defineUSB_PRODUCT_LOGITECH_QUICKCAMPRO0x0810  /* 
QuickCam Pro */
+#defineUSB_PRODUCT_LOGITECH_WEBCAMC310 0x081b  /* Webcam C310 
*/
 #defineUSB_PRODUCT_LOGITECH_HDPROC910  0x0821  /* HD Pro 
Webcam C910 */
 #defineUSB_PRODUCT_LOGITECH_QUICKCAMEXP0x0840  /* 
QuickCam Express */
 #defineUSB_PRODUCT_LOGITECH_QUICKCAM   0x0850  /* QuickCam */
Index: usbdevs_data.h
===
RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v
retrieving revision 1.643
diff -u -p -r1.643 usbdevs_data.h
--- usbdevs_data.h  5 Oct 2014 08:33:13 -   1.643
+++ usbdevs_data.h  9 Oct 2014 20:56:25 -
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdevs_data.h,v 1.643 2014/10/05 08:33:13 mpi Exp $  */
+/* $OpenBSD$   */
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -5488,6 +5488,10 @@ const struct usb_known_product usb_known
{
USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMPRO,
QuickCam Pro,
+   },
+   {
+   USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_WEBCAMC310,
+   Webcam C310,
},
{
USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_HDPROC910,



Re: rcctl(8): Fetch default service flags

2014-10-09 Thread Antoine Jacoutot
 The module wants to figure out if it should reset the flags in
 rc.conf.local to the default set if no arguments are supplied by the 
 user.

Can you provide an example. Because if not arguments are supplied, according to 
your previous mail, it should run like:
rcctl enable foobar flags
which will reset the flags anyway.

 The problem with this is that there is no way to find out what the 
 default flags are. This makes it hard to deal with a service like nfsd

But why do you need that exactly?
Note that I am not against modifying rcctl, I am just trying to understand the 
need...

-- 
Antoine



Add Logitech C310 to uvideo(4)

2014-10-09 Thread Jonathan Armani
Hi,

The Logitech Webcam C310 just works, diff add it to uvideo(4).

ok ?


Index: uvideo.4
===
RCS file: /cvs/src/share/man/man4/uvideo.4,v
retrieving revision 1.35
diff -u -p -r1.35 uvideo.4
--- uvideo.417 Sep 2012 11:04:24 -  1.35
+++ uvideo.49 Oct 2014 20:58:27 -
@@ -77,6 +77,8 @@ Logitech QuickCam Ultra Vision
 .It
 Logitech Webcam C200
 .It
+Logitech Webcam C310
+.It
 Logitech Webcam C500
 .It
 Microsoft LifeCam NX-6000



[diff] wc - type consistency

2014-10-09 Thread Nicolas Bedos
The following diff improves type consistency in wc: the return type of
read() is ssize_t, so the type of 'len' should be ssize_t too. There is
no reason for it to be an int.

Nicolas Bedos


Index: src/usr.bin/wc/wc.c
===
RCS file: /cvs/src/usr.bin/wc/wc.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 wc.c
--- src/usr.bin/wc/wc.c 27 Nov 2013 13:32:02 -  1.16
+++ src/usr.bin/wc/wc.c 9 Oct 2014 20:31:37 -
@@ -111,7 +111,7 @@ cnt(char *file)
 {
u_char *C;
short gotsp;
-   int len;
+   ssize_t len;
int64_t linect, wordct, charct;
struct stat sbuf;
int fd;



Re: rcctl(8): Fetch default service flags

2014-10-09 Thread Patrik Lundin
On Thu, Oct 09, 2014 at 10:58:34PM +0200, Antoine Jacoutot wrote:
  The module wants to figure out if it should reset the flags in
  rc.conf.local to the default set if no arguments are supplied by the 
  user.
 
 Can you provide an example. Because if not arguments are supplied, according 
 to your previous mail, it should run like:
 rcctl enable foobar flags
 which will reset the flags anyway.
 
  The problem with this is that there is no way to find out what the 
  default flags are. This makes it hard to deal with a service like nfsd
 
 But why do you need that exactly?
 Note that I am not against modifying rcctl, I am just trying to understand 
 the need...
 

Sorry, I should probably have been more clear on the reason I need it :).

The main issue from the ansible perspective is to know if we are _going_
to change something or not. The user may for example run ansible in
--check mode where it should only report if it is about to change
something or not.

Even when not running in --check mode the module needs to report if
something was changed or not.

Regards,
Patrik Lundin



Re: Add Logitech C310 to usbdevs

2014-10-09 Thread Martin Pieuchot
On 09/10/14(Thu) 22:58, Jonathan Armani wrote:
 Hi,
 
 Diff add my Logitech Webcam C310 to usbdevs.
  
 Bus 000 Device 003: ID 046d:081b Logitech, Inc. Webcam C310

What do you see in your dmesg when you don't have this entry in usbdevs?
Is it understandable?

I'm asking, because generally USB device names can be read from the
device descriptor.  My point is that, if you don't need to use this
define to whitelist a specific device in a driver, adding it to the 
list just makes the kernel bigger.

Since most of the devices attaching to uvideo(4) are matched by
interface, I think that we should simply remove the unused defines of
the Webcams: there's no point in maintaining an unmaintainable list :)

 Index: usbdevs
 ===
 RCS file: /cvs/src/sys/dev/usb/usbdevs,v
 retrieving revision 1.637
 diff -u -p -r1.637 usbdevs
 --- usbdevs   5 Oct 2014 08:32:39 -   1.637
 +++ usbdevs   9 Oct 2014 20:56:21 -
 @@ -2493,6 +2493,7 @@ product LOGITECH QUICKCAMWEB0x0801  Quic
  product LOGITECH WEBCAMC200  0x0802  Webcam C200
  product LOGITECH WEBCAMC500  0x0807  Webcam C500
  product LOGITECH QUICKCAMPRO 0x0810  QuickCam Pro
 +product LOGITECH WEBCAMC310  0x081b  Webcam C310
  product LOGITECH HDPROC910   0x0821  HD Pro Webcam C910
  product LOGITECH QUICKCAMEXP 0x0840  QuickCam Express
  product LOGITECH QUICKCAM0x0850  QuickCam
 Index: usbdevs.h
 ===
 RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v
 retrieving revision 1.649
 diff -u -p -r1.649 usbdevs.h
 --- usbdevs.h 5 Oct 2014 08:33:13 -   1.649
 +++ usbdevs.h 9 Oct 2014 20:56:23 -
 @@ -1,4 +1,4 @@
 -/*   $OpenBSD: usbdevs.h,v 1.649 2014/10/05 08:33:13 mpi Exp $   */
 +/*   $OpenBSD$   */
  
  /*
   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
 @@ -2500,6 +2500,7 @@
  #define  USB_PRODUCT_LOGITECH_WEBCAMC200 0x0802  /* Webcam C200 
 */
  #define  USB_PRODUCT_LOGITECH_WEBCAMC500 0x0807  /* Webcam C500 
 */
  #define  USB_PRODUCT_LOGITECH_QUICKCAMPRO0x0810  /* 
 QuickCam Pro */
 +#define  USB_PRODUCT_LOGITECH_WEBCAMC310 0x081b  /* Webcam C310 
 */
  #define  USB_PRODUCT_LOGITECH_HDPROC910  0x0821  /* HD Pro 
 Webcam C910 */
  #define  USB_PRODUCT_LOGITECH_QUICKCAMEXP0x0840  /* 
 QuickCam Express */
  #define  USB_PRODUCT_LOGITECH_QUICKCAM   0x0850  /* QuickCam */
 Index: usbdevs_data.h
 ===
 RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v
 retrieving revision 1.643
 diff -u -p -r1.643 usbdevs_data.h
 --- usbdevs_data.h5 Oct 2014 08:33:13 -   1.643
 +++ usbdevs_data.h9 Oct 2014 20:56:25 -
 @@ -1,4 +1,4 @@
 -/*   $OpenBSD: usbdevs_data.h,v 1.643 2014/10/05 08:33:13 mpi Exp $  */
 +/*   $OpenBSD$   */
  
  /*
   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
 @@ -5488,6 +5488,10 @@ const struct usb_known_product usb_known
   {
   USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMPRO,
   QuickCam Pro,
 + },
 + {
 + USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_WEBCAMC310,
 + Webcam C310,
   },
   {
   USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_HDPROC910,
 



Re: rcctl(8): Fetch default service flags

2014-10-09 Thread Antoine Jacoutot
 Sorry, I should probably have been more clear on the reason I need it :).
 
 The main issue from the ansible perspective is to know if we are _going_
 to change something or not. The user may for example run ansible in
 --check mode where it should only report if it is about to change
 something or not.

Ok but then I don't understand why you need to know the default flags :-)
If you run rcctl status, it will tell you the current flags of the daemon; if 
these differ from the new flags you want to pass ansible then 'ansible --check' 
will report you that it will change the flags. Which is correct, no ?
Or did I misundertand something (I probably did...).

-- 
Antoine



Re: rcctl(8): Fetch default service flags

2014-10-09 Thread Patrik Lundin
On Thu, Oct 09, 2014 at 11:25:58PM +0200, Antoine Jacoutot wrote:
  Sorry, I should probably have been more clear on the reason I need it :).
  
  The main issue from the ansible perspective is to know if we are _going_
  to change something or not. The user may for example run ansible in
  --check mode where it should only report if it is about to change
  something or not.
 
 Ok but then I don't understand why you need to know the default
 flags :-)
 If you run rcctl status, it will tell you the current flags of the
 daemon; if these differ from the new flags you want to pass ansible
 then 'ansible --check' will report you that it will change the flags.
 Which is correct, no ?
 Or did I misundertand something (I probably did...).
 

The problem occurs when I try to manage a service like nfsd which has a
default set of flags. Consider the following commands, which basically
performs what ansible does when the user is not supplying any extra
arguments:
---
# rcctl status nfsd
NO
# rcctl enable nfsd 
  
# rcctl status nfsd 
-tun 4
#
---

If I now run the tool again, still without any supplied arguments, it
will compare the empty set of user supplied flags to -tun 4 which
always differs. So ansible will now think it needs to change something
forever :).

To solve this I need the default flags to compare to the output of
'status'.

Regards,
Patrik Lundin



Re: Add Logitech C310 to usbdevs

2014-10-09 Thread Jonathan Armani
Before

uvideo0 at uhub0 port 4 configuration 1 interface 0 Logitech product
0x081b rev 2.00/0.12 addr 4

After

uvideo0 at uhub0 port 4 configuration 1 interface 0 Logitech Webcam C310
rev 2.00/0.12 addr 3

2014-10-09 23:20 GMT+02:00 Martin Pieuchot mpieuc...@nolizard.org:

 On 09/10/14(Thu) 22:58, Jonathan Armani wrote:
  Hi,
 
  Diff add my Logitech Webcam C310 to usbdevs.
 
  Bus 000 Device 003: ID 046d:081b Logitech, Inc. Webcam C310

 What do you see in your dmesg when you don't have this entry in usbdevs?
 Is it understandable?

 I'm asking, because generally USB device names can be read from the
 device descriptor.  My point is that, if you don't need to use this
 define to whitelist a specific device in a driver, adding it to the
 list just makes the kernel bigger.

 Since most of the devices attaching to uvideo(4) are matched by
 interface, I think that we should simply remove the unused defines of
 the Webcams: there's no point in maintaining an unmaintainable list :)

  Index: usbdevs
  ===
  RCS file: /cvs/src/sys/dev/usb/usbdevs,v
  retrieving revision 1.637
  diff -u -p -r1.637 usbdevs
  --- usbdevs   5 Oct 2014 08:32:39 -   1.637
  +++ usbdevs   9 Oct 2014 20:56:21 -
  @@ -2493,6 +2493,7 @@ product LOGITECH QUICKCAMWEB0x0801  Quic
   product LOGITECH WEBCAMC200  0x0802  Webcam C200
   product LOGITECH WEBCAMC500  0x0807  Webcam C500
   product LOGITECH QUICKCAMPRO 0x0810  QuickCam Pro
  +product LOGITECH WEBCAMC310  0x081b  Webcam C310
   product LOGITECH HDPROC910   0x0821  HD Pro Webcam C910
   product LOGITECH QUICKCAMEXP 0x0840  QuickCam Express
   product LOGITECH QUICKCAM0x0850  QuickCam
  Index: usbdevs.h
  ===
  RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v
  retrieving revision 1.649
  diff -u -p -r1.649 usbdevs.h
  --- usbdevs.h 5 Oct 2014 08:33:13 -   1.649
  +++ usbdevs.h 9 Oct 2014 20:56:23 -
  @@ -1,4 +1,4 @@
  -/*   $OpenBSD: usbdevs.h,v 1.649 2014/10/05 08:33:13 mpi Exp $   */
  +/*   $OpenBSD$   */
 
   /*
* THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  @@ -2500,6 +2500,7 @@
   #define  USB_PRODUCT_LOGITECH_WEBCAMC200 0x0802  /* Webcam
 C200 */
   #define  USB_PRODUCT_LOGITECH_WEBCAMC500 0x0807  /* Webcam
 C500 */
   #define  USB_PRODUCT_LOGITECH_QUICKCAMPRO0x0810  /*
 QuickCam Pro */
  +#define  USB_PRODUCT_LOGITECH_WEBCAMC310 0x081b  /* Webcam
 C310 */
   #define  USB_PRODUCT_LOGITECH_HDPROC910  0x0821  /* HD Pro
 Webcam C910 */
   #define  USB_PRODUCT_LOGITECH_QUICKCAMEXP0x0840  /*
 QuickCam Express */
   #define  USB_PRODUCT_LOGITECH_QUICKCAM   0x0850  /*
 QuickCam */
  Index: usbdevs_data.h
  ===
  RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v
  retrieving revision 1.643
  diff -u -p -r1.643 usbdevs_data.h
  --- usbdevs_data.h5 Oct 2014 08:33:13 -   1.643
  +++ usbdevs_data.h9 Oct 2014 20:56:25 -
  @@ -1,4 +1,4 @@
  -/*   $OpenBSD: usbdevs_data.h,v 1.643 2014/10/05 08:33:13 mpi Exp $  */
  +/*   $OpenBSD$   */
 
   /*
* THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  @@ -5488,6 +5488,10 @@ const struct usb_known_product usb_known
{
USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMPRO,
QuickCam Pro,
  + },
  + {
  + USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_WEBCAMC310,
  + Webcam C310,
},
{
USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_HDPROC910,
 



Re: rcctl(8): Fetch default service flags

2014-10-09 Thread Patrik Lundin
On Thu, Oct 09, 2014 at 11:51:50PM +0200, Patrik Lundin wrote:
 
 To solve this I need the default flags to compare to the output of
 'status'.
 

... I guess another solution could be if 'status' only showed flags that
differed from the default.

Regards,
Patrik Lundin



Re: improving OpenBSD's gmac.c...

2014-10-09 Thread Damien Miller
On Thu, 9 Oct 2014, Christian Weisgerber wrote:

 John-Mark Gurney:
 
  I also have an implementation of ghash that does a 4 bit lookup table
  version with the table split between cache lines in p4 at:
  https://p4db.freebsd.org/fileViewer.cgi?FSPC=//depot/projects/opencrypto/sys/opencrypto/gfmult.cREV=4
  
  This also has a version with does 4 blocks at a time getting a
  further speed up...
 
 FWIW, I did a quick  dirty merge of this into the OpenBSD tree and
 the speed of my test (net6501-50, tcpbench -u over esp aes-128-gmac)
 almost doubled.

isn't this likely to make it more likely to be subject to timing
attacks?

-d



Re: replace select with poll in libc

2014-10-09 Thread David Gwynne
On Thu, Oct 09, 2014 at 05:36:07AM -0600, Todd C. Miller wrote:
 Two comments inline, otherwise OK.

like this?

a couple of people also suggested changing select to poll in the
error messages.

Index: net/rcmd.c
===
RCS file: /cvs/src/lib/libc/net/rcmd.c,v
retrieving revision 1.56
diff -u -p -r1.56 rcmd.c
--- net/rcmd.c  18 Nov 2009 07:43:22 -  1.56
+++ net/rcmd.c  10 Oct 2014 04:39:32 -
@@ -46,6 +46,7 @@
 #include string.h
 #include syslog.h
 #include stdlib.h
+#include poll.h
 
 int
 rcmd(char **ahost, int rport, const char *locuser, const char *remuser,
@@ -63,7 +64,6 @@ rcmd_af(char **ahost, int porta, const c
struct addrinfo hints, *res, *r;
int error;
struct sockaddr_storage from;
-   fd_set *readsp = NULL;
sigset_t oldmask, mask;
pid_t pid;
int s, lport, timo;
@@ -188,18 +188,14 @@ rcmd_af(char **ahost, int porta, const c
write(s, , 1);
lport = 0;
} else {
+   struct pollfd pfd[2];
char num[8];
int s2 = rresvport_af(lport, af), s3;
socklen_t len = sizeof(from);
-   int fdssize = howmany(MAX(s, s2)+1, NFDBITS) * sizeof(fd_mask);
 
if (s2  0)
goto bad;
-   readsp = (fd_set *)malloc(fdssize);
-   if (readsp == NULL) {
-   close(s2);
-   goto bad;
-   }
+
listen(s2, 1);
(void)snprintf(num, sizeof(num), %d, lport);
if (write(s, num, strlen(num)+1) != strlen(num)+1) {
@@ -210,19 +206,21 @@ rcmd_af(char **ahost, int porta, const c
goto bad;
}
 again:
-   bzero(readsp, fdssize);
-   FD_SET(s, readsp);
-   FD_SET(s2, readsp);
+   pfd[0].fd = s;
+   pfd[0].events = POLLIN|POLLHUP;
+   pfd[1].fd = s2;
+   pfd[1].events = POLLIN|POLLHUP;
+
errno = 0;
-   if (select(MAX(s, s2) + 1, readsp, 0, 0, 0)  1 ||
-   !FD_ISSET(s2, readsp)) {
+   if (poll(pfd, 2, INFTIM)  1 ||
+   (pfd[1].revents  POLLIN) == 0) {
if (errno != 0)
(void)fprintf(stderr,
-   rcmd: select (setting up stderr): %s\n,
+   rcmd: poll (setting up stderr): %s\n,
strerror(errno));
else
(void)fprintf(stderr,
-   select: protocol failure in circuit setup\n);
+   poll: protocol failure in circuit setup\n);
(void)close(s2);
goto bad;
}
@@ -288,14 +286,11 @@ again:
goto bad2;
}
sigprocmask(SIG_SETMASK, oldmask, NULL);
-   free(readsp);
return (s);
 bad2:
if (lport)
(void)close(*fd2p);
 bad:
-   if (readsp)
-   free(readsp);
(void)close(s);
sigprocmask(SIG_SETMASK, oldmask, NULL);
return (-1);



Re: replace select with poll in libc

2014-10-09 Thread David Gwynne
On Fri, Oct 10, 2014 at 02:42:08PM +1000, David Gwynne wrote:
 On Thu, Oct 09, 2014 at 05:36:07AM -0600, Todd C. Miller wrote:
  Two comments inline, otherwise OK.
 
 like this?
 
 a couple of people also suggested changing select to poll in the
 error messages.

theo made me look at where i was using POLLHUP, so i read your
comment and the poll manpage again.

Index: net/rcmd.c
===
RCS file: /cvs/src/lib/libc/net/rcmd.c,v
retrieving revision 1.56
diff -u -p -r1.56 rcmd.c
--- net/rcmd.c  18 Nov 2009 07:43:22 -  1.56
+++ net/rcmd.c  10 Oct 2014 05:16:13 -
@@ -46,6 +46,7 @@
 #include string.h
 #include syslog.h
 #include stdlib.h
+#include poll.h
 
 int
 rcmd(char **ahost, int rport, const char *locuser, const char *remuser,
@@ -63,7 +64,6 @@ rcmd_af(char **ahost, int porta, const c
struct addrinfo hints, *res, *r;
int error;
struct sockaddr_storage from;
-   fd_set *readsp = NULL;
sigset_t oldmask, mask;
pid_t pid;
int s, lport, timo;
@@ -188,18 +188,14 @@ rcmd_af(char **ahost, int porta, const c
write(s, , 1);
lport = 0;
} else {
+   struct pollfd pfd[2];
char num[8];
int s2 = rresvport_af(lport, af), s3;
socklen_t len = sizeof(from);
-   int fdssize = howmany(MAX(s, s2)+1, NFDBITS) * sizeof(fd_mask);
 
if (s2  0)
goto bad;
-   readsp = (fd_set *)malloc(fdssize);
-   if (readsp == NULL) {
-   close(s2);
-   goto bad;
-   }
+
listen(s2, 1);
(void)snprintf(num, sizeof(num), %d, lport);
if (write(s, num, strlen(num)+1) != strlen(num)+1) {
@@ -210,19 +206,21 @@ rcmd_af(char **ahost, int porta, const c
goto bad;
}
 again:
-   bzero(readsp, fdssize);
-   FD_SET(s, readsp);
-   FD_SET(s2, readsp);
+   pfd[0].fd = s;
+   pfd[0].events = POLLIN;
+   pfd[1].fd = s2;
+   pfd[1].events = POLLIN;
+
errno = 0;
-   if (select(MAX(s, s2) + 1, readsp, 0, 0, 0)  1 ||
-   !FD_ISSET(s2, readsp)) {
+   if (poll(pfd, 2, INFTIM)  1 ||
+   (pfd[1].revents  (POLLIN|POLLHUP)) == 0) {
if (errno != 0)
(void)fprintf(stderr,
-   rcmd: select (setting up stderr): %s\n,
+   rcmd: poll (setting up stderr): %s\n,
strerror(errno));
else
(void)fprintf(stderr,
-   select: protocol failure in circuit setup\n);
+   poll: protocol failure in circuit setup\n);
(void)close(s2);
goto bad;
}
@@ -288,14 +286,11 @@ again:
goto bad2;
}
sigprocmask(SIG_SETMASK, oldmask, NULL);
-   free(readsp);
return (s);
 bad2:
if (lport)
(void)close(*fd2p);
 bad:
-   if (readsp)
-   free(readsp);
(void)close(s);
sigprocmask(SIG_SETMASK, oldmask, NULL);
return (-1);