Re: ARP reply towards MP-safeness

2015-10-26 Thread Alexander Bluhm
On Mon, Oct 26, 2015 at 07:08:19PM +0100, Martin Pieuchot wrote: > This rewrites the code to send an ARP reply to no use ``myaddr''. The > goal is to get rid of the per-ifp address list iterations. > > Instead do two route lookups. > > ok? Should the "reply:" label stay before the "if (op !=

Re: ip_ours() towards mpsafeness

2015-10-27 Thread Alexander Bluhm
On Mon, Oct 26, 2015 at 07:49:01PM +0100, Martin Pieuchot wrote: > This diff does two things. > > First it changes ip_ours() to no longer rely on ``rt_ifa''. The problem > here is that the route entry reference acts as a proxy for ``ia''. So > you cannot dereference ``ia'' *after* calling

Re: unify errno messages

2015-10-24 Thread Alexander Bluhm
On Sat, Oct 24, 2015 at 02:54:54AM +0159, Jiri Navratil wrote: > Hi Alexander, > > On Sat, Oct 24, 2015 at 12:41:18AM +0200, Alexander Bluhm wrote: > > -#defineEOVERFLOW 87 /* Conversion overflow */ > > +#defineEOVERFLOW 87 /* Value t

Re: Remove ARP load-balancing for carp(4)

2015-10-27 Thread Alexander Bluhm
On Tue, Oct 27, 2015 at 01:28:21PM +0100, Martin Pieuchot wrote: > Turns out that turning arpinput() mpsafe is more complicated than > expected because of the way carp(4) has been hooked^Whacked in it. > > Depending on the load-balancing mode arpinput() will need to use > one Ethernet address or

Re: Kill rtable_mpath_match

2015-10-27 Thread Alexander Bluhm
On Tue, Oct 27, 2015 at 01:40:04PM +0100, Martin Pieuchot wrote: > On 25/10/15(Sun) 16:21, Sebastian Benoit wrote: > > Martin Pieuchot(m...@openbsd.org) on 2015.10.25 16:14:27 +0100: > > > Diff below merges the guts of rtable_mpath_match() into rtable_lookup(). > > > As for the previous

Re: carp_iamatch() tweak

2015-10-22 Thread Alexander Bluhm
On Thu, Oct 22, 2015 at 12:34:56PM +0200, Martin Pieuchot wrote: > Instead of passing an ``ia'' to dereference ``ia_ifp'', pass ``ifp'' > directly, we have it. > > ok? OK bluhm@ > > Index: netinet/if_ether.c > === > RCS file:

Re: rt_ifa_add() dead code

2015-10-22 Thread Alexander Bluhm
On Thu, Oct 22, 2015 at 01:04:16PM +0200, Martin Pieuchot wrote: > RTAX_IFA is specified so rt_getifa() is never called and this is simply > dead code. > > ok? OK bluhm@ > > Index: net/route.c > === > RCS file:

unify errno messages

2015-10-23 Thread Alexander Bluhm
Hi, Before removig nls, I would like to unify all error messages in - include comment - libc comment - nls C - man page The EPROGUNAVAIL change is just beautification. Any objections against that? ok? bluhm Index: sys/sys/errno.h

syslogd pledge rpath cacert

2015-10-23 Thread Alexander Bluhm
Hi, When loading the CA certificates at startup fails, the syslogd child tries to load the default CA file when it connects to a TLS server. This always fails, as the child is chrooted to /var/empty. Set the CA storage to an empty string, to remove the pledge "rpath". ok? bluhm Index:

Re: ifa_ifp and RTF_LOCAL routes

2015-10-22 Thread Alexander Bluhm
On Wed, Oct 21, 2015 at 10:18:49AM +0200, Martin Pieuchot wrote: > Now that (rt_ifa->ifa_ifp == rt_ifp) we can simplify the check below. > > Ok? OK bluhm@ > > Index: net/route.c > === > RCS file: /cvs/src/sys/net/route.c,v >

Re: Fewer ifa_ifp

2015-10-22 Thread Alexander Bluhm
On Thu, Oct 22, 2015 at 04:31:09PM +0200, Martin Pieuchot wrote: > Two more cases, ok? OK bluhm@ > > Index: netinet6/in6_src.c > === > RCS file: /cvs/src/sys/netinet6/in6_src.c,v > retrieving revision 1.64 > diff -u -p -r1.64

Re: Kill frag6 dead code

2015-10-21 Thread Alexander Bluhm
On Wed, Oct 21, 2015 at 10:15:08AM +0200, Martin Pieuchot wrote: > dstifp is never used. > > ok? OK bluhm@ > > Index: netinet6/frag6.c > === > RCS file: /cvs/src/sys/netinet6/frag6.c,v > retrieving revision 1.64 > diff -u -p

Re: Patch 1/3 - make DIOCRADDADDRS to accept on IP address per ioctl() call

2015-11-08 Thread Alexander Bluhm
On Sun, Nov 08, 2015 at 02:37:58AM +0100, Alexander Bluhm wrote: > > + for (i = 0; (i < size) && (rv == 0); i++) { > > rv is unitialized in the first interation > > > + io.pfrio_buffer = addr++; > > + rv = ioctl(dev, DIOCRADDADDR,

Re: Patch 3/3 - update userland to reflect DIOCRADDADDRS/DIOCRDELADDRS changes

2015-11-08 Thread Alexander Bluhm
On Wed, Oct 28, 2015 at 06:24:04PM +0100, Alexandr Nedvedicky wrote: > Index: usr.sbin/bgpd/pftable.c > === > RCS file: /cvs/src/usr.sbin/bgpd/pftable.c,v > retrieving revision 1.8 > diff -u -p -r1.8 pftable.c > ---

Re: Call for Testing: rtalloc(9) change

2015-11-09 Thread Alexander Bluhm
On Wed, Nov 04, 2015 at 12:33:23PM +0100, Martin Pieuchot wrote: > On 12/08/15(Wed) 17:03, Martin Pieuchot wrote: > > I'm currently working on the routing table interface to make is safe > > to use by multiple CPUs at the same time. The diff below is a big > > step in this direction and I'd

Re: pair(4) + pf(4): reset all state on "reinjected" packets

2015-10-30 Thread Alexander Bluhm
On Fri, Oct 30, 2015 at 10:43:21AM +0100, Reyk Floeter wrote: > Question: > > How does pair(4) interact with pf? If a packet crosses a pair > > does it create a new state or does pf track the original state? > > > > Answer: > It does create a new state, you can filter between pair(4) without >

nd6 pool

2015-11-01 Thread Alexander Bluhm
Hi, To make the nd6 code more like arp, I would like to replace the llinfo malloc(9) with pool_get(9). ok? bluhm Index: netinet/if_ether.c === RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/if_ether.c,v retrieving revision

Re: pair(4) + pf(4): reset all state on "reinjected" packets

2015-10-30 Thread Alexander Bluhm
On Fri, Oct 30, 2015 at 12:56:34PM +0100, Reyk Floeter wrote: > --- sys/sys/mbuf.h22 Oct 2015 05:26:06 - 1.198 > +++ sys/sys/mbuf.h30 Oct 2015 11:30:33 - > @@ -410,6 +410,7 @@ structmbuf *m_get(int, int); > struct mbuf *m_getclr(int, int); > struct mbuf

Re: rt_ifix for ip6_forward()

2015-10-30 Thread Alexander Bluhm
On Thu, Oct 29, 2015 at 03:51:57PM +0100, Martin Pieuchot wrote: > Stop using rt_ifp in this function. > > ok? OK bluhm@ > > Index: netinet6/ip6_forward.c > === > RCS file: /cvs/src/sys/netinet6/ip6_forward.c,v > retrieving

Re: patch saves some cycles by extending pfr_walktree() a bit

2015-11-07 Thread Alexander Bluhm
On Wed, Oct 28, 2015 at 06:08:00PM +0100, Alexandr Nedvedicky wrote: > make implementation of reference handling and further MP stuff bit easier. I agree that filling the temporary list makes transition to MP harder. > Also the patch is part of my effort to kill work queues in radix tables. For

Re: Patch 2/3 - make DIOCRDELADDRS to accept on IP address per ioctl() call

2015-11-07 Thread Alexander Bluhm
On Wed, Oct 28, 2015 at 06:21:10PM +0100, Alexandr Nedvedicky wrote: > Index: sbin/pfctl/pfctl_radix.c > === > RCS file: /cvs/src/sbin/pfctl/pfctl_radix.c,v > retrieving revision 1.32 > diff -u -p -r1.32 pfctl_radix.c > ---

Re: Patch 1/3 - make DIOCRADDADDRS to accept on IP address per ioctl() call

2015-11-07 Thread Alexander Bluhm
On Wed, Oct 28, 2015 at 06:19:48PM +0100, Alexandr Nedvedicky wrote: > The idea has been proposed by Claudio at Varazdin. I guess the idea is to eliminate the workq. Or is ther naother reason to change it? Comments inline > Index: sbin/pfctl/pfctl_radix.c >

Re: patch - potential use-after-free pfr_set_addrs()

2015-11-03 Thread Alexander Bluhm
On Tue, Nov 03, 2015 at 09:40:38PM +0100, Alexandr Nedvedicky wrote: > I think the > right thing is to use goto _skip; in that branch to avoid 499 et. al. > completely. Yes > @@ -491,6 +491,7 @@ pfr_set_addrs(struct pfr_table *tbl, str > if (pfr_route_kentry(tmpkt, p)) { >

Re: libc asr _res.nsaddr_list overflow

2015-11-05 Thread Alexander Bluhm
Looks like I have fogotten to update the name server counter correctly. ok? bluhm Index: lib/libc/asr/res_init.c === RCS file: /data/mirror/openbsd/cvs/src/lib/libc/asr/res_init.c,v retrieving revision 1.7 diff -u -p -U4 -r1.7

libc asr _res.nsaddr_list overflow

2015-11-05 Thread Alexander Bluhm
Hi, I had sendmail crashes because of invalid pointers in _res.dnsrch. I have 4 nameservers in /etc/resolv.conf, the last one is IPv6. /usr/include/resolv.h: #define MAXNS 3 /* max # name servers we'll track */ struct __res_state { ... struct sockaddr_in

Re: remove NLS directory

2015-11-05 Thread Alexander Bluhm
On Thu, Nov 05, 2015 at 10:49:30PM +0100, Stefan Sperling wrote: > It sounds like not providing a default path violates POSIX. > Do we care? Perhaps this detail is not important? I think this spec was not written with implementations without NLS in mind. So I don't care. The kernel has

remove NLS directory

2015-11-05 Thread Alexander Bluhm
Hi, After removing National Language Support (NLS) from base, I think the directory /usr/share/nls should go. Having a non-existing default path in catopen(3) does not make sense, so I also removed that. ok? bluhm Index: etc/mtree/4.4BSD.dist

Re: nd6_nud_hint and rt_ifp

2015-11-05 Thread Alexander Bluhm
On Thu, Nov 05, 2015 at 11:53:34AM +0100, Martin Pieuchot wrote: > Change nd6_nud_hint() to no longer use rt_ifp directly. While here > remove unused argument and convert the route check to rtisvalid(9). > > ok? OK bluhm@ > > Index: netinet/tcp_input.c >

Re: pair(4) + pf(4): reset all state on "reinjected" packets

2015-10-30 Thread Alexander Bluhm
On Fri, Oct 30, 2015 at 02:04:52PM +0100, Reyk Floeter wrote: > > Socket splicing somove() does the same thing. I will change it to > > use m_resethdr() after that got commited. I just compared code in somove() with m_resethdr(). Socket splicing has to clear the whole packet header, not only

Re: pair(4) + pf(4): reset all state on "reinjected" packets

2015-10-30 Thread Alexander Bluhm
On Fri, Oct 30, 2015 at 06:48:16PM +0100, Mike Belopuhov wrote: > On Fri, Oct 30, 2015 at 18:27 +0100, Alexander Bluhm wrote: > > On Fri, Oct 30, 2015 at 02:04:52PM +0100, Reyk Floeter wrote: > > > > Socket splicing somove() does the same thing. I will change it to > >

Re: Stop using rt_ifp in nd6*

2015-10-30 Thread Alexander Bluhm
On Thu, Oct 29, 2015 at 03:54:29PM +0100, Martin Pieuchot wrote: > When we already had a valid ``ifp'' I used it. Since defrouter_lookup() > is only doing a comparison, let's use interface indexes. > > ok? OK bluhm@ > Index: netinet6/nd6.c >

Re: More rtisvalid(9)

2015-10-19 Thread Alexander Bluhm
On Mon, Oct 19, 2015 at 11:43:35AM +0200, Martin Pieuchot wrote: > Diff below also includes a routing table check in in_selectsrc() to > match your comment in the INET6 version of this diff. > > ok? OK bluhm@ > > Index: netinet/in_pcb.c >

Re: rtisvalid6

2015-10-19 Thread Alexander Bluhm
On Mon, Oct 19, 2015 at 11:31:32AM +0200, Martin Pieuchot wrote: > Updated version below. OK bluhm@ > > Index: netinet6/icmp6.c > === > RCS file: /cvs/src/sys/netinet6/icmp6.c,v > retrieving revision 1.172 > diff -u -p -r1.172

Re: Route entries refcounting

2015-10-19 Thread Alexander Bluhm
On Mon, Oct 19, 2015 at 11:51:55AM +0200, Martin Pieuchot wrote: > There's actually two different reference counts for route entries. A > generic one which is represented by the value of rt_ref and a rtable- > specific one which is either true or false represented by the value of > RT_ACTIVE(). >

cast struct sockaddr_dl

2015-10-15 Thread Alexander Bluhm
Hi, Inspired by the satosin() functions, I think it is better to have inline functions than casts to convert between sockaddrs. They check if the incoming object has the expected type. So introduce satosdl() and sdltosa() to the kernel. ok? bluhm Index: net/if.c

syslogd ttymsg cleanup

2015-10-19 Thread Alexander Bluhm
Hi, I want to get rid of the fork(2) in the ttymsg() syslogd function. Before I can do that, I need some cleanup. - use ERRBUFSIZE for all error buffers and call them "ebuf" - use TTYMSGTIME directly instead of passing it around - rename utmp entry "utline", normally "line" is used for the

fcntl F_SETOWN pipe

2015-10-20 Thread Alexander Bluhm
Hi, Setting fcntl(F_SETOWN) for a pipe does not work. fcntl F_SETOWN: Inappropriate ioctl for device In sys_fcntl() the ioctl(TIOCSPGRP) is called, but the pipe expects SIOCSPGRP. Sockets have a specal case for the same reason. I would prefer that socketpair and pipe behave identical, so I

Re: More rtisvalid(9)

2015-10-16 Thread Alexander Bluhm
On Fri, Oct 16, 2015 at 03:09:03PM +0200, Martin Pieuchot wrote: > - if (rt->rt_flags & (RTF_REJECT | RTF_BLACKHOLE) || > - (rt->rt_flags & RTF_UP) == 0) { > + if (!rtisvalid(rt) || ISSET(rt->rt_flags, RTF_REJECT|RTF_BLACKHOLE)) { Why change to ISSET()? I still don't know which

Re: rtisvalid6

2015-10-16 Thread Alexander Bluhm
On Fri, Oct 16, 2015 at 04:24:04PM +0200, Martin Pieuchot wrote: > --- netinet6/icmp6.c 18 Sep 2015 14:26:22 - 1.172 > +++ netinet6/icmp6.c 16 Oct 2015 13:48:56 - > @@ -1568,7 +1568,7 @@ icmp6_redirect_output(struct mbuf *m0, s > goto fail; > > /* sanity check

Re: ftp: ctype interfaces need unsigned chars

2015-10-11 Thread Alexander Bluhm
On Sat, Oct 10, 2015 at 08:03:28PM -0700, Philip Guenther wrote: > On Sat, 10 Oct 2015, Michael McConville wrote: > > FWIW, this is a perfect use case for Coccinelle. Below is what I dredged > > up in src/usr.sbin (diff not yet carefully audited, but apparently > > sane). > > These look good to

Re: rtisvalid(9) again

2015-10-12 Thread Alexander Bluhm
On Mon, Oct 12, 2015 at 01:49:54PM +0200, Martin Pieuchot wrote: > Turns out that our stack does a very bad job at tracking which routes > should be used or not based on the RTF_UP flag. So I'm not going to > change that. > > Nonetheless I'd like to use rtisvalid(9) for the existing route

Re: arptfree() tweak

2015-10-12 Thread Alexander Bluhm
On Fri, Oct 02, 2015 at 04:03:46PM +0200, Martin Pieuchot wrote: > I'd like to change the behavior of arptfree() to stop checking the > reference counter of the route: > > - to keep the logic for reference counting rout entries simple, > > - and to align it with the NDP behavior (see

syslogd optarg

2015-08-27 Thread Alexander Bluhm
Hi, When syslogd is reloading a modified config, it does a reexec on itself. For this it uses the original arguments of main(). The function loghost_parse() modifies the optarg memory it is operating on. To prevent that the exec arguments have been tampered, pass a copy of optarg to

Re: syslogd optarg

2015-08-27 Thread Alexander Bluhm
On Thu, Aug 27, 2015 at 10:13:25AM -0600, Theo de Raadt wrote: Why not strdup? And now with strdup() as suggested by Theo. ok? bluhm Index: usr.sbin/syslogd/syslogd.c === RCS file:

Re: syslogd optarg

2015-08-27 Thread Alexander Bluhm
On Thu, Aug 27, 2015 at 09:44:33AM -0600, Todd C. Miller wrote: On Thu, 27 Aug 2015 15:47:18 +0200, Alexander Bluhm wrote: When syslogd is reloading a modified config, it does a reexec on itself. For this it uses the original arguments of main(). The function loghost_parse() modifies

syslogd host matches ip

2015-08-28 Thread Alexander Bluhm
Hi, The +host feature allows to select log messages from a specific host. Normally syslogd does a reverse lookup on the sender's address. If that fails or if syslogd has been started with the -n option, the +host is matched with the IP. Unfortunatelty IP addresses consist of characters that

Re: syslogd host matches ip

2015-08-30 Thread Alexander Bluhm
On Sat, Aug 29, 2015 at 04:43:39PM +0200, Sebastien Marie wrote: On Fri, Aug 28, 2015 at 07:53:23PM +0200, Alexander Bluhm wrote: On Fri, Aug 28, 2015 at 06:11:02PM +0200, Alexander Bluhm wrote: The +host feature allows to select log messages from a specific host. Normally syslogd does

syslogd reuseaddr *:514

2015-08-31 Thread Alexander Bluhm
Hi, I had some problems running syslogd on a machine where another process had a 514 socket bound to a specific address. As this is not a real conflict, I think syslogd should bind *:514 with SO_REUSEADDR. This is already the case with all other sockets. ok? bluhm Index:

Re: rt_ifa_del() tweak

2015-08-31 Thread Alexander Bluhm
On Tue, Aug 25, 2015 at 01:01:38PM +0200, Martin Pieuchot wrote: > I want to remove this chunked introduce in r7.19 in 1991 by sklower@ > because it no longer makes any sense, it is a layer violation and > does no play well with rt refcounting. > > When this chunk was introduced

Re: Introducing rtvalid(9)

2015-08-31 Thread Alexander Bluhm
On Fri, Aug 28, 2015 at 12:47:51PM +0200, Martin Pieuchot wrote: > The rtvalid() function checks if the route entry rt is still valid and > can be used. Cached entries that are no longer valid should be released > by calling rtfree(). I like it. As it does some checks and returns

syslogd tcp linebuf

2015-09-01 Thread Alexander Bluhm
Hi, Instead of creating a line buffer on the stack, tcp_readcb() can use the global linebuf like the other read callbacks. ok? bluhm Index: usr.sbin/syslogd/syslogd.c === RCS file:

sendsyslog error log

2015-09-01 Thread Alexander Bluhm
Hi, To make syslog reliable, I want to see log messages about failed log atempts. sendsyslog(2) seems a good place to detect and report the problem. ok? bluhm Index: kern/subr_log.c === RCS file:

Re: Call for Testing: rtalloc(9) change

2015-09-02 Thread Alexander Bluhm
On Tue, Sep 01, 2015 at 04:47:31PM +0200, Martin Pieuchot wrote: > Smaller diff now that rtisvalid(9) is in! > +rt_isvalid(struct rtentry *rt) > +/* > + * Returns 1 if the (cached) ``rt'' entry is still valid, 0 otherwise. > + */ > +int > +rtisvalid(struct rtentry *rt) > +{ > + if

syslogd: dropped 1 message

2015-09-03 Thread Alexander Bluhm
Hi, In sendsyslog(2) I got the plural s of messages right. The messages of syslogd(8) should be alike. ok? bluhm Index: usr.sbin/syslogd/syslogd.c === RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/syslogd/syslogd.c,v retrieving

Re: nc -c, because openssl s_[client|server] sucks donkey balls

2015-09-08 Thread Alexander Bluhm
On Sat, Sep 05, 2015 at 01:00:54PM -0600, Bob Beck wrote: > OK to put it in and have others turdshine along? I think some things should be fixed before. $ mandoc -Tlint nc.1 mandoc: nc.1:105:64: WARNING: whitespace at end of input line mandoc: nc.1:188:69: WARNING: whitespace at end of

Re: Introducing rtvalid(9)

2015-09-01 Thread Alexander Bluhm
On Tue, Sep 01, 2015 at 03:03:07PM +0200, Martin Pieuchot wrote: > Now I still believe that such conversions should not be committed all at > once because they might have undesirable side effects. So here's a > first diff that I need for my rtalloc(9) rewrite. Are you ok with it? Yes, and small

syslogd: less global, more malloc, more random

2015-09-09 Thread Alexander Bluhm
Hi, Instead of having global variables containing the libevent structures, allocate them with malloc. This makes the address space layout more random. ok? bluhm Index: usr.sbin/syslogd/syslogd.c === RCS file:

syslog(3) message length

2015-09-09 Thread Alexander Bluhm
Hi, Now syslogd can handle 8192 bytes per message. I think we should increase the libc syslog(3) limit to the same size. The buffer needs one byte more as it conains a NUL byte that sendsyslog(2) does not process. ok? bluhm Index: lib/libc/gen/syslog_r.c

Re: pflow(4): reshuffle socreate(9)

2015-09-12 Thread Alexander Bluhm
On Sat, Sep 12, 2015 at 02:45:24PM +, Florian Obser wrote: > @@ -117,44 +117,12 @@ pflow_clone_create(struct if_clone *ifc, int unit) ... > MGET(pflowif->send_nam, M_WAIT, MT_SONAME); > - sin = mtod(pflowif->send_nam, struct sockaddr_in *); > - memset(sin, 0 , sizeof(*sin)); > -

Re: nd6_lookup() and rt refcount

2015-09-12 Thread Alexander Bluhm
On Sat, Sep 12, 2015 at 09:57:23PM +0200, Martin Pieuchot wrote: > Did I miss something else? I did not find anything. OK bluhm@ > @@ -1536,15 +1541,18 @@ struct nd_pfxrouter * > find_pfxlist_reachable_router(struct nd_prefix *pr) > { > struct nd_pfxrouter *pfxrtr; > - struct

Re: Purge route entries when an address is removed

2015-09-13 Thread Alexander Bluhm
On Sun, Sep 13, 2015 at 11:15:50AM +0200, Martin Pieuchot wrote: > This makes the kernel simpler as it no longer try to find a new ifa > when a route with a stale address is being used. This makes the code simpler, which is good. I am still not convinced that we want to loose the feature that

Re: Kill selectroute

2015-09-11 Thread Alexander Bluhm
On Fri, Sep 11, 2015 at 11:36:37AM +0200, Martin Pieuchot wrote: > I'm trying to help Claudio murdering some IPv6 madness. Here's a first > baby step to clean the source address selection code. > > Ok? OK bluhm@ > > Index: netinet6/in6_src.c >

syslogd logerrorx

2015-09-11 Thread Alexander Bluhm
Hi, Instead of printing errno strings here and there, add a logerrorx() that does not do that. Use it for anything that does not look like a system call or library call around it. Also add logerrorctx() that prints the TLS error instead. ok? bluhm Index: usr.sbin/syslogd/syslogd.c

Re: icmp6 error incorrect checksum packet

2015-09-11 Thread Alexander Bluhm
On Fri, Sep 11, 2015 at 02:16:12PM +0200, Martin Pieuchot wrote: > On 11/09/15(Fri) 13:20, Alexander Bluhm wrote: > > Hi, > > > > When pf modifies a TCP packet, it sets the M_TCP_CSUM_OUT flag in > > the mbuf packet header. If the packet is later dropped in >

icmp6 error incorrect checksum packet

2015-09-11 Thread Alexander Bluhm
Hi, When pf modifies a TCP packet, it sets the M_TCP_CSUM_OUT flag in the mbuf packet header. If the packet is later dropped in ip6_forward(), the TCP mbuf is copied and passed to icmp6_error(). The inherited M_TCP_CSUM_OUT flag generates ICMP6 packets with incorrect checksum. So reset the

Re: Brainy: a few bugs

2015-09-15 Thread Alexander Bluhm
On Mon, Sep 14, 2015 at 06:53:06AM +0200, Claudio Jeker wrote: > Fix for _17 OK bluhm@ > > -- > :wq Claudio > > Index: netinet/if_ether.c > === > RCS file: /cvs/src/sys/netinet/if_ether.c,v > retrieving revision 1.168 > diff -u

Re: nd6_lookup() and rt refcount

2015-09-12 Thread Alexander Bluhm
On Sat, Sep 12, 2015 at 11:17:54AM +0200, Martin Pieuchot wrote: > I'd like to have careful reviews. I'm running with this for a couple > of months but I doubt I'm exercising all the code paths. > @@ -1677,24 +1677,21 @@ icmp6_redirect_output(struct mbuf *m0, s > > { > /*

Re: syslogd: less global, more malloc, more random

2015-09-09 Thread Alexander Bluhm
On Wed, Sep 09, 2015 at 08:55:12AM -0600, Todd C. Miller wrote: > On Wed, 09 Sep 2015 13:14:16 +0200, Alexander Bluhm wrote: > > > Instead of having global variables containing the libevent structures, > > allocate them with malloc. This makes the address space layo

syslogd TLS accept

2015-09-25 Thread Alexander Bluhm
Hi, If syslogd is started with -S, it accepts TLS connections to receive encrypted traffic. The server certificates are taken from /etc/ssl like relayd does. ok? bluhm Index: usr.sbin/syslogd/evbuffer_tls.c === RCS file:

syslogd tls read write events

2015-09-18 Thread Alexander Bluhm
Hi, I discovered what caused the strange event loss in syslogd during the hackaton. I had mixed EV_READ and EV_WRITE events on the ev_read and ev_write event structures. The correct way is to use each event for its read and write purpose and instead switch the handler. Then libevent is no

Re: syslogd tls read write events

2015-09-18 Thread Alexander Bluhm
event_set() again. bluhm > if that's the case it reads ok... > > > On Fri, Sep 18, 2015 at 4:55 PM, Alexander Bluhm > <alexander.bl...@gmx.net> wrote: > > Hi, > > > > I discovered what caused the strange event loss in syslogd during > > the hackaton.

Re: syslogd host matches ip

2015-08-28 Thread Alexander Bluhm
On Fri, Aug 28, 2015 at 06:11:02PM +0200, Alexander Bluhm wrote: The +host feature allows to select log messages from a specific host. Normally syslogd does a reverse lookup on the sender's address. If that fails or if syslogd has been started with the -n option, the +host is matched

Re: syslogd TLS accept

2015-10-06 Thread Alexander Bluhm
On Fri, Sep 25, 2015 at 11:27:49PM +0200, Alexander Bluhm wrote: > If syslogd is started with -S, it accepts TLS connections to receive > encrypted traffic. The server certificates are taken from /etc/ssl > like relayd does. Anyone? bluhm Index: usr.sbin/syslogd/evbuf

pf statekey inp chaining

2015-12-02 Thread Alexander Bluhm
Hi, To avoid that the stack manipules the pf statekeys directly, introduce some pf_inp_...() functions as an interface. Locks can be added to them later. I have removed the first chaining at the beginning of tcp_input() and udp_input() directly after in_pcbhashlookup() as it is not necessary.

Re: pf statekey inp chaining

2015-12-02 Thread Alexander Bluhm
On Wed, Dec 02, 2015 at 04:48:51PM +0100, Alexander Bluhm wrote: > To avoid that the stack manipules the pf statekeys directly, introduce > some pf_inp_...() functions as an interface. Locks can be added > to them later. Here is a new version of the diff. This is new: - rename "c

pf unlink remove

2015-12-02 Thread Alexander Bluhm
Hi, So here is the result of the pf unlink bikeshedding. Rename pf_unlink_state() to pf_remove_state() so the name does not collide with the statekey to inp unlinking. ok? bluhm Index: net/if_pfsync.c === RCS file:

Re: more arp cleanup

2015-12-02 Thread Alexander Bluhm
On Wed, Dec 02, 2015 at 10:19:23PM +0100, Claudio Jeker wrote: > Last but of rt_ifp cleanup. Since we want to print the interface names in > those log messages we need to do the if_get/if_put dance there. Since this > is only in 2 places which should not be super common that should be fine > and

Re: ip6 fragment nibble

2015-12-03 Thread Alexander Bluhm
On Thu, Dec 03, 2015 at 06:48:28AM -0500, Ted Unangst wrote: > Cleaner this way I think. Yes, OK bluhm@ > > > Index: frag6.c > === > RCS file: /cvs/src/sys/netinet6/frag6.c,v > retrieving revision 1.65 > diff -u -p -r1.65 frag6.c

Re: explicitly check broadcast addresses on some ifa_ifwithaddr() uses

2015-12-03 Thread Alexander Bluhm
On Thu, Dec 03, 2015 at 02:52:59PM +0100, Vincent Gross wrote: > bluhm@ spotted one case where in_broadcast was needed. > > ok ? OK bluhm@ > > Index: sys/net/if.c > === > RCS file: /cvs/src/sys/net/if.c,v > retrieving revision

Re: ND and rt_ifa_add(9)

2015-12-01 Thread Alexander Bluhm
On Tue, Dec 01, 2015 at 01:34:15PM +0100, Martin Pieuchot wrote: > Diff below converts two custom uses of rtrequest(9) to rt_ifa_add(9). > These are used to automagically install and remove the RTF_CONNECTED > route obtained from a router advertisement. > > This changes the existing logic a bit

Re: Simplify rtredirect

2015-12-01 Thread Alexander Bluhm
On Tue, Dec 01, 2015 at 05:53:47PM +0100, Martin Pieuchot wrote: > The netmask argument is always NULL and the flags are always the same. > RTF_GATEWAY|RTF_HOST routes *are* routes created by redirect. > > I need this simplification to move forward with my rt_mask() cleanup. > > ok? OK

Re: introducing ip_send()/ip6_send() to OpenBSD kernel

2015-12-03 Thread Alexander Bluhm
On Thu, Dec 03, 2015 at 06:07:41PM +0100, Alexandr Nedvedicky wrote: > +#ifdef _KERNEL > +extern struct taskq *softnettq; > +#endif /* _KERNEL */ > #endif /* _NET_IF_H_ */ I think this should go to net/if_var.h > +static void > +ip_send_dispatch(void *cx) > +{ Maybe you should pass

Re: rtdeletemsg & KASSERT

2015-12-16 Thread Alexander Bluhm
ARP regression test. I cannot reproduce it by running the test. Perhaps I have to wait for the arp timer. The kernel is running on a single CPU qemu. bluhm On Wed, Dec 16, 2015 at 07:59:40PM +0100, Alexander Bluhm wrote: > I have merged the diff to -current before reviewing. There it looks &g

Re: rtdeletemsg & KASSERT

2015-12-16 Thread Alexander Bluhm
On Wed, Dec 16, 2015 at 08:47:02PM +0100, Alexander Bluhm wrote: > It happened after running the ARP regression test. I cannot reproduce > it by running the test. Perhaps I have to wait for the arp timer. Reproduceable by waiting for the arp timeout, then it crashes. I will investigate.

Re: rtdeletemsg & KASSERT

2015-12-16 Thread Alexander Bluhm
On Mon, Dec 07, 2015 at 04:36:17PM +0100, Martin Pieuchot wrote: > The rtrequest_delete() refactoring exposed an existing bug and > introduced a regression, both triggered by the same KASSERT(). > > The regression has been reported there: > https://marc.info/?l=openbsd-bugs=144943901304713=2 >

Re: rtdeletemsg & KASSERT

2015-12-16 Thread Alexander Bluhm
On Wed, Dec 16, 2015 at 09:46:26PM +0100, Alexander Bluhm wrote: > 10.188.70.17 fe:e1:ba:d0:d5:6d UHLS 03 - 8 vio0 This is this route that crashed the machine when the arp entry expired. When I move the rtref()/rtfree() calls into rtdeletemsg() it also prote

Re: Fix netstat(1) -P

2015-12-29 Thread Alexander Bluhm
On Tue, Dec 29, 2015 at 11:52:34AM +0100, Martin Pieuchot wrote: > The "-P" option does not need to read routing table symbols, so there's > no reason to bail if we cannot find them. > > Index: main.c > === > RCS file:

Re: PF: reference counting for statekey

2016-01-03 Thread Alexander Bluhm
OK bluhm@ On Sun, Jan 03, 2016 at 04:32:58PM +0100, Alexandr Nedvedicky wrote: > Index: kern/uipc_mbuf.c > === > RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v > retrieving revision 1.216 > diff -u -p -r1.216 uipc_mbuf.c > ---

Re: pledge tokenadm(8)

2015-12-30 Thread Alexander Bluhm
On Wed, Dec 23, 2015 at 04:26:11PM +, Ricardo Mestre wrote: > Hi tech@ > > tokenadm(8) pretty much needs almost the same pledge annotations as > login_token(8), > "rpath wpath cpath fattr flock" for operations on the DB files and before that > it also needs getpw due to calling getgrnam(3)

Re: just for safety

2015-11-30 Thread Alexander Bluhm
On Mon, Nov 30, 2015 at 06:13:04PM +0100, Martin Pieuchot wrote: > Considering the number of places where we do such iteration, if this > is still possible we're in big troubles, this is just a leftover of > old over engineering. The check is done inconsistenly only sometimes. Note that there

Re: Backward compat

2015-12-01 Thread Alexander Bluhm
On Mon, Nov 30, 2015 at 06:16:17PM +0100, Martin Pieuchot wrote: > I'm about to kill rt_mask() and I believe it's not worth keeping this > old backward compatibility. > > Anybody disagree? Ok? OK bluhm@ > > Index: netinet/if_ether.c >

Re: plug rt leak

2016-05-30 Thread Alexander Bluhm
On Mon, May 30, 2016 at 02:24:10PM +0200, Martin Pieuchot wrote: > Good catch, updated diff below. OK bluhm@ > > Index: net/route.c > === > RCS file: /cvs/src/sys/net/route.c,v > retrieving revision 1.300 > diff -u -p -r1.300

Re: nd6_output() and NULL

2016-05-30 Thread Alexander Bluhm
On Mon, May 30, 2016 at 02:46:18PM +0200, Martin Pieuchot wrote: > Here's a corrected version of the previous diff that got backed out. > > The idea is still to stop calling nd6_output() with a NULL ``rt'' > argument in order to always use the same code path when inserting > routes. > > ok? OK

Re: pf divert port reuse

2016-06-21 Thread Alexander Bluhm
On Tue, Jun 21, 2016 at 11:24:14AM +0200, Mike Belopuhov wrote: > So pf reused the port while some TCP segments were still in flight? No. The old state was in FIN_WAIT_2 and the socket in TIME_WAIT. They were idling for 25 seconds. Then a new state was created and Nat pf_get_sport() did choose

Re: pf divert port reuse

2016-06-22 Thread Alexander Bluhm
On Tue, Jun 21, 2016 at 05:12:39PM +0200, Mike Belopuhov wrote: > On Tue, Jun 21, 2016 at 16:08 +0200, Alexander Bluhm wrote: > > On Tue, Jun 21, 2016 at 02:45:42PM +0200, Mike Belopuhov wrote: > > > Unless I'm wrong, I have to retract my OK and ask you to fix > >

Re: pf divert port reuse

2016-06-21 Thread Alexander Bluhm
On Tue, Jun 21, 2016 at 02:45:42PM +0200, Mike Belopuhov wrote: > You're testing the sequence number > of the new state with an existing one which has seen some > traffic.. Are you sure this is correct? This is exactly what the stack does to distinguish between packets that belong to an old

Re: pf divert port reuse

2016-06-21 Thread Alexander Bluhm
On Tue, Jun 21, 2016 at 05:12:39PM +0200, Mike Belopuhov wrote: > Right, I've found it, but how can you tell that this is a new > connection if iss changes a lot and you just test if it's greater > than? The actual test should be if it's ouside of the window, > isn't it? That is very traditional

Re: IP_SENDSRCADDR [2/2] : add cmsg support

2016-06-19 Thread Alexander Bluhm
On Wed, Jun 15, 2016 at 07:43:37PM +0200, Vincent Gross wrote: > rev3 below. > > I fixed the line length, the useless bzero(), and also the wording in > ip.4 > > Ok ? OK bluhm@ > > Index: sys/netinet/in.h > === > RCS file:

Re: klog message buffer full

2016-06-22 Thread Alexander Bluhm
On Wed, Jun 22, 2016 at 05:08:24PM -0400, Ted Unangst wrote: > Alexander Bluhm wrote: > > +#ifndef SMALL_KERNEL > > + if (mbp->msg_bufd > 0) { > > + char buf[64]; > > This is not so much code that I'm worried about it on small kernels. Rather, >

Re: pf divert port reuse

2016-06-22 Thread Alexander Bluhm
On Wed, Jun 22, 2016 at 08:15:09PM +0200, Mike Belopuhov wrote: > Can you or benno test NAT64 with this change? > In case of weird behavior do this: > > int sidx = pd->af == pd->naf ? pd->sidx : pd->didx; > int didx = pd->af == pd->naf ? pd->didx : pd->sidx; > > And use sidx/didx throughout

<    1   2   3   4   5   6   7   8   9   10   >