Re: sqlite3 3.7.14.1

2012-11-27 Thread Antoine Jacoutot
On Tue, Nov 27, 2012 at 09:44:47AM +0100, Marc Espie wrote:
 On Tue, Nov 27, 2012 at 07:59:29AM +0100, Landry Breuil wrote:
  Hi,
  
  here's a 250k diff to update our base sqlite3 to the latest 3.7.14.1 :
  http://rhaalovely.net/~landry/shared/sqlite-3.7.14.1.diff
  I hope i got the diff right, iirc no local modifications were made to
  the actual code.
 
 I've had the same diff (more or less) in my tree for a while.
 
 It's just painful to import properly (since we have a proper vendor
 branch on sqlite as it is really clean software), which explains why
 I'm late in committing it.
 
 I'll try to sit down properly and commit it tonight...

FWIW I've been running your sqlite diff for a while on several installations 
without any regression.

-- 
Antoine



Re: hostname.if(5) clarification

2012-11-27 Thread Franco Fichtner
On Nov 26, 2012, at 9:44 PM, Christian Weisgerber na...@mips.inka.de wrote:

 Todd T. Fries t...@fries.net wrote:
 
 If there are desires to improve this (I hear Naddy grumbling!) then the
 stomach to break backwards compat must be present, or suggestions on how
 to do it without breaking backwards compat must be suggested.
 
 My suggestion is two-fold:
 
 * Introduce a new format.  This new format will ignore # comments,
  call ! commands, but otherwise pass on everything unchanged to
  ifconfig.  I'm neutral on the matter of retaining dhcp and
  rtsol as shortcuts for !dhclient \$if and !rtsol \$if.
 
 * To maintain backward compatibility, retain the old parsing for
  hostname.* files.  Interface configuration files in the new format
  will have a different name; if.* or whatever.
 
 Does that sound workable?

I like new format, but I'm not sure the road to go should be the
hostname.if type of format. Ordering could be imposed on such a
format in the likes of whatnot.if.priority - and you'll end up
with a mess of configuration files.

So how about a single new config file (implemented in the style of
Christian's suggestions, which also provides the following things:

(1) new syntax is invoked like this:

if {
up
down
}

(It would also be possible to provide inline backwards compatibility
with the old syntax, but I don't think this file is the right place
to put it, see below)

(2) the old style hostname.if files are invoked using solely this:

if

(3) allow wildcards to be used, so that the default and fully
compatible file is:

*

If you don't like the hostname.if stuff, you simple delete the config
file or remove/comment out that wildcard line. You can also impose
ordering this way, but you're on your own then:

re0
re1
# invoking * would be stupid now...

Next issue would probably be running external scripts in the new
format from this file. Maybe like so:

if /path/to/settings

The syntax is debatable, and there are probably a few consistency
considerations: what is executed in the old format and what is
not? But then this format would be something to migrate to if it's
feasible, so maybe the only backwards compatible way should be
for (2).


Franco



Re: hostname.if(5) clarification

2012-11-27 Thread Christiano F. Haesbaert
On 26 November 2012 22:06, Stuart Henderson s...@spacehopper.org wrote:
 On 2012/11/26 17:40, Jason McIntyre wrote:
 anyway...i still dislike the idea of just saying order matters. also,
 could someone really expect the file to not be parsed top down

 Yes, I think they might; people are used to config files being read
 and parsed before being applied, and because this file isn't a straight
 set of commands to pass to ifconfig(8) I think it's not unreasonable
 that someone should treat it as a config file.


I never liked the way hostname.if works, but I also dislike the idea
of a new configuration file.
If we do any change, I'd vote for a script where the user enters all
ifconfig calls explicitly, we can't do this in rc.conf.local since it
is too late on the boot process.



Re: hostname.if(5) clarification

2012-11-27 Thread Jiri B
On Tue, Nov 27, 2012 at 10:25:39AM +0200, Gregory Edigarov wrote:
 On 11/27/2012 09:03 AM, Claudio Jeker wrote:
 On Mon, Nov 26, 2012 at 05:36:20PM -0700, Theo de Raadt wrote:
 If there are desires to improve this (I hear Naddy grumbling!) then the
 stomach to break backwards compat must be present, or suggestions on how
 to do it without breaking backwards compat must be suggested.
 My suggestion is two-fold:
 
 * Introduce a new format.  This new format will ignore # comments,
   call ! commands, but otherwise pass on everything unchanged to
   ifconfig.  I'm neutral on the matter of retaining dhcp and
   rtsol as shortcuts for !dhclient \$if and !rtsol \$if.
 
 * To maintain backward compatibility, retain the old parsing for
   hostname.* files.  Interface configuration files in the new format
   will have a different name; if.* or whatever.
 
 Does that sound workable?
 Not really.  The netbsd experiment with ifconfig file format does
 not appear to have been a success.
 
 reason why? ifconfig has a really crummy argument parser, with all
 sorts of side effects. hostname.* files were supposed to isolate
 people from some of those nasty effects.
 
 stated simply, it would not have helped Paul.  He would have made
 the same mistake.
 
 Plus some interface changes need multiple ifconfig commands and a specific
 order to work. I think there is no way to express complex interface
 configurations without having an order in which the operations are done.
 Sure it is possible to throw the ordering all into netstart but I think
 that is not helpful.
 
 hostname.if is exactly what I dislike in all OpenBSD. I think the
 whole concept of it is leading to errors and misunderstanding. The
 very design is flawed. What I do right after the first boot is:
 mv /etc/netstart /etc/netstart.dist
 rm -f /etc/hostname.*
 and then vi /etc/netstart, inserting the plain ifconfigs, routes,
 call of clients etc.
 that way i have full control over network configuration.

IIRC Edd Barrett has an idea to create ifconfid - a daemon which would
setup networking on OpenBSD.

http://marc.info/?l=openbsd-techm=130450257324306w=2#1

jirib



Re: hostname.if(5) clarification

2012-11-27 Thread Stuart Henderson
On 2012/11/26 22:24, Christian Weisgerber wrote:
 Mark Kettenis:
 
  I don't really see what this buys us.  You still have to maintain the
  backwards compat code.  You'll end up with an inconsistent mess of
  hostname.if and if.whatever files.  And all of this to fix what exactly?
 
 To preserve my sanity every time I need to figure out how to bring
 ifconfig commands into a format that passes through the transformations
 done by the hostname.if parser.
 
 Remember how we were struggling with -autoconfprivacy a few months
 ago?

I am mostly happy with hostname.if, but I would find it useful
to have a nicer syntax that allows ignoring other parsing and
feeds the line directly to ifconfig interface. In sample config
files posted in various places I have often seen people abuse up
for this but that's no good, I don't want the interface up half-way
through config.

If there are no changes to the parser then I think it would help
to be explicit in the manual,

 The packed format is not compatible with the ifconfig(8)
 command line format.

 To pass a line directly to ifconfig and prevent it from being
 interpreted as a packed format, use !ifconfig \$if flags.

This is one of the first things that was run into by some people
who I suggested tried bgpd, so it clearly affects people who are
familiar with networking and used to making somewhat careful
configuration changes.

I have to check both ifconfig and hostname.if manpages pretty
much every time I add an alias, as I'm not keen on running
netstart just to add an address to an existing interface (as
it wipes out existing aliases temporarily) so I need to use
both formats, and neither are particularly memorable
(I think I may change my files to !ifconfig ... format
now, it's ugly but it will avoid errors; not least because
then I can use /prefix notation rather than netmasks).



X540T: link is not detected

2012-11-27 Thread mxb
Hi tech@,

ix(4) does not detects link then cable is plugged in into already running 
machine.

ix0: 
flags=28b43UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST,NOINET6 
mtu 1500
lladdr bc:30:5b:f3:60:10
description: HW_EXT
priority: 0
media: Ethernet autoselect (1000baseT full-duplex)
status: active
inet 172.16.0.232 netmask 0xf800 broadcast 172.16.7.255
ix1: 
flags=28b43UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST,NOINET6 
mtu 1500
lladdr bc:30:5b:f3:60:12
description: HW_INT
priority: 0
media: Ethernet autoselect
status: no carrier
inet 192.168.10.3 netmask 0xff00 broadcast 192.168.10.255

ix0 at pci1 dev 0 function 0 Intel X540T rev 0x01: msi
ix1 at pci1 dev 0 function 1 Intel X540T rev 0x01: msi

//maxim



Re: X540T: link is not detected

2012-11-27 Thread mxb
There is however, no problem then:

plugged - boot - wait - unplug - wait - plug in.

On 27 nov 2012, at 13:50, mxb m...@alumni.chalmers.se wrote:

 
 Hi tech@,
 
 ix(4) does not detects link then cable is plugged in into already running 
 machine.
 
 ix0: 
 flags=28b43UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST,NOINET6 
 mtu 1500
lladdr bc:30:5b:f3:60:10
description: HW_EXT
priority: 0
media: Ethernet autoselect (1000baseT full-duplex)
status: active
inet 172.16.0.232 netmask 0xf800 broadcast 172.16.7.255
 ix1: 
 flags=28b43UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST,NOINET6 
 mtu 1500
lladdr bc:30:5b:f3:60:12
description: HW_INT
priority: 0
media: Ethernet autoselect
status: no carrier
inet 192.168.10.3 netmask 0xff00 broadcast 192.168.10.255
 
 ix0 at pci1 dev 0 function 0 Intel X540T rev 0x01: msi
 ix1 at pci1 dev 0 function 1 Intel X540T rev 0x01: msi
 
 //maxim



PMAP_NOCACHE - PMAP_NC

2012-11-27 Thread Martin Pieuchot
While working on drm support for macppc that makes use of non-cached
memory I found that some platforms (amd64, i386, powerpc) use the MD
PMAP_NOCACHE flag where others (sparc, sparc64, solbourne) use PMAP_NC
for the same purpose.

Because I'd like to use this flag in the drm code and for coherency
the diff below rename PMAP_NOCACHE into PMAP_NC.

Tested on macppc and amd64, ok?


Index: amd64/amd64/bus_dma.c
===
RCS file: /cvs/src/sys/arch/amd64/amd64/bus_dma.c,v
retrieving revision 1.38
diff -u -p -r1.38 bus_dma.c
--- amd64/amd64/bus_dma.c   3 Jul 2011 18:31:02 -   1.38
+++ amd64/amd64/bus_dma.c   27 Nov 2012 09:38:11 -
@@ -476,7 +476,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
}
 
if (flags  BUS_DMA_NOCACHE)
-   pmapflags |= PMAP_NOCACHE;
+   pmapflags |= PMAP_NC;
 
size = round_page(size);
va = uvm_km_valloc(kernel_map, size);
Index: amd64/amd64/bus_space.c
===
RCS file: /cvs/src/sys/arch/amd64/amd64/bus_space.c,v
retrieving revision 1.20
diff -u -p -r1.20 bus_space.c
--- amd64/amd64/bus_space.c 23 May 2012 08:23:43 -  1.20
+++ amd64/amd64/bus_space.c 27 Nov 2012 09:38:11 -
@@ -241,7 +241,7 @@ x86_mem_add_mapping(bus_addr_t bpa, bus_
paddr_t pa, endpa;
vaddr_t va;
bus_size_t map_size;
-   int pmap_flags = PMAP_NOCACHE;
+   int pmap_flags = PMAP_NC;
 
pa = trunc_page(bpa);
endpa = round_page(bpa + size);
Index: amd64/amd64/pmap.c
===
RCS file: /cvs/src/sys/arch/amd64/amd64/pmap.c,v
retrieving revision 1.63
diff -u -p -r1.63 pmap.c
--- amd64/amd64/pmap.c  17 May 2011 18:06:13 -  1.63
+++ amd64/amd64/pmap.c  27 Nov 2012 09:38:11 -
@@ -441,7 +441,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
pte = kvtopte(va);
 
npte = (pa  PMAP_PA_MASK) | ((prot  VM_PROT_WRITE) ? PG_RW : PG_RO) |
-   ((pa  PMAP_NOCACHE) ? PG_N : 0) |
+   ((pa  PMAP_NC) ? PG_N : 0) |
((pa  PMAP_WC) ? pmap_pg_wc : 0) | PG_V;
 
/* special 1:1 mappings in the first 2MB must not be global */
@@ -457,7 +457,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
panic(pmap_kenter_pa: PG_PS);
 #endif
if (pmap_valid_entry(opte)) {
-   if (pa  PMAP_NOCACHE  (opte  PG_N) == 0)
+   if (pa  PMAP_NC  (opte  PG_N) == 0)
wbinvd();
/* This shouldn't happen */
pmap_tlb_shootpage(pmap_kernel(), va);
@@ -1946,7 +1946,7 @@ pmap_enter(struct pmap *pmap, vaddr_t va
struct pv_entry *pve = NULL;
int ptpdelta, wireddelta, resdelta;
boolean_t wired = (flags  PMAP_WIRED) != 0;
-   boolean_t nocache = (pa  PMAP_NOCACHE) != 0;
+   boolean_t nocache = (pa  PMAP_NC) != 0;
boolean_t wc = (pa  PMAP_WC) != 0;
int error;
 
Index: amd64/include/pmap.h
===
RCS file: /cvs/src/sys/arch/amd64/include/pmap.h,v
retrieving revision 1.39
diff -u -p -r1.39 pmap.h
--- amd64/include/pmap.h30 Jun 2011 22:18:01 -  1.39
+++ amd64/include/pmap.h27 Nov 2012 09:42:29 -
@@ -325,7 +325,7 @@ struct pmap {
  * MD flags that we use for pmap_enter (in the pa):
  */
 #define PMAP_PA_MASK   ~((paddr_t)PAGE_MASK) /* to remove the flags */
-#definePMAP_NOCACHE0x1 /* set the non-cacheable bit. */
+#definePMAP_NC 0x1 /* set the non-cacheable bit. */
 #definePMAP_WC 0x2 /* set page write combining. */
 
 /*
Index: i386/i386/bus_dma.c
===
RCS file: /cvs/src/sys/arch/i386/i386/bus_dma.c,v
retrieving revision 1.25
diff -u -p -r1.25 bus_dma.c
--- i386/i386/bus_dma.c 23 Jun 2011 20:44:39 -  1.25
+++ i386/i386/bus_dma.c 27 Nov 2012 09:38:11 -
@@ -431,7 +431,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
int curseg, pmapflags = 0, ret;
 
if (flags  BUS_DMA_NOCACHE)
-   pmapflags |= PMAP_NOCACHE;
+   pmapflags |= PMAP_NC;
 
size = round_page(size);
va = uvm_km_valloc(kernel_map, size);
Index: i386/i386/machdep.c
===
RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.517
diff -u -p -r1.517 machdep.c
--- i386/i386/machdep.c 10 Nov 2012 09:45:05 -  1.517
+++ i386/i386/machdep.c 27 Nov 2012 09:38:11 -
@@ -3710,7 +3710,7 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_
paddr_t pa, endpa;
vaddr_t va;
bus_size_t map_size;
-   int pmap_flags = PMAP_NOCACHE;
+   int pmap_flags = PMAP_NC;
 
pa = trunc_page(bpa);
endpa = round_page(bpa + size);
Index: i386/i386/pmap.c

Re: hostname.if(5) clarification

2012-11-27 Thread Christian Weisgerber
Stuart Henderson s...@spacehopper.org wrote:

 On 2012/11/26 22:24, Christian Weisgerber wrote:
 [...]

After some further reflection, I think I agree with sthen.

 I am mostly happy with hostname.if, but I would find it useful
 to have a nicer syntax that allows ignoring other parsing and
 feeds the line directly to ifconfig interface. In sample config
 files posted in various places I have often seen people abuse up
 for this but that's no good, I don't want the interface up half-way
 through config.

Yes, yes.

 If there are no changes to the parser then I think it would help
 to be explicit in the manual,
 
  The packed format is not compatible with the ifconfig(8)
  command line format.
 
  To pass a line directly to ifconfig and prevent it from being
  interpreted as a packed format, use !ifconfig \$if flags.

Yes.

 (I think I may change my files to !ifconfig ... format
 now, it's ugly but it will avoid errors; not least because
 then I can use /prefix notation rather than netmasks).

Yes.  I'm switching to !ifconfig for everything but trivial addresses.

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



Re: hostname.if(5) clarification

2012-11-27 Thread Marco S Hyman
 To pass a line directly to ifconfig and prevent it from being
 interpreted as a packed format, use !ifconfig \$if flags.
 
 Yes.
 
 (I think I may change my files to !ifconfig ... format
 now, it's ugly but it will avoid errors; not least because
 then I can use /prefix notation rather than netmasks).
 
 Yes.  I'm switching to !ifconfig for everything but trivial addresses.


How about a minimal change to hostname.* processing that adds a keyword used
to pass the rest of the line to ifconfig.  Minimal change that is, IMHO,
less obnoxious that typing !ifconfig \$if.  Maybe something like

pass ifconfig args for interface

--- netstartSun Dec 11 13:31:14 2011
+++ netstart.newTue Nov 27 10:57:27 2012
@@ -79,6 +79,9 @@
!*) # parse commands
cmd=${af#*!} ${name} ${mask} ${bcaddr} ${ext1} ${ext2}
;;
+   pass)
+   cmd=ifconfig $if ${name} ${mask} ${bcaddr} ${ext1} 
${ext2}
+   ;;
dhcp)
[ $name = NONE ]  name=
[ $mask = NONE ]  mask=



Re: raw_usrreq - spl diff

2012-11-27 Thread Mike Belopuhov
As you might have already noticed, the diff was committed.
Thanks!

On Mon, Nov 26, 2012 at 8:34 PM, David Hill dh...@mindcry.org wrote:
 Any thoughts?

 On Tue, Nov 13, 2012 at 02:18:35PM -0500, David Hill wrote:
Hello -

I originally asked mikeb if splnet was needed in net/pfkey.c.  He added
onto my diff (which I have included below).  I noticed route_usrreq from
net/rtsock.c calls raw_usrreq protected by splsoftnet.

I thought I'd send it to tech@ to possibly get more feedback.

Here is the diff I am running with.  I haven't had any regressions.

Index: sys/net/pfkey.c
===
RCS file: /cvs/src/sys/net/pfkey.c,v
retrieving revision 1.19
diff -N -u -p sys/net/pfkey.c
--- sys/net/pfkey.c20 Sep 2012 10:25:03 -  1.19
+++ sys/net/pfkey.c11 Nov 2012 01:18:42 -
@@ -198,15 +198,12 @@ static int
 pfkey_attach(struct socket *socket, struct mbuf *proto, struct proc *p)
 {
   int rval;
-  int s;

   if (!(socket-so_pcb = malloc(sizeof(struct rawcb),
   M_PCB, M_DONTWAIT | M_ZERO)))
   return (ENOMEM);

-  s = splnet();
   rval = raw_usrreq(socket, PRU_ATTACH, NULL, proto, NULL, p);
-  splx(s);
   if (rval)
   goto ret;

@@ -228,12 +225,10 @@ ret:
 static int
 pfkey_detach(struct socket *socket, struct proc *p)
 {
-  int rval, i, s;
+  int rval, i;

   rval = pfkey_versions[socket-so_proto-pr_protocol]-release(socket);
-  s = splnet();
   i = raw_usrreq(socket, PRU_DETACH, NULL, NULL, NULL, p);
-  splx(s);

   if (!rval)
   rval = i;
@@ -246,7 +241,6 @@ pfkey_usrreq(struct socket *socket, int req, struct mb
 struct mbuf *nam, struct mbuf *control, struct proc *p)
 {
   int rval;
-  int s;

   if ((socket-so_proto-pr_protocol  PFKEY_PROTOCOL_MAX) ||
   (socket-so_proto-pr_protocol  0) ||
@@ -261,9 +255,7 @@ pfkey_usrreq(struct socket *socket, int req, struct mb
   return (pfkey_detach(socket, p));

   default:
-  s = splnet();
   rval = raw_usrreq(socket, req, mbuf, nam, control, p);
-  splx(s);
   }

   return (rval);
Index: sys/net/raw_usrreq.c
===
RCS file: /cvs/src/sys/net/raw_usrreq.c,v
retrieving revision 1.14
diff -N -u -p sys/net/raw_usrreq.c
--- sys/net/raw_usrreq.c   11 Jan 2012 23:47:06 -  1.14
+++ sys/net/raw_usrreq.c   11 Nov 2012 01:18:42 -
@@ -151,7 +151,7 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m,
 {
   struct rawcb *rp = sotorawcb(so);
   int error = 0;
-  int len;
+  int len, s;

   if (req == PRU_CONTROL)
   return (EOPNOTSUPP);
@@ -163,6 +163,7 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m,
   error = EINVAL;
   goto release;
   }
+  s = splsoftnet();
   switch (req) {

   /*
@@ -269,6 +270,7 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m,
   /*
* stat: don't bother with a blocksize.
*/
+  splx(s);
   return (0);

   /*
@@ -276,6 +278,7 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m,
*/
   case PRU_RCVOOB:
   case PRU_RCVD:
+  splx(s);
   return (EOPNOTSUPP);

   case PRU_LISTEN:
@@ -308,6 +311,7 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m,
   panic(raw_usrreq);
   }
 release:
+  splx(s);
   if (m != NULL)
   m_freem(m);
   return (error);



clonable bpf

2012-11-27 Thread Mike Belopuhov
apparently it works just fine.  the number of clones is limited
by the v_specbitmap which currently allows for 64 clones total
(per system, not per process).

apply the diff and see how all your apps are happily using single
device node: /dev/bpf0.

thanks to pedro and thib for the spec_open_clone and guenther
for helping out big time.

i'm not 100% sure we want this but why wouldn't we?
generally speaking we also need to move to a single /dev/bpf
node, but that can be done, once this diff is tested and we all
agree that this is a way to go.

so please test and share your thoughts.


diff --git sys/sys/conf.h sys/sys/conf.h
index b2ee90c..46937fd 100644
--- sys/sys/conf.h
+++ sys/sys/conf.h
@@ -313,7 +313,7 @@ extern struct cdevsw cdevsw[];
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev, \
-   0, 0, dev_init(c,n,kqfilter) }
+   0, D_CLONE, dev_init(c,n,kqfilter) }
 
 /* open, close, ioctl */
 #definecdev_lkm_init(c,n) { \



Re: clonable bpf

2012-11-27 Thread Mike Belopuhov
On Tue, Nov 27, 2012 at 22:17 +0100, Mike Belopuhov wrote:
 apparently it works just fine.  the number of clones is limited
 by the v_specbitmap which currently allows for 64 clones total
 (per system, not per process).
 
 apply the diff and see how all your apps are happily using single
 device node: /dev/bpf0.
 
 thanks to pedro and thib for the spec_open_clone and guenther
 for helping out big time.
 
 i'm not 100% sure we want this but why wouldn't we?
 generally speaking we also need to move to a single /dev/bpf
 node, but that can be done, once this diff is tested and we all
 agree that this is a way to go.
 
 so please test and share your thoughts.
 

for those who wants to have lots of (1024) nodes available:

diff --git sys/sys/conf.h sys/sys/conf.h
index b2ee90c..46937fd 100644
--- sys/sys/conf.h
+++ sys/sys/conf.h
@@ -313,7 +313,7 @@ extern struct cdevsw cdevsw[];
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev, \
-   0, 0, dev_init(c,n,kqfilter) }
+   0, D_CLONE, dev_init(c,n,kqfilter) }
 
 /* open, close, ioctl */
 #definecdev_lkm_init(c,n) { \
diff --git sys/sys/specdev.h sys/sys/specdev.h
index 4341a35..1801d9a 100644
--- sys/sys/specdev.h
+++ sys/sys/specdev.h
@@ -46,7 +46,7 @@ struct specinfo {
daddr64_t si_lastr;
union {
struct vnode *ci_parent; /* pointer back to parent device */
-   u_int8_t ci_bitmap[8]; /* bitmap of devices cloned off us */
+   u_int8_t ci_bitmap[128]; /* bitmap of devices cloned off us */
} si_ci;
 };



rtsock: filter out unwanted rt flags

2012-11-27 Thread Claudio Jeker
Hi,

There are two flags which are not used or only used by the kernel
(outgoing to userland). When userlands sends rt messages with these flags
they do no harm but show up in route(8) and netstat(1). IMO we should
scrub those flags out since they will just confuse people.

OK?
-- 
:wq Claudio

Index: net/rtsock.c
===
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.123
diff -u -p -r1.123 rtsock.c
--- net/rtsock.c20 Sep 2012 20:53:13 -  1.123
+++ net/rtsock.c27 Nov 2012 22:13:56 -
@@ -543,6 +543,7 @@ route_output(struct mbuf *m, ...)
 
/* make sure that kernel-only bits are not set */
rtm-rtm_priority = RTP_MASK;
+   rtm-rtm_flags = ~(RTF_DONE|RTF_MASK);
 
if (rtm-rtm_priority != 0) {
if (rtm-rtm_priority  RTP_MAX) {



Re: rtsock: filter out unwanted rt flags

2012-11-27 Thread Mike Belopuhov
On Tue, Nov 27, 2012 at 11:30 PM, Claudio Jeker
cje...@diehard.n-r-g.com wrote:
 Hi,

 There are two flags which are not used or only used by the kernel
 (outgoing to userland). When userlands sends rt messages with these flags
 they do no harm but show up in route(8) and netstat(1). IMO we should
 scrub those flags out since they will just confuse people.

 OK?

ok



Re: hostname.if(5) clarification

2012-11-27 Thread Alexander Hall

On 11/27/12 16:20, Christian Weisgerber wrote:

Stuart Henderson s...@spacehopper.org wrote:


On 2012/11/26 22:24, Christian Weisgerber wrote:
[...]


After some further reflection, I think I agree with sthen.


I am mostly happy with hostname.if, but I would find it useful
to have a nicer syntax that allows ignoring other parsing and
feeds the line directly to ifconfig interface. In sample config
files posted in various places I have often seen people abuse up
for this but that's no good, I don't want the interface up half-way
through config.


Yes, yes.


If there are no changes to the parser then I think it would help
to be explicit in the manual,

  The packed format is not compatible with the ifconfig(8)
  command line format.

  To pass a line directly to ifconfig and prevent it from being
  interpreted as a packed format, use !ifconfig \$if flags.


Yes.


(I think I may change my files to !ifconfig ... format
now, it's ugly but it will avoid errors; not least because
then I can use /prefix notation rather than netmasks).


Yes.  I'm switching to !ifconfig for everything but trivial addresses.



IIRC, isn't there a few distinct (non-ifconfig-compatible) cases we 
handle specially, and the rest is passed as-is to ifconfig? Meaning you 
already have the sought functionality? Granted, I'm no user of advanced 
network configurations, and in the cases where I am, I mostly hack up 
some shell script to fix it for me.


Either way, the \$if notation is ugly as fuck and to me only smells of 
failure to do write a decent parser in shell code.


Should I ever find enough spare time, I would love to make the 
hostname.if parsing saner.


/Alexander



Re: hostname.if(5) clarification

2012-11-27 Thread Stuart Henderson
On 2012/11/27 23:50, Alexander Hall wrote:
 IIRC, isn't there a few distinct (non-ifconfig-compatible) cases we
 handle specially,

yes, but it's the important ones: inet and inet6.

inet by itself is pretty easy, it's the default anyway so you can
just write 11.22.33.44/28 directly in hostname.if.

inet6 isn't too bad unless you use a weird prefixlen.

inet alias is the biggest problem.



Re: set ifp-if_baudrate with IF_Gbps() / IF_Mbps()

2012-11-27 Thread Brad Smith
On Sat, Nov 24, 2012 at 10:24:00PM -0500, Brad Smith wrote:
 On Fri, Nov 23, 2012 at 11:57:50AM -0200, Gleydson Soares wrote:
  set ifp-if_baudrate with IF_Gbps() / IF_Mbps().
  
  OK ?
 
 Although it has already been commited its the wrong direction to go in.
 These should be removed as the MII framework deals with this properly,
 plus you missed a bunch of drivers.

An updated diff now that the other bits have been commited.

OK?


Index: arch/socppc/dev/if_tsec.c
===
RCS file: /cvs/src/sys/arch/socppc/dev/if_tsec.c,v
retrieving revision 1.28
diff -u -p -r1.28 if_tsec.c
--- arch/socppc/dev/if_tsec.c   21 Dec 2009 19:58:57 -  1.28
+++ arch/socppc/dev/if_tsec.c   28 Nov 2012 01:15:57 -
@@ -413,7 +413,6 @@ tsec_attach(struct device *parent, struc
ifp-if_ioctl = tsec_ioctl;
ifp-if_start = tsec_start;
ifp-if_watchdog = tsec_watchdog;
-   ifp-if_baudrate = IF_Gbps(1);
IFQ_SET_MAXLEN(ifp-if_snd, TSEC_NTXDESC - 1);
IFQ_SET_READY(ifp-if_snd);
bcopy(sc-sc_dev.dv_xname, ifp-if_xname, IFNAMSIZ);
Index: dev/ic/dc.c
===
RCS file: /cvs/src/sys/dev/ic/dc.c,v
retrieving revision 1.124
diff -u -p -r1.124 dc.c
--- dev/ic/dc.c 7 Jul 2011 20:42:56 -   1.124
+++ dev/ic/dc.c 28 Nov 2012 01:16:01 -
@@ -1731,7 +1731,6 @@ hasmac:
ifp-if_ioctl = dc_ioctl;
ifp-if_start = dc_start;
ifp-if_watchdog = dc_watchdog;
-   ifp-if_baudrate = 1000;
IFQ_SET_MAXLEN(ifp-if_snd, DC_TX_LIST_CNT - 1);
IFQ_SET_READY(ifp-if_snd);
bcopy(sc-sc_dev.dv_xname, ifp-if_xname, IFNAMSIZ);
Index: dev/ic/if_wi.c
===
RCS file: /cvs/src/sys/dev/ic/if_wi.c,v
retrieving revision 1.150
diff -u -p -r1.150 if_wi.c
--- dev/ic/if_wi.c  21 Jun 2011 16:52:45 -  1.150
+++ dev/ic/if_wi.c  28 Nov 2012 01:16:03 -
@@ -237,7 +237,6 @@ wi_attach(struct wi_softc *sc, struct wi
ifp-if_ioctl = funcs-f_ioctl;
ifp-if_start = funcs-f_start;
ifp-if_watchdog = funcs-f_watchdog;
-   ifp-if_baudrate = 1000;
IFQ_SET_READY(ifp-if_snd);
 
(void)wi_set_ssid(sc-wi_node_name, WI_DEFAULT_NODENAME,
Index: dev/ic/mtd8xx.c
===
RCS file: /cvs/src/sys/dev/ic/mtd8xx.c,v
retrieving revision 1.18
diff -u -p -r1.18 mtd8xx.c
--- dev/ic/mtd8xx.c 21 Jun 2011 16:52:45 -  1.18
+++ dev/ic/mtd8xx.c 28 Nov 2012 01:16:03 -
@@ -163,7 +163,6 @@ mtd_attach(struct mtd_softc *sc)
ifp-if_ioctl = mtd_ioctl;
ifp-if_start = mtd_start;
ifp-if_watchdog = mtd_watchdog;
-   ifp-if_baudrate = 1000;
IFQ_SET_READY(ifp-if_snd);
bcopy(sc-sc_dev.dv_xname, ifp-if_xname, IFNAMSIZ);
 
Index: dev/ic/rtl81x9.c
===
RCS file: /cvs/src/sys/dev/ic/rtl81x9.c,v
retrieving revision 1.75
diff -u -p -r1.75 rtl81x9.c
--- dev/ic/rtl81x9.c21 Jun 2011 16:52:45 -  1.75
+++ dev/ic/rtl81x9.c28 Nov 2012 01:16:04 -
@@ -1213,7 +1213,6 @@ rl_attach(struct rl_softc *sc)
ifp-if_ioctl = rl_ioctl;
ifp-if_start = rl_start;
ifp-if_watchdog = rl_watchdog;
-   ifp-if_baudrate = 1000;
IFQ_SET_READY(ifp-if_snd);
 
bcopy(sc-sc_dev.dv_xname, ifp-if_xname, IFNAMSIZ);
Index: dev/pci/if_age.c
===
RCS file: /cvs/src/sys/dev/pci/if_age.c,v
retrieving revision 1.19
diff -u -p -r1.19 if_age.c
--- dev/pci/if_age.c19 Oct 2011 05:23:44 -  1.19
+++ dev/pci/if_age.c28 Nov 2012 01:16:07 -
@@ -231,7 +231,6 @@ age_attach(struct device *parent, struct
ifp-if_ioctl = age_ioctl;
ifp-if_start = age_start;
ifp-if_watchdog = age_watchdog;
-   ifp-if_baudrate = IF_Gbps(1);
IFQ_SET_MAXLEN(ifp-if_snd, AGE_TX_RING_CNT - 1);
IFQ_SET_READY(ifp-if_snd);
bcopy(sc-age_eaddr, sc-sc_arpcom.ac_enaddr, ETHER_ADDR_LEN);
Index: dev/pci/if_alc.c
===
RCS file: /cvs/src/sys/dev/pci/if_alc.c,v
retrieving revision 1.21
diff -u -p -r1.21 if_alc.c
--- dev/pci/if_alc.c19 Oct 2011 05:23:44 -  1.21
+++ dev/pci/if_alc.c28 Nov 2012 01:16:08 -
@@ -847,7 +847,6 @@ alc_attach(struct device *parent, struct
ifp-if_ioctl = alc_ioctl;
ifp-if_start = alc_start;
ifp-if_watchdog = alc_watchdog;
-   ifp-if_baudrate = IF_Gbps(1);
IFQ_SET_MAXLEN(ifp-if_snd, ALC_TX_RING_CNT - 1);
IFQ_SET_READY(ifp-if_snd);
bcopy(sc-alc_eaddr, sc-sc_arpcom.ac_enaddr, ETHER_ADDR_LEN);
Index: dev/pci/if_ale.c
===
RCS file: /cvs/src/sys/dev/pci/if_ale.c,v
retrieving revision 

rc.d/sshd reload test

2012-11-27 Thread Alexander Hall
Make sure new config is valid before SIGHUP'ing sshd, which would
otherwise just kill it. Invalid configuration now gives:

# pgrep sshd
18998
# /etc/rc.d/sshd reload 
sshd(failed)
# pgrep sshd 
18998

Pros: Less risk of accidentally killing sshd and locking yourself out.
Cons: You may think that you have made changes that have not taken
  effect, and will still screw you after a reboot.

I think the pros win anyway.

OK?

/Alexander

Index: rc.d/sshd
===
RCS file: /data/openbsd/cvs/src/etc/rc.d/sshd,v
retrieving revision 1.1
diff -u -p -r1.1 sshd
--- rc.d/sshd   6 Jul 2011 18:55:36 -   1.1
+++ rc.d/sshd   28 Nov 2012 00:27:01 -
@@ -6,4 +6,8 @@ daemon=/usr/sbin/sshd
  . /etc/rc.d/rc.subr
 +rc_reload() {
+   ${daemon} ${daemon_flags} -t  pkill -HUP -f ^${pexp}
+}
+
 rc_cmd $1



Re: rc.d/sshd reload test

2012-11-27 Thread Antoine Jacoutot
On Wed, Nov 28, 2012 at 08:28:10AM +0100, Alexander Hall wrote:
 Make sure new config is valid before SIGHUP'ing sshd, which would
 otherwise just kill it. Invalid configuration now gives:
 
 # pgrep sshd
 18998
 # /etc/rc.d/sshd reload 
 sshd(failed)
 # pgrep sshd 
 18998
 
 Pros: Less risk of accidentally killing sshd and locking yourself out.
 Cons: You may think that you have made changes that have not taken
   effect, and will still screw you after a reboot.

I don't understand what this means...

 
 I think the pros win anyway.
 
 OK?

I'm in favor of this. But please put a blank line after sourcing 
/etc/rc.d/rc.subr for readability.

 /Alexander
 
 Index: rc.d/sshd
 ===
 RCS file: /data/openbsd/cvs/src/etc/rc.d/sshd,v
 retrieving revision 1.1
 diff -u -p -r1.1 sshd
 --- rc.d/sshd 6 Jul 2011 18:55:36 -   1.1
 +++ rc.d/sshd 28 Nov 2012 00:27:01 -
 @@ -6,4 +6,8 @@ daemon=/usr/sbin/sshd
   . /etc/rc.d/rc.subr
  +rc_reload() {
 + ${daemon} ${daemon_flags} -t  pkill -HUP -f ^${pexp}
 +}
 +
  rc_cmd $1
 

-- 
Antoine