Re: ibss and hostap support for urtwn(4)

2014-01-20 Thread Fabian Raetz
Hi,
i'm interested in testing your diff, but i will not get to testing until
saturday.

Regards,
Fabian


Intel drm resume

2014-01-20 Thread deraadt
Looking at ATI resume, I pushed Mark to explore using DVACT_WAKEUP instead,
because the code looks super hairy and might sleep...

The same applies to Intel.

Since there are many more people who rely on such machines, can we get
some test reports of this on all machines, for suspend/resume and
hibernate?

Index: dev/pci/drm/i915/i915_drv.c
===
RCS file: /cvs/src/sys/dev/pci/drm/i915/i915_drv.c,v
retrieving revision 1.55
diff -u -p -u -r1.55 i915_drv.c
--- dev/pci/drm/i915/i915_drv.c 6 Dec 2013 11:17:20 -   1.55
+++ dev/pci/drm/i915/i915_drv.c 20 Jan 2014 09:36:07 -
@@ -1126,7 +1126,7 @@ inteldrm_activate(struct device *arg, in
break;
case DVACT_SUSPEND:
break;
-   case DVACT_RESUME:
+   case DVACT_WAKEUP:
i915_drm_thaw(dev);
intel_fb_restore_mode(dev);
break;



received-on any

2014-01-20 Thread Henning Brauer
this diff adds any as a away to match any non-loopback interface.
primary use is probably sth like
  block out on $someinf received-on any
which prevents anything to be forwarded to $someif, while still
allowing locally generated packets.
  pass on any
also works, but is probably not all that useful.

Index: sys/net/pf_if.c
===
RCS file: /cvs/src/sys/net/pf_if.c,v
retrieving revision 1.70
diff -u -p -r1.70 pf_if.c
--- sys/net/pf_if.c 8 Jan 2014 22:38:29 -   1.70
+++ sys/net/pf_if.c 20 Jan 2014 03:54:33 -
@@ -118,6 +118,12 @@ pfi_kif_get(const char *kif_name)
kif-pfik_tzero = time_second;
TAILQ_INIT(kif-pfik_dynaddrs);
 
+   if (!strcmp(kif-pfik_name, any)) {
+   /* both so it works in the ioctl and the regular case */
+   kif-pfik_flags |= PFI_IFLAG_ANY;
+   kif-pfik_flags_new |= PFI_IFLAG_ANY;
+   }
+
RB_INSERT(pfi_ifhead, pfi_ifs, kif);
return (kif);
 }
@@ -199,6 +205,10 @@ pfi_kif_match(struct pfi_kif *rule_kif, 
TAILQ_FOREACH(p, packet_kif-pfik_ifp-if_groups, ifgl_next)
if (p-ifgl_group == rule_kif-pfik_group)
return (1);
+
+   if (rule_kif-pfik_flags  PFI_IFLAG_ANY  packet_kif-pfik_ifp 
+   !(packet_kif-pfik_ifp-if_flags  IFF_LOOPBACK))
+   return (1); 
 
return (0);
 }
Index: sys/net/pfvar.h
===
RCS file: /cvs/src/sys/net/pfvar.h,v
retrieving revision 1.396
diff -u -p -r1.396 pfvar.h
--- sys/net/pfvar.h 20 Jan 2014 02:57:50 -  1.396
+++ sys/net/pfvar.h 20 Jan 2014 04:01:19 -
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.394 2014/01/03 12:43:09 pelikan Exp $ */
+/* $OpenBSD: pfvar.h,v 1.396 2014/01/20 02:57:50 henning Exp $ */
 
 /*
  * Copyright (c) 2001 Daniel Hartmeier
@@ -1222,6 +1222,7 @@ enum pfi_kif_refs {
 };
 
 #define PFI_IFLAG_SKIP 0x0100  /* skip filtering on interface */
+#define PFI_IFLAG_ANY  0x0200  /* match any non-loopback interface */
 
 struct pf_pdesc {
struct {
Index: sbin/pfctl/parse.y
===
RCS file: /cvs/src/sbin/pfctl/parse.y,v
retrieving revision 1.629
diff -u -p -r1.629 parse.y
--- sbin/pfctl/parse.y  20 Jan 2014 02:59:13 -  1.629
+++ sbin/pfctl/parse.y  20 Jan 2014 03:20:52 -
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.627 2013/11/22 04:12:48 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.629 2014/01/20 02:59:13 henning Exp $ */
 
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
@@ -2762,6 +2762,15 @@ if_item  : STRING{
$$-ifa_flags = n-ifa_flags;
 
free($1);
+   $$-not = 0;
+   $$-next = NULL;
+   $$-tail = $$;
+   }
+   | ANY   {
+   $$ = calloc(1, sizeof(struct node_if));
+   if ($$ == NULL)
+   err(1, if_item: calloc);
+   strlcpy($$-ifname, any, sizeof($$-ifname));
$$-not = 0;
$$-next = NULL;
$$-tail = $$;
Index: share/man/man5/pf.conf.5
===
RCS file: /cvs/src/share/man/man5/pf.conf.5,v
retrieving revision 1.534
diff -u -p -r1.534 pf.conf.5
--- share/man/man5/pf.conf.520 Jan 2014 02:59:55 -  1.534
+++ share/man/man5/pf.conf.520 Jan 2014 04:05:09 -
@@ -1,4 +1,4 @@
-.\$OpenBSD: pf.conf.5,v 1.532 2013/12/21 20:57:01 camield Exp $
+.\$OpenBSD: pf.conf.5,v 1.534 2014/01/20 02:59:55 henning Exp $
 .\
 .\ Copyright (c) 2002, Daniel Hartmeier
 .\ Copyright (c) 2003 - 2013 Henning Brauer henn...@openbsd.org
@@ -276,6 +276,8 @@ see the
 .Ic group
 keyword in
 .Xr ifconfig 8 .
+.Ar any
+will match any existing interface except loopback ones.
 .It Ar on Ar rdomain Aq Ar number
 This rule applies only to packets coming in on, or going out through, this
 particular routing domain.
@@ -627,6 +629,8 @@ For example, the following rule will dro
 Only match packets which were received on the specified
 .Ar interface
 (or interface group).
+.Ar any
+will match any existing interface except loopback ones.
 .Pp
 .It Ar rtable Aq Ar number
 Used to select an alternate routing table for the routing lookup.



Cleanup rtsock crazy defines

2014-01-20 Thread Martin Pieuchot
Here's a diff that substitutes the crazy defines of rtsock.c plus some 0
- NULL conversion.  There's no object change with it.

ok?

Index: net/rtsock.c
===
RCS file: /home/ncvs/src/sys/net/rtsock.c,v
retrieving revision 1.134
diff -u -p -r1.134 rtsock.c
--- net/rtsock.c19 Jan 2014 11:20:46 -  1.134
+++ net/rtsock.c20 Jan 2014 11:34:58 -
@@ -107,15 +107,6 @@ struct rt_omsghdr *rtmsg_5to4(struct rt_
 void rt_ogetmetrics(struct rt_kmetrics *in, struct rt_ometrics *out);
 #endif /* RTM_OVERSION */
 
-/* Sleazy use of local variables throughout file, warning */
-#define dstinfo.rti_info[RTAX_DST]
-#define gate   info.rti_info[RTAX_GATEWAY]
-#define netmaskinfo.rti_info[RTAX_NETMASK]
-#define genmaskinfo.rti_info[RTAX_GENMASK]
-#define ifpaddrinfo.rti_info[RTAX_IFP]
-#define ifaaddrinfo.rti_info[RTAX_IFA]
-#define brdaddrinfo.rti_info[RTAX_BRD]
-
 struct routecb {
struct rawcbrcb;
struct timeout  timeout;
@@ -474,7 +465,7 @@ route_output(struct mbuf *m, ...)
so = va_arg(ap, struct socket *);
va_end(ap);
 
-   dst = NULL; /* for error handling (goto flush) */
+   info.rti_info[RTAX_DST] = NULL; /* for error handling (goto flush) */
if (m == 0 || ((m-m_len  sizeof(int32_t)) 
(m = m_pullup(m, sizeof(int32_t))) == 0))
return (ENOBUFS);
@@ -588,19 +579,23 @@ route_output(struct mbuf *m, ...)
info.rti_addrs = rtm-rtm_addrs;
rt_xaddrs(rtm-rtm_hdrlen + (caddr_t)rtm, len + (caddr_t)rtm, info);
info.rti_flags = rtm-rtm_flags;
-   if (dst == 0 || dst-sa_family = AF_MAX ||
-   (gate != 0  gate-sa_family = AF_MAX)) {
+   if (info.rti_info[RTAX_DST] == NULL ||
+   info.rti_info[RTAX_DST]-sa_family = AF_MAX ||
+   (info.rti_info[RTAX_GATEWAY] != NULL 
+info.rti_info[RTAX_GATEWAY]-sa_family = AF_MAX)) {
error = EINVAL;
goto flush;
}
-   if (genmask) {
+   if (info.rti_info[RTAX_GENMASK] != NULL) {
struct radix_node   *t;
-   t = rn_addmask(genmask, 0, 1);
-   if (t  genmask-sa_len =
+   t = rn_addmask(info.rti_info[RTAX_GENMASK], 0, 1);
+   if (t  info.rti_info[RTAX_GENMASK]-sa_len =
((struct sockaddr *)t-rn_key)-sa_len 
-   memcmp((caddr_t *)genmask + 1, (caddr_t *)t-rn_key + 1,
+   memcmp((caddr_t *)info.rti_info[RTAX_GENMASK] + 1,
+   (caddr_t *)t-rn_key + 1,
((struct sockaddr *)t-rn_key)-sa_len) - 1)
-   genmask = (struct sockaddr *)(t-rn_key);
+   info.rti_info[RTAX_GENMASK] =
+   (struct sockaddr *)(t-rn_key);
else {
error = ENOBUFS;
goto flush;
@@ -612,7 +607,7 @@ route_output(struct mbuf *m, ...)
 
switch (rtm-rtm_type) {
case RTM_ADD:
-   if (gate == 0) {
+   if (info.rti_info[RTAX_GATEWAY] == NULL) {
error = EINVAL;
goto flush;
}
@@ -622,7 +617,7 @@ route_output(struct mbuf *m, ...)
rt_setmetrics(rtm-rtm_inits, rtm-rtm_rmx,
saved_nrt-rt_rmx);
saved_nrt-rt_refcnt--;
-   saved_nrt-rt_genmask = genmask;
+   saved_nrt-rt_genmask = info.rti_info[RTAX_GENMASK];
/* write back the priority the kernel used */
rtm-rtm_priority = saved_nrt-rt_priority  RTP_MASK;
rtm-rtm_index = saved_nrt-rt_ifp-if_index;
@@ -640,11 +635,13 @@ route_output(struct mbuf *m, ...)
case RTM_GET:
case RTM_CHANGE:
case RTM_LOCK:
-   if ((rnh = rt_gettable(dst-sa_family, tableid)) == NULL) {
+   rnh = rt_gettable(info.rti_info[RTAX_DST]-sa_family, tableid);
+   if (rnh == NULL) {
error = EAFNOSUPPORT;
goto flush;
}
-   rt = rt_lookup(dst, netmask, tableid);
+   rt = rt_lookup(info.rti_info[RTAX_DST],
+   info.rti_info[RTAX_NETMASK], tableid);
rn = (struct radix_node *)rt;
if (rn == NULL || (rn-rn_flags  RNF_ROOT) != 0) {
error = ESRCH;
@@ -656,9 +653,10 @@ route_output(struct mbuf *m, ...)
 * for RTM_CHANGE/LOCK, if we got multipath routes,
 * we require users to specify a matching RTAX_GATEWAY.
 *
-* for RTM_GET, gate is optional even with multipath.
-* if gate == NULL the first match is returned.
-* (no need to call rt_mpath_matchgate if gate 

Re: Request for Funding our Electricity

2014-01-20 Thread Kevin Chadwick
previously on this list Theo de Raadt contributed:

  
  If the tests are as good as this project claims them to be, the process
  should take exactly one test cycle. If that's the case, then the test
  regime suck big time. Logic brother. Logic.  
 
 the OpenBSD project's purpose is not to test emulators.

And this should be obvious to many that it is a time consuming task to
prove or even have confidence of.

Virtualbox without hardware virtualisation still crashes OpenBSD never
mind being accurate because it's memory handling implementation is so
far removed from x86 atleast.

-- 
___

'Write programs that do one thing and do it well. Write programs to work
together. Write programs to handle text streams, because that is a
universal interface'

(Doug McIlroy)

In Other Words - Don't design like polkit or systemd
___



asdasd

2014-01-20 Thread Bob Beck
Greetings All,

About a week ago I warned you all that the OpenBSD project did not
have the funds to cover our bills for the past year (especially the
ability to handle the electricity) and that our funding sources were
not sustainable.

As most of you know the news of our predicament has been widely
distributed over the last week, and the response from the community as
well as corporate donors has been significant - some of this response
has been hitting the internet media already.

To all of you who have donated, please allow me to give you a huge
Thank You.  In a nutshell, we have in one week gone from being in a
dire situation to having a commitment of approximately $100,000 in
donations to the foundation. From a developer's perspective let me
assure you that this reaffirms the worth of what we are supporting and
makes us want to work on it that much more.

We would like to continue to build on your groundswell of support, and
have set a target for $150,000 this year in fundraising.  Please see

http://www.openbsdfoundation.org/campaign2104.html

If you have contributed already - Thank you!
If you can help us by contributing - Please do.
If you know or work for someone who can help us reach our goals,
please contact us.

Sincerely,

-Bob



OpenBSD Foundation Fundraising for 2014

2014-01-20 Thread Bob Beck
Greetings All,

About a week ago I warned you all that the OpenBSD project did not
have the funds to cover our bills for the past year (especially the
ability to handle the electricity) and that our funding sources were
not sustainable.

As most of you know the news of our predicament has been widely
distributed over the last week, and the response from the community as
well as corporate donors has been significant - some of this response
has been hitting the internet media already.

To all of you who have donated, please allow me to give you a huge
Thank You.  In a nutshell, we have in one week gone from being in a
dire situation to having a commitment of approximately $100,000 in
donations to the foundation. From a developer's perspective let me
assure you that this reaffirms the worth of what we are supporting and
makes us want to work on it that much more.

We would like to continue to build on your groundswell of support, and
have set a target for $150,000 this year in fundraising.  Please see

http://www.openbsdfoundation.org/campaign2104.html

If you have contributed already - Thank you.
If you can help us by contributing - Please do.
If you know or work for someone who can help us reach our goals,
please contact us.

Sincerely,

-Bob



Re: [PATCH] nginx.conf(5): Less EXAMPLES, more HISTORY

2014-01-20 Thread Ingo Schwarze
Hi Donovan,

Donovan Watteau wrote on Sat, Jan 11, 2014 at 04:18:59PM +0100:

 OpenBSD now provides an nginx.conf(5) manual page and I love this,
 thanks!
 
 But it ends with an EXAMPLES section which only deals with some
 horrible use of whitespace, which is not recommended.  I don't
 get it.  This manpage is a relief, but it ends in a really sad
 and not really useful way...

Oh, i forgot to mention what the point is.  The DESCRIPTION
contains a description of the grammar.  The only thing about
the grammer that is really tricky is the whitespace rules.
The rest doesn't really need examples for clarification, in
particular since the documentation of individual directives
already provide plenty.

Anyway, i didn't remove the example, i consider it helpful
for understanding the whitespace rules more easily, even though
you are not supposed to use them in that way.

 I'd rather see a mention that this
 manpage is an OpenBSD improvement!

I just added some text to that effect, thanks for pointing out
that HISTORY and AUTHORS were missing.

Yours,
  Ingo



Re: extent_supply_region_descriptor

2014-01-20 Thread Miod Vallat
 In order to make the sparc64 iommu code mpsafe, I need to make sure
 the extent manager can be used in an mpsafe manner.  The current code
 isn't really safe since the extent manager needs to allocate region
 descriptors whenever we do a bus_dmamap_load().  The diff below adds a
 function to provide the extent manager with a region descriptor such
 that the next extent_alloc_xxx() call can use that one instead of
 allocating a new one.
 
 I deliberately chose to add a seperate API, since
 extent_alloc_subregion() already has too many arguments.
 
 The 2nd diff shows how I use this in the sparc64 iommu code.
 
 opinions?

This is ugly. Better introduce an extent_alloc_with_descr() or
extent_alloc_static() interface which is similar to extent_alloc(), but
receives the extent descriptor as an added argument.



Re: Cleanup rtsock crazy defines

2014-01-20 Thread Claudio Jeker
On Mon, Jan 20, 2014 at 12:38:37PM +0100, Martin Pieuchot wrote:
 Here's a diff that substitutes the crazy defines of rtsock.c plus some 0
 - NULL conversion.  There's no object change with it.
 
 ok?

OK claudio

makes rtsock.c not nicer but at least not worse.
 
 Index: net/rtsock.c
 ===
 RCS file: /home/ncvs/src/sys/net/rtsock.c,v
 retrieving revision 1.134
 diff -u -p -r1.134 rtsock.c
 --- net/rtsock.c  19 Jan 2014 11:20:46 -  1.134
 +++ net/rtsock.c  20 Jan 2014 11:34:58 -
 @@ -107,15 +107,6 @@ struct rt_omsghdr *rtmsg_5to4(struct rt_
  void rt_ogetmetrics(struct rt_kmetrics *in, struct rt_ometrics *out);
  #endif /* RTM_OVERSION */
  
 -/* Sleazy use of local variables throughout file, warning */
 -#define dst  info.rti_info[RTAX_DST]
 -#define gate info.rti_info[RTAX_GATEWAY]
 -#define netmask  info.rti_info[RTAX_NETMASK]
 -#define genmask  info.rti_info[RTAX_GENMASK]
 -#define ifpaddr  info.rti_info[RTAX_IFP]
 -#define ifaaddr  info.rti_info[RTAX_IFA]
 -#define brdaddr  info.rti_info[RTAX_BRD]
 -
  struct routecb {
   struct rawcbrcb;
   struct timeout  timeout;
 @@ -474,7 +465,7 @@ route_output(struct mbuf *m, ...)
   so = va_arg(ap, struct socket *);
   va_end(ap);
  
 - dst = NULL; /* for error handling (goto flush) */
 + info.rti_info[RTAX_DST] = NULL; /* for error handling (goto flush) */
   if (m == 0 || ((m-m_len  sizeof(int32_t)) 
   (m = m_pullup(m, sizeof(int32_t))) == 0))
   return (ENOBUFS);
 @@ -588,19 +579,23 @@ route_output(struct mbuf *m, ...)
   info.rti_addrs = rtm-rtm_addrs;
   rt_xaddrs(rtm-rtm_hdrlen + (caddr_t)rtm, len + (caddr_t)rtm, info);
   info.rti_flags = rtm-rtm_flags;
 - if (dst == 0 || dst-sa_family = AF_MAX ||
 - (gate != 0  gate-sa_family = AF_MAX)) {
 + if (info.rti_info[RTAX_DST] == NULL ||
 + info.rti_info[RTAX_DST]-sa_family = AF_MAX ||
 + (info.rti_info[RTAX_GATEWAY] != NULL 
 +  info.rti_info[RTAX_GATEWAY]-sa_family = AF_MAX)) {
   error = EINVAL;
   goto flush;
   }
 - if (genmask) {
 + if (info.rti_info[RTAX_GENMASK] != NULL) {
   struct radix_node   *t;
 - t = rn_addmask(genmask, 0, 1);
 - if (t  genmask-sa_len =
 + t = rn_addmask(info.rti_info[RTAX_GENMASK], 0, 1);
 + if (t  info.rti_info[RTAX_GENMASK]-sa_len =
   ((struct sockaddr *)t-rn_key)-sa_len 
 - memcmp((caddr_t *)genmask + 1, (caddr_t *)t-rn_key + 1,
 + memcmp((caddr_t *)info.rti_info[RTAX_GENMASK] + 1,
 + (caddr_t *)t-rn_key + 1,
   ((struct sockaddr *)t-rn_key)-sa_len) - 1)
 - genmask = (struct sockaddr *)(t-rn_key);
 + info.rti_info[RTAX_GENMASK] =
 + (struct sockaddr *)(t-rn_key);
   else {
   error = ENOBUFS;
   goto flush;
 @@ -612,7 +607,7 @@ route_output(struct mbuf *m, ...)
  
   switch (rtm-rtm_type) {
   case RTM_ADD:
 - if (gate == 0) {
 + if (info.rti_info[RTAX_GATEWAY] == NULL) {
   error = EINVAL;
   goto flush;
   }
 @@ -622,7 +617,7 @@ route_output(struct mbuf *m, ...)
   rt_setmetrics(rtm-rtm_inits, rtm-rtm_rmx,
   saved_nrt-rt_rmx);
   saved_nrt-rt_refcnt--;
 - saved_nrt-rt_genmask = genmask;
 + saved_nrt-rt_genmask = info.rti_info[RTAX_GENMASK];
   /* write back the priority the kernel used */
   rtm-rtm_priority = saved_nrt-rt_priority  RTP_MASK;
   rtm-rtm_index = saved_nrt-rt_ifp-if_index;
 @@ -640,11 +635,13 @@ route_output(struct mbuf *m, ...)
   case RTM_GET:
   case RTM_CHANGE:
   case RTM_LOCK:
 - if ((rnh = rt_gettable(dst-sa_family, tableid)) == NULL) {
 + rnh = rt_gettable(info.rti_info[RTAX_DST]-sa_family, tableid);
 + if (rnh == NULL) {
   error = EAFNOSUPPORT;
   goto flush;
   }
 - rt = rt_lookup(dst, netmask, tableid);
 + rt = rt_lookup(info.rti_info[RTAX_DST],
 + info.rti_info[RTAX_NETMASK], tableid);
   rn = (struct radix_node *)rt;
   if (rn == NULL || (rn-rn_flags  RNF_ROOT) != 0) {
   error = ESRCH;
 @@ -656,9 +653,10 @@ route_output(struct mbuf *m, ...)
* for RTM_CHANGE/LOCK, if we got multipath routes,
* we require users to specify a matching RTAX_GATEWAY.
*
 -  * for RTM_GET, gate is optional even with multipath.
 -  * if gate == NULL the first match is 

fuse_opt_parse(), constify param

2014-01-20 Thread Jérémie Courrèges-Anglas

Hi,

The reference FUSE implementation defines fuse_opt_parse's third
argument as const.  At least fuse-zip[1] needs this.
follow.

ok?

[1] https://code.google.com/p/fuse-zip/

Index: fuse_opt.c
===
RCS file: /cvs/src/lib/libfuse/fuse_opt.c,v
retrieving revision 1.7
diff -u -p -r1.7 fuse_opt.c
--- fuse_opt.c  4 Nov 2013 19:54:18 -   1.7
+++ fuse_opt.c  20 Jan 2014 20:23:57 -
@@ -218,8 +218,8 @@ fuse_opt_add_arg(struct fuse_args *args,
 }
 
 static int
-parse_opt(struct fuse_opt *o, const char *val, void *data, fuse_opt_proc_t f,
-struct fuse_args *arg)
+parse_opt(const struct fuse_opt *o, const char *val, void *data,
+fuse_opt_proc_t f, struct fuse_args *arg)
 {
int ret;
int found = 0;
@@ -256,8 +256,8 @@ parse_opt(struct fuse_opt *o, const char
  * when f() returns 0 we need to discard the arg
  */
 int
-fuse_opt_parse(struct fuse_args *args, void *data, struct fuse_opt *opt,
-fuse_opt_proc_t f)
+fuse_opt_parse(struct fuse_args *args, void *data,
+const struct fuse_opt *opt, fuse_opt_proc_t f)
 {
struct fuse_args outargs = FUSE_ARGS_INIT(args-argc, args-argv);
const char *arg;
Index: fuse_opt.h
===
RCS file: /cvs/src/lib/libfuse/fuse_opt.h,v
retrieving revision 1.2
diff -u -p -r1.2 fuse_opt.h
--- fuse_opt.h  11 Jul 2013 11:41:13 -  1.2
+++ fuse_opt.h  20 Jan 2014 20:20:16 -
@@ -41,7 +41,7 @@ void fuse_opt_free_args(struct fuse_args
 int fuse_opt_add_opt(char **, const char *);
 int fuse_opt_add_opt_escaped(char **, const char *);
 int fuse_opt_match(const struct fuse_opt *, const char *);
-int fuse_opt_parse(struct fuse_args *, void *, struct fuse_opt *,
+int fuse_opt_parse(struct fuse_args *, void *, const struct fuse_opt *,
 fuse_opt_proc_t);
 
 #define FUSE_ARGS_INIT(ac, av) { ac, av, 0 }


-- 
jca | PGP: 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
(previous: 0x06A11494 / 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494)



Re: extent_supply_region_descriptor

2014-01-20 Thread Mark Kettenis
 This is ugly. Better introduce an extent_alloc_with_descr() or
 extent_alloc_static() interface which is similar to extent_alloc(), but
 receives the extent descriptor as an added argument.

Fair enough; seems this is indeed a better interface as it doesn't
require the use of a fixed extent.

Here's a new diff.  I'll do the man page before committing this.

ok?


Index: sys/extent.h
===
RCS file: /cvs/src/sys/sys/extent.h,v
retrieving revision 1.12
diff -u -p -r1.12 extent.h
--- sys/extent.h19 Apr 2009 15:26:52 -  1.12
+++ sys/extent.h21 Jan 2014 00:28:12 -
@@ -44,6 +44,7 @@ struct extent_region {
 
 /* er_flags */
 #define ER_ALLOC   0x01/* region descriptor dynamically allocated */
+#define ER_DISCARD 0x02/* discard region descriptor after use */
 
 struct extent {
char*ex_name;   /* name of extent */
@@ -105,6 +106,9 @@ struct  extent *extent_create(char *, u_l
 void   extent_destroy(struct extent *);
 intextent_alloc_subregion(struct extent *, u_long, u_long,
u_long, u_long, u_long, u_long, int, u_long *);
+intextent_alloc_subregion_with_descr(struct extent *, u_long, u_long,
+   u_long, u_long, u_long, u_long, int, struct extent_region *,
+   u_long *);
 intextent_alloc_region(struct extent *, u_long, u_long, int);
 intextent_free(struct extent *, u_long, u_long, int);
 void   extent_print(struct extent *);
Index: kern/subr_extent.c
===
RCS file: /cvs/src/sys/kern/subr_extent.c,v
retrieving revision 1.48
diff -u -p -r1.48 subr_extent.c
--- kern/subr_extent.c  8 Aug 2013 23:25:06 -   1.48
+++ kern/subr_extent.c  21 Jan 2014 00:32:35 -
@@ -78,6 +78,8 @@ staticvoid extent_insert_and_optimize(s
 static struct extent_region *extent_alloc_region_descriptor(struct extent *, 
int);
 static void extent_free_region_descriptor(struct extent *,
struct extent_region *);
+intextent_do_alloc(struct extent *, u_long, u_long, u_long, u_long,
+   u_long, u_long, int, struct extent_region *, u_long *);
 
 /*
  * Shortcut to align to an arbitrary power-of-two boundary.
@@ -580,11 +582,11 @@ extent_alloc_region(struct extent *ex, u
  * a power of 2.
  */
 int
-extent_alloc_subregion(struct extent *ex, u_long substart, u_long subend,
+extent_do_alloc(struct extent *ex, u_long substart, u_long subend,
 u_long size, u_long alignment, u_long skew, u_long boundary, int flags,
-u_long *result)
+struct extent_region *myrp, u_long *result)
 {
-   struct extent_region *rp, *myrp, *last, *bestlast;
+   struct extent_region *rp, *last, *bestlast;
u_long newstart, newend, exend, beststart, bestovh, ovh;
u_long dontcross;
int error;
@@ -593,6 +595,8 @@ extent_alloc_subregion(struct extent *ex
/* Check arguments. */
if (ex == NULL)
panic(%s: NULL extent, __func__);
+   if (myrp == NULL)
+   panic(%s: NULL region descriptor, __func__);
if (result == NULL)
panic(%s: NULL result pointer, __func__);
if ((substart  ex-ex_start) || (substart  ex-ex_end) ||
@@ -617,18 +621,6 @@ extent_alloc_subregion(struct extent *ex
}
 #endif
 
-   /*
-* Allocate the region descriptor.  It will be freed later
-* if we can coalesce with another region.
-*/
-   myrp = extent_alloc_region_descriptor(ex, flags);
-   if (myrp == NULL) {
-#ifdef DIAGNOSTIC
-   printf(%s: can't allocate region descriptor\n, __func__);
-#endif
-   return (ENOMEM);
-   }
-
  alloc_start:
/*
 * Keep a pointer to the last region we looked at so
@@ -927,6 +919,41 @@ skip:
 }
 
 int
+extent_alloc_subregion(struct extent *ex, u_long substart, u_long subend,
+u_long size, u_long alignment, u_long skew, u_long boundary, int flags,
+u_long *result)
+{
+   struct extent_region *rp;
+
+   /*
+* Allocate the region descriptor.  It will be freed later
+* if we can coalesce with another region.
+*/
+   rp = extent_alloc_region_descriptor(ex, flags);
+   if (rp == NULL) {
+#ifdef DIAGNOSTIC
+   printf(%s: can't allocate region descriptor\n, __func__);
+#endif
+   return (ENOMEM);
+   }
+
+   return extent_do_alloc(ex, substart, subend, size, alignment, skew,
+   boundary, flags, rp, result);
+}
+
+int
+extent_alloc_subregion_with_descr(struct extent *ex, u_long substart,
+u_long subend, u_long size, u_long alignment, u_long skew,
+u_long boundary, int flags, struct extent_region *rp, u_long *result)
+{
+   KASSERT(ex-ex_flags  EXF_NOCOALESCE);
+
+   rp-er_flags = ER_DISCARD;
+   return extent_do_alloc(ex, substart, subend, size, alignment, skew,
+   boundary, flags, rp, result);
+}
+
+int
 

Re: fuse_opt_parse(), constify param

2014-01-20 Thread Jérémie Courrèges-Anglas
j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes:

 Hi,

 The reference FUSE implementation defines fuse_opt_parse's third
 argument as const.  At least fuse-zip[1] needs this.

 follow.

Scratch that. 8)

[...]

-- 
jca | PGP: 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
(previous: 0x06A11494 / 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494)



tighten /etc/rc's pf ruleset slightly further

2014-01-20 Thread Henning Brauer
absolutely prevent forwarding carp or NFS/rpc using the shiny new
received-on any.

can only minimally test that here. need at least one carp and one
diskless test. 

Index: rc
===
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.420
diff -u -p -r1.420 rc
--- rc  19 Jan 2014 09:39:04 -  1.420
+++ rc  21 Jan 2014 01:53:59 -
@@ -335,13 +335,14 @@ if [ X${pf} != XNO ]; then
RULES=$RULES\npass out inet6 proto udp from any port 
dhcpv6-client to any port dhcpv6-server
RULES=$RULES\npass in inet6 proto udp from any port 
dhcpv6-server to any port dhcpv6-client
fi
-   RULES=$RULES\npass proto carp keep state (no-sync)
+   RULES=$RULES\npass in proto carp keep state (no-sync)
+   RULES=$RULES\npass out proto carp !received-on any keep state 
(no-sync)
case `sysctl vfs.mounts.nfs 2/dev/null` in
*[1-9]*)
# don't kill NFS
RULES=set reassemble yes no-df\n$RULES
RULES=$RULES\npass in proto { tcp, udp } from any port { 111, 
2049 } to any
-   RULES=$RULES\npass out proto { tcp, udp } from any to any port 
{ 111, 2049 }
+   RULES=$RULES\npass out proto { tcp, udp } from any to any port 
{ 111, 2049 } !received-on any
;;
esac
echo $RULES | pfctl -f -



More radix.c cleanup

2014-01-20 Thread Claudio Jeker
Cleanup the abuse of x as the rn_addmask radix node. Since in most
cases x is just used as a temp variable. Main offender is rn_addmask()
which sets x once at the top uses it then late in the function and then
starts reuing it for various other stuff. While there fix some for loops
to while ones and fix one strange do { } while() loop.
And since rn_search() can not return NULL remove one extra check.

OK?
-- 
:wq Claudio

Index: radix.c
===
RCS file: /cvs/src/sys/net/radix.c,v
retrieving revision 1.37
diff -u -p -r1.37 radix.c
--- radix.c 20 Jan 2014 22:42:06 -  1.37
+++ radix.c 21 Jan 2014 03:44:20 -
@@ -109,10 +109,10 @@ struct radix_node *rn_search_m(void *, s
 static inline struct radix_node *
 rn_search(void *v_arg, struct radix_node *head)
 {
-   struct radix_node *x;
+   struct radix_node *x = head;
caddr_t v = v_arg;
 
-   for (x = head; x-rn_b = 0;) {
+   while (x-rn_b = 0) {
if (x-rn_bmask  v[x-rn_off])
x = x-rn_r;
else
@@ -124,11 +124,11 @@ rn_search(void *v_arg, struct radix_node
 struct radix_node *
 rn_search_m(void *v_arg, struct radix_node *head, void *m_arg)
 {
-   struct radix_node *x;
+   struct radix_node *x = head;
caddr_t v = v_arg;
caddr_t m = m_arg;
 
-   for (x = head; x-rn_b = 0;) {
+   while (x-rn_b = 0) {
if ((x-rn_bmask  m[x-rn_off]) 
(x-rn_bmask  v[x-rn_off]))
x = x-rn_r;
@@ -170,14 +170,14 @@ rn_refines(void *m_arg, void *n_arg)
 struct radix_node *
 rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
 {
-   struct radix_node *x;
+   struct radix_node *x, *tm;
caddr_t netmask = 0;
 
if (m_arg) {
-   x = rn_addmask(m_arg, 1, head-rnh_treetop-rn_off);
-   if (x == NULL)
-   return (0);
-   netmask = x-rn_key;
+   tm = rn_addmask(m_arg, 1, head-rnh_treetop-rn_off);
+   if (tm == NULL)
+   return (NULL);
+   netmask = tm-rn_key;
}
x = rn_match(v_arg, head);
if (x  netmask) {
@@ -278,28 +278,26 @@ on1:
struct radix_mask *m;
t = t-rn_p;
m = t-rn_mklist;
-   if (m) {
+   while (m) {
/*
 * If non-contiguous masks ever become important
 * we can restore the masking and open coding of
 * the search and satisfaction test and put the
 * calculation of off back before the do.
 */
-   do {
-   if (m-rm_flags  RNF_NORMAL) {
-   if (rn_b = m-rm_b)
-   return (m-rm_leaf);
-   } else {
-   struct radix_node *x;
-   off = min(t-rn_off, matched_off);
-   x = rn_search_m(v, t, m-rm_mask);
-   while (x  x-rn_mask != m-rm_mask)
-   x = x-rn_dupedkey;
-   if (x  rn_satisfies_leaf(v, x, off))
-   return x;
-   }
-   m = m-rm_mklist;
-   } while (m);
+   if (m-rm_flags  RNF_NORMAL) {
+   if (rn_b = m-rm_b)
+   return (m-rm_leaf);
+   } else {
+   struct radix_node *x;
+   off = min(t-rn_off, matched_off);
+   x = rn_search_m(v, t, m-rm_mask);
+   while (x  x-rn_mask != m-rm_mask)
+   x = x-rn_dupedkey;
+   if (x  rn_satisfies_leaf(v, x, off))
+   return x;
+   }
+   m = m-rm_mklist;
}
} while (t != top);
return NULL;
@@ -408,7 +406,7 @@ struct radix_node *
 rn_addmask(void *n_arg, int search, int skip)
 {
caddr_t netmask = n_arg;
-   struct radix_node *x, *saved_x;
+   struct radix_node *tm, *saved_tm;
caddr_t cp, cplim;
int b = 0, mlen, j;
int maskduplicated, m0, isnormal;
@@ -438,21 +436,22 @@ rn_addmask(void *n_arg, int search, int 
if (m0  last_zeroed)
memset(addmask_key + m0, 0, last_zeroed - m0);
*addmask_key = last_zeroed = mlen;
-   x = rn_search(addmask_key, rn_masktop);
-   if (memcmp(addmask_key, x-rn_key, 

Re: 5.5beta wierds

2014-01-20 Thread Otto Moerbeek
On Tue, Jan 21, 2014 at 03:52:23PM +1100, Rod Whitworth wrote:

 I had a short run-up of the first 5.5 i386 snap install and it
 looked pretty much as expected but a more recent one showed up and I
 grabbed it and loaded it onto my little Shuttle.
 
 The dmesg is below but I'll make some observations first.
 
 Unlike the earlier snap the screen does not get entirely covered
 when the boot reaches the point where it changes to the higher
 resolution. It now is 33 lines by 83 columns with a great lump of
 black screen below.
 
 I haven't gone hunting for all the nitty-gritty of the new time
 keeping but I did a bit of playing with date -r to see what
 wonderful years we have ahead of us. 8-)
 
 I'm not sure that giving date -r 65599 is likely to ever
 be used but it works.
 Sadly it coredumps somewhere above that number. I'm not sure where
 exactly but if you change the leading 6 to a 7 it crashes..
 
 I feel that date should spit out an error message rather than crash
 even if it only happens when some idiot plays with the numbers.

Right. what happens is that localtime(3) returns NULL, because the
year is not representable as an int. struct tm.tm_year must be an int
according to posix. 

The diff below catches the case. But it does not solve that 64-bit
time_t can represent years that do not fit into the int sized tm_year. 

And there's probably a lot of code that does not check the return
value of localtime(). I see that our man pages lacks to mention that
it can return NULL. 

-Otto

Index: date.c
===
RCS file: /cvs/src/bin/date/date.c,v
retrieving revision 1.42
diff -u -p -r1.42 date.c
--- date.c  5 Jan 2014 05:27:44 -   1.42
+++ date.c  21 Jan 2014 07:29:10 -
@@ -60,6 +60,7 @@ int
 main(int argc, char *argv[])
 {
struct timezone tz;
+   struct tm *tp;
int ch, rflag;
char *format, buf[1024], *outzone = NULL;
 
@@ -139,7 +140,10 @@ main(int argc, char *argv[])
if (outzone)
setenv(TZ, outzone, 1);
 
-   (void)strftime(buf, sizeof(buf), format, localtime(tval));
+   tp = localtime(tval);
+   if (tp == NULL)
+   errx(1, conversion error);
+   (void)strftime(buf, sizeof(buf), format, tp);
(void)printf(%s\n, buf);
exit(0);
 }

 
 DMESG:
 OpenBSD 5.5-beta (GENERIC.MP) #219: Fri Jan 17 16:08:39 MST 2014
 t...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
 cpu0: Intel(R) Atom(TM) CPU D525 @ 1.80GHz (GenuineIntel
 686-class) 1.80 GHz
 cpu0: 
 FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF
 real mem  = 2137223168 (2038MB)
 avail mem = 2090397696 (1993MB)
 mainbus0 at root
 bios0 at mainbus0: AT/286+ BIOS, date 06/23/11, BIOS32 rev. 0 @
 0xf0010, SMBIOS rev. 2.6 @ 0xfc8b0 (23 entries)
 bios0: vendor American Megatrends Inc. version 080015 date
 06/23/2011
 bios0: Standard XS35
 acpi0 at bios0: rev 2
 acpi0: sleep states S0 S3 S4 S5
 acpi0: tables DSDT FACP APIC MCFG SLIC OEMB HPET GSCI
 acpi0: wakeup devices P0P1(S4) AZAL(S3) P0P4(S4) P0P5(S4) JLAN(S3)
 P0P6(S4) P0P7(S4) P0P8(S4) P0P9(S4) USB0(S3) USB1(S3) USB2(S3)
 USB3(S3) EUSB(S3)
 acpitimer0 at acpi0: 3579545 Hz, 24 bits
 acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
 cpu0 at mainbus0: apid 0 (boot processor)
 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
 cpu0: apic clock running at 199MHz
 cpu0: mwait min=64, max=64, C-substates=0.1.0.0.0, IBE
 cpu1 at mainbus0: apid 2 (application processor)
 cpu1: Intel(R) Atom(TM) CPU D525 @ 1.80GHz (GenuineIntel
 686-class) 1.84 GHz
 cpu1: 
 FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF
 cpu2 at mainbus0: apid 1 (application processor)
 cpu2: Intel(R) Atom(TM) CPU D525 @ 1.80GHz (GenuineIntel
 686-class) 1.87 GHz
 cpu2: 
 FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF
 cpu3 at mainbus0: apid 3 (application processor)
 cpu3: Intel(R) Atom(TM) CPU D525 @ 1.80GHz (GenuineIntel
 686-class) 1.84 GHz
 cpu3: 
 FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF
 ioapic0 at mainbus0: apid 4 pa 0xfec0, version 20, 24 pins
 ioapic0: misconfigured as apic 3, remapped to apid 4
 acpimcfg0 at acpi0 addr 0xe000, bus 0-255
 acpihpet0 at acpi0: 14318179 Hz
 acpiprt0 at acpi0: bus 0 (PCI0)
 acpiprt1 at acpi0: bus 3 (P0P1)
 acpiprt2 at acpi0: bus 1 (P0P4)
 acpiprt3 at acpi0: bus 2 (P0P5)
 acpiprt4 at acpi0: bus -1 (P0P6)
 acpiprt5