Re: [External] : Re: if_etherbridge.c vs. parallel forwarding

2021-06-25 Thread Alexandr Nedvedicky
Hello David, > > during the drive to work it occurred to me that we should basically have > the same logic around whether we should insert or replace or do nothing > in both the smr and mutex critical sections. > > it at least makes the code easier to understand. i think? yes, the new

Re: [External] : Re: parallel forwarding vs. bridges

2021-06-16 Thread Alexandr Nedvedicky
Hello, re-sending the same diff updated to current if_pfsync.c. diff avoids a recursion to PF_LOCK(), which is indicated by panic stack here: > > production firewalls panicked with the pf lock trying to lock against > > itself a couple of nights ago: > > > > db_enter() at db_enter+0x5 > >

if_etherbridge.c vs. parallel forwarding

2021-06-18 Thread Alexandr Nedvedicky
Hello, skip reading if you are not interested in L2 switching combined with bluhm's diff [1], which enables parallel forwarding. Hrvoje gave it a try and soon discovered some panics. Diff below fixes a panic indicated by stack as follows: login: panic: kernel diagnostic assertion

Re: [External] : Re: parallel forwarding vs. bridges

2021-05-18 Thread Alexandr Nedvedicky
Hello, just for the record... > > in current tree the ether_input() is protected by NET_LOCK(), which is > > grabbed > > by caller as a writer. bluhm's diff changes NET_LOCK() readlock, so > > ether_input() can run concurrently. Switching NET_LOCK() to r-lock has > > implications on smr read

parallel forwarding vs. bridges

2021-05-17 Thread Alexandr Nedvedicky
Hrvoje, managed to trigger diagnostic panics with diff [1] sent by bluhm@ some time ago. The panic Hrvoje sees comes from ether_input() here: 414 415 /* 416 * Third phase: bridge processing. 417 * 418 * Give the packet to a bridge interface, ie,

Re: [External] : Re: parallel forwarding vs. bridges

2021-05-17 Thread Alexandr Nedvedicky
Hello, On Mon, May 17, 2021 at 06:59:36PM +0200, Martin Pieuchot wrote: > On 17/05/21(Mon) 16:24, Alexandr Nedvedicky wrote: > > Hrvoje, > > > > managed to trigger diagnostic panics with diff [1] sent by bluhm@ > > some time ago. The panic Hrvoje sees comes from ether_

Re: [External] : Re: parallel forwarding vs. bridges

2021-05-17 Thread Alexandr Nedvedicky
On Mon, May 17, 2021 at 08:27:12PM +0200, Martin Pieuchot wrote: > On 17/05/21(Mon) 19:52, Alexandr Nedvedicky wrote: > > [...] > > I don't mind to trade pf_lock and pf_state_lock for mutexes, however > > I see such step is kind of 'NO-OP'. We do have sufficient measure

Re: [External] : Re: parallel forwarding vs. bridges

2021-05-17 Thread Alexandr Nedvedicky
Hello, On Mon, May 17, 2021 at 08:19:37PM +0200, Alexander Bluhm wrote: > On Mon, May 17, 2021 at 04:24:15PM +0200, Alexandr Nedvedicky wrote: > > in current tree the ether_input() is protected by NET_LOCK(), which is > > grabbed > > by caller as a writer. bluhm's

Re: [External] : Re: move copyout() in DIOCGETSTATES outside of NET_LOCK() and state_lcok

2021-05-20 Thread Alexandr Nedvedicky
Hello, > > > with this diff i can't reproduce panic as before. i tried pf with > routing, veb, tpmr and bridge. > > Do you want me to test this diff with parallel diff? > I think it makes no sense to test the change around copyout() with parallel diff as mpi@ points out rwlocks don't

Re: [External] : Re: move copyout() in DIOCGETSTATES outside of NET_LOCK() and state_lcok

2021-05-20 Thread Alexandr Nedvedicky
Hello, On Thu, May 20, 2021 at 11:28:19AM +0200, Claudio Jeker wrote: > > One way to reduce the problems with copyout(9) is to use uvm_vslock() to > lock the pages. This is what sysctl does but it comes with its own set of > issues. > using uvm_vslock() did not come to my mind, when I was

Re: [External] : factor out ipv4 and ipv6 initial packet sanity checks for bridges

2021-05-31 Thread Alexandr Nedvedicky
Hello, On Mon, May 31, 2021 at 02:33:00PM +1000, David Gwynne wrote: > if you're looking at an ip header, it makes sense to do some checks to > make sure that the values and addresses make some sense. the canonical > versions of these checks are in the ipv4 and ipv6 input paths, which > makes

Re: [External] : Re: parallel forwarding vs. bridges

2021-06-05 Thread Alexandr Nedvedicky
Hello David, > > my best argument for mutexes in pf is that currently we use smr critical > sections around things like the bridge and aggr port selection, which > are very obviously read-only workloads. pf may be a largely read-only > workload, but where it is at the moment means it's not

Re: [External] : Re: parallel forwarding vs. bridges

2021-06-05 Thread Alexandr Nedvedicky
Hello David, > the scope of the pf locks likely needs reduction anyway. one of my I agree. pf_lock covers too much in PF currently. it protects, all rules, tables and fragment caches. > production firewalls panicked with the pf lock trying to lock against > itself a couple of nights

Re: [External] : Re: parallel forwarding vs. bridges

2021-06-07 Thread Alexandr Nedvedicky
Hello, On Sun, Jun 06, 2021 at 09:54:50PM +0200, Hrvoje Popovski wrote: > > > this one? yes, exactly this one. > > > ddb{5}> show panic > cpu5: kernel diagnostic assertion "rvebe == NULL" failed: file > "/sys/net/if_etherbridge.c", line 226 ebt_replace eb 0x80682e68 > nebe

Re: [External] : forwarding in parallel

2021-07-07 Thread Alexandr Nedvedicky
On Wed, Jul 07, 2021 at 01:15:00PM -0700, Chris Cappuccio wrote: > Alexandr Nedvedicky [alexandr.nedvedi...@oracle.com] wrote: > > diff --git a/sys/net/if_tpmr.c b/sys/net/if_tpmr.c > > index f6eb99f347c..4ffa5b18293 100644 > > @@ -725,10 +759,9 @@ tpmr_p_dtor(struct t

Re: [External] : forwarding in parallel

2021-07-07 Thread Alexandr Nedvedicky
Hello, On Wed, Jul 07, 2021 at 06:14:35PM +0200, Alexander Bluhm wrote: > On Wed, Jul 07, 2021 at 10:20:01AM +0200, Alexandr Nedvedicky wrote: > > we still need to agree on whether pf_test() can sleep (give up CPU), > > when processing packet. I don't mind if pf_test

Re: [External] : forwarding in parallel

2021-07-07 Thread Alexandr Nedvedicky
On Tue, Jul 06, 2021 at 11:05:47PM +0200, Alexander Bluhm wrote: > Hi, > > Thank a lot to Hrvoje Popovski for testing my diff and to sashan@ > and dlg@ for fixing all the fallout in pf and pseudo drivers. > > Are there any bugs left? I think everything has been fixed. > I've just

Re: [External] : Re: if_etherbridge.c vs. parallel forwarding

2021-06-24 Thread Alexandr Nedvedicky
Hello David, > > i think we can get away with not refcounting eb_entry structures at all. > either they're in the etherbridge map/table or they're not, and the > thing that takes them out of the map while holding the eb_lock mutex > becomes responsible for their cleanup. > > i feel like most

Re: [External] : tcp path mtu discovery max segement size

2021-06-29 Thread Alexandr Nedvedicky
Hello, > > But the functions in_rtchange() and in_pcbrtentry() do not touch > t_maxseg. So orig_maxseg is always equal to tp->t_maxseg and > tcp_output() is not called after changes in t_maxseg. this also matches my observation. > > ok? > tcp_mtudisc() looks good to me now. OK

Re: [External] : forwarding in parallel

2021-07-07 Thread Alexandr Nedvedicky
Hello, On Tue, Jul 06, 2021 at 11:05:47PM +0200, Alexander Bluhm wrote: > Hi, > > Thank a lot to Hrvoje Popovski for testing my diff and to sashan@ > and dlg@ for fixing all the fallout in pf and pseudo drivers. > > Are there any bugs left? I think everything has been fixed. > there is

move copyout() in DIOCGETSTATES outside of NET_LOCK() and state_lcok

2021-05-19 Thread Alexandr Nedvedicky
Hello, Hrvoje gave a try to experimental diff, which trades rw-locks in pf(4) for mutexes [1]. Hrvoje soon discovered machine panics, when doing 'pfctl -ss' The callstack looks as follows: panic: acquiring blockable sleep lock with spinlock or critical section held (rwlock) vmmaplk Stopped at

Re: [External] : arp mbuf queue

2021-04-26 Thread Alexandr Nedvedicky
Hello, > > > > would it make sense to have let's say > > > > mq_move2mlist(struct mbuf_queue *, struct mbuf_list *) > > This already exists, it's called mq_delist() > thanks, I've missed that when skimming through sources. > > > > This would allow as to move whole

pf_state_key_link_reverse() is prone to race on parallel forwarding

2021-04-21 Thread Alexandr Nedvedicky
Hello, people who will be running pf(4) with bluhm's diff [1], may trip one of the asserts triggered by pf_state_key_link_reverse() here: 7366 void 7367 pf_state_key_link_reverse(struct pf_state_key *sk, struct pf_state_key *skrev) 7368 { 7369 /* Note that sk and skrev may be equal,

Re: [External] : running network stack forwarding in parallel

2021-04-21 Thread Alexandr Nedvedicky
Hello, just a quick question: was pf(4) enabled while running those tests? if pf(4) was enabled while those tests were running, what rules were loaded to to pf(4)? my guess is pf(4) was not enabled when running those tests. if I remember correctly I could see performance boost by

Re: [External] : Re: running network stack forwarding in parallel

2021-04-21 Thread Alexandr Nedvedicky
Hello, > > Hi, > > > > with this diff i'm getting panic when i'm pushing traffic over that box. > > This is plain forwarding. To compile with witness ? > > > with witness > any chance to check other CPUs to see what code they are executing? I hope to be lucky enough and see thread,

Re: [External] : running network stack forwarding in parallel

2021-04-21 Thread Alexandr Nedvedicky
Hello, thanks for good news. On Wed, Apr 21, 2021 at 10:32:08PM +0200, Alexander Bluhm wrote: > On Wed, Apr 21, 2021 at 09:59:53PM +0200, Alexandr Nedvedicky wrote: > > was pf(4) enabled while running those tests? > > Yes. > > > if pf(4) was enabled while

Re: [External] : Re: running network stack forwarding in parallel

2021-04-22 Thread Alexandr Nedvedicky
Hello, On Thu, Apr 22, 2021 at 01:09:34PM +0200, Alexander Bluhm wrote: > On Thu, Apr 22, 2021 at 12:33:13PM +0200, Hrvoje Popovski wrote: > > r620-1# papnpaiancini:cc :p :op > > opooolo_llc_ac_caccahhceh_ei_eti_tieetmme_mm__amgamigacigci__cc_hccehhcekcekc:: > > k :m bmubmfubfuppflp llc pc pcuup

Re: [External] : Re: running network stack forwarding in parallel

2021-04-22 Thread Alexandr Nedvedicky
Hello, On Thu, Apr 22, 2021 at 03:08:21PM +0200, Mark Kettenis wrote: > > Date: Thu, 22 Apr 2021 14:43:24 +0200 > > From: Alexandr Nedvedicky > > > > Hello, > > > > On Thu, Apr 22, 2021 at 01:09:34PM +0200, Alexander Bluhm wrote: > > > On Thu, Apr

Re: [External] : arpcache mbuf if_output reinsert

2021-04-28 Thread Alexandr Nedvedicky
Hello, > Such a diff is below. I will test extensively towmorrow. If anyone > wants to try now, be my guest. > > Is the comment correct? I think comment is not quite right. the packet gets inserted into la->la_mq via arpresolve(), which is not protected by KERNEL_LOCK(). arpresolve()

Re: [External] : arp mbuf delist

2021-04-28 Thread Alexandr Nedvedicky
Hello, diff looks good to me, I've just found one cosmetic nit. > @@ -683,21 +685,17 @@ arpcache(struct ifnet *ifp, struct ether > > la->la_asked = 0; > la->la_refreshed = 0; > - while ((m = mq_dequeue(>la_mq)) != NULL) { > - unsigned int len; > - > -

Re: [External] : arp locking

2021-04-27 Thread Alexandr Nedvedicky
Hello, On Wed, Apr 28, 2021 at 01:49:27AM +0200, Alexander Bluhm wrote: > On Wed, Apr 28, 2021 at 12:46:31AM +0200, Alexandr Nedvedicky wrote: > > looks good in general. I have just two nits/questions. > > mvs@ has asked the same questions. > > > > struct llin

Re: [External] : arp mbuf delist

2021-04-27 Thread Alexandr Nedvedicky
Hello, On Tue, Apr 27, 2021 at 11:45:19PM +0200, Alexander Bluhm wrote: > On Sun, Apr 25, 2021 at 06:08:17PM +1000, Jonathan Matthew wrote: > > On Sun, Apr 25, 2021 at 09:44:16AM +0200, Alexandr Nedvedicky wrote: > > This already exists, it's called mq_delist() >

Re: [External] : arp locking

2021-04-27 Thread Alexandr Nedvedicky
Hello, looks good in general. I have just two nits/questions. > ok? > > bluhm > > Index: netinet/if_ether.c > === > RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/if_ether.c,v > retrieving revision 1.246 > diff -u -p -r1.246

time to add NET_ASSERT_WLOCKED()

2021-04-27 Thread Alexandr Nedvedicky
Hello, with moving towards NET_RLOCK...() shall we add an explicit assert to state caller owns netlock exclusively? I propose to introduce NET_ASSERT_WLOCKED() NET_ASSERT_WLOCKED() thanks and regards sashan 8<---8<---8<--8< diff

Re: [External] : arp mbuf delist

2021-04-28 Thread Alexandr Nedvedicky
Hello, On Wed, Apr 28, 2021 at 02:25:26AM +0200, Alexander Bluhm wrote: > On Wed, Apr 28, 2021 at 03:19:47AM +0300, Vitaliy Makkoveev wrote: > > The code not only breaks loop but also cleans the queue. Should this be > > kept? > this is a good point > In IPv6 nd6_cache_lladdr() we have

Re: [External] : arp mbuf delist

2021-04-28 Thread Alexandr Nedvedicky
On Wed, Apr 28, 2021 at 03:31:41PM +0200, Claudio Jeker wrote: > On Wed, Apr 28, 2021 at 02:56:27PM +0200, Alexandr Nedvedicky wrote: > > Hello, > > > > On Wed, Apr 28, 2021 at 02:25:26AM +0200, Alexander Bluhm wrote: > > > On Wed, Apr 28, 2021 at 03:19:47AM

Re: [External] : arpcache mbuf if_output reinsert

2021-04-28 Thread Alexandr Nedvedicky
> > This time arpcache() is only called by netisr() with both kernel and > exclusive net locks held. RTM_DELETE message processing will also call > ifp->if_rtrequest() with exclusive netlock held. > > So this while() loop within arpcache() can’t be broken by “arp -a -d”. completely agree.

Re: [External] : arpcache mbuf if_output reinsert

2021-04-28 Thread Alexandr Nedvedicky
On Thu, Apr 29, 2021 at 02:30:48AM +0300, Vitaliy Makkoveev wrote: > > > > On 29 Apr 2021, at 02:20, Alexandr Nedvedicky > > wrote: > > > > > >> > >> This time arpcache() is only called by netisr() with both kernel and > >> exclusiv

Re: [External] : arp mbuf queue

2021-04-25 Thread Alexandr Nedvedicky
Hello, I think this should go in as-is. Though I have one question/idea to share at the moment. > @@ -672,20 +666,18 @@ arpcache(struct ifnet *ifp, struct ether > > la->la_asked = 0; > la->la_refreshed = 0; > - while ((len = ml_len(>la_ml)) != 0) { > - struct mbuf

Re: [External] : Re: tell pfctl(8) route-to and reply-to accept next-hop only

2021-01-24 Thread Alexandr Nedvedicky
hello, On Fri, Jan 22, 2021 at 05:32:47PM +1000, David Gwynne wrote: > I tried this diff, and it broke the ability to use dynamic addresses. > ie, the following rules should work: > > pass in on gre52 inet proto icmp route-to (gre49:peer) > pass in on vmx0 inet proto icmp route-to (gre:peer)

Re: [External] : [ICMP] IP options lead to malformed reply

2021-03-24 Thread Alexandr Nedvedicky
Hello Dominik, thanks for reporting a bug. I'll take a look at it later today. your proposed fix re-introduces a recursion to PF, which we want to avoid, hence we let icmp_send() to dispatch outbound ICMP response to task. We really need to fix ip_send() such the output task will handle IP

Re: [External] : [ICMP] IP options lead to malformed reply

2021-03-25 Thread Alexandr Nedvedicky
Hello, > > 1) ip_insertoptions() does not update length of IP header (ip_hl) > > > > 2) ip_hl is being overridden anyway later in ip_output() called > > by ip_send_dispatch() to send ICMP error packet out. Looks > > like ip_send_dispatch() should use IP_RAWOUTPUT

Re: [External] : [ICMP] IP options lead to malformed reply

2021-03-29 Thread Alexandr Nedvedicky
Hello, On Mon, Mar 29, 2021 at 11:56:40AM +, Schreilechner, Dominik wrote: > > > > > I think the changes in ip_insertoptions() can be dropped completely, > > > because the if-statement uses ip-ip_hl, which might not be initialized. > > > > yes, you are right, I think we should rather go

Re: [External] : [ICMP] IP options lead to malformed reply

2021-03-29 Thread Alexandr Nedvedicky
Hello, > > @@ -790,6 +795,7 @@ ip_insertoptions(struct mbuf *m, struct mbuf *opt, int > > *phlen) > > memcpy(ip + 1, p->ipopt_list, optlen); > > *phlen = sizeof(struct ip) + optlen; > > ip->ip_len = htons(ntohs(ip->ip_len) + optlen); > > + ip->ip_hl += (optlen >>

Re: [External] : [ICMP] IP options lead to malformed reply

2021-03-29 Thread Alexandr Nedvedicky
Hello, On Mon, Mar 29, 2021 at 08:44:26AM +, Schreilechner, Dominik wrote: > Hi, > > > > > yes, you are right. below is updated diff I would like to commit. > > > > > > Appart from that, adding a special task seems the way to go. > > > > I think so too. Alternative way would be to

Re: [External] : [ICMP] IP options lead to malformed reply

2021-03-26 Thread Alexandr Nedvedicky
Hello, > > You missed the initialization of ipsendraw_mq. Otherwise, ICMP with and > without IP options work for me with the diff. > > I don't know how this is usually handled here and it is probably a bit > nit-picky, but I introduced a new function to remove the duplicate code > in

Re: [External] : [ICMP] IP options lead to malformed reply

2021-03-24 Thread Alexandr Nedvedicky
Hello, > We really need to fix ip_send() such the output task will handle IP options > properly. took a look at bug reported by Dominik earlier today. Looks like there are two issues: 1) ip_insertoptions() does not update length of IP header (ip_hl) 2) ip_hl is being

Re: [External] : Re: pf_state_key_link_reverse() is prone to race on parallel forwarding

2021-04-22 Thread Alexandr Nedvedicky
Hello, > > + > Can you remove one of the double empty lines? sure, updated diff is below. > > + > > + old_reverse = atomic_cas_ptr(>reverse, NULL, sk); > > + if (old_reverse != NULL) > > + KASSERT(old_reverse == sk); > > + else > > + pf_state_key_ref(sk); > > } >

Re: [External] : better use the tokeniser in the pfctl parser

2021-08-30 Thread Alexandr Nedvedicky
Hello, On Tue, Aug 31, 2021 at 02:40:57PM +1000, David Gwynne wrote: > handling the "no" option with a token, and "yes" via a string made my > eye twitch. > > ok? or is the helpful yyerror a nice feature? > I actually think it's a nice feature. below is output for current pfctl we have

Re: [External] : TCP missing window update stalls connection

2021-08-06 Thread Alexandr Nedvedicky
Hello, On Fri, Aug 06, 2021 at 12:26:10AM +0200, Alexander Bluhm wrote: > Hi, > > I have seen some stalling TCP connections while doing unidirectional > throughput tests. The sending machine is doing zero window probes, > but is not sending more data although the other machine announced > that

Re: [External] : TCP missing window update stalls connection

2021-08-11 Thread Alexandr Nedvedicky
Hello, On Mon, Aug 09, 2021 at 01:17:27PM +0200, Alexander Bluhm wrote: > On Fri, Aug 06, 2021 at 05:22:18PM +0200, Alexandr Nedvedicky wrote: > > > Although I did not obverve it, there seems to be the same problem > > > for snd_wl1 and rcv_up. For rcv_up I

Re: [External] : Re: more ipsec mbuf pointer

2021-10-24 Thread Alexandr Nedvedicky
On Sun, Oct 24, 2021 at 06:00:59PM +0200, Alexander Bluhm wrote: > On Sun, Oct 24, 2021 at 02:52:45AM +0200, Alexander Bluhm wrote: > > There are more m_pullup()s in IPsec input. Pass down the pointer > > to the mbuf. At the end it will reach ip_deliver() which expects > > a pointer to an mbuf

Re: [External] : Re: make 'set skip on ...' dynamic

2021-12-04 Thread Alexandr Nedvedicky
Hello, On Fri, Dec 03, 2021 at 03:42:09PM +0100, Claudio Jeker wrote: > > See comments below. > > > > +void > > +pfi_group_delmember(const char *group, struct ifnet *ifp) > > +{ > > + struct pfi_kif *gkif, *ikif; > > + > > + if ((gkif = pfi_kif_get(group, NULL)) == NULL || > > +

Re: [External] : Re: make 'set skip on ...' dynamic

2021-12-25 Thread Alexandr Nedvedicky
Hello, > > updated diff is attached. > > One comment below but this diff is OK claudio@ > > > thanks and > > regards > > sashan > > > > 8<---8<---8<--8< > > void > > pfi_xcommit(void) > > { > > - struct pfi_kif *p; > > + struct

Re: make 'set skip on ...' dynamic

2021-11-18 Thread Alexandr Nedvedicky
Hello, it has turned out things are bit more complicated when it comes to interface groups. diff below makes following scenario work for me. we start with etc/pf.conf as follows: # cat /etc/pf.conf set skip on lo set skip on test1 set skip on test2

Re: [External] : Stop building the kernel with -Wno-uninitialized on clang archs

2021-11-26 Thread Alexandr Nedvedicky
Hello, On Fri, Nov 26, 2021 at 04:32:59PM +1100, Jonathan Gray wrote: > Stop building the kernel with -Wno-uninitialized on clang archs. > This hides real problems like the recently fixed uninitialised memory > use in pf and igc. yes, please. I'd like to have the warning enabled. I'm

Re: [External] : Stop building the kernel with -Wno-uninitialized on clang archs

2021-11-26 Thread Alexandr Nedvedicky
Hello, On Fri, Nov 26, 2021 at 10:14:47PM +1100, Jonathan Gray wrote: > On Fri, Nov 26, 2021 at 12:04:21PM +0100, Alexandr Nedvedicky wrote: > > Hello, > > > > On Fri, Nov 26, 2021 at 04:32:59PM +1100, Jonathan Gray wrote: > > > Stop building the kernel with -Wn

Re: [External] : Re: make 'set skip on ...' dynamic

2021-11-25 Thread Alexandr Nedvedicky
Hello, thank you for taking a look at my diff. > > } > > > > - if (kif->pfik_ifp != NULL || kif->pfik_group != NULL || kif == pfi_all) > > + if (kif->pfik_ifp != NULL || kif->pfik_group != NULL ||kif == pfi_all) > > Missing space over^^^

Re: [External] : Re: make 'set skip on ...' dynamic

2021-11-26 Thread Alexandr Nedvedicky
Hello, On Fri, Nov 26, 2021 at 01:01:40PM +0100, Claudio Jeker wrote: > > One more thing to consider, I think the following test in pfi_set_flags(): > > > + if ((p->pfik_flags_new != p->pfik_flags) && > > + (p->pfik_flagrefs == 0)) > > +

make 'set skip on ...' dynamic

2021-11-16 Thread Alexandr Nedvedicky
Hello, back in Gouveia claudio@ complained 'set skip on ...' requires reloading pf.conf, when new interface appears. Diff below should fix that. the idea is to introduce yet another reference type (PFI_KIF_REF_FLAG) pfi_kif objects. PFI_KIF_REF_FLAG type keeps pfi_kif object in pf's interface

Re: make 'set skip on ...' dynamic

2021-11-16 Thread Alexandr Nedvedicky
ed from pfi_kif_get() when flags were actually same. thanks and regards sashan On Wed, Nov 17, 2021 at 03:07:04AM +0100, Alexandr Nedvedicky wrote: > Hello, > > back in Gouveia claudio@ complained 'set skip on ...' requires reloading > pf.conf, when new interface appears. Dif

Re: [External] : soqinsque(): replace 'DIAGNOSTIC' block by KASSERT(9)

2021-10-27 Thread Alexandr Nedvedicky
On Tue, Oct 26, 2021 at 11:55:23PM +0300, Vitaliy Makkoveev wrote: > Just for consistency with the rest of kern/uipc_socket2.c looks OK to me. sashan > > Index: sys/kern/uipc_socket2.c > === > RCS file:

Re: [External] : Re: forwarding in parallel ipsec workaround

2021-07-21 Thread Alexandr Nedvedicky
Hello, my statement here is just for the record. we should have a follow up discussion in a different thread, which is yet to be started (when time will come). > > > - Make ARP MP safe. Currently we need the kernel lock there or > > it crashes. This creates latency for all kind of packets.

Re: [External] : check pf rule set prio values consistently in the pf ioctl code

2022-02-14 Thread Alexandr Nedvedicky
Hello, On Tue, Feb 15, 2022 at 03:29:19PM +1000, David Gwynne wrote: > consistently means we do the check in pf_rule_copyin() so both > DIOCADDRULE and DIOCCHANGERULE have the prio values checked. this in > turn prevents invalid prio values getting set on a rule via > DIOCCHANGERULE, which in

Re: [External] : Re: in pcb table mutex

2022-03-14 Thread Alexandr Nedvedicky
Hello, On Fri, Mar 11, 2022 at 09:40:00PM +0100, Alexander Bluhm wrote: > Regress tested with witness, rebased to current, anyone? > > On Wed, Mar 02, 2022 at 07:13:09PM +0100, Alexander Bluhm wrote: > > Hi, > > > > pf_socket_lookup() calls in_pcbhashlookup() in the PCB layer. So > > to run pf

Re: [External] : ipsec acquire mutex refcount

2022-03-14 Thread Alexandr Nedvedicky
Hello, changes looks good. just few nits. I took a closer look at ipsec_delete_policy(): 667 ipsec_delete_policy(struct ipsec_policy *ipo) 668 { 669 struct ipsec_acquire *ipa; 670 struct radix_node_head *rnh; 671

Re: [External] : Use refcnt API in bpf

2022-03-16 Thread Alexandr Nedvedicky
On Wed, Mar 16, 2022 at 04:11:43PM +, Visa Hankala wrote: > Use the refcnt API in bpf. > > OK? Looks OK to me. sashan

Re: [External] : ipsec acquire mutex refcount

2022-03-17 Thread Alexandr Nedvedicky
Hello, > > > +ipsp_delete_acquire_locked(struct ipsec_acquire *ipa) > > > +{ > > > + if (timeout_del(>ipa_timeout) == 1) > > > + refcnt_rele(>ipa_refcnt); > >^^ > > can we also put ASSERT/check into this branch > > to verify we are no releasing the

Re: [External] : ipsec acquire mutex refcount

2022-03-14 Thread Alexandr Nedvedicky
Hello, On Tue, Mar 15, 2022 at 12:58:48AM +0300, Vitaliy Makkoveev wrote: > > > >I think local var `ipa` needs to be initialized to NULL > >to avoid random value/pointer when no `ipa` for given `seq` > >is found. > > > >ipsp_pending_acquire() plays the same gamble. > > #define

Re: [External] : ipsec acquire mutex refcount

2022-03-14 Thread Alexandr Nedvedicky
Hello, On Tue, Mar 15, 2022 at 12:37:00AM +0300, Vitaliy Makkoveev wrote: > Hi, > > Why do you want to initialize `ipa’ variable in > ipsp_pending_acquire() and ipsec_get_acquire()? This doesn’t > require. after looking at code with bluhm's diff applied I see this: 936 struct

simplify mutexes for pf state table in pfsync

2022-03-08 Thread Alexandr Nedvedicky
Hello, my original idea was to have a one mutex per pfsync queue. however it creates things more complicated then necessary for queues, which keep pf(4) state. hrvoje@ hit some panics in this area recently. bluhm@ and I are still looking at those issues. However there is the first change in

Re: [External] : pfsync mutex

2022-02-24 Thread Alexandr Nedvedicky
Hello, On Thu, Feb 24, 2022 at 10:42:58PM +0100, Alexander Bluhm wrote: > Hi, > > Hrvoje reported some crashes with pfsync, IPsec and parallel > forwarding. Some locks were missing around the tdb flags in pfsync. > > ok? > change looks good to me. I just have a single concern about

Re: [External] : Re: pfsync mutex

2022-02-28 Thread Alexandr Nedvedicky
Hello, > > i will still play with sasyncd setup, maybe something comes up > > > > And when I thought everything is fine.. after 2 days of hitting sasyncd > setup I've got this panic .. will stay in ddb if some other information > is needed > I think you are hitting a different issue,

Re: [External] : Re: pfsync mutex

2022-02-28 Thread Alexandr Nedvedicky
Hello, > > do you need ddb console ? if you want i can try to reproduce this panic > without isakmpd, just hitting pfsync setup? > > console might help. I won't be able to get to it before tonight/tomorrow. I think you can leave isakmpd enabled. it still might be a contributing

Re: [External] : in6_pcbnotify void

2022-03-02 Thread Alexandr Nedvedicky
On Wed, Mar 02, 2022 at 12:47:11AM +0100, Alexander Bluhm wrote: > Hi, > > The return value of in6_pcbnotify() is never used. Make it a void > function. > > ok? > given we always return 0, which is nothing, then it makes sense to return void, (which is also nothing). ok sashan2

Re: [External] : udp_sbappend() with inpcb table mutex

2022-03-21 Thread Alexandr Nedvedicky
Hello, On Mon, Mar 21, 2022 at 04:53:12PM +0100, Alexander Bluhm wrote: > Hi, > > syzkaller and witness found a bug in my pcb table mutex commit. > > https://syzkaller.appspot.com/bug?id=90a4811c99d6a2df7b252971b754612ca632894d > > For multicast and broadcast packets udp_input() traverses the

introduce pfioctl_rw

2022-03-21 Thread Alexandr Nedvedicky
Hello, there was a brief email discussion off-list between bluhm, mbuhl and me preceding diff below. Let me briefly summarize a context for tech@ here. Moritz (mbuhl) is working on a fix reported syzkaller by syzkaller [1]. In order to fix it he wants to move both locks (pf_lock and net_lock)

Re: [External] : pfioctl goto fail

2022-03-23 Thread Alexandr Nedvedicky
On Wed, Mar 23, 2022 at 03:53:21PM +0100, Alexander Bluhm wrote: > Hi, > > pfioctl() is inconsistent when to use break or goto fail. There > is a big switch and when looking at a break you need more context > to see where it jumps to. > > I would like to use goto fail consistently to leave the

Re: syzcaller pf unhandled af

2022-01-24 Thread Alexandr Nedvedicky
Hello, I'm fine with the fix. I have just small comment/nit. leaving it up to you to fix it ore leave it. > - > if (newrule->rt && !newrule->direction) { > pf_rule_free(newrule); > error = EINVAL; > @@ -3216,6

Re: [External] : pf_rollback_rules always returns 0

2022-04-07 Thread Alexandr Nedvedicky
Hello, On Thu, Apr 07, 2022 at 03:21:32PM +0200, Moritz Buhl wrote: > Hi, > > Since 2015 pf_rollback_rules always returns 0. Make it void. > > OK? looks good to me. OK sashan

pfsync(4) snapshot lists must have dedicated link element

2022-04-06 Thread Alexandr Nedvedicky
Hello, Hrvoje was testing pf(4) and pfsync(4) with parallel forwarding diff which bluhm@ has shared sometime ago. Hrvoje found a bug in my very naive implementation of 'snapshots': 1573 void 1574 pfsync_grab_snapshot(struct pfsync_snapshot *sn, struct pfsync_softc *sc) 1575 { 1576 int

Re: [External] : Re: pfsync(4) snapshot lists must have dedicated link element

2022-04-08 Thread Alexandr Nedvedicky
Hello, thank you for taking a look at it. > > I think there is a use after free in you diff. After you return > from pfsync_delete_tdb() you must not access the TDB again. > > Comments inline. > > > > > TAILQ_INIT(>sn_upd_req_list); > > - TAILQ_CONCAT(>sn_upd_req_list,

Re: vmd testers: serial console hangs fix

2023-10-16 Thread Alexandr Nedvedicky
Hello, I've applied diff to 7.3. it works I can paste to serial console, hitting tab, etc.. Everything seems to work as expected. thanks and regards sashan On Mon, Oct 09, 2023 at 10:51:05AM -0400, Dave Voutila wrote: > Looking for folks that use the serial console connection in vmd(8) and >

Re: pf log drop default rule

2023-10-15 Thread Alexandr Nedvedicky
Hello, > When I check my pflog files in WireShark, I note that WireShark displays > this in the "Info" column: > > [pass vio0/-1] > yes, this can be default rule. snippet below comes from pfattach(): 239 /* default rule should never be garbage collected */ 240

Re: pf_pull_hdr useless action pointer and fragment logic

2023-10-10 Thread Alexandr Nedvedicky
Hello, On Mon, Oct 09, 2023 at 08:07:35PM +0200, Alexander Bluhm wrote: > 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

Re: pf passes packet if limit reached

2023-10-10 Thread Alexandr Nedvedicky
On Tue, Oct 10, 2023 at 02:53:15PM +0200, Alexander Bluhm wrote: > 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:

Re: pf log drop default rule

2023-10-10 Thread Alexandr Nedvedicky
Hello, I'm fine with it. OK sashan On Wed, Oct 11, 2023 at 12:28:20AM +0200, Alexander Bluhm wrote: > 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

Re: link mbufs/inpcbs to pf_states, not pf_state_keys

2023-08-21 Thread Alexandr Nedvedicky
Hello, On Tue, Aug 22, 2023 at 12:21:59AM +0200, Alexander Bluhm wrote: > 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

Re: [External] : parallel IP forwarding

2022-04-21 Thread Alexandr Nedvedicky
On Fri, Apr 08, 2022 at 12:56:12PM +0200, Alexander Bluhm wrote: > Hi, > > I now the right time to commit the parallel forwarding diff? > > Known limitiations are: > - Hrvoje has seen a crash with both pfsync and ipsec on his production > machine. But he cannot reproduce it in his lab. > -

Re: [External] : Re: Provide memory barriers in refcnt_rele() and refcnt_finalize()

2022-04-22 Thread Alexandr Nedvedicky
Hello, I must admit I'm still kind of lost here. The email from kettenis@ with comment from linux helped a bit, but still my understanding is really blurry here. Let me share my view on the recent example from visa@. > > > > Above, thread A would need a barrier before the release. Otherwise >

Re: [External] : Re: pf igmp icmp6 multicast router alert

2022-04-22 Thread Alexandr Nedvedicky
Hello, Looks like time has come to tweak a tuning knob from paranoia towards 'get network working' I have just few nits, see below. thanks and regards sashan > > int > +pf_walk_option(struct pf_pdesc *pd, struct ip *h, int off, int end, > +u_short *reason) > +{ > + uint8_t type,

Re: [External] : pfsync debug bye-bye

2022-04-20 Thread Alexandr Nedvedicky
Hello, On Wed, Apr 20, 2022 at 06:14:37PM +0200, Alexander Bluhm wrote: > Hi, > > In pfsync there are some KASSERT hidden behind #ifdef PFSYNC_DEBUG. > That does not make sense to me. Either they are correct, then they > should actively check in production. Or they got wrong over time, > then

Re: [External] : Re: pfsync(4) snapshot lists must have dedicated link element

2022-04-20 Thread Alexandr Nedvedicky
Hello, On Wed, Apr 20, 2022 at 03:43:06PM +0200, Alexander Bluhm wrote: > On Sat, Apr 09, 2022 at 01:51:05AM +0200, Alexandr Nedvedicky wrote: > > updated diff is below. > > I am not sure what Hrvoje actually did test and what not. My > impression was, that he got a panic

Re: [External] : Re: pfsync(4) snapshot lists must have dedicated link element

2022-04-21 Thread Alexandr Nedvedicky
Hello, On Thu, Apr 21, 2022 at 02:42:45PM +0200, Alexander Bluhm wrote: > On Wed, Apr 20, 2022 at 11:22:27PM +0200, Alexandr Nedvedicky wrote: > > updated diff is below > > OK bluhm@ > > You have to merge again, as I removed #ifdef PFSYNC_DEBUG and added > a #

Re: pf_state_export panic with NET_TASKQ=6 and stuff ....

2022-05-27 Thread Alexandr Nedvedicky
Hello, On Fri, May 27, 2022 at 10:33:06AM +0200, Hrvoje Popovski wrote: > Hi all, > > I'm running firewall in production with NET_TASKQ=6 with claudio@ "use > timeout for rttimer" and bluhm@ "kernel lock in arp" diffs. > After week or so of running smoothly I've got panic. thank you for

Re: [External] : pf: remove unused include files

2022-05-18 Thread Alexandr Nedvedicky
Hello, On Tue, May 17, 2022 at 06:40:12PM +, Miod Vallat wrote: > sys/net/pf.c r1.968 added a call to m_print() #ifdef DDB in a > troublesome situation. > > Once the root cause of the problem was fixed, the DDB-specific code path > was removed in r1.970, but the added includes were kept,

Re: ip6 hbhchcheck mbuf pointer

2022-06-28 Thread Alexandr Nedvedicky
Hello, I like the idea. I would just consider to make ip6_hbhchcheck() to always free mp on error and set NULL as return value. for example here in current ip6_input_if() we may leak memory on error: 308 int 309 ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)

Re: ip6 hbhchcheck next protocol

2022-06-28 Thread Alexandr Nedvedicky
Hello, On Tue, Jun 28, 2022 at 02:39:24AM +0200, Alexander Bluhm wrote: > Hi, > > The ip6_hbhchcheck() function never reads the nxtp parameter, it > only sets its value. It is more obvious if we return the next > protocol and return IPPROTO_DONE to signal error. All IP protocol > functions do

Re: ip6 hbhchcheck mbuf pointer

2022-06-29 Thread Alexandr Nedvedicky
Hello, On Wed, Jun 29, 2022 at 02:34:02PM +0200, Alexander Bluhm wrote: > On Wed, Jun 29, 2022 at 12:42:13AM +0200, Alexandr Nedvedicky wrote: > > for example here in current ip6_input_if() we may leak memory > > on error: > > Curently we do not leak memory. We free t

potential memory leak in if_vinput()

2022-06-06 Thread Alexandr Nedvedicky
Hello, I've spotted this glitch while hunting down use after-free in 'veb' packet path. I believe the issue is rather hypothetical, there is no evidence the deemed memory leak ever occurred. Anyway I believe the if_vinput() should always consume packet by either passing it further when

<    1   2   3   4   5   6   7   >