On Tue, Dec 02, 2025 at 02:43:23PM +0100, Claudio Jeker wrote: > On Tue, Dec 02, 2025 at 03:52:11PM +0300, Alexander Mukhin wrote: > > >Synopsis: ldpd dumps core on exit > > >Category: user > > >Environment: > > System : OpenBSD 7.8 > > Details : OpenBSD 7.8 (GENERIC) #54: Sun Oct 12 12:45:58 MDT 2025 > > > > [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC > > > > Architecture: OpenBSD.amd64 > > Machine : amd64 > > >Description: > > ldpd dumps core on exit > > >How-To-Repeat: > > # cat ldpd.conf > > address-family ipv4 { > > interface vio1 > > } > > # ldpd -d -v -f ldpd.conf > > startup > > <...> > > ^C > > <...> > > Segmentation fault (core dumped) > > >Fix: > > In ldpd_shutdown() call kr_shutdown() before closing pipes > > to children. > > > > How about this diff instead? This should prevent kr_shutdown() from > sending imsgs. Which is the reason of the fault. > > -- > :wq Claudio > > > Index: kroute.c > =================================================================== > RCS file: /cvs/src/usr.sbin/ldpd/kroute.c,v > diff -u -p -r1.71 kroute.c > --- kroute.c 8 Mar 2023 04:43:13 -0000 1.71 > +++ kroute.c 2 Dec 2025 13:42:00 -0000 > @@ -103,7 +103,7 @@ static void kroute_clear(void); > static __inline int kif_compare(struct kif_node *, struct kif_node *); > static struct kif_node *kif_find(unsigned short); > static struct kif_node *kif_insert(unsigned short); > -static int kif_remove(struct kif_node *); > +static int kif_remove(struct kif_node *, int); > static struct kif_node *kif_update(unsigned short, int, struct if_data > *, > struct sockaddr_dl *, int *); > static struct kroute_priority *kroute_match(int, union ldpd_addr *); > @@ -769,7 +769,6 @@ kroute_clear(void) > while ((kp = RB_MIN(kroute_tree, &krt)) != NULL) { > while ((kprio = TAILQ_FIRST(&kp->priorities)) != NULL) { > while ((kn = TAILQ_FIRST(&kprio->nexthops)) != NULL) { > - kr_redist_remove(&kn->r); > kroute_uninstall(kn); > TAILQ_REMOVE(&kprio->nexthops, kn, entry); > free(kn); > @@ -830,7 +829,7 @@ kif_insert(unsigned short ifindex) > } > > static int > -kif_remove(struct kif_node *kif) > +kif_remove(struct kif_node *kif, int notify) > { > struct kif_addr *ka; > > @@ -840,7 +839,9 @@ kif_remove(struct kif_node *kif) > } > > while ((ka = TAILQ_FIRST(&kif->addrs)) != NULL) { > - main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka->a, sizeof(ka->a)); > + if (notify) > + main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka->a, > + sizeof(ka->a)); > TAILQ_REMOVE(&kif->addrs, ka, entry); > free(ka); > } > @@ -854,7 +855,7 @@ kif_clear(void) > struct kif_node *kif; > > while ((kif = RB_MIN(kif_tree, &kit)) != NULL) > - kif_remove(kif); > + kif_remove(kif, 0); > } > > static struct kif_node * > @@ -1152,7 +1153,7 @@ if_announce(void *msg) > case IFAN_DEPARTURE: > kif = kif_find(ifan->ifan_index); > if (kif) > - kif_remove(kif); > + kif_remove(kif, 1); > break; > } > }
Claudio, yes, this patch solves the problem. Thank you! -- Alexander.
