-/* $OpenBSD: bgpd.c,v 1.266 2024/09/04 13:30:10 claudio Exp $ */
+/* $OpenBSD: bgpd.c,v 1.267 2024/09/04 15:06:36 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
return (1);
}
+int
+bgpd_has_bgpnh(void)
+{
+ return ((cflags & BGPD_FLAG_NEXTHOP_BGP) != 0);
+}
+
int
control_setup(struct bgpd_config *conf)
{
-/* $OpenBSD: bgpd.h,v 1.495 2024/08/14 19:09:51 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.496 2024/09/04 15:06:36 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
int send_network(int, struct network_config *,
struct filter_set_head *);
int bgpd_oknexthop(struct kroute_full *);
+int bgpd_has_bgpnh(void);
void set_pollfd(struct pollfd *, struct imsgbuf *);
int handle_pollfd(struct pollfd *, struct imsgbuf *);
-/* $OpenBSD: kroute.c,v 1.309 2024/01/09 13:41:32 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.310 2024/09/04 15:06:36 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
else
kr->flags &= ~F_REJECT;
+ if (kr->flags & F_NEXTHOP)
+ knexthop_update(kt, kf);
+
if (send_rtmsg(RTM_CHANGE, kt, kf))
kr->flags |= F_BGPD_INSERTED;
}
else
kr6->flags &= ~F_REJECT;
+ if (kr6->flags & F_NEXTHOP)
+ knexthop_update(kt, kf);
+
if (send_rtmsg(RTM_CHANGE, kt, kf))
kr6->flags |= F_BGPD_INSERTED;
}
break;
}
- /* XXX this is wrong for nexthop validated via BGP */
- if (!(kf->flags & F_BGPD)) {
+ if (bgpd_has_bgpnh() || !(kf->flags & F_BGPD)) {
RB_FOREACH(n, knexthop_tree, KT2KNT(kt))
if (prefix_compare(&kf->prefix, &n->nexthop,
kf->prefixlen) == 0)
knexthop_validate(kt, n);
+ }
+ if (!(kf->flags & F_BGPD)) {
/* redistribute multipath routes only once */
if (!multipath)
kr_redistribute(IMSG_NETWORK_ADD, kt, kf);