Re: [Patch] Update the ifconfig(8) manpage

2014-07-01 Thread Jason McIntyre
On Mon, Jun 30, 2014 at 07:31:45PM +0200, Gregor Best wrote:
> Hi people,
> 
> the attached patch fixes two minor issues with the ifconfig(8) manpage.
> 
> The first part makes the operation of the `delete' option without an
> argument a bit more obvious.
> 
> The second is a simple fix for the range of the `priority' option.
> 
> -- 
>   Gregor Best


i've just committed a fix based on your diff. i had to tweak the bit
about "delete", since henning pointed out that this works:

ifconfig if inet6 delete

my fix below. it was a bit of a pain to work, and i tried to do it
briefly rather than labouring the point. hope it suits.

jmc

Index: ifconfig.8
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v
retrieving revision 1.242
diff -u -r1.242 ifconfig.8
--- ifconfig.8  23 Jun 2014 18:55:29 -  1.242
+++ ifconfig.8  2 Jul 2014 05:51:45 -
@@ -183,8 +183,9 @@
 .It Fl debug
 Disable driver-dependent debugging code.
 .It Cm delete
-Remove the specified network address,
-including any netmask or destination address configured with this address.
+Remove the default inet address associated with the interface,
+including any netmask or destination address configured with it.
+An address and address family can be given to make the deletion more specific.
 .It Cm description Ar value
 Specify a description of the interface.
 This can be used to label interfaces in situations where they may
@@ -403,7 +404,7 @@
 This will influence the default routing priority of new static routes added to
 the kernel.
 .Ar n
-is in the range of 0 to 16 with smaller numbers being better.
+is in the range of 0 to 15 with smaller numbers being better.
 .It Cm rdomain Ar rdomainid
 Attach the interface to the routing domain with the specified
 .Ar rdomainid .



Re: Rename MAP_ANON to MAP_ANONYMOUS

2014-07-01 Thread Matthew Dempsky
On Mon, Jun 30, 2014 at 2:47 PM, Ingo Schwarze  wrote:
> so in a nutshell, mmap(2) was originally a BSD idea and first implemented
> in SunOS?  And there is no doubt that *BSD always had MAP_ANON and never
> MAP_ANONYMOUS and that SunOS primarily defines MAP_ANON and MAP_ANONYMOUS
> only for "/* (source compatibility) */", right?  And that the earliest
> occurence of MAP_ANONYMOUS we found so far is Linux (1994)?  And that
> 4.4BSD was released with MAP_ANON before that (1993)...

I've reaffirmed that OpenBSD's stance is that we'd prefer that
MAP_ANON be standardized, explained the commit history of MAP_ANON and
MAP_ANONYMOUS (thanks Ingo!), and also pointed out that "Advanced
Programming in the UNIX Environment" recommends MAP_ANON:
http://austingroupbugs.net/view.php?id=850#c2299

I'll update the thread if anything new develops.  Next Austin Group
teleconference is July 10.



daily(8) scratch and junk files removal

2014-07-01 Thread Rafael Zalamena
I noticed a problem in one of my OpenBSD installation where tmux(1)
would lose its session socket after a few inactive days. Every time
that happened I quickly fixed it by sending a SIGUSR1 (as suggested by
the man page) to restore the socket session.

I also noted that would only happen on one machine which I had setup
one partition for /var/tmp and /tmp (and /tmp -> /var/tmp). After some
investigation I found out that the code that daily(8) uses to clean
/var/tmp is different from /tmp.

/tmp:
Test if /tmp exists and it's not a symlink
Clean all files unaccessed in 3 days except: ssh-*,
X11-unix, ICE-unix and portslocks
Clean all directories unmodified in 3 days except: ssh-*,
vi.recover, X11-unix, ICE-unix and portslocks

/var/tmp:
This one has similar rules as /tmp, but instead of cleaning all
unaccessed files, it says: clean all not directories.

The following diff fixes the issue by ignoring folders belonging to
tmux(1) sessions. Another solution would be changing the find(1) type
flag to only remove files (and not 'not directories' which include
special files like sockets, pipe, devices etc...), but I found the
first one less intrusive and more correct.


Index: etc/daily
===
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.80
diff -u -p -r1.80 daily
--- etc/daily   24 Apr 2014 19:04:54 -  1.80
+++ etc/daily   1 Jul 2014 00:49:54 -
@@ -49,7 +49,7 @@ if [ -d /tmp -a ! -L /tmp ]; then
cd /tmp && {
find -x . \
\( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \
-   -o -path ./portslocks \) \
+   -o -path ./portslocks -o -path './tmux-*' \) \
-prune -o -type f -atime +3 -execdir rm -f -- {} \; 2>/dev/null
find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \
! -path ./.ICE-unix ! -path ./portslocks ! -name . \
@@ -60,7 +60,7 @@ if [ -d /var/tmp -a ! -L /var/tmp ]; the
cd /var/tmp && {
find -x . \
\( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \
-   -o -path ./portslocks \) \
+   -o -path ./portslocks -o -path './tmux-*' \) \
-prune -o ! -type d -atime +7 -execdir rm -f -- {} \; 2>/dev/null
find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \
! -path ./.ICE-unix ! -path ./portslocks ! -name . \



Replace "void *" in u{dv,vn}_attach()

2014-07-01 Thread Matthew Dempsky
udv_attach() and uvn_attach() are called directly, not via any generic
dispatch table mechanism, so there's no point in specifying that they
accept "void *" instead of the underlying types they actually expect.

ok?

Index: share/man/man9/uvm.9
===
RCS file: /home/matthew/cvs-mirror/cvs/src/share/man/man9/uvm.9,v
retrieving revision 1.55
diff -u -p -r1.55 uvm.9
--- share/man/man9/uvm.930 Jun 2014 21:48:09 -  1.55
+++ share/man/man9/uvm.91 Jul 2014 19:57:54 -
@@ -439,7 +439,7 @@ returns a standard errno.
 .Sh MEMORY MAPPING FILES AND DEVICES
 .nr nS 1
 .Ft struct uvm_object *
-.Fn uvn_attach "void *arg" "vm_prot_t accessprot"
+.Fn uvn_attach "struct vnode *vp" "vm_prot_t accessprot"
 .Ft void
 .Fn uvm_vnp_setsize "struct vnode *vp" "voff_t newsize"
 .Ft void
@@ -453,7 +453,7 @@ returns a standard errno.
 The
 .Fn uvn_attach
 function attaches a UVM object to vnode
-.Fa arg ,
+.Fa vp ,
 creating the object if necessary.
 The object is returned.
 .Pp
Index: sys/kern/exec_subr.c
===
RCS file: /home/matthew/cvs-mirror/cvs/src/sys/kern/exec_subr.c,v
retrieving revision 1.33
diff -u -p -r1.33 exec_subr.c
--- sys/kern/exec_subr.c29 May 2014 05:05:34 -  1.33
+++ sys/kern/exec_subr.c1 Jul 2014 19:54:15 -
@@ -187,7 +187,7 @@ vmcmd_map_pagedvn(struct proc *p, struct
 * first, attach to the object
 */
 
-   uobj = uvn_attach((void *)cmd->ev_vp, VM_PROT_READ|VM_PROT_EXECUTE);
+   uobj = uvn_attach(cmd->ev_vp, VM_PROT_READ|VM_PROT_EXECUTE);
if (uobj == NULL)
return (ENOMEM);
 
Index: sys/uvm/uvm_vnode.c
===
RCS file: /home/matthew/cvs-mirror/cvs/src/sys/uvm/uvm_vnode.c,v
retrieving revision 1.82
diff -u -p -r1.82 uvm_vnode.c
--- sys/uvm/uvm_vnode.c 8 May 2014 20:08:50 -   1.82
+++ sys/uvm/uvm_vnode.c 1 Jul 2014 19:53:41 -
@@ -139,9 +139,8 @@ uvn_init(void)
  *pointers are equiv.
  */
 struct uvm_object *
-uvn_attach(void *arg, vm_prot_t accessprot)
+uvn_attach(struct vnode *vp, vm_prot_t accessprot)
 {
-   struct vnode *vp = arg;
struct uvm_vnode *uvn = &vp->v_uvm;
struct vattr vattr;
int oldflags, result;
Index: sys/uvm/uvm_vnode.h
===
RCS file: /home/matthew/cvs-mirror/cvs/src/sys/uvm/uvm_vnode.h,v
retrieving revision 1.12
diff -u -p -r1.12 uvm_vnode.h
--- sys/uvm/uvm_vnode.h 14 Mar 2002 01:27:19 -  1.12
+++ sys/uvm/uvm_vnode.h 1 Jul 2014 19:53:54 -
@@ -102,7 +102,7 @@ struct uvm_vnode {
  * include sys/vnode.h, and files that include sys/vnode.h don't know
  * what a vm_prot_t is.
  */
-struct uvm_object  *uvn_attach(void *, vm_prot_t);
+struct uvm_object  *uvn_attach(struct vnode *, vm_prot_t);
 #endif
 
 #endif /* _KERNEL */
Index: sys/uvm/uvm_device.c
===
RCS file: /home/matthew/cvs-mirror/cvs/src/sys/uvm/uvm_device.c,v
retrieving revision 1.45
diff -u -p -r1.45 uvm_device.c
--- sys/uvm/uvm_device.c13 Apr 2014 23:14:15 -  1.45
+++ sys/uvm/uvm_device.c1 Jul 2014 19:56:09 -
@@ -97,9 +97,8 @@ struct uvm_pagerops uvm_deviceops = {
  * The last two arguments (off and size) are only used for access checking.
  */
 struct uvm_object *
-udv_attach(void *arg, vm_prot_t accessprot, voff_t off, vsize_t size)
+udv_attach(dev_t device, vm_prot_t accessprot, voff_t off, vsize_t size)
 {
-   dev_t device = *((dev_t *)arg);
struct uvm_device *udv, *lcv;
paddr_t (*mapfn)(dev_t, off_t, int);
 #if NDRM > 0
@@ -118,7 +117,7 @@ udv_attach(void *arg, vm_prot_t accesspr
return(NULL);
 
 #if NDRM > 0
-   obj = udv_attach_drm(arg, accessprot, off, size);
+   obj = udv_attach_drm(device, accessprot, off, size);
if (obj)
return(obj);
 #endif
Index: sys/uvm/uvm_device.h
===
RCS file: /home/matthew/cvs-mirror/cvs/src/sys/uvm/uvm_device.h,v
retrieving revision 1.9
diff -u -p -r1.9 uvm_device.h
--- sys/uvm/uvm_device.h7 Jun 2013 20:46:14 -   1.9
+++ sys/uvm/uvm_device.h1 Jul 2014 19:55:42 -
@@ -70,8 +70,8 @@ struct uvm_device {
  * prototypes
  */
 
-struct uvm_object *udv_attach(void *, vm_prot_t, voff_t, vsize_t);
-struct uvm_object *udv_attach_drm(void *, vm_prot_t, voff_t, vsize_t);
+struct uvm_object *udv_attach(dev_t, vm_prot_t, voff_t, vsize_t);
+struct uvm_object *udv_attach_drm(dev_t, vm_prot_t, voff_t, vsize_t);
 
 #endif /* _KERNEL */
 
Index: sys/uvm/uvm_extern.h
===
RCS file: /home/matthew/cvs-mirror/cvs/src/sys/uvm/uvm_extern.h,v
retrieving revision 1.116
diff -u -p -r1.116 uvm_extern.h
--- sys/uvm/uvm_extern.h   

Re: sort(1) updates

2014-07-01 Thread Jared Yanovich
On Mon, Jun 30, 2014 at 11:53:04AM +0200, Otto Moerbeek wrote:

> This indeed solves some problems, but I have a test file on which it cores.

Patch relative to the original diff I posted.

diff -ru sort.new/fsort.c sort.new2/fsort.c
--- sort.new/fsort.cTue Jul  1 15:54:45 2014
+++ sort.new2/fsort.c   Tue Jul  1 15:55:15 2014
@@ -62,7 +62,7 @@
static size_t bufsize;
int ntfiles, mfct = 0;
int c, nelem;
-   union f_handle tfiles, mstart = { MAXFCT - MERGE_FNUM };
+   union f_handle tfiles = { 0 }, mstart = { MAXFCT - MERGE_FNUM };
int (*get)(int, union f_handle, int, RECHEADER *,
u_char *, struct field *);
RECHEADER *crec;



Re: PATCH: ftp: allow @ in username for Basic Auth

2014-07-01 Thread Sébastien Marie
On Sun, Jun 29, 2014 at 09:52:28PM -0700, Philip Guenther wrote:
> > > Here's a patch to do that.
> > 
> > Just a comment in code (unused variables in urldecode).
> > Else it seems ok. And my use-case works.
> 
> Dang it, I just noticed that I had sent an earlier version of my diff, 
> which had problems with some proxy setting, IIRC.  Here's the diff that I 
> settled on after testing.
> 

It works also for my use-case. Please note I haven't tested proxy
setting (by lake of server to test).

Thanks for your help.
-- 
Sébastien Marie



Modifying queues while pf is disabled

2014-07-01 Thread Nathanael Rensen
When pf is disabled (pfctl -d), pf_remove_queues() detaches hfsc from the
interface but the queues are not removed from pf_queues_active.

The next time pf rules are loaded, pf_commit_queues() calls pf_remove_queues()
and in turn hfsc_delqueue() for each queue in pf_queues_active. This fails
since hfsc has already been detached.

Example:

# echo 'queue root on em0 bandwidth 2M default' > /tmp/pf.conf
# pfctl -f /tmp/pf.conf
# pfctl -d
# sudo pfctl -f /tmp/pf.conf
pfctl: DIOCXCOMMIT: Invalid argument

Also, if queues are loaded after pf is disabled they become immediately
active rather than remaining inactive until pf is enabled. Example:

# pfctl -Fa
# pfctl -d
# pfctl -f /tmp/pf.conf
# pfctl -vs queue
  [ pkts:  0  bytes:  0  dropped pkts:  0 bytes:  0 ]
  [ qlength:   0/ 50 ]
queue root on em0 bandwidth 2M default qlimit 50
  [ pkts:180  bytes:  25352  dropped pkts:  0 bytes:  0 ]
  [ qlength:   0/ 50 ]

The diff below also allows 'pfctl -vs queue' to show zeros rather than an
error when pf is disabled.

Nathanael

Index: sys/net/pf_ioctl.c
===
RCS file: /cvs/src/sys/net/pf_ioctl.c,v
retrieving revision 1.272
diff -u -p -r1.272 pf_ioctl.c
--- sys/net/pf_ioctl.c  22 Apr 2014 14:41:03 -  1.272
+++ sys/net/pf_ioctl.c  1 Jul 2014 12:36:08 -
@@ -591,7 +591,7 @@ pf_commit_queues(void)
struct pf_queuehead *qswap;
int error;
 
-   if ((error = pf_remove_queues(NULL)) != 0)
+   if (pf_status.running && (error = pf_remove_queues(NULL)) != 0)
return (error);
 
/* swap */
@@ -600,7 +600,9 @@ pf_commit_queues(void)
pf_queues_inactive = qswap;
pf_free_queues(pf_queues_inactive, NULL);
 
-   return (pf_create_queues());
+   if (pf_status.running && (error = pf_create_queues()) != 0)
+   return (error);
+   return (0);
 }
 
 #define PF_MD5_UPD(st, elm)\
@@ -1004,8 +1006,9 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a
break;
}
bcopy(qs, &pq->queue, sizeof(pq->queue));
-   error = hfsc_qstats(qs, pq->buf, &nbytes);
-   if (error == 0)
+   pq->nbytes = 0;
+   if (pf_status.running &&
+   (error = hfsc_qstats(qs, pq->buf, &nbytes)) == 0)
pq->nbytes = nbytes;
break;
}



"new" package format

2014-07-01 Thread Marc Espie
I've just switched on "out-of-order" packages, after much testing.

What this means:

new packages won't be compatible with older pkg_add. Most specifically,
the plist order may no longer match the packing-list.

-> if you see strange pkg_add errors, and your base system is not uptodate,
that's your fault.

New bulks will exploit that feature: build machines log an history of
files in a package. With out-of-order archives, they can take advantage
of that to produce packages where the most recently changed files are
at the front.

For some packages, this can be a drastic performance improvement: some
measurements show that as much as half of some packages do not change
over a 2 months period.

Note that this will speed up "dependency, maintainer and other meta info"
updates even more, as the package extraction may stop right after the meta
information...