faq6.html: Fix typo uaw -> use

2016-03-22 Thread Juuso Lapinlampi
This typo was introduced in revision 1.346.
Index: www/faq/faq6.html
===
RCS file: /cvs/www/faq/faq6.html,v
retrieving revision 1.357
diff -u -r1.357 faq6.html
--- www/faq/faq6.html   22 Mar 2016 10:54:47 -  1.357
+++ www/faq/faq6.html   23 Mar 2016 05:50:17 -
@@ -440,7 +440,7 @@
 Unlike some other operating systems, OpenBSD doesn't refer to them as
 dc0:0, dc0:1.
 If you are referring to a specific aliased IP address with ifconfig,
-or adding an alias, be sure to uaw ifconfig int alias instead of
+or adding an alias, be sure to use ifconfig int alias instead of
 just ifconfig int at the command line.
 You can delete aliases with ifconfig int delete.
 


tcpdump crashes in print-cdp.c

2016-03-22 Thread Can Erkin Acar
Here is a new version of the diff that fixes the CDP printer in tcpdump.
(https://www.sccs.swarthmore.edu/users/16/mmcconv1/dump/tcpdump-crashes/)

With this change the code does not access outside the packet anymore
but it would be nice if it could be tested on a network with real CDP
(Cisco Discovery Protocol) packets to see if there is any change in the
output. Error checking may have become too aggressive.

Thanks,

Can

Index: print-cdp.c
===
RCS file: /cvs/src/usr.sbin/tcpdump/print-cdp.c,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 print-cdp.c
--- print-cdp.c 16 Jan 2015 06:40:21 -  1.5
+++ print-cdp.c 23 Mar 2016 06:09:31 -
@@ -39,7 +39,7 @@
 #include "addrtoname.h"
 #include "extract.h"   /* must come after interface.h */

-void cdp_print_addr(const u_char * p, int l);
+int cdp_print_addr(const u_char * p, int l);
 void cdp_print_prefixes(const u_char * p, int l);

 /*
@@ -65,7 +65,7 @@ cdp_print(const u_char *p, u_int length,

while (i < length) {
if (i + 4 > caplen) {
-   printf("[!cdp]");
+   printf("[|cdp]");
return;
}

@@ -75,8 +75,11 @@ cdp_print(const u_char *p, u_int length,
if (vflag)
printf(" %02x/%02x", type, len);

+   if (len < 4)
+   goto error;
+
if (i+len > caplen) {
-   printf("[!cdp]");
+   printf("[|cdp]");
return;
}

@@ -86,12 +89,15 @@ cdp_print(const u_char *p, u_int length,
break;
case 0x02:
printf(" Addr");
-   cdp_print_addr(p + i + 4, len - 4);
+   if (cdp_print_addr(p + i + 4, len - 4))
+   goto error;
break;
case 0x03:
printf(" PortID '%.*s'", len - 4, p + i + 4);
break;
case 0x04:
+   if (len < 8)
+   goto error;
printf(" CAP 0x%02x", (unsigned) p[i+7]);
break;
case 0x05:
@@ -110,9 +116,13 @@ cdp_print(const u_char *p, u_int length,
printf(" VTP-Management-Domain '%.*s'", len-4, p+i+4 );
break;
case 0x0a:  /* guess - not documented */
+   if (len < 6)
+   goto error;
printf(" Native-VLAN-ID %d", (p[i+4]<<8) + p[i+4+1] - 1 
);
break;
case 0x0b:  /* guess - not documented */
+   if (len < 5)
+   goto error;
printf(" Duplex %s", p[i+4] ? "full": "half" );
break;
default:
@@ -124,42 +134,59 @@ cdp_print(const u_char *p, u_int length,
break;
i += len;
}
+error:
+   printf("[!cdp]");
 }

-void
+#define CDP_CHECK_ACCESS(p, s) if ((endp - (p)) < (s)) return 1
+
+int
 cdp_print_addr(const u_char * p, int l)
 {
-   int pl, al, num;
+   int pl, pt, al, num;
const u_char * endp = p+l;

+   CDP_CHECK_ACCESS(p, 4);
num = (p[0] << 24) + (p[1]<<16) + (p[2]<<8)+ p[3];
p+=4;

printf(" (%d): ", num);

while(p < endp && num >= 0) {
+   CDP_CHECK_ACCESS(p, 2);
+   pt=*p;
pl=*(p+1);
p+=2;

+   CDP_CHECK_ACCESS(p, 3);
/* special case: IPv4, protocol type=0xcc, addr. length=4 */
if (pl == 1 && *p == 0xcc && p[1] == 0 && p[2] == 4) {
p+=3;

+   CDP_CHECK_ACCESS(p, 4);
printf("IPv4 %d.%d.%d.%d ", p[0], p[1], p[2], p[3]);
p+=4;
} else {/* generic case: just print raw data */
-   printf("pt=0x%02x, pl=%d, pb=", *(p-2), pl);
+   printf("pt=0x%02x, pl=%d, pb=", pt, pl);
+
+   CDP_CHECK_ACCESS(p, pl);
while(pl-- > 0)
printf(" %02x", *p++);
+
+   CDP_CHECK_ACCESS(p, 2);
al=(*p << 8) + *(p+1);
printf(", al=%d, a=", al);
p+=2;
+
+   CDP_CHECK_ACCESS(p, al);
while(al-- > 0)
printf(" %02x", *p++);
}
printf("  ");
num--;
}
+
+   return 0;
 }


@@ -169,7 +196,8 @@ cdp_print_prefixes(const u_char * p, int
printf(" IPv4 Prefixes (%d)

Re: www.openbsd.org/cgi-bin/man.cgi

2016-03-22 Thread Ingo Schwarze
Hi,

Bob Beck wrote on Tue, Mar 22, 2016 at 10:49:37PM -0600:

> This has been our constant friend for many many years.  I babied some
> truly horrible perl that did this, along with some nasty things to
> extract the old man pages for many years.
> 
> It is now no more.
> 
> A few years back, Ingo moved it to the new mandoc based man.cgi, and
> now we've actually moved this to a dedicated place - "man.openbsd.org"

And by the way, you can save several keystrokes when adding new links
from other web pages:

  http://man.openbsd.org/pledge
  http://man.openbsd.org/malloc.9   # same name in multiple sections

See  http://man.openbsd.org/mandoc/man8/man.cgi.8
section "URI interface" for the full syntax.
But of course, for interactive use, just rely on the HTML search form.

The list of available releases now includes 4.4BSD-Lite2 and UNIX-7,
too, just in case you are stuck with old hardware that is no longer
supported.  ;-)

The OpenBSD-5.9 manuals are already up, too, just in case you didn't
order the CD set yet and wonder whether we are still doing any
development and whether it's worth to keep the project going...

> If you have a web site that links openbsd man pages, it's easy to change
> just replace the http://www.openbsd.org/cgi-bin/man.cgi with
> http://man.openbsd.org - it takes all the same arguments.
> 
> man.openbsd.org runs Ingo's latest and gives him a nice place to host
> it that it dedicated only to that purpose. It separates it out from
> the main web site so we can separate some of this functionality
> better.
> 
> Thanks to Ingo Scharwze for setting it up, along with Nick Holland and
> Ken Westerback for support and getting the machine set up for it, The
> OpenBSD Foundation for buying the gear, and the University of Toronto
> for being so kind as to host it.

Many more people helped with the new code over the years, and i
won't attempt to list them all as i'd probably forget some even if
i tried - so i'll just mention two:  Kristaps Dzonsons originally
wrote the code, not only of mandoc(1), but also of makewhatis(8),
apropos(1), and man.cgi(8), the latter in 2011/2012, and Sebastien
Marie (semarie@) did a security audit of man.cgi(8) in 2014.

Yours,
  Ingo



www.openbsd.org/cgi-bin/man.cgi

2016-03-22 Thread Bob Beck
This has been our constant friend for many many years.  I babied some
truly horrible perl that did this, along with some nasty things to
extract the old man pages for many years.

It is now no more.

A few years back, Ingo moved it to the new mandoc based man.cgi, and
now we've actually moved this to a dedicated place - "man.openbsd.org"

If you have a web site that links openbsd man pages, it's easy to change
just replace the http://www.openbsd.org/cgi-bin/man.cgi with
http://man.openbsd.org - it takes all the same arguments.

man.openbsd.org runs Ingo's latest and gives him a nice place to host
it that it dedicated only to that purpose. It separates it out from
the main web site so we can separate some of this functionality
better.

Thanks to Ingo Scharwze for setting it up, along with Nick Holland and
Ken Westerback for support and getting the machine set up for it, The
OpenBSD Foundation for buying the gear, and the University of Toronto
for being so kind as to host it.

-Bob



Re: uvm: shrinking amap kmem consumption

2016-03-22 Thread Ted Unangst
Stefan Kempf wrote:
> To reduce these memory requirements, we need three flavors of amaps:
> 
> - Tiny amaps with only one slot store the pointer to the vm_anon in the
>   amap directly. The two ints are not needed. This was Theo's idea.
> 
> - Small amaps with up to 32 slots need 8 instead of 16 bytes per slot
>   (or 4 bytes instead of 12 on 32 bit machines).
>   It's enough to store the array of anons. The two ints per slot are
>   not needed.
> 
>   Tiny and small amaps are the ones used most often.

A little late to the party. I was looking at this in December. One slot amaps
dominated, then 2 slots maybe up to 4, and then a bit of a long tail. Or
basically, what you said. This all makes sense.



Re: OpenBSD ASLR and the stack

2016-03-22 Thread Ted Unangst
Shawn Webb wrote:
> Does OpenBSD's ASLR implementation also randomize the top stack address?
> Or is it simply a random gap (top of the stack still at the same
> address, but application starts utilizing the stack at a random, but
> properly aligned, offset)?

The top of the stack, above the random start address, is effectively
PROT_NONE since about 5.7.



Re: OpenBSD ASLR and the stack

2016-03-22 Thread sven falempin
http://www.openbsd.org/papers/asiabsdcon2015-pie-slides.pdf
page6 ?


On Tue, Mar 22, 2016 at 8:36 PM, Shawn Webb 
wrote:

> Random newbie-sounding question:
>
> Does OpenBSD's ASLR implementation also randomize the top stack address?
> Or is it simply a random gap (top of the stack still at the same
> address, but application starts utilizing the stack at a random, but
> properly aligned, offset)?
>
> If it's just a random gap, would OpenBSD appreciate a patch that
> implements true stack randomization + stack gap?
>
> Thanks,
>
> --
> Shawn Webb
> HardenedBSD
>
> GPG Key ID:  0x6A84658F52456EEE
> GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
>



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


OpenBSD ASLR and the stack

2016-03-22 Thread Shawn Webb
Random newbie-sounding question:

Does OpenBSD's ASLR implementation also randomize the top stack address?
Or is it simply a random gap (top of the stack still at the same
address, but application starts utilizing the stack at a random, but
properly aligned, offset)?

If it's just a random gap, would OpenBSD appreciate a patch that
implements true stack randomization + stack gap?

Thanks,

-- 
Shawn Webb
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: Scheduler hack for multi-threaded processes

2016-03-22 Thread Amit Kulkarni
On Tue, Mar 22, 2016 at 10:00 AM, Douglas Ray  wrote:

> On 21/03/16 11:29 AM, Mark Kettenis wrote:
>
>> From: Amit Kulkarni 
>>> Date: Sun, 20 Mar 2016 17:57:49 -0500
>>>
>> ...
>
>> +1. Previously, when I did a cvs update with original scheduler code,
>>> doing
>>> the ports update the machine always froze solid while doing cvs update,
>>> taking 3 minutes to recover. This time with Martin's patch, the freezing
>>> period seems to have decreased quite a bit, although the freeze still
>>> happens. Stefan's amap diff and Bob's VFS/UVM diff also seems to have a
>>> made a difference.
>>>
>>> Pentium G2020 2.9GHz dual core Ivy bridge 22nm... 8 GB RAM
>>>
>>> IMHO, this patch should go in!
>>>
>>
>> No.  It's a hack. It points out aproblem that should be investigated
>> deeper.
>>
>>
> If it gives a significant performance improvement but is too distant
> from a real solution, maybe it could be worth distributing in
> package(s) form.
>
> The team then has the option to actively promote it, or not; and
> the package could be updated as new refinements are found.
>
>
I am not sure if you know how the OpenBSD team operates. They call a hack a
hack and will do it right. I am thankful that Michal pointed out a
deficiency in our current implementation, and Martin reduced the test case.
That will help to figure out where the problem(s) is/are. To repeat the
team will do it right.

Thanks


librthread mutex limitation

2016-03-22 Thread Martin Pieuchot
I generated the output below by running firefox on my x220 with a
patched librthread.  The diff I used is attached and uses some builtins
to see which _spinlock() calls are *really* contended.

The result is interesting.


<_rthread_mutex_lock+0x58> correspond to the line 108 of rthread_sync.c:

...
_rthread_debug(5, "%p: mutex_lock %p\n", (void *)self, (void *)mutex);
_spinlock(&mutex->lock);
if (mutex->owner == NULL && TAILQ_EMPTY(&mutex->lockers)) {
...




 correspond to the line 395 of the same file:

...
if (self->blocking_cond == NULL) {
_spinunlock(&cond->lock);
_spinlock(&mutex->lock);
continue;
}
...




 corresponds to the line 527:

...
_spinlock(&cond->lock);
if (self->blocking_cond == NULL) {
_spinunlock(&cond->lock);
...


0x13da768ac960 called yield() 100 times from 
0x13d9d855b900 called yield() 100 times from 
0x13da41b80900 called yield() 100 times from <_rthread_mutex_lock+0x1c6>
0x13d9f5cebb00 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da768ac960 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da8a19d900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 100 times from 
0x13da04988d00 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da8a19d900 called yield() 200 times from <_rthread_mutex_lock+0x58>
0x13da8a19d900 called yield() 300 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 200 times from 
0x13da04988d00 called yield() 200 times from <_rthread_mutex_lock+0x58>
0x13da8a19d900 called yield() 400 times from <_rthread_mutex_lock+0x58>
0x13da8a19d900 called yield() 500 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 300 times from 
0x13da04988d00 called yield() 300 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 400 times from 
0x13da04988d00 called yield() 400 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 500 times from 
0x13da04988d00 called yield() 500 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 600 times from 
0x13da04988d00 called yield() 600 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 700 times from 
0x13da04988d00 called yield() 700 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 800 times from 
0x13da04988d00 called yield() 800 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 900 times from 
0x13da04988d00 called yield() 900 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 1000 times from 
0x13da04988d00 called yield() 1000 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 1100 times from 
0x13da04988d00 called yield() 1100 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 1200 times from 
0x13da04988d00 called yield() 1200 times from <_rthread_mutex_lock+0x58>
0x13d9d855b900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13d9d855b900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da9f5a3400 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13d9d855b900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13d9d855b900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da9f5a3400 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13dab6e24400 called yield() 100 times from 
0x13dab6e24400 called yield() 200 times from 
0x13dab6e24400 called yield() 300 times from 
0x13d9d855b900 called yield() 100 times from 
0x13d9d855b900 called yield() 100 times from 
0x13d9d855b900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13d9d855b900 called yield() 100 times from 
0x13d9c6e7b800 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da768ac960 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13d9f5456900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da768ac960 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da41b7f100 called yield() 100 times from <_rthread_mutex_lock+0x1c6>
0x13d9d855b900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13d9f5cebb00 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da768ac960 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13daab203400 called yield() 100 times from 
0x13da768ac960 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da768ac960 called yield() 200 times from <_rthread_mutex_lock+0x58>
0x13da768ac960 called yield() 300 times from <_rthread_mutex_lock+0x58>
0x13d9d855b900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da8a19d900 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da8a19d900 called yield() 200 times from <_rthread_mutex_lock+0x58>
0x13da768ac960 called yield() 100 times from <_rthread_mutex_lock+0x58>
0x13da8a19de00 called yield() 100 times from <_rthread_mutex_lock+0x5

Re: Scheduler hack for multi-threaded processes

2016-03-22 Thread Michael McConville
Douglas Ray wrote:
> On 21/03/16 11:29 AM, Mark Kettenis wrote:
> >>From: Amit Kulkarni 
> >>Date: Sun, 20 Mar 2016 17:57:49 -0500
> ...
> >>+1. Previously, when I did a cvs update with original scheduler code, doing
> >>the ports update the machine always froze solid while doing cvs update,
> >>taking 3 minutes to recover. This time with Martin's patch, the freezing
> >>period seems to have decreased quite a bit, although the freeze still
> >>happens. Stefan's amap diff and Bob's VFS/UVM diff also seems to have a
> >>made a difference.
> >>
> >>Pentium G2020 2.9GHz dual core Ivy bridge 22nm... 8 GB RAM
> >>
> >>IMHO, this patch should go in!
> >
> >No.  It's a hack. It points out aproblem that should be investigated
> >deeper.
> >
> 
> If it gives a significant performance improvement but is too distant
> from a real solution, maybe it could be worth distributing in
> package(s) form.
> 
> The team then has the option to actively promote it, or not; and
> the package could be updated as new refinements are found.

It's kernel code, you can't package it.



Re: Scheduler hack for multi-threaded processes

2016-03-22 Thread Theo de Raadt
> >> IMHO, this patch should go in!
> >
> > No.  It's a hack. It points out aproblem that should be investigated
> > deeper.
> >
> 
> If it gives a significant performance improvement but is too distant
> from a real solution, maybe it could be worth distributing in
> package(s) form.
> 
> The team then has the option to actively promote it, or not; and
> the package could be updated as new refinements are found.

A package that modifies the kernel, RIGHT



Re: Scheduler hack for multi-threaded processes

2016-03-22 Thread Douglas Ray

On 21/03/16 11:29 AM, Mark Kettenis wrote:

From: Amit Kulkarni 
Date: Sun, 20 Mar 2016 17:57:49 -0500

...

+1. Previously, when I did a cvs update with original scheduler code, doing
the ports update the machine always froze solid while doing cvs update,
taking 3 minutes to recover. This time with Martin's patch, the freezing
period seems to have decreased quite a bit, although the freeze still
happens. Stefan's amap diff and Bob's VFS/UVM diff also seems to have a
made a difference.

Pentium G2020 2.9GHz dual core Ivy bridge 22nm... 8 GB RAM

IMHO, this patch should go in!


No.  It's a hack. It points out aproblem that should be investigated
deeper.



If it gives a significant performance improvement but is too distant
from a real solution, maybe it could be worth distributing in
package(s) form.

The team then has the option to actively promote it, or not; and
the package could be updated as new refinements are found.

Douglas



Re: uvm: shrinking amap kmem consumption

2016-03-22 Thread Stefan Kempf
Mark Kettenis wrote:
> > Date: Mon, 21 Mar 2016 20:02:28 +0100
> > From: Stefan Kempf 
> > 
> > Recently we found that amaps consume a good deal of kernel address space.
> > See this thread: https://marc.info/?l=openbsd-tech&m=145752756005014&w=2.
> > And we found a way to reduce kernel mem pressure for some architectures
> > at least. See the diffs in that thread.
> > 
> > Besides that, it's possible to shrink the amap struct from 72 to 48 bytes
> > on 64 bit systems (or from 44 to 32 bytes on 32 bit systems).
> > 
> > It's also possible to cut down the memory needed for slots roughly in half
> > on 64 bit architectures, and cut it up to a factor of 3 on 32 bit machines.
> > 
> > Here's how amap slots are maintained currently: for every slot, the kernel
> > allocates one pointer to a vm_anon and two ints (16 bytes per slot on
> > 64 bit systems, 12 bytes for 32 CPUs).
> > 
> > To reduce these memory requirements, we need three flavors of amaps:
> > 
> > - Tiny amaps with only one slot store the pointer to the vm_anon in the
> >   amap directly. The two ints are not needed. This was Theo's idea.
> > 
> > - Small amaps with up to 32 slots need 8 instead of 16 bytes per slot
> >   (or 4 bytes instead of 12 on 32 bit machines).
> >   It's enough to store the array of anons. The two ints per slot are
> >   not needed.
> > 
> >   Tiny and small amaps are the ones used most often.
> > 
> > - Normal amaps with n >= 32 slots only need
> >   4 * sizeof(pointer) + n * sizeof(struct vm_anon *) + 12*n/32 bytes
> >   to maintain amap slots. For large n that's also around 1.8 times
> >   less memory for slots (or about 2.7 times less on 32 bit CPUs) compared
> >   to the current implementation.
> >   That memory is for the vm_anon array, and a header structure. The two
> >   ints per slot in the current code are replaced by n/32 bitmaps.
> > 
> [...]
> 
> Is it really worth having three flavours?  If having only two
> (tiny+normal?) simplifies the code considerable and doesn't result in
> much more memory being used, that may be preferable.

I think it's possible to simplify the current diff a little more.
If it's still considered too complex then doing small and normal
only would be an option.

I'll experiment some more.
 
> The amaps are one of the roadblocks on the way to make uvm more
> mpsafe.  And keeping the code simple will make that easier.
> 
> > Index: uvm/uvm_amap.c
> > ===
> > RCS file: /cvs/src/sys/uvm/uvm_amap.c,v
> > retrieving revision 1.62
> > diff -u -p -r1.62 uvm_amap.c
> > --- uvm/uvm_amap.c  16 Mar 2016 16:53:43 -  1.62
> > +++ uvm/uvm_amap.c  21 Mar 2016 18:53:45 -
> > @@ -53,21 +53,31 @@
> >  struct pool uvm_amap_pool;
> >  
> >  /* Pools for amap slots for the most common amap slot sizes */
> > -struct pool uvm_amap_slot_pools[UVM_AMAP_CHUNK];
> > +struct pool uvm_amap_slot_pools[UVM_AMAP_CHUNK - 1];
> >  
> >  LIST_HEAD(, vm_amap) amap_list;
> >  
> > -static char amap_slot_pool_names[UVM_AMAP_CHUNK][13];
> > -
> > -#define MALLOC_SLOT_UNIT (2 * sizeof(int) + sizeof(struct vm_anon *))
> > +static char amap_slot_pool_names[UVM_AMAP_CHUNK - 1][13];
> >  
> >  /*
> >   * local functions
> >   */
> >  
> > -static struct vm_amap *amap_alloc1(int, int, int);
> > +struct vm_anon **amap_slots_alloc(struct vm_amap *, u_int, int,
> > +struct vm_amap_meta **);
> > +static struct vm_amap *amap_alloc1(u_int, u_int, int);
> >  static __inline void amap_list_insert(struct vm_amap *);
> >  static __inline void amap_list_remove(struct vm_amap *);   
> > +static __inline void amap_anon_release(struct vm_anon *);
> > +void amap_fill_slot(struct vm_amap *, u_int);
> > +void amap_normal_clear_slot(struct vm_amap *, u_int);
> > +void amap_clear_slot(struct vm_amap *, u_int);
> > +static __inline void amap_normal_wipe_slot(struct vm_amap *, u_int);
> > +
> > +void amap_wipeout_traverse(struct vm_anon **, u_int, u_int);
> > +int amap_cow_now_traverse(struct vm_anon **, u_int, u_int);
> > +int amap_swap_off_traverse(struct vm_amap *, struct vm_anon **, u_int, 
> > u_int,
> > +int, int);
> >  
> >  static __inline void
> >  amap_list_insert(struct vm_amap *amap)
> > @@ -81,6 +91,99 @@ amap_list_remove(struct vm_amap *amap)
> > LIST_REMOVE(amap, am_list);
> >  }
> >  
> > +static __inline void
> > +amap_anon_release(struct vm_anon *anon)
> > +{
> > +   int refs;
> > +
> > +   refs = --anon->an_ref;
> > +   if (refs == 0) {
> > +   /* we had the last reference to a vm_anon. free it. */
> > +   uvm_anfree(anon);
> > +   }
> > +}
> > +
> > +void
> > +amap_fill_slot(struct vm_amap *amap, u_int slot)
> > +{
> > +   u_int clust, ptr;
> > +   struct vm_amap_meta *meta;
> > +   struct vm_amap_clust *slotclust;
> > +
> > +   if (amap->am_maxslot == 1) {
> > +   amap->am_nused = 1;
> > +   return;
> > +   } else if (amap->am_maxslot <= UVM_AMAP_MAXSLOT_SMALL) {
> > +   amap->am_nused |= 1 << slot;
> > + 

[patch] www faq/current.html - validation pass href and id rYYYYMMDD

2016-03-22 Thread lists
Mon, 21 Mar 2016 07:49:47 -0600 (MDT) Theo Buehler 
> CVSROOT:  /cvs
> Module name:  www
> Changes by:   t...@cvs.openbsd.org2016/03/21 07:49:47
> 
> Modified files:
>   faq: current.html 
> 
> Log message:
> add missing  tag, from lists () wrant ! com
> 
> while there, zap some trailing whitespace

Thank you, Theo Buehler!

A quick patch [1], hope this applies (non-mangled).

While at it, please note the href anchors and their ids are formatted
as "#%Y%m%d" and "%Y%m%d" respectively, e.g.




According to both validating tool reports here:

[http://validator.w3.org/check?uri=http://www.openbsd.org/faq/current.html]
[http://www.htmlhelp.org/cgi-bin/validate.cgi?url=http://www.openbsd.org/faq/current.html]

It is probably worth converting these to start with the letter "r" for
"revision", or eventually "id" for "incremental date" (or identifier),
e.g.




or




[1] The bellow patch does the "r" for the hrefs and ids to become
"#r%Y%m%d" and "r%Y%m%d" respectively, please see here:

$ diff -u current.html{-1.652,}
--- current.html-1.652  Mon Mar 21 22:18:51 2016
+++ current.htmlMon Mar 21 22:32:36 2016
@@ -28,29 +28,30 @@
 Introduction
 
 
-2015/08/22 - [xenocara] libdrm update
-2015/08/25 - [ports] security/cfs removed
-2015/09/11 - config(8) update
-2015/09/12 - ifmedia extended to 64 bits
-2015/09/18 - [ports] php-fpm rc script renamed
-2015/10/19 - [xenocara] freetype update
-2015/10/23 - ntpd.conf(5) remove rtable for server
-2015/10/24 - [ports] node module ports removed
-2015/10/26 - [ports] puppetboard configuration 
update
-2015/11/16 - /dev/tun -> /dev/tap
-2015/11/30 - smtpd tables removed
-2015/12/03 - termcap.db and terminfo.db removed
-2015/12/03 - vmmctl(8) and vmm.conf(8) renamed
-2015/12/05 - netstart(8) options "multicast_host" and
+
+2015/08/22 - [xenocara] libdrm update
+2015/08/25 - [ports] security/cfs removed
+2015/09/11 - config(8) update
+2015/09/12 - ifmedia extended to 64 bits
+2015/09/18 - [ports] php-fpm rc script renamed
+2015/10/19 - [xenocara] freetype update
+2015/10/23 - ntpd.conf(5) remove rtable for server
+2015/10/24 - [ports] node module ports removed
+2015/10/26 - [ports] puppetboard configuration 
update
+2015/11/16 - /dev/tun -> /dev/tap
+2015/11/30 - smtpd tables removed
+2015/12/03 - termcap.db and terminfo.db removed
+2015/12/03 - vmmctl(8) and vmm.conf(8) renamed
+2015/12/05 - netstart(8) options "multicast_host" and
"multicast_router" merged
-2015/12/07 - smtpd makemap(8) merged into 
smtpctl(8)
-2015/12/12 - smtpd.conf(5) "pki" keyword change and 
"ca" keyword addition
-2015/12/27 - amd64 and i386 support for rdseed 
instruction
-2015/12/31 - [ports] gophernicus moved
-2016/01/05 - pf.conf(5) set debug syntax 
change
-2016/01/06 - pledge(2) path whitelist disabled
-2016/03/07 - lpd(8) spool directory change
-2016/03/19 - csu and ld.so update
+2015/12/07 - smtpd makemap(8) merged into 
smtpctl(8)
+2015/12/12 - smtpd.conf(5) "pki" keyword change and 
"ca" keyword addition
+2015/12/27 - amd64 and i386 support for rdseed 
instruction
+2015/12/31 - [ports] gophernicus moved
+2016/01/05 - pf.conf(5) set debug syntax 
change
+2016/01/06 - pledge(2) path whitelist disabled
+2016/03/07 - lpd(8) spool directory change
+2016/03/19 - csu and ld.so update
 
 
 
@@ -81,7 +82,7 @@
 Most of these changes will have to be performed as root.
 
 
-2015/08/22 - [xenocara] libdrm updated
+2015/08/22 - [xenocara] libdrm updated
 libdrm has been updated to a new version, moving a few files around.
 As a consequence, old files should be removed:
 
@@ -89,7 +90,7 @@
 rm -f /usr/X11R6/include/r600_pci_ids.h
 rm -f /usr/X11R6/include/radeon_*.h
 
-2015/08/25 - [ports] security/cfs removed
+2015/08/25 - [ports] security/cfs removed
 The security/cfs ports has been removed, users are encouraged to use
 another data encryption method.  Possible alternatives are softraid(4)
 CRYPTO, encrypted vnd(4) devices or the security/encfs port.  To remove
@@ -98,7 +99,7 @@
pkg_delete cfs
 
 
-2015/09/11 - config(8) update
+2015/09/11 - config(8) update
 An up to date
 http://man.openbsd.org?query=config&sektion=8";>
 config(8) is needed to build kernels.
@@ -113,7 +114,7 @@
 http://man.openbsd.org?query=release&sektion=8";>
 release(8) for details.
 
-2015/09/12 - ifmedia extended to 64 bits
+2015/09/12 - ifmedia extended to 64 bits
 
 The ifmedia options word has been extended to 64 bits.
 This changes numbers of the SIOCSIFMEDIA and SIOCGIFMEDIA ioctls and
@@ -143,14 +144,14 @@
 Some additional libraries and applications must also be recompiled.
 Run a full 'make build' to ensure everything is in order.
 
-2015/09/18 - [ports] php-fpm rc script renamed
+2015/09/18 - [ports] php-fpm rc script renamed
 
 To allow installing multiple versions of php-fpm on the same system,
 the rc script has been renamed to include the version number.
 If you are using this, modify references to php_fpm in /etc/rc.conf.local
 to e.g. php56_fpm.
 
-2015/10/1

Re: make vlan(4) remember its parent by index, not by reference

2016-03-22 Thread Masao Uebayashi
On Tue, Mar 22, 2016 at 09:36:18PM +1000, David Gwynne wrote:
> this basically makes the code use if_get instead of carrying a
> pointer around. this is as mechanical as i can make it.
> 
> ok?
> 
> Index: if_vlan_var.h
> ===
> RCS file: /cvs/src/sys/net/if_vlan_var.h,v
> retrieving revision 1.33
> diff -u -p -r1.33 if_vlan_var.h
> --- if_vlan_var.h 14 Mar 2016 03:48:47 -  1.33
> +++ if_vlan_var.h 22 Mar 2016 11:34:45 -
> @@ -61,9 +61,8 @@ struct vlan_mc_entry {
>  
>  struct   ifvlan {
>   struct  arpcom ifv_ac;  /* make this an interface */
> - struct  ifnet *ifv_p;   /* parent interface of this vlan */
> + unsigned int ifv_p; /* parent interface of this vlan */
>   struct  ifv_linkmib {
> - int ifvm_parent;
>   u_int16_t ifvm_proto; /* encapsulation ethertype */
>   u_int16_t ifvm_tag; /* tag to apply on packets leaving if */
>   u_int16_t ifvm_prio; /* prio to apply on packet leaving if */
> Index: if_vlan.c
> ===
> RCS file: /cvs/src/sys/net/if_vlan.c,v
> retrieving revision 1.155
> diff -u -p -r1.155 if_vlan.c
> --- if_vlan.c 18 Mar 2016 02:40:04 -  1.155
> +++ if_vlan.c 22 Mar 2016 11:34:45 -
> @@ -235,7 +235,12 @@ vlan_start(struct ifnet *ifp)
>   uint8_t  prio;
>  
>   ifv = ifp->if_softc;
> - ifp0 = ifv->ifv_p;
> + ifp0 = if_get(ifv->ifv_p);
> + if (ifp0 == NULL || (ifp0->if_flags & (IFF_UP|IFF_RUNNING)) !=
> + (IFF_UP|IFF_RUNNING)) {
> + ifq_purge(&ifp->if_snd);

You can't dereference ifp if (ifp0 == NULL)?

> + goto leave;
> + }
>  
>   for (;;) {
>   IFQ_DEQUEUE(&ifp->if_snd, m);
> @@ -247,12 +252,6 @@ vlan_start(struct ifnet *ifp)
>   bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT);
>  #endif /* NBPFILTER > 0 */
>  
> - if ((ifp0->if_flags & (IFF_UP|IFF_RUNNING)) !=
> - (IFF_UP|IFF_RUNNING)) {
> - ifp->if_oerrors++;
> - m_freem(m);
> - continue;
> - }
>  
>   /* IEEE 802.1p has prio 0 and 1 swapped */
>   prio = m->m_pkthdr.pf.prio;
> @@ -290,6 +289,9 @@ vlan_start(struct ifnet *ifp)
>   }
>   ifp->if_opackets++;
>   }
> +
> +leave:
> + if_put(ifp0);
>  }
>  
>  struct mbuf *
> @@ -358,7 +360,7 @@ vlan_input(struct ifnet *ifp0, struct mb
>  
>   list = &tagh[TAG_HASH(tag)];
>   SRPL_FOREACH(ifv, list, &i, ifv_list) {
> - if (ifp0 == ifv->ifv_p && tag == ifv->ifv_tag &&
> + if (ifp0->if_index == ifv->ifv_p && tag == ifv->ifv_tag &&
>   etype == ifv->ifv_type)
>   break;
>   }
> @@ -417,13 +419,13 @@ vlan_config(struct ifvlan *ifv, struct i
>  
>   if (ifp0->if_type != IFT_ETHER)
>   return EPROTONOSUPPORT;
> - if (ifv->ifv_p == ifp0 && ifv->ifv_tag == tag) /* noop */
> + if (ifp0->if_index == ifv->ifv_p && ifv->ifv_tag == tag) /* noop */
>   return (0);
>  
>   /* Remember existing interface flags and reset the interface */
>   flags = ifv->ifv_flags;
>   vlan_unconfig(&ifv->ifv_if, ifp0);
> - ifv->ifv_p = ifp0;
> + ifv->ifv_p = ifp0->if_index;
>   ifv->ifv_if.if_baudrate = ifp0->if_baudrate;
>  
>   if (ifp0->if_capabilities & IFCAP_VLAN_MTU) {
> @@ -509,8 +511,9 @@ vlan_unconfig(struct ifnet *ifp, struct 
>   struct ifnet*ifp0;
>  
>   ifv = ifp->if_softc;
> - if ((ifp0 = ifv->ifv_p) == NULL)
> - return 0;
> + ifp0 = if_get(ifv->ifv_p);
> + if (ifp0 == NULL)
> + goto disconnect;
>  
>   /* Unset promisc mode on the interface and its parent */
>   if (ifv->ifv_flags & IFVF_PROMISC) {
> @@ -544,8 +547,9 @@ vlan_unconfig(struct ifnet *ifp, struct 
>*/
>   vlan_multi_apply(ifv, ifp0, SIOCDELMULTI);
>  
> +disconnect:
>   /* Disconnect from parent. */
> - ifv->ifv_p = NULL;
> + ifv->ifv_p = 0;
>   ifv->ifv_if.if_mtu = ETHERMTU;
>   ifv->ifv_if.if_hardmtu = ETHERMTU;
>   ifv->ifv_flags = 0;

So you're changing error code path here?  I'm not sure this correctness
but I'd change this separately.

> @@ -557,6 +561,8 @@ vlan_unconfig(struct ifnet *ifp, struct 
>   bzero(LLADDR(sdl), ETHER_ADDR_LEN);
>   bzero(ifv->ifv_ac.ac_enaddr, ETHER_ADDR_LEN);
>  
> + if_put(ifp0);
> +
>   return (0);
>  }
>  
> @@ -564,12 +570,22 @@ void
>  vlan_vlandev_state(void *v)
>  {
>   struct ifvlan   *ifv = v;
> + struct ifnet*ifp0;
> + int  link_state = LINK_STATE_DOWN;
> + uint64_t baudrate = 0;
>  
> - if (ifv->ifv_if.if_link_state == ifv->ifv_p->if_link_state)
> + ifp0 = if_get(ifv->ifv_p);
> + if (ifp0 != NULL) {
> + lin

Re: sendsyslog(2) man page

2016-03-22 Thread Jason McIntyre
On Tue, Mar 22, 2016 at 01:07:29PM +0100, Alexander Bluhm wrote:
> On Tue, Mar 22, 2016 at 07:20:56AM +, Jason McIntyre wrote:
> > > -formatted message direct to
> > > +formatted message directly to
> > 
> > i think both are acceptable. i actually prefer how it is now.
> 
> There was another "directly" in the next sentence.  I have removed
> that to avoid inconsistency.
> 
> > > +.It Bq Er EMSGSIZE
> > > +The socket requires that message be sent atomically, and the size
> > 
> > messages? a message? the message?
> > you need something though.
> 
> I had copied it from send(2), both man pages should be fixed.

ok, but one more comment about the sentence above:

> 
> bluhm
> 
> Index: send.2
> ===
> RCS file: /data/mirror/openbsd/cvs/src/lib/libc/sys/send.2,v
> retrieving revision 1.31
> diff -u -p -r1.31 send.2
> --- send.29 Sep 2014 06:32:37 -   1.31
> +++ send.222 Mar 2016 11:52:22 -
> @@ -147,7 +147,7 @@ is not a socket.
>  .It Bq Er EFAULT
>  An invalid user space address was specified for a parameter.
>  .It Bq Er EMSGSIZE
> -The socket requires that message be sent atomically,
> +The socket requires that messages are sent atomically,

the text was already correct. the addition you propose should use this
text (and not the be->are change).

jmc

>  and the size of the message to be sent made this impossible.
>  .It Bq Er EAGAIN
>  The socket is marked non-blocking or the
> Index: sendsyslog.2
> ===
> RCS file: /data/mirror/openbsd/cvs/src/lib/libc/sys/sendsyslog.2,v
> retrieving revision 1.7
> diff -u -p -r1.7 sendsyslog.2
> --- sendsyslog.2  22 Mar 2016 07:13:16 -  1.7
> +++ sendsyslog.2  22 Mar 2016 11:57:54 -
> @@ -33,29 +33,36 @@ function is used to transmit a
>  formatted message direct to
>  .Xr syslogd 8
>  without requiring the allocation of a socket.
> -.Pp
> -The
> -.Fa flags
> -argument of
> -.Fn sendsyslog
> -accepts the
> -.Dv LOG_CONS
> -flag.
>  If
>  .Dv LOG_CONS
> -is specified, and
> +is specified in the
> +.Fa flags
> +argument, and
>  .Xr syslogd 8
> -is not accepting messages, the message will be sent directly to the
> -console.
> +is not accepting messages, the message will be sent to the console.
>  This is used internally by
>  .Xr syslog_r 3 ,
>  so that messages can be sent during difficult situations.
> +If sending to
> +.Xr syslogd 8
> +fails, dropped messages are counted.
> +When
> +.Xr syslogd 8
> +works again, a warning with the counter and error number is logged.
>  .Sh RETURN VALUES
>  .Rv -std
>  .Sh ERRORS
>  .Fn sendsyslog
>  can fail if:
>  .Bl -tag -width Er
> +.It Bq Er EFAULT
> +An invalid user space address was specified for a parameter.
> +.It Bq Er EMSGSIZE
> +The socket requires that messages are sent atomically,
> +and the size of the message to be sent made this impossible.
> +.It Bq Er ENOBUFS
> +The system was unable to allocate an internal buffer.
> +The operation may succeed when buffers become available.
>  .It Bq Er ENOTCONN
>  The message cannot be sent, likely because
>  .Xr syslogd 8
> @@ -69,3 +76,7 @@ The
>  .Fn sendsyslog
>  function call appeared in
>  .Ox 5.6 .
> +The
> +.Fa flags
> +argument was added in
> +.Ox 6.0 .



replace m_copym2 with m_dup_pkt in pfkey.c

2016-03-22 Thread David Gwynne
ok?

Index: pfkey.c
===
RCS file: /cvs/src/sys/net/pfkey.c,v
retrieving revision 1.29
diff -u -p -r1.29 pfkey.c
--- pfkey.c 22 Mar 2016 11:53:21 -  1.29
+++ pfkey.c 22 Mar 2016 12:07:25 -
@@ -142,7 +142,7 @@ pfkey_sendup(struct socket *socket, stru
int s;
 
if (more) {
-   if (!(packet2 = m_copym2(packet, 0, M_COPYALL, M_DONTWAIT)))
+   if (!(packet2 = m_dup_pkt(packet, 0, M_DONTWAIT)))
return (ENOMEM);
} else
packet2 = packet;



replace m_copym2 with m_dup_pkt in pf.c

2016-03-22 Thread David Gwynne
the subject says it all.  could someone who uses dup-to try this?

ok?

Index: pf.c
===
RCS file: /cvs/src/sys/net/pf.c,v
retrieving revision 1.966
diff -u -p -r1.966 pf.c
--- pf.c4 Mar 2016 22:38:23 -   1.966
+++ pf.c22 Mar 2016 11:59:50 -
@@ -5487,7 +5487,7 @@ pf_route(struct mbuf **m, struct pf_rule
}
 
if (r->rt == PF_DUPTO) {
-   if ((m0 = m_copym2(*m, 0, M_COPYALL, M_NOWAIT)) == NULL)
+   if ((m0 = m_dup_pkt(*m, max_linkhdr, M_NOWAIT)) == NULL)
return;
} else {
if ((r->rt == PF_REPLYTO) == (r->direction == dir))
@@ -5646,7 +5646,7 @@ pf_route6(struct mbuf **m, struct pf_rul
}
 
if (r->rt == PF_DUPTO) {
-   if ((m0 = m_copym2(*m, 0, M_COPYALL, M_NOWAIT)) == NULL)
+   if ((m0 = m_dup_pkt(*m, max_linkhdr, M_NOWAIT)) == NULL)
return;
} else {
if ((r->rt == PF_REPLYTO) == (r->direction == dir))



Re: sendsyslog(2) man page

2016-03-22 Thread Alexander Bluhm
On Tue, Mar 22, 2016 at 07:20:56AM +, Jason McIntyre wrote:
> > -formatted message direct to
> > +formatted message directly to
> 
> i think both are acceptable. i actually prefer how it is now.

There was another "directly" in the next sentence.  I have removed
that to avoid inconsistency.

> > +.It Bq Er EMSGSIZE
> > +The socket requires that message be sent atomically, and the size
> 
> messages? a message? the message?
> you need something though.

I had copied it from send(2), both man pages should be fixed.

bluhm

Index: send.2
===
RCS file: /data/mirror/openbsd/cvs/src/lib/libc/sys/send.2,v
retrieving revision 1.31
diff -u -p -r1.31 send.2
--- send.2  9 Sep 2014 06:32:37 -   1.31
+++ send.2  22 Mar 2016 11:52:22 -
@@ -147,7 +147,7 @@ is not a socket.
 .It Bq Er EFAULT
 An invalid user space address was specified for a parameter.
 .It Bq Er EMSGSIZE
-The socket requires that message be sent atomically,
+The socket requires that messages are sent atomically,
 and the size of the message to be sent made this impossible.
 .It Bq Er EAGAIN
 The socket is marked non-blocking or the
Index: sendsyslog.2
===
RCS file: /data/mirror/openbsd/cvs/src/lib/libc/sys/sendsyslog.2,v
retrieving revision 1.7
diff -u -p -r1.7 sendsyslog.2
--- sendsyslog.222 Mar 2016 07:13:16 -  1.7
+++ sendsyslog.222 Mar 2016 11:57:54 -
@@ -33,29 +33,36 @@ function is used to transmit a
 formatted message direct to
 .Xr syslogd 8
 without requiring the allocation of a socket.
-.Pp
-The
-.Fa flags
-argument of
-.Fn sendsyslog
-accepts the
-.Dv LOG_CONS
-flag.
 If
 .Dv LOG_CONS
-is specified, and
+is specified in the
+.Fa flags
+argument, and
 .Xr syslogd 8
-is not accepting messages, the message will be sent directly to the
-console.
+is not accepting messages, the message will be sent to the console.
 This is used internally by
 .Xr syslog_r 3 ,
 so that messages can be sent during difficult situations.
+If sending to
+.Xr syslogd 8
+fails, dropped messages are counted.
+When
+.Xr syslogd 8
+works again, a warning with the counter and error number is logged.
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS
 .Fn sendsyslog
 can fail if:
 .Bl -tag -width Er
+.It Bq Er EFAULT
+An invalid user space address was specified for a parameter.
+.It Bq Er EMSGSIZE
+The socket requires that messages are sent atomically,
+and the size of the message to be sent made this impossible.
+.It Bq Er ENOBUFS
+The system was unable to allocate an internal buffer.
+The operation may succeed when buffers become available.
 .It Bq Er ENOTCONN
 The message cannot be sent, likely because
 .Xr syslogd 8
@@ -69,3 +76,7 @@ The
 .Fn sendsyslog
 function call appeared in
 .Ox 5.6 .
+The
+.Fa flags
+argument was added in
+.Ox 6.0 .



make vlan(4) remember its parent by index, not by reference

2016-03-22 Thread David Gwynne
this basically makes the code use if_get instead of carrying a
pointer around. this is as mechanical as i can make it.

ok?

Index: if_vlan_var.h
===
RCS file: /cvs/src/sys/net/if_vlan_var.h,v
retrieving revision 1.33
diff -u -p -r1.33 if_vlan_var.h
--- if_vlan_var.h   14 Mar 2016 03:48:47 -  1.33
+++ if_vlan_var.h   22 Mar 2016 11:34:45 -
@@ -61,9 +61,8 @@ struct vlan_mc_entry {
 
 struct ifvlan {
struct  arpcom ifv_ac;  /* make this an interface */
-   struct  ifnet *ifv_p;   /* parent interface of this vlan */
+   unsigned int ifv_p; /* parent interface of this vlan */
struct  ifv_linkmib {
-   int ifvm_parent;
u_int16_t ifvm_proto; /* encapsulation ethertype */
u_int16_t ifvm_tag; /* tag to apply on packets leaving if */
u_int16_t ifvm_prio; /* prio to apply on packet leaving if */
Index: if_vlan.c
===
RCS file: /cvs/src/sys/net/if_vlan.c,v
retrieving revision 1.155
diff -u -p -r1.155 if_vlan.c
--- if_vlan.c   18 Mar 2016 02:40:04 -  1.155
+++ if_vlan.c   22 Mar 2016 11:34:45 -
@@ -235,7 +235,12 @@ vlan_start(struct ifnet *ifp)
uint8_t  prio;
 
ifv = ifp->if_softc;
-   ifp0 = ifv->ifv_p;
+   ifp0 = if_get(ifv->ifv_p);
+   if (ifp0 == NULL || (ifp0->if_flags & (IFF_UP|IFF_RUNNING)) !=
+   (IFF_UP|IFF_RUNNING)) {
+   ifq_purge(&ifp->if_snd);
+   goto leave;
+   }
 
for (;;) {
IFQ_DEQUEUE(&ifp->if_snd, m);
@@ -247,12 +252,6 @@ vlan_start(struct ifnet *ifp)
bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT);
 #endif /* NBPFILTER > 0 */
 
-   if ((ifp0->if_flags & (IFF_UP|IFF_RUNNING)) !=
-   (IFF_UP|IFF_RUNNING)) {
-   ifp->if_oerrors++;
-   m_freem(m);
-   continue;
-   }
 
/* IEEE 802.1p has prio 0 and 1 swapped */
prio = m->m_pkthdr.pf.prio;
@@ -290,6 +289,9 @@ vlan_start(struct ifnet *ifp)
}
ifp->if_opackets++;
}
+
+leave:
+   if_put(ifp0);
 }
 
 struct mbuf *
@@ -358,7 +360,7 @@ vlan_input(struct ifnet *ifp0, struct mb
 
list = &tagh[TAG_HASH(tag)];
SRPL_FOREACH(ifv, list, &i, ifv_list) {
-   if (ifp0 == ifv->ifv_p && tag == ifv->ifv_tag &&
+   if (ifp0->if_index == ifv->ifv_p && tag == ifv->ifv_tag &&
etype == ifv->ifv_type)
break;
}
@@ -417,13 +419,13 @@ vlan_config(struct ifvlan *ifv, struct i
 
if (ifp0->if_type != IFT_ETHER)
return EPROTONOSUPPORT;
-   if (ifv->ifv_p == ifp0 && ifv->ifv_tag == tag) /* noop */
+   if (ifp0->if_index == ifv->ifv_p && ifv->ifv_tag == tag) /* noop */
return (0);
 
/* Remember existing interface flags and reset the interface */
flags = ifv->ifv_flags;
vlan_unconfig(&ifv->ifv_if, ifp0);
-   ifv->ifv_p = ifp0;
+   ifv->ifv_p = ifp0->if_index;
ifv->ifv_if.if_baudrate = ifp0->if_baudrate;
 
if (ifp0->if_capabilities & IFCAP_VLAN_MTU) {
@@ -509,8 +511,9 @@ vlan_unconfig(struct ifnet *ifp, struct 
struct ifnet*ifp0;
 
ifv = ifp->if_softc;
-   if ((ifp0 = ifv->ifv_p) == NULL)
-   return 0;
+   ifp0 = if_get(ifv->ifv_p);
+   if (ifp0 == NULL)
+   goto disconnect;
 
/* Unset promisc mode on the interface and its parent */
if (ifv->ifv_flags & IFVF_PROMISC) {
@@ -544,8 +547,9 @@ vlan_unconfig(struct ifnet *ifp, struct 
 */
vlan_multi_apply(ifv, ifp0, SIOCDELMULTI);
 
+disconnect:
/* Disconnect from parent. */
-   ifv->ifv_p = NULL;
+   ifv->ifv_p = 0;
ifv->ifv_if.if_mtu = ETHERMTU;
ifv->ifv_if.if_hardmtu = ETHERMTU;
ifv->ifv_flags = 0;
@@ -557,6 +561,8 @@ vlan_unconfig(struct ifnet *ifp, struct 
bzero(LLADDR(sdl), ETHER_ADDR_LEN);
bzero(ifv->ifv_ac.ac_enaddr, ETHER_ADDR_LEN);
 
+   if_put(ifp0);
+
return (0);
 }
 
@@ -564,12 +570,22 @@ void
 vlan_vlandev_state(void *v)
 {
struct ifvlan   *ifv = v;
+   struct ifnet*ifp0;
+   int  link_state = LINK_STATE_DOWN;
+   uint64_t baudrate = 0;
 
-   if (ifv->ifv_if.if_link_state == ifv->ifv_p->if_link_state)
+   ifp0 = if_get(ifv->ifv_p);
+   if (ifp0 != NULL) {
+   link_state = ifp0->if_link_state;
+   baudrate = ifp0->if_baudrate;
+   }
+   if_put(ifp0);
+
+   if (ifv->ifv_if.if_link_state == link_state)
return;
 
-   ifv->ifv_if.if_link_state = ifv->ifv_p->if_link_state;
-   ifv->ifv_if.if_baudrate = ifv->ifv_p->if_baudrate;
+   ifv->

Re: arm: remove ARM11

2016-03-22 Thread Patrick Wildt
On Tue, Mar 22, 2016 at 12:22:55PM +0100, Patrick Wildt wrote:
> Hi,
> 
> the last one to remove would be ARM11.

I forgot to mention that this diff is based on the ARM10 diff.

> 
> ok?
> 
> Patrick
> 
> diff --git sys/arch/arm/arm/bus_space_asm_generic.S 
> sys/arch/arm/arm/bus_space_asm_generic.S
> index 66727a2..fa8c0df 100644
> --- sys/arch/arm/arm/bus_space_asm_generic.S
> +++ sys/arch/arm/arm/bus_space_asm_generic.S
> @@ -50,7 +50,7 @@ ENTRY(generic_bs_r_1)
>   ldrbr0, [r1, r2]
>   mov pc, lr
>  
> -#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
> +#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
>  ENTRY(generic_armv4_bs_r_2)
>   ldrhr0, [r1, r2]
>   mov pc, lr
> @@ -68,7 +68,7 @@ ENTRY(generic_bs_w_1)
>   strbr3, [r1, r2]
>   mov pc, lr
>  
> -#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
> +#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
>  ENTRY(generic_armv4_bs_w_2)
>   strhr3, [r1, r2]
>   mov pc, lr
> @@ -96,7 +96,7 @@ ENTRY(generic_bs_rm_1)
>  
>   mov pc, lr
>  
> -#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
> +#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
>  ENTRY(generic_armv4_bs_rm_2)
>   add r0, r1, r2
>   mov r1, r3
> @@ -144,7 +144,7 @@ ENTRY(generic_bs_wm_1)
>  
>   mov pc, lr
>  
> -#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
> +#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
>  ENTRY(generic_armv4_bs_wm_2)
>   add r0, r1, r2
>   mov r1, r3
> @@ -192,7 +192,7 @@ ENTRY(generic_bs_rr_1)
>  
>   mov pc, lr
>  
> -#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
> +#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
>  ENTRY(generic_armv4_bs_rr_2)
>   add r0, r1, r2
>   mov r1, r3
> @@ -240,7 +240,7 @@ ENTRY(generic_bs_wr_1)
>  
>   mov pc, lr
>  
> -#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
> +#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
>  ENTRY(generic_armv4_bs_wr_2)
>   add r0, r1, r2
>   mov r1, r3
> @@ -287,7 +287,7 @@ ENTRY(generic_bs_sr_1)
>  
>   mov pc, lr
>  
> -#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
> +#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
>  ENTRY(generic_armv4_bs_sr_2)
>   add r0, r1, r2
>   mov r1, r3
> @@ -319,7 +319,7 @@ ENTRY(generic_bs_sr_4)
>   * copy region
>   */
>  
> -#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
> +#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
>  ENTRY(generic_armv4_bs_c_2)
>   add r0, r1, r2
>   ldr r2, [sp, #0]
> diff --git sys/arch/arm/arm/cpu.c sys/arch/arm/arm/cpu.c
> index df572c1..4711123 100644
> --- sys/arch/arm/arm/cpu.c
> +++ sys/arch/arm/arm/cpu.c
> @@ -85,7 +85,6 @@ cpu_attach(struct device *dv)
>  enum cpu_class {
>   CPU_CLASS_NONE,
>   CPU_CLASS_XSCALE,
> - CPU_CLASS_ARM11J,
>   CPU_CLASS_ARMv7
>  };
>  
> @@ -173,11 +172,6 @@ const struct cpuidtab cpuids[] = {
>   { CPU_ID_PXA210C,   CPU_CLASS_XSCALE,   "PXA210",
> pxa2x0_steppings },
>  
> - { CPU_ID_ARM1136JS, CPU_CLASS_ARM11J,   "ARM1136J-S",
> -   generic_steppings },
> - { CPU_ID_ARM1136JSR1,   CPU_CLASS_ARM11J,   "ARM1136J-S R1",
> -   generic_steppings },
> -
>   { CPU_ID_CORTEX_A5, CPU_CLASS_ARMv7,"ARM Cortex A5",
> generic_steppings },
>   { CPU_ID_CORTEX_A7, CPU_CLASS_ARMv7,"ARM Cortex A7",
> @@ -239,7 +233,6 @@ struct cpu_classtab {
>  const struct cpu_classtab cpu_classes[] = {
>   { "unknown",NULL }, /* CPU_CLASS_NONE */
>   { "XScale", "CPU_XSCALE_..." }, /* CPU_CLASS_XSCALE */
> - { "ARM11J", "CPU_ARM11" },  /* CPU_CLASS_ARM11J */
>   { "ARMv7",  "CPU_ARMv7" }   /* CPU_CLASS_ARMv7 */
>  
>  };
> @@ -304,7 +297,6 @@ identify_arm_cpu(struct device *dv, struct cpu_info *ci)
>  
>   switch (cpu_class) {
>   case CPU_CLASS_XSCALE:
> - case CPU_CLASS_ARM11J:
>   case CPU_CLASS_ARMv7:
>   if ((ci->ci_ctrl & CPU_CONTROL_DC_ENABLE) == 0)
>   printf(" DC disabled");
> @@ -353,9 +345,6 @@ identify_arm_cpu(struct device *dv, struct cpu_info *ci)
>   skip_pcache:
>  
>   switch (cpu_class) {
> -#ifdef CPU_ARM11
> - case CPU_CLASS_ARM11J:
> -#endif
>  #ifdef CPU_ARMv7
>   case CPU_CLASS_ARMv7:
>  #endif
> diff --git sys/arch/arm/arm/cpufunc.c sys/arch/arm/arm/cpufunc.c
> index c981f40..622f4f8 100644
> --- sys/arch/arm/arm/cpufunc.c
> +++ sys/arch/arm/arm/cpufunc.c
> @@ -87,63 +87,6 @@ intarm_dcache_align_mask;
>  /* 1 == use cpu_sleep(), 0 == don't */
>  int cpu_do_powersave;
>  
> -#ifdef CPU_ARM11
> -struct cpu_functions arm11_cpufuncs = {
> - /* CPU functions */
> -
> - cpufunc_id, /* id   */
> - cpufunc_nullop, /* cpwait   */
> -
> - /* MMU functions */
> -
> - cpufunc_control,/* control  */
> - cpufunc_domains,/* Domain   */
> - arm11_setttb, 

arm: remove ARM11

2016-03-22 Thread Patrick Wildt
Hi,

the last one to remove would be ARM11.

ok?

Patrick

diff --git sys/arch/arm/arm/bus_space_asm_generic.S 
sys/arch/arm/arm/bus_space_asm_generic.S
index 66727a2..fa8c0df 100644
--- sys/arch/arm/arm/bus_space_asm_generic.S
+++ sys/arch/arm/arm/bus_space_asm_generic.S
@@ -50,7 +50,7 @@ ENTRY(generic_bs_r_1)
ldrbr0, [r1, r2]
mov pc, lr
 
-#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
+#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
 ENTRY(generic_armv4_bs_r_2)
ldrhr0, [r1, r2]
mov pc, lr
@@ -68,7 +68,7 @@ ENTRY(generic_bs_w_1)
strbr3, [r1, r2]
mov pc, lr
 
-#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
+#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
 ENTRY(generic_armv4_bs_w_2)
strhr3, [r1, r2]
mov pc, lr
@@ -96,7 +96,7 @@ ENTRY(generic_bs_rm_1)
 
mov pc, lr
 
-#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
+#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
 ENTRY(generic_armv4_bs_rm_2)
add r0, r1, r2
mov r1, r3
@@ -144,7 +144,7 @@ ENTRY(generic_bs_wm_1)
 
mov pc, lr
 
-#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
+#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
 ENTRY(generic_armv4_bs_wm_2)
add r0, r1, r2
mov r1, r3
@@ -192,7 +192,7 @@ ENTRY(generic_bs_rr_1)
 
mov pc, lr
 
-#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
+#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
 ENTRY(generic_armv4_bs_rr_2)
add r0, r1, r2
mov r1, r3
@@ -240,7 +240,7 @@ ENTRY(generic_bs_wr_1)
 
mov pc, lr
 
-#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
+#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
 ENTRY(generic_armv4_bs_wr_2)
add r0, r1, r2
mov r1, r3
@@ -287,7 +287,7 @@ ENTRY(generic_bs_sr_1)
 
mov pc, lr
 
-#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
+#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
 ENTRY(generic_armv4_bs_sr_2)
add r0, r1, r2
mov r1, r3
@@ -319,7 +319,7 @@ ENTRY(generic_bs_sr_4)
  * copy region
  */
 
-#if (ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
+#if (ARM_ARCH_5 + ARM_ARCH_7) > 0
 ENTRY(generic_armv4_bs_c_2)
add r0, r1, r2
ldr r2, [sp, #0]
diff --git sys/arch/arm/arm/cpu.c sys/arch/arm/arm/cpu.c
index df572c1..4711123 100644
--- sys/arch/arm/arm/cpu.c
+++ sys/arch/arm/arm/cpu.c
@@ -85,7 +85,6 @@ cpu_attach(struct device *dv)
 enum cpu_class {
CPU_CLASS_NONE,
CPU_CLASS_XSCALE,
-   CPU_CLASS_ARM11J,
CPU_CLASS_ARMv7
 };
 
@@ -173,11 +172,6 @@ const struct cpuidtab cpuids[] = {
{ CPU_ID_PXA210C,   CPU_CLASS_XSCALE,   "PXA210",
  pxa2x0_steppings },
 
-   { CPU_ID_ARM1136JS, CPU_CLASS_ARM11J,   "ARM1136J-S",
- generic_steppings },
-   { CPU_ID_ARM1136JSR1,   CPU_CLASS_ARM11J,   "ARM1136J-S R1",
- generic_steppings },
-
{ CPU_ID_CORTEX_A5, CPU_CLASS_ARMv7,"ARM Cortex A5",
  generic_steppings },
{ CPU_ID_CORTEX_A7, CPU_CLASS_ARMv7,"ARM Cortex A7",
@@ -239,7 +233,6 @@ struct cpu_classtab {
 const struct cpu_classtab cpu_classes[] = {
{ "unknown",NULL }, /* CPU_CLASS_NONE */
{ "XScale", "CPU_XSCALE_..." }, /* CPU_CLASS_XSCALE */
-   { "ARM11J", "CPU_ARM11" },  /* CPU_CLASS_ARM11J */
{ "ARMv7",  "CPU_ARMv7" }   /* CPU_CLASS_ARMv7 */
 
 };
@@ -304,7 +297,6 @@ identify_arm_cpu(struct device *dv, struct cpu_info *ci)
 
switch (cpu_class) {
case CPU_CLASS_XSCALE:
-   case CPU_CLASS_ARM11J:
case CPU_CLASS_ARMv7:
if ((ci->ci_ctrl & CPU_CONTROL_DC_ENABLE) == 0)
printf(" DC disabled");
@@ -353,9 +345,6 @@ identify_arm_cpu(struct device *dv, struct cpu_info *ci)
  skip_pcache:
 
switch (cpu_class) {
-#ifdef CPU_ARM11
-   case CPU_CLASS_ARM11J:
-#endif
 #ifdef CPU_ARMv7
case CPU_CLASS_ARMv7:
 #endif
diff --git sys/arch/arm/arm/cpufunc.c sys/arch/arm/arm/cpufunc.c
index c981f40..622f4f8 100644
--- sys/arch/arm/arm/cpufunc.c
+++ sys/arch/arm/arm/cpufunc.c
@@ -87,63 +87,6 @@ int  arm_dcache_align_mask;
 /* 1 == use cpu_sleep(), 0 == don't */
 int cpu_do_powersave;
 
-#ifdef CPU_ARM11
-struct cpu_functions arm11_cpufuncs = {
-   /* CPU functions */
-
-   cpufunc_id, /* id   */
-   cpufunc_nullop, /* cpwait   */
-
-   /* MMU functions */
-
-   cpufunc_control,/* control  */
-   cpufunc_domains,/* Domain   */
-   arm11_setttb,   /* Setttb   */
-   cpufunc_dfsr,   /* dfsr */
-   cpufunc_dfar,   /* dfar */
-   cpufunc_ifsr,   /* ifsr */
-   cpufunc_ifar,   /* ifar */
-
-

arm: remove ARM10

2016-03-22 Thread Patrick Wildt
Hi,

Now we only have 2 unused processor generations left: ARM10 and ARM11.
This diff removes support for the ARM10.

ok?

Patrick

diff --git sys/arch/arm/arm/cpu.c sys/arch/arm/arm/cpu.c
index 6fa6bc3..df572c1 100644
--- sys/arch/arm/arm/cpu.c
+++ sys/arch/arm/arm/cpu.c
@@ -84,7 +84,6 @@ cpu_attach(struct device *dv)
 
 enum cpu_class {
CPU_CLASS_NONE,
-   CPU_CLASS_ARM10E,
CPU_CLASS_XSCALE,
CPU_CLASS_ARM11J,
CPU_CLASS_ARMv7
@@ -145,11 +144,6 @@ struct cpuidtab {
 };
 
 const struct cpuidtab cpuids[] = {
-   { CPU_ID_ARM1020E,  CPU_CLASS_ARM10E,   "ARM1020E",
- generic_steppings },
-   { CPU_ID_ARM1022ES, CPU_CLASS_ARM10E,   "ARM1022E-S",
- generic_steppings },
-
{ CPU_ID_80321_400, CPU_CLASS_XSCALE,   "i80321 400MHz",
  i80321_steppings },
{ CPU_ID_80321_600, CPU_CLASS_XSCALE,   "i80321 600MHz",
@@ -244,7 +238,6 @@ struct cpu_classtab {
 
 const struct cpu_classtab cpu_classes[] = {
{ "unknown",NULL }, /* CPU_CLASS_NONE */
-   { "ARM10E", "CPU_ARM10" },  /* CPU_CLASS_ARM10E */
{ "XScale", "CPU_XSCALE_..." }, /* CPU_CLASS_XSCALE */
{ "ARM11J", "CPU_ARM11" },  /* CPU_CLASS_ARM11J */
{ "ARMv7",  "CPU_ARMv7" }   /* CPU_CLASS_ARMv7 */
@@ -310,7 +303,6 @@ identify_arm_cpu(struct device *dv, struct cpu_info *ci)
printf("%s:", dv->dv_xname);
 
switch (cpu_class) {
-   case CPU_CLASS_ARM10E:
case CPU_CLASS_XSCALE:
case CPU_CLASS_ARM11J:
case CPU_CLASS_ARMv7:
@@ -361,9 +353,6 @@ identify_arm_cpu(struct device *dv, struct cpu_info *ci)
  skip_pcache:
 
switch (cpu_class) {
-#ifdef CPU_ARM10
-   case CPU_CLASS_ARM10E:
-#endif
 #ifdef CPU_ARM11
case CPU_CLASS_ARM11J:
 #endif
diff --git sys/arch/arm/arm/cpufunc.c sys/arch/arm/arm/cpufunc.c
index fe60dd6..c981f40 100644
--- sys/arch/arm/arm/cpufunc.c
+++ sys/arch/arm/arm/cpufunc.c
@@ -87,122 +87,6 @@ int arm_dcache_align_mask;
 /* 1 == use cpu_sleep(), 0 == don't */
 int cpu_do_powersave;
 
-#if defined(CPU_ARM10)
-struct cpu_functions armv5_ec_cpufuncs = {
-   /* CPU functions */
-
-   cpufunc_id, /* id   */
-   cpufunc_nullop, /* cpwait   */
-
-   /* MMU functions */
-
-   cpufunc_control,/* control  */
-   cpufunc_domains,/* Domain   */
-   armv5_ec_setttb,/* Setttb   */
-   cpufunc_dfsr,   /* dfsr */
-   cpufunc_dfar,   /* dfar */
-   cpufunc_ifsr,   /* ifsr */
-   cpufunc_ifar,   /* ifar */
-
-   /* TLB functions */
-
-   armv4_tlb_flushID,  /* tlb_flushID  */
-   arm10_tlb_flushID_SE,   /* tlb_flushID_SE   */
-   armv4_tlb_flushI,   /* tlb_flushI   */
-   arm10_tlb_flushI_SE,/* tlb_flushI_SE*/
-   armv4_tlb_flushD,   /* tlb_flushD   */
-   armv4_tlb_flushD_SE,/* tlb_flushD_SE*/
-
-   /* Cache operations */
-
-   armv5_ec_icache_sync_all,   /* icache_sync_all  */
-   armv5_ec_icache_sync_range, /* icache_sync_range*/
-
-   /* ...cache in write-though mode... */
-   armv5_ec_dcache_wbinv_all,  /* dcache_wbinv_all */
-   armv5_ec_dcache_wbinv_range,/* dcache_wbinv_range   */
-   armv5_ec_dcache_wbinv_range,/* dcache_inv_range */
-   armv5_ec_dcache_wb_range,   /* dcache_wb_range  */
-
-   armv5_ec_idcache_wbinv_all, /* idcache_wbinv_all*/
-   armv5_ec_idcache_wbinv_range,   /* idcache_wbinv_range  */
-
-   cpufunc_nullop, /* sdcache_wbinv_all*/
-   (void *)cpufunc_nullop, /* sdcache_wbinv_range  */
-   (void *)cpufunc_nullop, /* sdcache_inv_range*/
-   (void *)cpufunc_nullop, /* sdcache_wb_range */
-
-   /* Other functions */
-
-   cpufunc_nullop, /* flush_prefetchbuf*/
-   armv4_drain_writebuf,   /* drain_writebuf   */
-
-   (void *)cpufunc_nullop, /* sleep*/
-
-   /* Soft functions */
-   arm10_context_switch,   /* context_switch   */
-   arm9e_setup /* cpu setup*/
-};
-#endif /* CPU_ARM10 */
-
-
-#ifdef CPU_ARM10
-struct cpu_functions arm10_cpufuncs = {
-   /* CPU functions */
-
-   cpufunc_id, /* id   */
-   cpufunc_nullop, /* cpwait   */
-
-   /* MMU functions */
-
-   cpufunc_control,/* control  */
-   cpufunc_domains,   

Re: bgpd: fix adding a new interface and network inet connected

2016-03-22 Thread Denis Fondras
Peter,

Thank you for fixing this bug that has been responsible for much of my service
disruption over the months :)

Denis



Re: route(4) diff

2016-03-22 Thread Peter Hessler
OK


On 2016 Mar 22 (Tue) at 10:47:53 +0100 (+0100), Sebastian Benoit wrote:
:add missing RTF_CONNECTED.
:remove ESIS (End System to Intermediate System Protocol), ann NDP in
:comment.
:add information about RTF_FMASK.
:
:ok?
:
:diff --git share/man/man4/route.4 share/man/man4/route.4
:index 7c1402c..d17dbf3 100644
:--- share/man/man4/route.4
:+++ share/man/man4/route.4
:@@ -356,23 +356,37 @@ Flags include the values:
: #define   RTF_DYNAMIC   0x10  /* created dynamically (by redirect) */
: #define   RTF_MODIFIED  0x20  /* modified dynamically (by redirect) */
: #define   RTF_DONE  0x40  /* message confirmed */
: #define   RTF_MASK  0x80  /* subnet mask present */
: #define   RTF_CLONING   0x100 /* generate new routes on use */
:-#define   RTF_LLINFO0x400 /* generated by ARP or ESIS */
:+#define   RTF_LLINFO0x400 /* generated by ARP or NDP */
: #define   RTF_STATIC0x800 /* manually added */
: #define   RTF_BLACKHOLE 0x1000/* just discard pkts (during updates) */
: #define   RTF_PROTO30x2000/* protocol specific routing flag */
: #define   RTF_PROTO20x4000/* protocol specific routing flag */
: #define   RTF_PROTO10x8000/* protocol specific routing flag */
: #define   RTF_CLONED0x1   /* this is a cloned route */
: #define RTF_MPATH 0x4   /* multipath route or operation */
: #define RTF_MPLS  0x10  /* MPLS additional infos */
: #define RTF_LOCAL 0x20/* route to a local address */
: #define RTF_BROADCAST 0x40/* route associated to a bcast addr. */
:+#define RTF_CONNECTED 0x80/* interface route */
: .Ed
: .Pp
:+The following flags (defined as
:+.Dv RTF_FMASK )
:+can be changed by an RTM_CHANGE request:
:+.Dv RTF_LLINFO ,
:+.Dv RTF_PROTO1 ,
:+.Dv RTF_PROTO2 ,
:+.Dv RTF_PROTO3 ,
:+.Dv RTF_BLACKHOLE ,
:+.Dv RTF_REJECT ,
:+.Dv RTF_STATIC
:+and
:+.Dv RTF_MPLS .
:+.Pp
: Specifiers for metric values in
: .Va rmx_locks
: and
: .Va rtm_inits
: are:
:



Re: [patch] NULL check in libedit

2016-03-22 Thread Ingo Schwarze
Hi Martijn,

Martijn van Duren wrote on Tue, Mar 22, 2016 at 09:57:33AM +0100:

> I found this one by exiting bc -l via ^D.
> It should be fine since ct_encode_string also returns NULL
> when tmp is NULL.

Oops, indeed, sorry for overlooking that edge case.
Completely correct.

> OK?

OK schwarze@; please commit quickly.
  Ingo


> Index: eln.c
> ===
> RCS file: /cvs/src/lib/libedit/eln.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 eln.c
> --- eln.c 21 Mar 2016 18:40:25 -  1.12
> +++ eln.c 22 Mar 2016 08:56:48 -
> @@ -72,7 +72,8 @@ el_gets(EditLine *el, int *nread)
>   const wchar_t *tmp;
>   wchar_t *rd, *wr;
>  
> - tmp = el_wgets(el, nread);
> + if ((tmp = el_wgets(el, nread)) == NULL)
> + return NULL;
>  
>   /*
>* Temporary until the libedit audit is complete:



route(4) diff

2016-03-22 Thread Sebastian Benoit
add missing RTF_CONNECTED.
remove ESIS (End System to Intermediate System Protocol), ann NDP in
comment.
add information about RTF_FMASK.

ok?

diff --git share/man/man4/route.4 share/man/man4/route.4
index 7c1402c..d17dbf3 100644
--- share/man/man4/route.4
+++ share/man/man4/route.4
@@ -356,23 +356,37 @@ Flags include the values:
 #defineRTF_DYNAMIC   0x10  /* created dynamically (by redirect) */
 #defineRTF_MODIFIED  0x20  /* modified dynamically (by redirect) */
 #defineRTF_DONE  0x40  /* message confirmed */
 #defineRTF_MASK  0x80  /* subnet mask present */
 #defineRTF_CLONING   0x100 /* generate new routes on use */
-#defineRTF_LLINFO0x400 /* generated by ARP or ESIS */
+#defineRTF_LLINFO0x400 /* generated by ARP or NDP */
 #defineRTF_STATIC0x800 /* manually added */
 #defineRTF_BLACKHOLE 0x1000/* just discard pkts (during updates) */
 #defineRTF_PROTO30x2000/* protocol specific routing flag */
 #defineRTF_PROTO20x4000/* protocol specific routing flag */
 #defineRTF_PROTO10x8000/* protocol specific routing flag */
 #defineRTF_CLONED0x1   /* this is a cloned route */
 #define RTF_MPATH 0x4   /* multipath route or operation */
 #define RTF_MPLS  0x10  /* MPLS additional infos */
 #define RTF_LOCAL 0x20 /* route to a local address */
 #define RTF_BROADCAST 0x40 /* route associated to a bcast addr. */
+#define RTF_CONNECTED 0x80 /* interface route */
 .Ed
 .Pp
+The following flags (defined as
+.Dv RTF_FMASK )
+can be changed by an RTM_CHANGE request:
+.Dv RTF_LLINFO ,
+.Dv RTF_PROTO1 ,
+.Dv RTF_PROTO2 ,
+.Dv RTF_PROTO3 ,
+.Dv RTF_BLACKHOLE ,
+.Dv RTF_REJECT ,
+.Dv RTF_STATIC
+and
+.Dv RTF_MPLS .
+.Pp
 Specifiers for metric values in
 .Va rmx_locks
 and
 .Va rtm_inits
 are:



[patch] NULL check in libedit

2016-03-22 Thread Martijn van Duren
Hello tech@,

I found this one by exiting bc -l via ^D.
It should be fine since ct_encode_string also returns NULL when tmp is  
NULL.

OK?

Index: eln.c
===
RCS file: /cvs/src/lib/libedit/eln.c,v
retrieving revision 1.12
diff -u -p -r1.12 eln.c
--- eln.c   21 Mar 2016 18:40:25 -  1.12
+++ eln.c   22 Mar 2016 08:56:48 -
@@ -72,7 +72,8 @@ el_gets(EditLine *el, int *nread)
const wchar_t *tmp;
wchar_t *rd, *wr;
 
-   tmp = el_wgets(el, nread);
+   if ((tmp = el_wgets(el, nread)) == NULL)
+   return NULL;
 
/*
 * Temporary until the libedit audit is complete: