bgpd: cleanup optparamlen handling in session_open

2023-10-27 Thread Claudio Jeker
a fair amount of conditions to cover now. -- :wq Claudio Index: session.c === RCS file: /cvs/src/usr.sbin/bgpd/session.c,v retrieving revision 1.452 diff -u -p -r1.452 session.c --- session.c 27 Oct 2023 09:40:27 - 1.452

bgpd fix holdtime in session_open

2023-10-27 Thread Claudio Jeker
While looking for something else I noticed this error. The holdtime is written into the buffer with ibuf_add_n16() so the htons() call is done in the ibuf add call. So there is no need for the htons() when assigning holdtime. -- :wq Claudio Index: session.c

Re: ibuf free fd on close

2023-10-24 Thread Claudio Jeker
On Tue, Oct 24, 2023 at 03:50:47PM +0200, Theo Buehler wrote: > On Tue, Oct 24, 2023 at 03:01:26PM +0200, Claudio Jeker wrote: > > When I added ibuf_get_fd() the idea was to make sure that ibuf_free() will > > close any fd still on the buffer. This way even if a fd is unexpect

ibuf free fd on close

2023-10-24 Thread Claudio Jeker
. All of this is to my knowledge fixed so there is no reason to keep the NOTYET :) With this users need to use ibuf_fd_get() to take the fd off the ibuf. Code not doing so will break because ibuf_free() will close the fd which is probably still in use somewhere else. -- :wq Claudio Index: imsg

fix an error in flowspec_get_addr()

2023-10-23 Thread Claudio Jeker
later in the code. This should fix: https://github.com/openbgpd-portable/openbgpd-portable/security/code-scanning/2 -- :wq Claudio Index: flowspec.c === RCS file: /cvs/src/usr.sbin/bgpd/flowspec.c,v retrieving revision 1.4 diff -u -p

Re: 7.3: Squid 6.3 with multiple workers - net.unix.dgram.sendspace too low

2023-10-19 Thread Claudio Jeker
ed to be limited. >From the man-page: A SOCK_DGRAM socket supports datagrams (connectionless, unreliable messages of a fixed (typically small) maximum length). The program should set the socket buffer size via setsockopt() using SO_SNDBUF. It seems squid just YOLOs this and hopes for the best. So the best way to fix this is in squid itself. -- :wq Claudio

Re: bgpd convert rtr_proto.c to new ibuf API

2023-10-19 Thread Claudio Jeker
On Thu, Oct 19, 2023 at 12:59:17PM +0200, Theo Buehler wrote: > On Thu, Oct 19, 2023 at 10:41:07AM +0200, Claudio Jeker wrote: > > More ibuf cleanup. rtr_proto.c still uses ibuf_add() where it could use > > the new functions. > > > > Two bits I'm unsure about: &

bgpd convert rtr_proto.c to new ibuf API

2023-10-19 Thread Claudio Jeker
ld be impossible but still maybe it would be better to check for errors. -- :wq Claudio Index: rtr_proto.c === RCS file: /cvs/src/usr.sbin/bgpd/rtr_proto.c,v retrieving revision 1.17 diff -u -p -r1.17 rtr_proto.c --- rtr_proto.c 16 Aug

bgpd session.c convert to new ibuf API

2023-10-18 Thread Claudio Jeker
This is a bit overdue. Convert session.c to also use the new ibuf API. This simplifies some code since there is no need for local variables. Also kill the struct msg_header and especially msg_open. The are of very little use. Regress passes so I think this should be fine :) -- :wq Claudio Index

Re: log.c use buffered IO

2023-10-18 Thread Claudio Jeker
On Tue, Oct 17, 2023 at 10:06:54AM +0200, Sebastian Benoit wrote: > Theo Buehler(t...@theobuehler.org) on 2023.10.17 09:13:15 +0200: > > On Mon, Oct 16, 2023 at 12:19:17PM +0200, Claudio Jeker wrote: > > > I dislike how log.c does all these asprintf() calls with dubious > &g

bgpd cleanup around mask2prefixlen

2023-10-17 Thread Claudio Jeker
would at least have sin_len == 4 but on OpenBSD even that no longer happens. Last check for RTF_HOST first, then for sa_in != NULL. If RTF_HOST is set the netmask is irrelevant. -- :wq Claudio Index: kroute.c === RCS file: /cvs/src

log.c use buffered IO

2023-10-16 Thread Claudio Jeker
R, "%s: %s", fmtbuf, strerror(saved_errno)); Any opinions? -- :wq Claudio Index: log.c === RCS file: /cvs/src/usr.sbin/bgpd/log.c,v retrieving revision 1.64 diff -u -p -r1.64 log.c --- log.c 21 Mar 2017 12:06:55 -

Re: Improve IPv6 link-local support in bgpd

2023-10-16 Thread Claudio Jeker
On Mon, Oct 16, 2023 at 09:23:12AM +0200, Claudio Jeker wrote: > This diff fixes a few more things when establishing connections with > link-local IPv6 addresses. In get_alternate_addr() the interface scope > of the connection is recovered and then passed to the RDE. The RDE can > t

Improve IPv6 link-local support in bgpd

2023-10-16 Thread Claudio Jeker
follow soon. -- :wq Claudio Index: bgpd.h === RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v retrieving revision 1.477 diff -u -p -r1.477 bgpd.h --- bgpd.h 30 Aug 2023 08:16:28 - 1.477 +++ bgpd.h 9 Oct 2023 13:50:36 -

Re: l2vpn pseudowire and bridge type interface

2023-10-14 Thread Claudio Jeker
it but I think mpw(4) should work with veb(4) just fine. -- :wq Claudio

Re: bgpd, fix log_peer_info() and friends

2023-10-14 Thread Claudio Jeker
On Fri, Oct 13, 2023 at 07:16:13PM +0200, Theo Buehler wrote: > On Fri, Oct 13, 2023 at 07:01:06PM +0200, Claudio Jeker wrote: > > Extending the format string with the peer info is a bad idea. > > The reason is DNS^WIPv6 and scoped addresses which add a % to the > > string ret

bgpd, fix log_peer_info() and friends

2023-10-13 Thread Claudio Jeker
Extending the format string with the peer info is a bad idea. The reason is DNS^WIPv6 and scoped addresses which add a % to the string returned by log_fmt_peer. So instead vasprintf() the emsg and then just use logit(). -- :wq Claudio Index: logmsg.c

OpenBGPD 8.3 released

2023-10-13 Thread Claudio Jeker
We have released OpenBGPD 8.3, which will be arriving in the OpenBGPD directory of your local OpenBSD mirror soon. This release includes the following changes to the previous release: * bgpd 8.1 and 8.2 could send a bad COMMUNITY attribute when non-transitive ext-communities are present

bgpd: announce add-path send all can hit a fatal error

2023-10-12 Thread Claudio Jeker
nctions don't have this issue since they use prefix_best() to get new and that already calls prefix_eligible(). -- :wq Claudio Index: rde_decide.c === RCS file: /cvs/src/usr.sbin/bgpd/rde_decide.c,v retrieving revision 1.101

bgpd: fix handling of non-transitive ext communities

2023-10-10 Thread Claudio Jeker
ommunities can walk over their respective end of the list into the COMMUNITY_TYPE_EXT communities (if the non-transitive ext-comm is the first ext-community). The fix is to move the non_transitive_ext_community() check into if ((uint8_t)cp->flags == t) { } block. Since then we know the type is

Re: wg destroy hangs

2023-10-08 Thread Claudio Jeker
(ifq_len(_ifq) == 0) > -#define ifq_set_maxlen(_ifq, _l)((_ifq)->ifq_maxlen = (_l)) > +#define ifq_len(_ifq)READ_ONCE((_ifq)->ifq_len) > +#define ifq_empty(_ifq) (ifq_len(_ifq) == 0) > > static inline int > ifq_is_priq(struct ifqueue *ifq) > @@ -490,8 +490,8 @@ intifiq_input(struct ifiqueue *, stru > int ifiq_enqueue(struct ifiqueue *, struct mbuf *); > void ifiq_add_data(struct ifiqueue *, struct if_data *); > > -#define ifiq_len(_ifiq) ml_len(&(_ifiq)->ifiq_ml) > -#define ifiq_empty(_ifiq) ml_empty(&(_ifiq)->ifiq_ml) > +#define ifiq_len(_ifiq) READ_ONCE(ml_len(&(_ifiq)->ifiq_ml)) > +#define ifiq_empty(_ifiq)(ifiq_len(_ifiq) == 0) > > #endif /* _KERNEL */ > > -- :wq Claudio

OpenBGPD 8.2 released

2023-10-02 Thread Claudio Jeker
We have released OpenBGPD 8.2, which will be arriving in the OpenBGPD directory of your local OpenBSD mirror soon. This release includes the following changes to the previous release: * Update ASPA support to follow draft-ietf-sidrops-aspa-verification-16 and draft-ietf-sidrops-aspa-pro

Re: vscsi(4): make `vscsi_filtops' mpsafe

2023-09-28 Thread Claudio Jeker
nt event = 0; > + > + return (!TAILQ_EMPTY(&sc->sc_ccb_i2t)); > +} > + > +int > +filt_vscsimodify(struct kevent *kev, struct knote *kn) > +{ > + struct vscsi_softc *sc = kn->kn_hook; > + int active; > + > + mtx_enter(&sc->sc_state_mtx); > + active = knote_modify(kev, kn); > + mtx_leave(&sc->sc_state_mtx); > + > + return (active); > +} > + > +int > +filt_vscsiprocess(struct knote *kn, struct kevent *kev) > +{ > + struct vscsi_softc *sc = kn->kn_hook; > + int active; > > mtx_enter(&sc->sc_state_mtx); > - if (!TAILQ_EMPTY(&sc->sc_ccb_i2t)) > - event = 1; > + active = knote_process(kn, kev); > mtx_leave(&sc->sc_state_mtx); > > - return (event); > + return (active); > } > > int > -- :wq Claudio

adjust example bgpd.conf GRACEFUL_SHUTDOWN rule

2023-09-27 Thread Claudio Jeker
apply the rule to ebgp peers. Btw. RFC8326 mentions explicitly that GRACEFUL_SHUTDOWN should only be applied for eBGP sessions. -- :wq Claudio Index: etc/examples/bgpd.conf === RCS file: /cvs/src/etc/examples/bgpd.conf,v retrieving

Re: rpki-client: refactor sbgp_assysnum() and sbgp_ipaddrblk()

2023-09-25 Thread Claudio Jeker
On Mon, Sep 25, 2023 at 05:02:06PM +0200, Theo Buehler wrote: > On Mon, Sep 25, 2023 at 04:43:31PM +0200, Claudio Jeker wrote: > > On Mon, Sep 25, 2023 at 04:38:48PM +0200, Theo Buehler wrote: > > > On Mon, Sep 25, 2023 at 02:47:37PM +0200, Claudio Jeker wrote: > > > &

Re: rpki-client: refactor sbgp_assysnum() and sbgp_ipaddrblk()

2023-09-25 Thread Claudio Jeker
On Mon, Sep 25, 2023 at 04:38:48PM +0200, Theo Buehler wrote: > On Mon, Sep 25, 2023 at 02:47:37PM +0200, Claudio Jeker wrote: > > On Sat, Sep 23, 2023 at 01:23:34PM +0200, Theo Buehler wrote: > > > This is a second chunk split out of the diff mentioned in my previous > >

Re: rpki-client: refactor sbgp_assysnum() and sbgp_ipaddrblk()

2023-09-25 Thread Claudio Jeker
if ((asidentifiers = X509V3_EXT_d2i(ext)) == NULL) { > + warnx("%s: RFC 6487 section 4.8.11: autonomousSysNum: " > + "failed extension parse", p->fn); > + goto out; > + } > + > + if (!sbgp_parse_assysnum(p->fn, asidentifiers, &p->res->as, > &p->res->asz)) This line is over 80 chars. Apart from that OK. -- :wq Claudio

Re: rpki-client: pass talid to callers of cert_parse_ee_cert()

2023-09-25 Thread Claudio Jeker
d > do the check in proc_parser_* instead of cert_parse_ee_cert(). The > resulting complexity is about the same and unless there are strong > concerns or objections I'd like to do it the way below. > > Regress needs a trivial adjustment that

Re: update bsd.regress.mk(5)

2023-09-24 Thread Claudio Jeker
On Sun, Sep 24, 2023 at 04:22:30PM +0200, Theo Buehler wrote: > On Sun, Sep 24, 2023 at 03:17:11PM +0200, Claudio Jeker wrote: > > Try to document how REGRESS_LOG and REGRESS_FAIL_EARLY interact. > > We could make it fully precise with a few more words. > Done --

update bsd.regress.mk(5)

2023-09-24 Thread Claudio Jeker
Try to document how REGRESS_LOG and REGRESS_FAIL_EARLY interact. -- :wq Claudio Index: bsd.regress.mk.5 === RCS file: /cvs/src/share/man/man5/bsd.regress.mk.5,v retrieving revision 1.24 diff -u -p -r1.24 bsd.regress.mk.5

Re: scheduler_start: move static timeout structs into callback functions

2023-09-16 Thread Claudio Jeker
ing the global namespace by keeping the scheduler > - * timeouts static in this function. > - * We setup the timeout here and kick schedcpu once to make it do > - * its job. > - */ > - timeout_set(&schedcpu_to, schedcpu, &schedcpu_to); > - timeout_set(&loadavg_to, update_loadavg, &loadavg_to); > - > - schedcpu(&schedcpu_to); > - update_loadavg(&loadavg_to); > + schedcpu(NULL); > + update_loadavg(NULL); > > #ifndef SMALL_KERNEL > if (perfpolicy == PERFPOL_AUTO) -- :wq Claudio

Re: ps.1/kvm documentation

2023-09-11 Thread Claudio Jeker
KERN_PROC_SHOW_THREADS. > > The code around (dothreads) in kvm* doesn't make things really obvious. > -- :wq Claudio

Re: btop++

2023-09-04 Thread Claudio Jeker
nothing else. > How could we go about including this in OpenBSD (ports or native package)? > > (Please CC me as I'm not subscribed to the list) > > Thx, > Jos -- :wq Claudio

Re: sched_cpu_init: no need to NULL-check clockintr pointers

2023-08-31 Thread Claudio Jeker
On Thu, Aug 31, 2023 at 10:30:45AM -0500, Scott Cheloha wrote: > We don't actually need these NULL-checks, my mistake. > > sched_init_cpu() is only ever run once for a given cpu_info. > > ok? Yes please. OK claudio@ &

introduce ctl_results CTL_RES_OPNOTSUPP for portable

2023-08-30 Thread Claudio Jeker
In portable some features are disabled and requests by bgpctl should result in an error that is reasonable. For example bgpctl show fib returns "permission denied" in kroute-disabled.c which is not great. So lets have an explicit error for unavailable features in -portable. -- :

Re: __predict_{true,false} is this right?

2023-08-22 Thread Claudio Jeker
On Tue, Aug 22, 2023 at 02:33:39PM +0200, Peter J. Philipp wrote: > Hi, > > I have an outstanding bug report that I send to deraadt and claudio, in > reading the code I came across these macros: > > https://github.com/openbsd/src/blame/master/sys/sys/cdefs.h > > li

Re: EVFILT_TIMER add support for different timer precisions NOTE_{,U,N,M}SECONDS

2023-08-08 Thread Claudio Jeker
tps://github.com/sogou/workflow/blob/80b3dfbad2264bcd79ba37811c66421490e337d2/src/kernel/poller.c#L227 > > I think timerfd(2) is the superior interface here. It keeps the POSIX > interval timer semantics without all the signal delivery baggage. It > also supports multiple clocks and starting a periodic timeout from an > absolute starting time. > > So, if the goal is "add www/workflow to ports", adding timerfd(2) might > be the right thing. I don't think that this is a good move. Adding timerfd(2) will result in the need to add all those magic fd interfaces linux invents on a weekly basis. I would not go down that rabbit-hole unless there is realy realy no alternative. -- :wq Claudio

bgpd, be more carefule with shutdown reason

2023-08-04 Thread Claudio Jeker
terminate p->conf.reason. What is the preferred way? -- :wq Claudio ? obj Index: control.c === RCS file: /cvs/src/usr.sbin/bgpd/control.c,v retrieving revision 1.112 diff -u -p -r1.112 control.c --- control.c 4 Aug 2023 09:20

Re: vmd: handle EAGAIN from imsg_flush

2023-08-04 Thread Claudio Jeker
On Thu, Aug 03, 2023 at 07:01:51PM -0400, Dave Voutila wrote: > > Claudio Jeker writes: > > > On Thu, Aug 03, 2023 at 04:20:47PM -0400, Dave Voutila wrote: > >> Found this while working on some virtio stuff. My original > >> implementation as part of the multi-

Re: vmd: handle EAGAIN from imsg_flush

2023-08-03 Thread Claudio Jeker
_t reg, uint32_t *data, u > " device", __func__); > return (ret); > } > - if (imsg_flush(ibuf) == -1) { > - log_warnx("%s: imsg_flush (read)", __func__); > + do { > + ret = imsg_flush(ibuf); > + } while (ret == -1 && errno == EAGAIN); > + if (ret == -1) { > + log_warn("%s: imsg_flush (read)", __func__); > return (-1); > } > -- :wq Claudio

iked, ibuf_length vs ibuf_size

2023-08-03 Thread Claudio Jeker
buf is later allocated. (ikev2_pld.c and ikev2.c::ikev2_sa_responder()). Please double check if I did not introduce some error. -- :wq Claudio Index: ca.c === RCS file: /cvs/src/sbin/iked/ca.c,v retrieving revision 1.95 diff -u -p

Re: uvm_loadav: don't recompute schedstate_percpu.spc_nrun

2023-08-03 Thread Claudio Jeker
On Thu, Aug 03, 2023 at 10:53:24AM +0200, Claudio Jeker wrote: > On Thu, Aug 03, 2023 at 10:13:57AM +0200, Martin Pieuchot wrote: > > On 02/08/23(Wed) 14:22, Claudio Jeker wrote: > > > On Mon, Jul 31, 2023 at 10:21:11AM -0500, Scott Cheloha wrote: > > > > On Fri, Ju

Re: uvm_loadav: don't recompute schedstate_percpu.spc_nrun

2023-08-03 Thread Claudio Jeker
On Thu, Aug 03, 2023 at 10:13:57AM +0200, Martin Pieuchot wrote: > On 02/08/23(Wed) 14:22, Claudio Jeker wrote: > > On Mon, Jul 31, 2023 at 10:21:11AM -0500, Scott Cheloha wrote: > > > On Fri, Jul 28, 2023 at 07:36:41PM -0500, Scott Cheloha wrote: > > > >

Re: [v2]: uvm_meter, schedcpu: make uvm_meter() an independent timeout

2023-08-02 Thread Claudio Jeker
namelen" "void *oldp" "size_t *oldlenp" > "void *newp " "size_t newlen" "struct proc *p" > .Ft int > @@ -212,7 +212,7 @@ access, in the kernel address space. > .Pp > The > .Fn uvm_meter > -function calculates the load average and wakes up the swapper if necessary. > +timeout updates system load averages every five seconds. > .Pp > The > .Fn uvm_sysctl -- :wq Claudio

Re: uvm_loadav: don't recompute schedstate_percpu.spc_nrun

2023-08-02 Thread Claudio Jeker
On Mon, Jul 31, 2023 at 10:21:11AM -0500, Scott Cheloha wrote: > On Fri, Jul 28, 2023 at 07:36:41PM -0500, Scott Cheloha wrote: > > claudio@ notes that uvm_loadav() pointlessly walks the allproc list to > > recompute schedstate_percpu.spn_nrun for each CPU. > > > >

uvm_meter remove wakeup of swapper

2023-08-01 Thread Claudio Jeker
Now that the issue in inteldrm was resolved we can finally remove this old wakeup of the swapper. OK? -- :wq Claudio Index: uvm_meter.c === RCS file: /cvs/src/sys/uvm/uvm_meter.c,v retrieving revision 1.44 diff -u -p -r1.44

Re: uvm_meter: remove wakeup of proc0

2023-08-01 Thread Claudio Jeker
On Mon, Jul 31, 2023 at 08:31:41PM -0500, Scott Cheloha wrote: > On Mon, Jul 31, 2023 at 10:04:44PM +0200, Claudio Jeker wrote: > > On Mon, Jul 31, 2023 at 09:49:30PM +0200, Claudio Jeker wrote: > > > On Mon, Jul 31, 2023 at 08:03:41PM +0300, Vitaliy Makkoveev wrote: > >

Re: uvm_meter: remove wakeup of proc0

2023-07-31 Thread Claudio Jeker
On Mon, Jul 31, 2023 at 09:49:30PM +0200, Claudio Jeker wrote: > On Mon, Jul 31, 2023 at 08:03:41PM +0300, Vitaliy Makkoveev wrote: > > This is the culprit: > > > > schedule_timeout_uninterruptible(long timeout) > > { > > tsleep(curproc, PWAIT, "s

Re: uvm_meter: remove wakeup of proc0

2023-07-31 Thread Claudio Jeker
s a try. I think on initialization intel_dp_wait_source_oui() is called before intel_dp->last_oui_write is set and this results in a 10min timeout because our jiffies are set to ULONG_MAX - (10 * 60 * HZ); -- :wq Claudio Index: intel_dp.c === RC

Re: uvm_meter: remove wakeup of proc0

2023-07-31 Thread Claudio Jeker
tel_dp_wait_source_oui(). Which either missed the wakeup and still hit the schedule_timeout_uninterruptible() codepath or the wakeup() was issued before the tsleep(). In anycase something is not quite correct in that codepath. Will look into it. -- :wq Claudio

Re: uvm_meter: remove wakeup of proc0

2023-07-31 Thread Claudio Jeker
On Sat, Jul 29, 2023 at 03:00:59PM +0300, Vitaliy Makkoveev wrote: > On Sat, Jul 29, 2023 at 11:16:14AM +0200, Claudio Jeker wrote: > > proc0 aka the swapper does not do anything. So there is no need to wake it > > up. Now the problem is that last time this was tried some inteldrm

uvm_meter: remove wakeup of proc0

2023-07-29 Thread Claudio Jeker
so it is time to retry this. People with affected machines please give this a try. -- :wq Claudio Index: uvm/uvm_meter.c === RCS file: /cvs/src/sys/uvm/uvm_meter.c,v retrieving revision 1.44 diff -u -p -r1.44 uvm_meter.c --- uvm

iked: add print_hexbuf() to hexdump an ibuf

2023-07-28 Thread Claudio Jeker
As suggested by tb@ add print_hexbuf() to hexdump an ibuf. Use this in place where a full ibuf is dumped. In some cases print_hex() is still used because the length is not the full ibuf or an offset is used. -- :wq Claudio Index: iked.h

iked: more ibuf cleanup

2023-07-27 Thread Claudio Jeker
Use ibuf_data() instead of direct access to ibuf->buf. In some cases use ibuf_add_buf(). -- :wq Claudio Index: crypto.c === RCS file: /cvs/src/sbin/iked/crypto.c,v retrieving revision 1.44 diff -u -p -r1.44 crypto.c --- crypt

Re: inetd echo localhost

2023-07-21 Thread Claudio Jeker
:52:39 - > > @@ -444,7 +444,7 @@ dg_badinput(struct sockaddr *sa) > > if (IN_MULTICAST(in.s_addr)) > > goto bad; > > switch ((in.s_addr & 0xff00) >> 24) { > > - case 0: case 127: case 255: > > + case 0: case 255: > > goto bad; > > } > > if (dg_broadcast(&in)) > > > -- :wq Claudio

Re: bgpd: adjust ctl_neighbor usage

2023-07-20 Thread Claudio Jeker
On Thu, Jul 20, 2023 at 05:22:25PM +0200, Theo Buehler wrote: > On Thu, Jul 20, 2023 at 05:06:00PM +0200, Claudio Jeker wrote: > > I think it is better to use a safe ideom when matching against a peer name > > instead of forcefully NUL terminate the string somewhere unrelated. >

bgpd: adjust ctl_neighbor usage

2023-07-20 Thread Claudio Jeker
option would be to move neighbor->descr[PEER_DESCR_LEN - 1] = 0; into the match functions. At least then it is certainly done. -- :wq Claudio Index: control.c === RCS file: /cvs/src/usr.sbin/bgpd/control.c,v retrieving revis

bgpd, use right buffer in strlcpy

2023-07-20 Thread Claudio Jeker
Use the destination for the buffer len not the source. -- :wq Claudio Index: control.c === RCS file: /cvs/src/usr.sbin/bgpd/control.c,v retrieving revision 1.110 diff -u -p -r1.110 control.c --- control.c 20 Apr 2023 12:53:27

iked: s/ibuf_cat/ibuf_add_buf/

2023-07-18 Thread Claudio Jeker
ibuf_cat() is the same as ibuf_add_buf() so use the latter. -- :wq Claudio Index: eap.c === RCS file: /cvs/src/sbin/iked/eap.c,v retrieving revision 1.24 diff -u -p -r1.24 eap.c --- eap.c 23 May 2023 13:57:14 - 1.24

Re: vnode: drop comment, nonsensical where it is

2023-07-17 Thread Claudio Jeker
llocates its own private area and hangs > - * it from v_data. If non-null, this area is freed in getnewvnode(). > - */ > LIST_HEAD(buflists, buf); > - > RBT_HEAD(buf_rb_bufs, buf); > > struct namecache; > Yes, this comment is not helpful (especially since v_data is cleaned up by the reclaim function). OK claudio@ -- :wq Claudio

Re: vfs: drop a bunch of cast macros

2023-07-17 Thread Claudio Jeker
On Mon, Jul 17, 2023 at 11:05:03AM +0200, Sebastien Marie wrote: > On Wed, Jul 12, 2023 at 12:26:01PM +0200, thib4711 wrote: > > make it obvious in the vfsops assignment that an op isnt supported. > > I agree that it is more readable. > > ok semarie@ OK claudio@ as well. S

iked: more ibuf cleanup

2023-07-16 Thread Claudio Jeker
:wq Claudio Index: iked.h === RCS file: /cvs/src/sbin/iked/iked.h,v retrieving revision 1.220 diff -u -p -r1.220 iked.h --- iked.h 28 Jun 2023 14:10:24 - 1.220 +++ iked.h 16 Jul 2023 13:45:20 - @@ -1271,9 +127

Re: bgpd: cleanup mrt.c

2023-07-14 Thread Claudio Jeker
On Thu, Jul 13, 2023 at 11:36:22AM +0200, Theo Buehler wrote: > On Thu, Jul 13, 2023 at 10:04:33AM +0200, Claudio Jeker wrote: > > This is a follow-up to use more of the new ibuf API to write the mrt > > message. > > > > This removes all of the DUMP_XYZ ma

bgpd: cleanup mrt.c

2023-07-13 Thread Claudio Jeker
This is a follow-up to use more of the new ibuf API to write the mrt message. This removes all of the DUMP_XYZ macros and replaces them with ibuf_add_nX() calls. Also unify the error handling by using goto fail; in all cases and use a more generic log_warn() there once. -- :wq Claudio Index

OpenBGPD 8.1 released

2023-07-12 Thread Claudio Jeker
We have released OpenBGPD 8.1, which will be arriving in the OpenBGPD directory of your local OpenBSD mirror soon. This release includes the following changes to the previous release: * Include OpenBSD 7.3 errata 002: Avoid fatal errors in bgpd(8) due to incorrect refcounting and

Re: GPROF: sleep_state: disable _mcount() across suspend/resume

2023-07-09 Thread Claudio Jeker
> +} > +#endif /* SUSPEND */ > +#endif /* _KERNEL */ > + > /* > * mcount is called on entry to each function compiled with the profiling > * switch set. _mcount(), which is declared in a machine-dependent way > @@ -61,7 +87,10 @@ _MCOUNT_DECL(u_long frompc, u_long selfp >*/ > if (gmoninit == 0) > return; > - > +#ifdef SUSPEND > + if (mcount_disabled) > + return; > +#endif > if ((p = curcpu()->ci_gmon) == NULL) > return; > #else > -- :wq Claudio

Re: make mbstat smaller (was Re: make mstat smaller)

2023-07-09 Thread Claudio Jeker
> > The userland program also needed to be changed. > > ok? The code in netstat still has some more 256 bits: bool seen[256]; /* "have we seen this type yet?" */ I guess that can be fixed once this is in tree. The diff is OK cl

Re: tcp timer wrap around, use 64 bit

2023-07-07 Thread Claudio Jeker
P(tcpi, so_snd_sb_lowat, "%u") > P(tcpi, so_snd_sb_wat, "%u") > P(tcpi, ts_recent, "%u") > - P(tcpi, ts_recent_age, "%u") > + P(tcpi, ts_recent_age, "%" PRIu64) > #undef S > #undef P > } -- :wq Claudio

Re: validate vm.conf local prefixes in parser

2023-07-04 Thread Claudio Jeker
if (errstr != NULL) > + *errstr = "last eight octets must be zero"; > + return (1); > } > - } else > - prefixlen = 128; > - > - memset(&hints, 0, sizeof(hints)); > - hints.ai_family = AF_UNSPEC; > - hints.ai_flags = AI_NUMERICHOST; > - if (getaddrinfo(s, NULL, &hints, &res) == 0) { > - memset(h, 0, sizeof(*h)); > - memcpy(&h->ss, res->ai_addr, res->ai_addrlen); > - h->prefixlen = prefixlen; > - freeaddrinfo(res); > - free(s); > - return (0); > } > > - fail: > - free(s); > - return (-1); > + return (0); > } > blob - 9c25b0c92ade2e1a1d3a1f67548becfc3d4eca7b > blob + 91a8e1117f4859026db8adaa01d951ce1d9b4c11 > --- usr.sbin/vmd/vmd.h > +++ usr.sbin/vmd/vmd.h > @@ -518,7 +518,8 @@ inthost(const char *, struct address *); > /* parse.y */ > int parse_config(const char *); > int cmdline_symset(char *); > -int host(const char *, struct address *); > +int parse_prefix4(const char *, struct address *, const char **); > +int parse_prefix6(const char *, struct address *, const char **); > > /* virtio.c */ > int virtio_get_base(int, char *, size_t, int, const char *); > -- :wq Claudio

Re: ldpd: use new ibuf api

2023-07-03 Thread Claudio Jeker
On Mon, Jun 26, 2023 at 06:14:30PM +0200, Claudio Jeker wrote: > Adjust ldpd to follow the new ibuf API. > Diff is simple but as usual I could not test it out so please test. This is still open. I will commit this later today. > -- > :wq Claudio > &

eigrpd more ibuf cleanup

2023-07-03 Thread Claudio Jeker
Same change as done in other daemons, use ibuf_data() and ibuf_size(). -- :wq Claudio Index: packet.c === RCS file: /cvs/src/usr.sbin/eigrpd/packet.c,v retrieving revision 1.21 diff -u -p -r1.21 packet.c --- packet.c26 Jun 2023

ripd more ibuf cleanup

2023-07-03 Thread Claudio Jeker
Similar to the other daemons use ibuf_data() and ibuf_size() instead of direct access. -- :wq Claudio Index: message.c === RCS file: /cvs/src/usr.sbin/ripd/message.c,v retrieving revision 1.16 diff -u -p -r1.16 message.c

ospf6d ibuf cleanup

2023-07-03 Thread Claudio Jeker
Like ospfd use ibuf_data() consistently, also use ibuf_size() instead of ibuf->wpos and ibuf_left() to check if there is enough space left. -- :wq Claudio Index: lsreq.c === RCS file: /cvs/src/usr.sbin/ospf6d/lsreq.c,v retriev

ospfd more ibuf cleanup

2023-07-03 Thread Claudio Jeker
Similar to the relayd diff use ibuf_data instead of ibuf->buf. -- :wq Claudio Index: auth.c === RCS file: /cvs/src/usr.sbin/ospfd/auth.c,v retrieving revision 1.21 diff -u -p -r1.21 auth.c --- auth.c 20 Jun 2023 15:19:55 -0

more relayd ibuf cleanup

2023-07-03 Thread Claudio Jeker
This is just some additional ibuf cleanup in relayd. Mostly use ibuf_data() instead of direct access to ibuf->buf. -- :wq Claudio Index: check_tcp.c === RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v retrieving revision 1.60 d

Re: lo(4) loopback LRO and TSO

2023-07-02 Thread Claudio Jeker
On Sun, Jul 02, 2023 at 02:28:17PM +0200, Alexander Bluhm wrote: > anyone? Was not able to test yet but I like the diff. Right now this is a noop since LRO is not on by default for lo(4). Because of that OK claudio@ > On Fri, Jun 23, 2023 at 06:06:16PM +0200, Alexander Bluhm wrote:

Re: bgpd: rewrite code to send UPDATE messages

2023-06-29 Thread Claudio Jeker
On Thu, Jun 29, 2023 at 06:25:01PM +0200, Theo Buehler wrote: > On Tue, Jun 27, 2023 at 12:10:21PM +0200, Claudio Jeker wrote: > > Sorry this diff is a monster but it kind of turned into a all or nothing > > situation. > > Frankly, it's not that bad. > > > Fo

Re: rpki-client: fix aspa provider stats

2023-06-29 Thread Claudio Jeker
consistency with the other products or do we need to maintain compat for > some parsers? No, I think renaming is fine. It is just the value of the label that is changing. Now I would not use "valid" but instead "total" since we use "total" for roa and aspa as well.

relayd: fix route handling for IPv6

2023-06-29 Thread Claudio Jeker
is possible to use router blocks with IPv6 addrs. Btw. this does not work with link local addressing but I do not care about that dumpster fire. -- :wq Claudio Index: pfe_route.c === RCS file: /cvs/src/usr.sbin/relayd/pfe_route.c,v

Re: rpki-client: retire log.c

2023-06-29 Thread Claudio Jeker
On Thu, Jun 29, 2023 at 09:12:06AM +, Job Snijders wrote: > On Thu, Jun 29, 2023 at 09:30:19AM +0200, Theo Buehler wrote: > > I wrote versions of this diff several times in the past but never sent > > it out. A question by claudio encouraged me... > > > > cryptowa

Re: btrace(8) allow to store kstack in a map

2023-06-27 Thread Claudio Jeker
On Mon, Jun 26, 2023 at 08:58:47PM +, Klemens Nanni wrote: > On Mon, Jun 26, 2023 at 10:52:20PM +0200, Claudio Jeker wrote: > > count() is strange since it only works on maps (at least from what I > > figured out). I need to double check how min() and max() work. Since the >

Re: Introduce M_IFGROUP type of memory allocation

2023-06-27 Thread Claudio Jeker
On Tue, Jun 27, 2023 at 11:09:32AM +, Klemens Nanni wrote: > On Tue, Jun 27, 2023 at 01:32:37PM +0300, Vitaliy Makkoveev wrote: > > M_TEMP seems unreasonable for interface groups data allocations. > > After claudio pointed out the wrong type, I thought of the same name, >

bgpd: rewrite code to send UPDATE messages

2023-06-27 Thread Claudio Jeker
ce we call pt_writebuf() until there is no more space. community_writebuf() does maybe too much at once. As mentioned this is a major rewrite, I did run this through regress and also on a few personal systems but I'm unable to test all possible cases. Please try this out and report back. -- :

Re: btrace(8) allow to store kstack in a map

2023-06-26 Thread Claudio Jeker
On Mon, Jun 26, 2023 at 04:53:45PM +, Klemens Nanni wrote: > On Mon, Jun 26, 2023 at 05:24:53PM +0200, Claudio Jeker wrote: > > I created this simple btrace script to help find malloc(9) leaks but > > it did not work. First step was adding kstack support to the map > > imp

ldpd: use new ibuf api

2023-06-26 Thread Claudio Jeker
Adjust ldpd to follow the new ibuf API. Diff is simple but as usual I could not test it out so please test. -- :wq Claudio Index: hello.c === RCS file: /cvs/src/usr.sbin/ldpd/hello.c,v retrieving revision 1.58 diff -u -p -r1.58

btrace(8) allow to store kstack in a map

2023-06-26 Thread Claudio Jeker
@mem[arg1] = kstack } } tracepoint:uvm:free { if (arg0 == 127 && arg2 <= 64) { delete(@mem[arg1]) } } END { printf("Possible memory leaks\n"); print(@mem)

eigrpd: use new ibuf API

2023-06-26 Thread Claudio Jeker
uses eigrpd please test. -- :wq Claudio Index: packet.c === RCS file: /cvs/src/usr.sbin/eigrpd/packet.c,v retrieving revision 1.20 diff -u -p -r1.20 packet.c --- packet.c19 Jan 2021 11:49:26 - 1.20 +++ packet.c26 Jun

ldapd better bufferevent error callback

2023-06-26 Thread Claudio Jeker
Noticed this since an ldapd ran out of memory and the error printed by the callback is just not helpful. So lets try to improve this. I think errno is not clobbered so log_warn() should work and then also add an indication if it is read or write. -- :wq Claudio Index: conn.c

dvrmpd refactor and ibuf API updates

2023-06-22 Thread Claudio Jeker
Here is a diff to refactor and update dvrmpd to use the new ibuf API. Instead of doing the checksum calculations in various places do it in send_packet() as a central place. Could people using dvrmpd test this diff, thanks -- :wq Claudio Index: ask_nbrs2.c

Re: update ripd to use new ibuf API

2023-06-22 Thread Claudio Jeker
On Thu, Jun 22, 2023 at 11:15:31AM +0200, Theo Buehler wrote: > On Thu, Jun 22, 2023 at 10:26:29AM +0200, Claudio Jeker wrote: > > Another ibuf_seek() -> ibuf_set_n16() conversions. > > While there also switch to ibuf_data() and ibuf_size(). > > Reads fine. ok. a test woul

update ripd to use new ibuf API

2023-06-22 Thread Claudio Jeker
Another ibuf_seek() -> ibuf_set_n16() conversions. While there also switch to ibuf_data() and ibuf_size(). Anyone still uses ripd that can test this? -- :wq Claudio Index: auth.c === RCS file: /cvs/src/usr.sbin/ripd/auth.

Re: [s...@spacehopper.org: ospf6d fib reload [Re: bgpd fix for possible crash in SE]]

2023-06-21 Thread Claudio Jeker
/* > + * We lost some routing packets. Schedule a reload > + * of the kernel route/interface information. > + */ > + if (kr_state.reload_state == KR_RELOAD_IDLE) { > + delay = KR_RELOAD_TIMER; > + log_info("desync; scheduling fib reload"); > + } else { > + delay = KR_RELOAD_HOLD_TIMER; > + log_debug("desync during KR_RELOAD_%s", > + kr_state.reload_state == > + KR_RELOAD_FETCH ? "FETCH" : "HOLD"); > + } > + kr_state.reload_state = KR_RELOAD_FETCH; > + kr_fib_reload_arm_timer(delay); > break; > default: > /* ignore for now */ As said above everything else is OK. -- :wq Claudio

Re: ospfd use new ibuf functions

2023-06-20 Thread Claudio Jeker
On Tue, Jun 20, 2023 at 02:47:41PM +0200, Claudio Jeker wrote: > This diff updates ospfd to use the new ibuf API. > > It mainly removes the use of ibuf_seek() and replaces these calls with > ibuf_set(). > > Regress still passes with this diff in. Here the same diff for ospf6

Re: more relayd cleanup

2023-06-20 Thread Claudio Jeker
On Tue, Jun 20, 2023 at 03:35:11PM +0200, Theo Buehler wrote: > On Tue, Jun 20, 2023 at 02:17:06PM +0200, Claudio Jeker wrote: > > Ok, this went overboard. I just wanted to clean up a bit more in > > check_tcp.c but noticed check_send_expect and CHECK_BINSEND_EXPECT. > > >

Re: uvm_meter: improve periodic execution logic for uvm_loadav()

2023-06-20 Thread Claudio Jeker
On Tue, Jun 20, 2023 at 10:25:02AM -0500, Scott Cheloha wrote: > On Tue, Jun 20, 2023 at 11:47:10AM +0200, Claudio Jeker wrote: > > On Mon, Jun 19, 2023 at 04:45:03PM -0500, Scott Cheloha wrote: > > > > [...] > > &

open_memstream cleanup

2023-06-20 Thread Claudio Jeker
In open_memstream() the code does a bzero() of the new memory even though recallocarray() used which does this already. In open_wmemstream() the code does the same but is still using reallocarray(). So adjust that code to be like open_memstream(). -- :wq Claudio Index: open_memstream.c

Re: ospfd use new ibuf functions

2023-06-20 Thread Claudio Jeker
On Tue, Jun 20, 2023 at 03:46:23PM +0200, Theo Buehler wrote: > On Tue, Jun 20, 2023 at 02:47:41PM +0200, Claudio Jeker wrote: > > This diff updates ospfd to use the new ibuf API. > > > > It mainly removes the use of ibuf_seek() and replaces these calls with > > ibuf_se

rpki-client use new ibuf API

2023-06-20 Thread Claudio Jeker
Use the ibuf_fd_*() API for file descriptor passing and also ibuf_set() instead of ibuf_seek(). -- :wq Claudio Index: http.c === RCS file: /cvs/src/usr.sbin/rpki-client/http.c,v retrieving revision 1.76 diff -u -p -r1.76 http.c

ospfd use new ibuf functions

2023-06-20 Thread Claudio Jeker
This diff updates ospfd to use the new ibuf API. It mainly removes the use of ibuf_seek() and replaces these calls with ibuf_set(). Regress still passes with this diff in. -- :wq Claudio Index: auth.c === RCS file: /cvs/src

more relayd cleanup

2023-06-20 Thread Claudio Jeker
noticed string2binary() and decided to write it in simpler way (copying code over from rpki-client). All in all I think this diff is improving the situation a little bit. -- :wq Claudio Index: check_tcp.c === RCS file: /cvs/src/usr.sbin

  1   2   3   4   5   6   7   8   9   10   >