Re: patch unveil fail

2023-10-25 Thread Alexander Bluhm
On Wed, Oct 25, 2023 at 07:00:28PM +0200, Omar Polo wrote: > On 2023/10/25 13:38:37 +0200, Alexander Bluhm wrote: > > @@ -213,11 +214,27 @@ main(int argc, char *argv[]) > > perror("unveil"); > > my_exit(2); > >

Re: IPv4 on ix(4) slow/nothing - 7.4

2023-10-25 Thread Alexander Bluhm
On Thu, Oct 19, 2023 at 04:04:26PM +0200, Jan Klemkow wrote: > On Wed, Oct 18, 2023 at 08:53:44PM +0200, Alexander Bluhm wrote: > > On Wed, Oct 18, 2023 at 08:19:29PM +0200, Mischa wrote: > > > It's indeed something like that: ix -> vlan (tagged) -> veb > > &g

patch unveil fail

2023-10-25 Thread Alexander Bluhm
Hi, Since 7.4 patch(1) does not work if an explicit patchfile is given on command line. https://marc.info/?l=openbsd-cvs&m=168941770509379&w=2 root@ot14:.../~# patch /usr/src/usr.bin/patch/patch.c patch-unveil.diff Hmm... Looks like a unified diff to me... The text leading up to this was: -

OpenBSD Errata: October 25, 2023 (xserver msplit)

2023-10-25 Thread Alexander Bluhm
Errata patches for X11 server and kernel mbuf handling have been released for OpenBSD 7.3 and 7.4. Binary updates for the amd64, arm64 and i386 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata73.html

Re: nfsd: don't clear SB_NOINTR flag

2023-10-20 Thread Alexander Bluhm
On Mon, Oct 16, 2023 at 10:17:50PM +0300, Vitaliy Makkoveev wrote: > This socket comes from userland, so this flag is never set. This makes > SB_NOINTR flag immutable, because we only set this bit on NFS client > socket buffers for all it's lifetime. > > I want to do this because this flag modifie

Re: TSO for ixl(4)

2023-10-18 Thread Alexander Bluhm
On Wed, Oct 18, 2023 at 05:29:41PM +0200, Jan Klemkow wrote: > This diff implements TCP Segmentation Offloading for ixl(4). I tested > it successfully on amd64 and sparc64 with Intel X710. It should > increase the TCP bulk performance to 10 Gbit/s. On sparc64 I got an > increase from 600 MBit/s

syslogd udp dropped counter

2023-10-17 Thread Alexander Bluhm
Hi, Now that syslogd handles delayed DNS lookups, I think we should count dropped packets to UDP loghosts. Although not every dropped UDP packet can be detected, the message makes the admin aware that there may be a blind spot during startup. syslogd[26493]: dropped 8 messages to udp loghost "@u

pf log drop default rule

2023-10-10 Thread Alexander Bluhm
Hi, If a packet is malformed, it is dropped by pf(4). The rule referenced in pflog(4) is the default rule. As the default rule is a pass rule, tcpdump prints "pass" although the packet is actually dropped. I have reports from genua and OPNsense users who are confused by the output. With the dif

pf passes packet if limit reached

2023-10-10 Thread Alexander Bluhm
Hi, The behaviour of the PFRULE_SRCTRACK and max_states check was unintentionally changed by this commit. revision 1.964 date: 2016/01/25 18:49:57; author: sashan; state: Exp; lines: +18 -10; commitid: KeemoLxcm7FS1oYy; - plugging massive pf_state_key leak OK mp

pf_pull_hdr useless action pointer and fragment logic

2023-10-09 Thread Alexander Bluhm
Hi, pf_pull_hdr() allows to pass an action pointer parameter as output value. This is never used, all callers pass a NULL argument. Remove ACTION_SET() entirely. The logic if (fragoff >= len) in pf_pull_hdr() looks odd. One is the offset in the IP packet, the latter the length of some header w

Re: ifq_start_task(): purge queue before exit when IFF_RUNNING flag is not set

2023-10-06 Thread Alexander Bluhm
On Fri, Oct 06, 2023 at 04:17:34PM +0300, Vitaliy Makkoveev wrote: > On Fri, Oct 06, 2023 at 02:50:21PM +0200, Alexander Bluhm wrote: > > On Fri, Oct 06, 2023 at 12:45:54PM +0300, Vitaliy Makkoveev wrote: > > > On Thu, Oct 05, 2023 at 10:42:25PM +1000, David Gwynne wrote: >

Re: tcp syn cache unlock

2023-10-06 Thread Alexander Bluhm
On Fri, Oct 06, 2023 at 03:47:31PM +0300, Vitaliy Makkoveev wrote: > On Fri, Oct 06, 2023 at 02:14:52PM +0200, Alexander Bluhm wrote: > > > @@ -718,11 +743,13 @@ softclock(void *arg) > > > softclock_process_tick_timeout(to, new); > > > }

Re: ifq_start_task(): purge queue before exit when IFF_RUNNING flag is not set

2023-10-06 Thread Alexander Bluhm
On Fri, Oct 06, 2023 at 12:45:54PM +0300, Vitaliy Makkoveev wrote: > On Thu, Oct 05, 2023 at 10:42:25PM +1000, David Gwynne wrote: > > > On 5 Oct 2023, at 21:50, Vitaliy Makkoveev wrote: > > > > > > I don't like this unlocked if_flags check we have in ifq_start_task(). > > > Guess READ_ONCE() is

Re: tcp syn cache unlock

2023-10-06 Thread Alexander Bluhm
On Fri, Oct 06, 2023 at 02:12:31PM +0300, Vitaliy Makkoveev wrote: > I reworked your diff for a little. At firts I use separate > softclock_thread_mpsafe() for mpsafe timers. I don't think we need to > bind this thread to the primary CPU. I also think a separate thread is better. Makes no sense t

Re: wg destroy hangs

2023-10-05 Thread Alexander Bluhm
On Thu, Oct 05, 2023 at 07:15:23AM +0200, Kirill Miazine wrote: > > This diff checks IFF_RUNNING flag within while (!ifq_empty()) loop of > > wg_peer_destroy(). If the flag is not set queue will be purged and check > > performed again. I intentionally keep netlock to prevent ifconfig > > manipulati

Re: syslogd retry dns lookup

2023-10-04 Thread Alexander Bluhm
On Sun, Sep 03, 2023 at 02:00:46AM +0200, Alexander Bluhm wrote: > When DNS lookup for remote loghost in @ line in syslog.conf does > not work at startup, retry in intervals. Thanks Paul de Weerd for testing my diff. Together we improved the debug output to make clear what is going on.

tcp syn cache unlock

2023-10-04 Thread Alexander Bluhm
Hi, This is a first step to unlock TCP syn cache. The timer function is independent of the socket code. That makes it easy to start there. Introduce tcp syn cache mutex. Document fields protected by net lock and mutex. Devide timer function in parts protected by mutex and sending with netlock

Re: wg destroy hangs

2023-10-04 Thread Alexander Bluhm
On Wed, Oct 04, 2023 at 11:03:27PM +0300, Vitaliy Makkoveev wrote: > On Wed, Oct 04, 2023 at 09:13:59PM +0200, Alexander Bluhm wrote: > > On Wed, Oct 04, 2023 at 08:42:48PM +0200, Kirill Miazine wrote: > > > > If it happns again, could you send an 'ps axlww | grep ifcon

Re: wg destroy hangs

2023-10-04 Thread Alexander Bluhm
On Wed, Oct 04, 2023 at 08:42:48PM +0200, Kirill Miazine wrote: > > If it happns again, could you send an 'ps axlww | grep ifconifg' > > output? Then we see the wait channel where it hangs in the kernel. > > > > $ ps axlww > >UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TT TIM

Re: wg destroy hangs

2023-10-04 Thread Alexander Bluhm
On Wed, Oct 04, 2023 at 10:53:30AM -0400, Sonic wrote: > When it happened to me back then (2022) I'm pretty sure I did a "down" > followed by a "delete" and then the "destroy". root@ot6:.../~# cd /usr/src/regress/sys/net/wg root@ot6:.../wg# make ifconfig ... root@ot6:.../wg# ifconfig wg11 wg11: fl

Re: wg destroy hangs

2023-10-04 Thread Alexander Bluhm
On Wed, Oct 04, 2023 at 10:08:01AM -0400, Sonic wrote: > See the post: > "Uninterruptible D State after ifconfig wg0 destroy" Oct. 31, 2022 in the > Bugs archive. I have a test regress/sys/net/wg that configures a wg(4), sends some traffic, and destroys it. I have never seen this bug. There must

OpenBSD Errata: October 3, 2023 (xlibs)

2023-10-03 Thread Alexander Bluhm
Errata patches for X11 libraries libX11 and libXpm have been released for OpenBSD 7.2 and 7.3. Binary updates for the amd64, arm64 and i386 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata72.html h

Re: link mbufs/inpcbs to pf_states, not pf_state_keys

2023-09-29 Thread Alexander Bluhm
On Tue, Aug 22, 2023 at 06:30:31AM +0200, Alexandr Nedvedicky wrote: > Currently we have something like this: > > { mbuf, pcb } <-> state key <-> { state, state ... } > > with this diff we get to: > > { mbuf, pcb } <-> state <-> state key > > Basically when we do process

Re: pfkey: forward after validation

2023-09-29 Thread Alexander Bluhm
On Fri, Sep 29, 2023 at 01:46:40AM +0200, Tobias Heider wrote: > Like with route messages we should really only forward pfkey messages > that made it past the validation step. This fixes a lot of possible > crashes in ipsecctl -m. > > ok? OK bluhm@ > diff /home/user/got/co/src > commit - 1ce2bc2

ixl witness lock order

2023-09-28 Thread Alexander Bluhm
Hi, There is a lock order problem in ixl(4) show by witness. Here I replaced a wrong net lock with kernel lock. revision 1.84 date: 2022/08/05 13:57:16; author: bluhm; state: Exp; lines: +6 -3; commitid: sAcV6NsO35L03mLS; The netlock for SIOCSIFMEDIA and SIOCGIFM

Re: hotplug(4): introduce `hotplug_mtx' mutex(9) and make `hotplugread_filterops' mp safe

2023-09-22 Thread Alexander Bluhm
On Mon, Sep 18, 2023 at 02:12:21PM +0300, Vitaliy Makkoveev wrote: > On Mon, Sep 18, 2023 at 02:03:08PM +0300, Vitaliy Makkoveev wrote: > > Also use this mutex to protect `evqueue_head', `evqueue_tail' and > > `evqueue_count'. > > > > Sorry, the right diff: OK bluhm@ > Index: sys/dev/hotplug.c

Re: hyperv(4): use shared netlock to protect if_list and ifa_list walkthrough and data

2023-09-22 Thread Alexander Bluhm
On Mon, Sep 18, 2023 at 11:40:28AM +0300, Vitaliy Makkoveev wrote: > Context switch looks fine here. OK bluhm@ > Index: sys/dev/pv/hypervic.c > === > RCS file: /cvs/src/sys/dev/pv/hypervic.c,v > retrieving revision 1.19 > diff -u -p

Re: Make `logread_filtops' mpsafe

2023-09-22 Thread Alexander Bluhm
On Thu, Sep 14, 2023 at 01:12:22PM +0300, Vitaliy Makkoveev wrote: > `log_mtx' mutex(9) already used for message buffer protection, so use it > to protect `logread_filtops' too. > > ok? OK bluhm@ > Index: sys/kern/subr_log.c > === >

Re: fix a wireguard mbuf leak

2023-09-22 Thread Alexander Bluhm
On Fri, Sep 22, 2023 at 12:21:42PM +0900, YASUOKA Masahiko wrote: > A leak may happens when wgpeer is deleted. > > ok? OK bluhm@ > The state queue should be freeed when wg_peer is destroyed. > diff from IIJ. > > Index: sys/net/if_wg.c > ==

OpenBSD Errata: September 21, 2023 (npppd)

2023-09-20 Thread Alexander Bluhm
Errata patches for npppd have been released for OpenBSD 7.2 and 7.3. Binary updates for the amd64, arm64 and i386 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata72.html https://www.openbsd.org/err

Re: Use counters_read(9) from ddb(4)

2023-09-18 Thread Alexander Bluhm
On Fri, Sep 15, 2023 at 04:18:13PM +0200, Martin Pieuchot wrote: > On 11/09/23(Mon) 21:05, Martin Pieuchot wrote: > > On 06/09/23(Wed) 23:13, Alexander Bluhm wrote: > > > On Wed, Sep 06, 2023 at 12:23:33PM -0500, Scott Cheloha wrote: > > > > On Wed, Sep 06, 20

Re: Replace selinfo by klist in vnode structure

2023-09-08 Thread Alexander Bluhm
On Thu, Sep 07, 2023 at 10:32:58PM +0300, Vitaliy Makkoveev wrote: > Remove the remnants of the leftover selinfo from vnode(9) layer. Just > mechanical replacement because knote(9) API is already used. I don't > want make klist MP safe with this diff. > > headers added where is was required. Disa

Re: syslogd retry dns lookup

2023-09-07 Thread Alexander Bluhm
On Sun, Sep 03, 2023 at 02:00:46AM +0200, Alexander Bluhm wrote: > Hi, > > When DNS lookup for remote loghost in @ line in syslog.conf does > not work at startup, retry in intervals. > > Please test if you use the feature. > > ok? anyone? >

Re: Use counters_read(9) from ddb(4)

2023-09-06 Thread Alexander Bluhm
On Wed, Sep 06, 2023 at 12:23:33PM -0500, Scott Cheloha wrote: > On Wed, Sep 06, 2023 at 01:04:19PM +0100, Martin Pieuchot wrote: > > Debugging OOM is hard. UVM uses per-CPU counters and sadly > > counters_read(9) needs to allocate memory. This is not acceptable in > > ddb(4). As a result I cann

ip send shared netlock

2023-09-05 Thread Alexander Bluhm
Hi, ip_output() and ip6_output() should be MP safe when called with NULL options. ok? bluhm Index: netinet/ip_input.c === RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_input.c,v retrieving revision 1.385 diff -u -p -r1.385

Re: tcp sync cache signed use counter

2023-09-04 Thread Alexander Bluhm
On Mon, Sep 04, 2023 at 07:22:03PM +0300, Vitaliy Makkoveev wrote: > > On 4 Sep 2023, at 16:19, Alexander Bluhm wrote: > > > > Hi, > > > > Variable scs_use is basically counting packet insertions to syn > > cache, so I would prefer type long to exclude over

tcp sync cache signed use counter

2023-09-04 Thread Alexander Bluhm
Hi, Variable scs_use is basically counting packet insertions to syn cache, so I would prefer type long to exclude overflow on fast machines. With the current limits int should be enough, but long does not hurt. It can be negative as it starts at a positive limit and counts backwards. After all

tcp sync cache refcount improvement

2023-09-03 Thread Alexander Bluhm
Hi, Avoid a useless increment and decrement of of the tcp syn cache refcount by unexpanding the SYN_CACHE_TIMER_ARM() macro in the timer callback. ok? bluhm Index: netinet/tcp_input.c === RCS file: /data/mirror/openbsd/cvs/src/sys/

syslogd retry dns lookup

2023-09-02 Thread Alexander Bluhm
Hi, When DNS lookup for remote loghost in @ line in syslog.conf does not work at startup, retry in intervals. Please test if you use the feature. ok? bluhm Index: syslogd.c === RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/syslo

Re: link mbufs/inpcbs to pf_states, not pf_state_keys

2023-08-21 Thread Alexander Bluhm
On Thu, Aug 17, 2023 at 12:02:35PM +1000, David Gwynne wrote: > there are links between the pcb/socket layer and pf as an optimisation, > and links on mbufs between both sides of a forwarded connection. > these links let pf skip an rb tree lookup for outgoing packets. > > right now these links are

Re: sosetopt(): merge SO_SND* with corresponding SO_RCV* cases

2023-08-08 Thread Alexander Bluhm
On Wed, Aug 09, 2023 at 12:41:18AM +0300, Vitaliy Makkoveev wrote: > I think it's better to merge SO_BINDANY cases from both switch blocks. > This time SO_LINGER case is separated, so there is no reason for > dedicated switch block. OK bluhm@ > Index: sys/kern/uipc_socket.c >

Re: sosetopt(): merge SO_SND* with corresponding SO_RCV* cases

2023-08-08 Thread Alexander Bluhm
On Fri, Aug 04, 2023 at 12:38:23AM +0300, Vitaliy Makkoveev wrote: > @@ -1856,6 +1856,9 @@ sosetopt(struct socket *so, int level, i > case SO_SNDLOWAT: > case SO_RCVLOWAT: > { > + struct sockbuf *sb = (optname == SO_SNDBUF || > +

Re: pf(4) may cause relayd(8) to abort

2023-08-08 Thread Alexander Bluhm
On Tue, Aug 01, 2023 at 01:50:52AM +0200, Alexandr Nedvedicky wrote: > OK to commit? OK bluhm@ > 8<---8<---8<--8< > diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c > index 6f23a6f795d..c862c804f84 100644 > --- a/sys/net/pf_table.c > +++

Re: Move solock() down to sosetopt()

2023-07-28 Thread Alexander Bluhm
On Sat, Jul 22, 2023 at 05:42:49PM +0300, Vitaliy Makkoveev wrote: > Thanks for testing. There is updated diff below. OK bluhm@ > Index: sys/kern/uipc_socket.c > === > RCS file: /cvs/src/sys/kern/uipc_socket.c,v > retrieving revision

Re: fix vlan handling with tcplro on ix(4)

2023-07-27 Thread Alexander Bluhm
On Thu, Jul 27, 2023 at 09:15:48AM -0700, Chris Cappuccio wrote: > Jan Klemkow [j.klem...@wemelug.de] wrote: > > +#if NVLAN > 0 > > + if (ext.evh) > > + hdrlen += ETHER_VLAN_ENCAP_LEN; > > +#endif > > if (ext.ip

Re: fix vlan handling with tcplro on ix(4)

2023-07-26 Thread Alexander Bluhm
On Wed, Jul 26, 2023 at 11:30:45AM +0200, Jan Klemkow wrote: > Hi, > > I missed the vlan-tag size in the mss calculation of lro packets in > ix(4). This diff add vlan-header detection in ether_extract_headers() > and uses this information to calculate the right mss. > > This fixes forwarding of

OpenBSD Errata: July 25, 2023 (hv amd cpu)

2023-07-25 Thread Alexander Bluhm
Errata patches for guests running on hypervisors on AMD cpus have been released for OpenBSD 7.2 and 7.3. Binary updates for the amd64 and i386 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata72.html

OpenBSD Errata: July 24, 2023 (amd cpu firmware, wscons)

2023-07-24 Thread Alexander Bluhm
Errata patches for AMD cpus with their firmware updates and for wscons have been released for OpenBSD 7.2 and 7.3. Binary updates for the amd64, i386 and arm64 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.o

Re: Move solock() down to sosetopt()

2023-07-21 Thread Alexander Bluhm
On Thu, Jul 13, 2023 at 02:22:17AM +0300, Vitaliy Makkoveev wrote: > This is a part of my standalone sblock() work. I need this movement > because buffers related SO_SND* and SO_RCV* socket options modification > should be protected with sblock(). However, standalone sblock() has > different lock o

Re: inetd echo localhost

2023-07-21 Thread Alexander Bluhm
On Fri, Jul 21, 2023 at 03:05:41PM +0200, Claudio Jeker wrote: > On Fri, Jul 21, 2023 at 03:17:35PM +0300, Vitaliy Makkoveev wrote: > > On Thu, Jul 20, 2023 at 09:57:00PM +0200, Alexander Bluhm wrote: > > > Hi, > > > > > > I wonder why UDP echo d

Re: sobuf_print(): add `sb_state' output

2023-07-21 Thread Alexander Bluhm
On Fri, Jul 21, 2023 at 11:35:21AM +0300, Vitaliy Makkoveev wrote: > It contains SS_CANTSENDMORE, SS_ISSENDING, SS_CANTRCVMORE and > SS_RCVATMARK bits. Also do `sb_flags' output as hex, it contains flags > too. OK bluhm@ > Index: sys/kern/uipc_socket.c > ==

inetd echo localhost

2023-07-20 Thread Alexander Bluhm
Hi, I wonder why UDP echo does not work with inetd on 127.0.0.1. Note that it is default off. One of my regress machines has it enabled for other tests. There perl dist/Net-Ping/t/510_ping_udp.t expects that UDP echo works on 127.0.0.1. It was disabled with this commit: ---

loopback bpf tcpdump curruption

2023-07-20 Thread Alexander Bluhm
Hi, When running tcpdump on loopback, I see a currupted packet for each valid packet. root@v74:.../~# tcpdump -ni lo0 -X -vvv tcpdump: listening on lo0, link-type LOOP 21:01:07.645880 : e161 ff01 7f00 0001 7f00 0001 .a.. 0010: 0800 00df 3a4f d257 38fa 0236 0129

OpenBSD Errata: July 19, 2023 (ssh-agent)

2023-07-19 Thread Alexander Bluhm
Errata patches for ssh-agent have been released for OpenBSD 7.2 and 7.3. Binary updates for the amd64, i386 and arm64 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata72.html https://www.openbsd.org

Re: tcp lro by default, call for testing

2023-07-17 Thread Alexander Bluhm
On Mon, Jul 10, 2023 at 02:07:01PM +0200, Jan Klemkow wrote: > On Sat, Jul 08, 2023 at 05:15:26PM +0300, Alexander Bluhm wrote: > > I am not aware of any more limitations when enabling LRO for TCP > > in the network drivers. The feature allows to receive agregated > > packet

route leak nd6 detach

2023-07-09 Thread Alexander Bluhm
Hi, While testing my ART reference couting fix, I discovered a rtentry leak that is triggered by regress/sbin/route and detected with btrace(8) refcnt. The reference returned by rtalloc() must be freed with rtfree() in all cases. ok? bluhm Index: netinet6/in6_ifattach.c ===

tcp lro by default, call for testing

2023-07-08 Thread Alexander Bluhm
Hi, I am not aware of any more limitations when enabling LRO for TCP in the network drivers. The feature allows to receive agregated packets larger than the MTU. Receiving TCP streams becomes much faster. As the network hardware is not aware whether a packet is received locally or forwarded, ev

Re: Use u_long for struct mstat

2023-07-07 Thread Alexander Bluhm
On Fri, Jul 07, 2023 at 12:31:02PM +0300, YASUOKA Masahiko wrote: > Hi, > > I'd like to expand the counters in struct mbstat from u_short to u_long. > > When I was debugging a mbuf leak, I saw the result of "netstat -m" > --- > 28647 mbufs in use: > 28551 mbufs allocated to data >

Re: tcp timer wrap around, use 64 bit

2023-07-07 Thread Alexander Bluhm
On Fri, Jul 07, 2023 at 12:07:36PM +0300, YASUOKA Masahiko wrote: > Hi, > > This netstat diff is already needed to avoid compiler warnings since > it uses struct tcpcb directly. > > ok? OK bluhm@ > Index: usr.bin/netstat/inet.c > =

Re: tcp timer wrap around, use 64 bit

2023-07-07 Thread Alexander Bluhm
On Fri, Jul 07, 2023 at 10:43:21AM +0200, Claudio Jeker wrote: > On Fri, Jul 07, 2023 at 11:38:58AM +0300, YASUOKA Masahiko wrote: > > Hi, > > > > Does using 64 bit for timer in tcpcb require this? > > Not sure about this but one comment below. When we introduced struct tcp_info, we discussed if

tso lo keep mss

2023-07-07 Thread Alexander Bluhm
Hi, When we preserve M_TCP_TSO we also must keep ph_mss. In lo(4) LRO/TSO this logic was missing. As this may be relevant only for weird pf configs that forward from loopback and ifconfig tcplro is disabled by default, it is not relevant yet. ok? bluhm Index: net/if.c

Re: tcp lro tso path mtu

2023-07-06 Thread Alexander Bluhm
On Thu, Jul 06, 2023 at 08:49:03PM +0200, Jan Klemkow wrote: > > @@ -109,6 +109,9 @@ > > #include > > #include > > #include > > I think is a merge bug, isn't it? > > > +#include > > +#include > > +#include Right. > > + error = tcp_if_output_tso(ifp, mp, dst, rt, ifcap, mtu); > > +

Re: OpenBSD perl 5.36.1 - Call for Testing

2023-07-06 Thread Alexander Bluhm
On Tue, Jul 04, 2023 at 06:38:46PM +0300, Alexander Bluhm wrote: > On Sat, May 20, 2023 at 06:59:14PM -0700, Andrew Hewus Fresh wrote: > > Here's a patch to bring perl in base from 5.36.0 to 5.36.1, there are > > only a few fixes in it and at least one of them I had previ

fix crash in routing table

2023-07-05 Thread Alexander Bluhm
Hi, When forwaring in packets parallel while removing the corresponding ARP entry in a loop like this while :; do arp -nd 10.10.21.1; arp -nd 10.10.22.4; done it was quite easy to crash the kernel. The race is exposed by putting a delay() here: Index: net/rtable.c ===

Re: Remove unnecessary NOWITNESS kludge

2023-07-05 Thread Alexander Bluhm
On Wed, Jul 05, 2023 at 03:41:31AM +, Visa Hankala wrote: > Initialize stack-based mutexed using mtx_init(). This removes the need > of the NOWITNESS kludge and lets the lock checker do its job with these > mutexes. > > At the moment, static initialization of locks inside functions does not >

Re: cksum remove redundant code

2023-07-04 Thread Alexander Bluhm
anyone? On Fri, May 26, 2023 at 06:44:25PM +0200, Alexander Bluhm wrote: > Hi, > > in_ifcap_cksum() checks ifp == NULL > in_hdr_cksum_out() sets ip_sum = 0 > in_proto_cksum_out() and in6_proto_cksum_out() always write > th_sum if M_TCP_CSUM_OUT is set and proto is IP

tcp timer wrap around, use 64 bit

2023-07-04 Thread Alexander Bluhm
Hi, After changing tcp now tick to milliseconds, it will wrap around after 49 days of uptime. That may be a problem in some places of our stack. Better use a 64 bit counter. As timestamp option is 32 bit in TCP protocol, we have to use the lower 32 bit there. There are casts to 32 bits that sh

Re: Add ethernet type check in ifsetlro()

2023-07-04 Thread Alexander Bluhm
On Mon, Jul 03, 2023 at 11:12:17PM +0200, Jan Klemkow wrote: > bluhm pointed out that the ether_brport_isset() check it just allowed on > ethernet devices. Thus, I put an additional ethernet check in the > condition. This also fixes EBUSY errors of "ifconfig lo0 tcplro" calls > in my setup. > >

tcp lro tso path mtu

2023-07-03 Thread Alexander Bluhm
Hi, As final step before making LRO (Large Receive Offload) the default, we have to fix path MTU discovery when forwarding. The drivers, currently ix(4) and lo(4) only, record an upper bound of the size of the original packets in ph_mss. When sending we must chop the packets with TSO (TCP Segmen

Re: bge(4) kstats

2023-07-03 Thread Alexander Bluhm
On Mon, Jul 03, 2023 at 04:48:36PM +1000, Jonathan Matthew wrote: > This adds kstats for the hardware counters available in bge(4) devices, > BCM5705 > and newer. The main complication is that some of the counters are already > used > in bge_stats_update_regs() as part of a hardware bug workarou

Re: lo(4) loopback LRO and TSO

2023-07-02 Thread Alexander Bluhm
anyone? On Fri, Jun 23, 2023 at 06:06:16PM +0200, Alexander Bluhm wrote: > Hi, > > Claudio@ mentioned the idea to use TSO and LRO on the loopback > interface to transfer TCP faster. > > I see a performance effect with this diff, but more importantly it > gives us more test

Re: Introduce M_IFGROUP type of memory allocation

2023-06-27 Thread Alexander Bluhm
On Tue, Jun 27, 2023 at 01:55:23PM +0200, Mark Kettenis wrote: > > Date: Tue, 27 Jun 2023 11:09:32 + > > From: Klemens Nanni > > > > On Tue, Jun 27, 2023 at 01:32:37PM +0300, Vitaliy Makkoveev wrote: > > > M_TEMP seems unreasonable for interface groups data allocations. > > > > After claudio

Re: inpcb sip hash mutex contention

2023-06-26 Thread Alexander Bluhm
On Sat, Jun 24, 2023 at 11:20:50AM +1000, David Gwynne wrote: > maybe it's time to re-evaluate siphash? In one of our products we have replaced SipHash with xxHash. https://xxhash.com/ https://github.com/Cyan4973/xxHash bluhm

lo(4) loopback LRO and TSO

2023-06-23 Thread Alexander Bluhm
Hi, Claudio@ mentioned the idea to use TSO and LRO on the loopback interface to transfer TCP faster. I see a performance effect with this diff, but more importantly it gives us more test coverage. Currently LRO on lo(4) is default off. Future plan is: - Fix some corner cases for LRO/TSO with TC

inpcb sip hash mutex contention

2023-06-22 Thread Alexander Bluhm
Hi, I am working on a diff to run UDP input in parallel. Btrace kstack analysis shows that SIP hash for PCB lookup is quite expensive. When running in parallel we get lock contention on the PCB table mutex. So it results in better performance to calculate the hash value before taking the mutex.

Re: tso ip6 forward

2023-06-16 Thread Alexander Bluhm
On Mon, Jun 12, 2023 at 03:46:28PM +0200, Alexander Bluhm wrote: > I found a little inconsistency in IPv6 forwarding with TSO. > > Sending with TSO should only done if the large packet does not fit > in the interface MTU. In case tcp_if_output_tso() does not process > the packet,

OpenBSD Errata: June 15, 2023 (libx11)

2023-06-15 Thread Alexander Bluhm
Errata patches for libX11 CVE-2023-3138 have been released for OpenBSD 7.2 and 7.3. Binary updates for the amd64, i386 and arm64 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata72.html https://www.

Re: msdosfs: fixes for Undefined Behavior

2023-06-15 Thread Alexander Bluhm
On Thu, Jun 15, 2023 at 11:36:21AM +0200, Stefan Fritsch wrote: > >From FreeBSD commits > > commit c0db7289c3de290d821311942d5533f2284af77f > Author: pfg > Date: Wed Aug 8 15:08:22 2018 + > > msdosfs: fixes for Undefined Behavior. > > and > >

Re: ix(4): allocate less memory for tx buffers

2023-06-13 Thread Alexander Bluhm
On Fri, Jun 09, 2023 at 08:10:22PM +0200, Jan Klemkow wrote: > On Fri, Jun 09, 2023 at 06:59:57PM +0200, Jan Klemkow wrote: > > On Fri, Jun 09, 2023 at 06:11:38PM +0200, Jan Klemkow wrote: > > > TSO packets are limited to MAXMCLBYTES (64k). Thus, we don't need to > > > allocate IXGBE_TSO_SIZE (256

tso ip6 forward

2023-06-12 Thread Alexander Bluhm
Hi, I found a little inconsistency in IPv6 forwarding with TSO. Sending with TSO should only done if the large packet does not fit in the interface MTU. In case tcp_if_output_tso() does not process the packet, we should send an ICMP6 error. Rearrange the code that it looks more like other calls

Re: Kill if_detached_ioctl()

2023-06-12 Thread Alexander Bluhm
On Wed, Jun 07, 2023 at 01:36:23PM +0300, Vitaliy Makkoveev wrote: > In this point the interface is already removed from the list of all > interfaces and from the interface index map and all possible > concurrent ioctl() threads finished. Remove this dead code. Should we set ifp->if_ioctl to NULL?

Re: if_detach(): move nd6_ifdetach() out of netlock

2023-06-12 Thread Alexander Bluhm
On Wed, Jun 07, 2023 at 01:15:46PM +0300, Vitaliy Makkoveev wrote: > In this point, the interface is disconnected from everywhere. No need to > hold netlock for dummy 'nd_ifinfo' release. Netlock is also not needed > for TAILQ_EMPTY(&ifp->if_*hooks) assertions. OK bluhm@ > Index: sys/net/if.c > =

Re: ifconfig rename tcplro

2023-06-07 Thread Alexander Bluhm
On Wed, Jun 07, 2023 at 12:59:11PM +0300, Vitaliy Makkoveev wrote: > On Wed, Jun 07, 2023 at 10:19:32AM +1000, David Gwynne wrote: > > > > > > > On 7 Jun 2023, at 06:33, Vitaliy Makkoveev wrote: > > > > > >> On 6 Jun 2023, at 20:29, Alexander Bluh

Re: ifconfig rename tcplro

2023-06-06 Thread Alexander Bluhm
On Tue, Jun 06, 2023 at 11:33:36PM +0300, Vitaliy Makkoveev wrote: > > On 6 Jun 2023, at 20:29, Alexander Bluhm wrote: > > > > On Tue, Jun 06, 2023 at 05:54:31PM +0300, Vitaliy Makkoveev wrote: > >> On Tue, Jun 06, 2023 at 02:31:52PM +0200, Alexander Bluhm wrote: >

Re: ifconfig rename tcplro

2023-06-06 Thread Alexander Bluhm
On Tue, Jun 06, 2023 at 05:54:31PM +0300, Vitaliy Makkoveev wrote: > On Tue, Jun 06, 2023 at 02:31:52PM +0200, Alexander Bluhm wrote: > > Hi, > > > > I would suggest to rename ifconfig tcprecvoffload to tcplro. Maybe > > it's just because I had to type that lo

ifconfig rename tcplro

2023-06-06 Thread Alexander Bluhm
Hi, I would suggest to rename ifconfig tcprecvoffload to tcplro. Maybe it's just because I had to type that long name too often. With that we have consistent naming: # ifconfig ix0 tcplro # sysctl net.inet.tcp.tso=1 Also the coresponding flag are named LRO. # ifconfig ix1 hwfeatures ix1: flags=

Re: lo(4) checksum offload

2023-06-02 Thread Alexander Bluhm
On Wed, May 31, 2023 at 09:36:22AM +1000, David Gwynne wrote: > we could export these csum flags as part of the bpf header so we can > teach tcpdump to shut up in this situation. Linux does not do that and I want to keep pcap file format compatible. Also smart tools make debugging real checksum pr

Re: lo(4) checksum offload

2023-06-01 Thread Alexander Bluhm
On Thu, Jun 01, 2023 at 04:38:53PM +, Peter Stuge wrote: > David Gwynne wrote: > > > Currently packets sent over loopback interface get their checksum > > > calculated twice. In the output path it is set and during TCP/IP > > > input it is calculated again to be compared with the previous valu

Re: ix(4): LRO forwarding

2023-05-31 Thread Alexander Bluhm
On Thu, May 25, 2023 at 10:40:51PM +0200, Jan Klemkow wrote: > On Wed, May 24, 2023 at 05:28:58PM +0200, Alexander Bluhm wrote: > > On Tue, May 23, 2023 at 02:14:57PM +0200, Jan Klemkow wrote: > > > This diff sets needed offloading flags and the calculated mss to LRO > >

lo(4) checksum offload

2023-05-30 Thread Alexander Bluhm
Hi, Currently packets sent over loopback interface get their checksum calculated twice. In the output path it is set and during TCP/IP input it is calculated again to be compared with the previous value. This can be avoided by claiming that lo(4) supports hardware checksum offloading. For each

Re: syn cache tcp checksum

2023-05-30 Thread Alexander Bluhm
anyone? On Mon, May 22, 2023 at 10:17:31PM +0200, Alexander Bluhm wrote: > Hi, > > I noticed a missing checksum count in netstat tcp packets sent > software-checksummed. Turns out that our syn cache does the checksum > calculation by hand, instead of the established mechanism

cksum remove redundant code

2023-05-26 Thread Alexander Bluhm
Hi, in_ifcap_cksum() checks ifp == NULL in_hdr_cksum_out() sets ip_sum = 0 in_proto_cksum_out() and in6_proto_cksum_out() always write th_sum if M_TCP_CSUM_OUT is set and proto is IPPROTO_TCP. ok? bluhm Index: netinet/ip_output.c =

Re: Relax netlock to shared netlock and push it down to mrt_sysctl_mfc()

2023-05-26 Thread Alexander Bluhm
On Wed, May 17, 2023 at 01:02:58PM +0300, Vitaliy Makkoveev wrote: > mrt_rtwalk_mfcsysctl() performs read-only access to protected data, so > rtable_walk() could be called with shared netlock. While I think the NET_LOCK_SHARED() is not sufficent, you can move the NET_LOCK() into mrt_sysctl_mfc().

Re: Relax netlock to shared netlock and push it down to mrt_sysctl_mfc()

2023-05-26 Thread Alexander Bluhm
On Fri, May 26, 2023 at 06:25:46PM +0300, Vitaliy Makkoveev wrote: > On Fri, May 26, 2023 at 05:08:06PM +0200, Alexander Bluhm wrote: > > On Fri, May 26, 2023 at 05:29:58PM +0300, Vitaliy Makkoveev wrote: > > > On Wed, May 17, 2023 at 01:02:58PM +0300, Vital

Re: Relax netlock to shared netlock and push it down to mrt_sysctl_mfc()

2023-05-26 Thread Alexander Bluhm
On Fri, May 26, 2023 at 05:29:58PM +0300, Vitaliy Makkoveev wrote: > On Wed, May 17, 2023 at 01:02:58PM +0300, Vitaliy Makkoveev wrote: > > mrt_rtwalk_mfcsysctl() performs read-only access to protected data, so > > rtable_walk() could be called with shared netlock. > > > > Regardless on sysctl(2)

OpenBSD Errata: May 26, 2023 (rpki ssl)

2023-05-26 Thread Alexander Bluhm
Errata patches for rpki-client and LibreSSL libssl have been released for OpenBSD 7.2 and 7.3. Binary updates for the amd64, i386 and arm64 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata72.html h

Re: ix(4): LRO forwarding

2023-05-24 Thread Alexander Bluhm
On Tue, May 23, 2023 at 02:14:57PM +0200, Jan Klemkow wrote: > Hi, > > This diff sets needed offloading flags and the calculated mss to LRO > mbufs in ix(4). Thus, we can forward this packets and process them via > tcp_if_output_tso(). This diff also uses tcp_if_output_tso() in > ip6_forward().

syn cache tcp checksum

2023-05-22 Thread Alexander Bluhm
Hi, I noticed a missing checksum count in netstat tcp packets sent software-checksummed. Turns out that our syn cache does the checksum calculation by hand, instead of the established mechanism in ip output. Just set the flag M_TCP_CSUM_OUT and let in_proto_cksum_out() do the work later. While

Re: Fix wrong interface mtu in tcp_mss

2023-05-21 Thread Alexander Bluhm
On Sat, May 20, 2023 at 02:46:27PM +0200, Claudio Jeker wrote: > On Fri, May 19, 2023 at 07:58:47PM +0200, Jan Klemkow wrote: > > Hi, > > > > We use the wrong interface and mtu in tcp_mss() to calculate the mss if > > the destination address points is a local address. In ip_output() we > > use th

tcp tso loopback checksum

2023-05-21 Thread Alexander Bluhm
Hi, When sending TCP packets with software TSO to the local address of a physical interface, the TCP checksum was miscalculated. This bug was triggered on loopback interface, when sending to the local interface address of a physical interface. Due to another bug, the smaller MTU of the physical

  1   2   3   4   5   6   7   8   9   10   >