-/* $OpenBSD: bgpd.h,v 1.325 2018/07/12 21:45:37 benno Exp $ */
+/* $OpenBSD: bgpd.h,v 1.326 2018/07/14 12:32:35 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
int ktable_exists(u_int, u_int *);
int kr_change(u_int, struct kroute_full *, u_int8_t);
int kr_delete(u_int, struct kroute_full *, u_int8_t);
-void kr_shutdown(u_int8_t);
+void kr_shutdown(u_int8_t, u_int);
void kr_fib_couple(u_int, u_int8_t);
void kr_fib_couple_all(u_int8_t);
void kr_fib_decouple(u_int, u_int8_t);
void kr_fib_decouple_all(u_int8_t);
void kr_fib_update_prio_all(u_int8_t);
-int kr_dispatch_msg(void);
+int kr_dispatch_msg(u_int rdomain);
int kr_nexthop_add(u_int32_t, struct bgpd_addr *,
struct bgpd_config *);
void kr_nexthop_delete(u_int32_t, struct bgpd_addr *,
-/* $OpenBSD: kroute.c,v 1.220 2018/07/12 21:45:37 benno Exp $ */
+/* $OpenBSD: kroute.c,v 1.221 2018/07/14 12:32:35 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
struct kif_node *kif_find(int);
int kif_insert(struct kif_node *);
-int kif_remove(struct kif_node *);
-void kif_clear(void);
+int kif_remove(struct kif_node *, u_int);
+void kif_clear(u_int);
int kif_kr_insert(struct kroute_node *);
int kif_kr_remove(struct kroute_node *);
u_int8_t mask2prefixlen(in_addr_t);
u_int8_t mask2prefixlen6(struct sockaddr_in6 *);
void get_rtaddrs(int, struct sockaddr *, struct sockaddr **);
-void if_change(u_short, int, struct if_data *);
-void if_announce(void *);
+void if_change(u_short, int, struct if_data *, u_int);
+void if_announce(void *, u_int);
int send_rtmsg(int, int, struct ktable *, struct kroute *,
u_int8_t);
int send_rt6msg(int, int, struct ktable *, struct kroute6 *,
u_int8_t);
-int dispatch_rtmsg(void);
+int dispatch_rtmsg(u_int);
int fetchtable(struct ktable *, u_int8_t);
int fetchifs(int);
int dispatch_rtmsg_addr(struct rt_msghdr *,
}
void
-kr_shutdown(u_int8_t fib_prio)
+kr_shutdown(u_int8_t fib_prio, u_int rdomain)
{
u_int i;
for (i = krt_size; i > 0; i--)
ktable_free(i - 1, fib_prio);
- kif_clear();
+ kif_clear(rdomain);
}
void
}
int
-kr_dispatch_msg(void)
+kr_dispatch_msg(u_int rdomain)
{
- return (dispatch_rtmsg());
+ return (dispatch_rtmsg(rdomain));
}
int
}
int
-kif_remove(struct kif_node *kif)
+kif_remove(struct kif_node *kif, u_int rdomain)
{
struct ktable *kt;
struct kif_kr *kkr;
return (-1);
}
- if ((kt = ktable_get(/* XXX */ 0)) == NULL)
+ if ((kt = ktable_get(rdomain)) == NULL)
goto done;
while ((kkr = LIST_FIRST(&kif->kroute_l)) != NULL) {
}
void
-kif_clear(void)
+kif_clear(u_int rdomain)
{
struct kif_node *kif;
while ((kif = RB_MIN(kif_tree, &kit)) != NULL)
- kif_remove(kif);
+ kif_remove(kif, rdomain);
}
int
}
void
-if_change(u_short ifindex, int flags, struct if_data *ifd)
+if_change(u_short ifindex, int flags, struct if_data *ifd,
+ u_int rdomain)
{
struct ktable *kt;
struct kif_node *kif;
return;
}
+ log_info("%s: ifindex %u, ifi_rdomain %u", __func__, ifindex,
+ ifd->ifi_rdomain);
+
kif->k.flags = flags;
kif->k.link_state = ifd->ifi_link_state;
kif->k.if_type = ifd->ifi_type;
kif->k.nh_reachable = reachable;
- kt = ktable_get(/* XXX */ 0);
+ kt = ktable_get(rdomain);
LIST_FOREACH(kkr, &kif->kroute_l, entry) {
if (reachable)
}
void
-if_announce(void *msg)
+if_announce(void *msg, u_int rdomain)
{
struct if_announcemsghdr *ifan;
struct kif_node *kif;
break;
case IFAN_DEPARTURE:
kif = kif_find(ifan->ifan_index);
- kif_remove(kif);
+ kif_remove(kif, rdomain);
break;
}
}
}
int
-dispatch_rtmsg(void)
+dispatch_rtmsg(u_int rdomain)
{
char buf[RT_BUF_SIZE];
ssize_t n;
rtm = (struct rt_msghdr *)next;
if (lim < next + sizeof(u_short) ||
lim < next + rtm->rtm_msglen)
- fatalx("dispatch_rtmsg: partial rtm in buffer");
+ fatalx("%s: partial rtm in buffer", __func__);
if (rtm->rtm_version != RTM_VERSION)
continue;
case RTM_IFINFO:
memcpy(&ifm, next, sizeof(ifm));
if_change(ifm.ifm_index, ifm.ifm_flags,
- &ifm.ifm_data);
+ &ifm.ifm_data, rdomain);
break;
case RTM_IFANNOUNCE:
- if_announce(next);
+ if_announce(next, rdomain);
break;
default:
/* ignore for now */