Replace struct kroute_node and kroute6_node with direct versions of
authorclaudio <claudio@openbsd.org>
Thu, 23 Jun 2022 07:43:37 +0000 (07:43 +0000)
committerclaudio <claudio@openbsd.org>
Thu, 23 Jun 2022 07:43:37 +0000 (07:43 +0000)
struct kroute and kroute6.

Rename knexthop_node to knexthop as well. Mostly mechanical but fix
at least one log format string to have the correct order of arguments.

OK tb@

usr.sbin/bgpd/bgpd.h
usr.sbin/bgpd/kroute.c

index 68f9046..55cdd56 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: bgpd.h,v 1.435 2022/06/22 15:24:58 claudio Exp $ */
+/*     $OpenBSD: bgpd.h,v 1.436 2022/06/23 07:43:37 claudio Exp $ */
 
 /*
  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -656,13 +656,13 @@ enum suberr_rrefresh {
        ERR_RR_INV_LEN = 1
 };
 
-struct kroute_node;
-struct kroute6_node;
-struct knexthop_node;
+struct kroute;
+struct kroute6;
+struct knexthop;
 struct kredist_node;
-RB_HEAD(kroute_tree, kroute_node);
-RB_HEAD(kroute6_tree, kroute6_node);
-RB_HEAD(knexthop_tree, knexthop_node);
+RB_HEAD(kroute_tree, kroute);
+RB_HEAD(kroute6_tree, kroute6);
+RB_HEAD(knexthop_tree, knexthop);
 RB_HEAD(kredist_tree, kredist_node);
 
 struct ktable {
index 9ca4cfd..5d3489e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kroute.c,v 1.264 2022/06/22 15:24:58 claudio Exp $ */
+/*     $OpenBSD: kroute.c,v 1.265 2022/06/23 07:43:37 claudio Exp $ */
 
 /*
  * Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
@@ -55,41 +55,33 @@ struct {
 } kr_state;
 
 struct kroute {
-       struct in_addr  prefix;
-       struct in_addr  nexthop;
-       uint32_t        mplslabel;
-       uint16_t        flags;
-       uint16_t        labelid;
-       u_short         ifindex;
-       uint8_t         prefixlen;
-       uint8_t         priority;
+       RB_ENTRY(kroute)         entry;
+       struct kroute           *next;
+       struct in_addr           prefix;
+       struct in_addr           nexthop;
+       uint32_t                 mplslabel;
+       uint16_t                 flags;
+       uint16_t                 labelid;
+       u_short                  ifindex;
+       uint8_t                  prefixlen;
+       uint8_t                  priority;
 };
 
 struct kroute6 {
-       struct in6_addr prefix;
-       struct in6_addr nexthop;
-       uint32_t        mplslabel;
-       uint16_t        flags;
-       uint16_t        labelid;
-       u_short         ifindex;
-       uint8_t         prefixlen;
-       uint8_t         priority;
-};
-
-struct kroute_node {
-       RB_ENTRY(kroute_node)    entry;
-       struct kroute            r;
-       struct kroute_node      *next;
-};
-
-struct kroute6_node {
-       RB_ENTRY(kroute6_node)   entry;
-       struct kroute6           r;
-       struct kroute6_node     *next;
+       RB_ENTRY(kroute6)        entry;
+       struct kroute6          *next;
+       struct in6_addr          prefix;
+       struct in6_addr          nexthop;
+       uint32_t                 mplslabel;
+       uint16_t                 flags;
+       uint16_t                 labelid;
+       u_short                  ifindex;
+       uint8_t                  prefixlen;
+       uint8_t                  priority;
 };
 
-struct knexthop_node {
-       RB_ENTRY(knexthop_node)  entry;
+struct knexthop {
+       RB_ENTRY(knexthop)       entry;
        struct bgpd_addr         nexthop;
        void                    *kroute;
 };
@@ -104,12 +96,12 @@ struct kredist_node {
 
 struct kif_kr {
        LIST_ENTRY(kif_kr)       entry;
-       struct kroute_node      *kr;
+       struct kroute           *kr;
 };
 
 struct kif_kr6 {
        LIST_ENTRY(kif_kr6)      entry;
-       struct kroute6_node     *kr;
+       struct kroute6          *kr;
 };
 
 LIST_HEAD(kif_kr_head, kif_kr);
@@ -143,57 +135,50 @@ void      kr_redistribute(int, struct ktable *, struct kroute *);
 void   kr_redistribute6(int, struct ktable *, struct kroute6 *);
 struct kroute_full *kr_tofull(struct kroute *);
 struct kroute_full *kr6_tofull(struct kroute6 *);
-int    kroute_compare(struct kroute_node *, struct kroute_node *);
-int    kroute6_compare(struct kroute6_node *, struct kroute6_node *);
-int    knexthop_compare(struct knexthop_node *, struct knexthop_node *);
+int    kroute_compare(struct kroute *, struct kroute *);
+int    kroute6_compare(struct kroute6 *, struct kroute6 *);
+int    knexthop_compare(struct knexthop *, struct knexthop *);
 int    kredist_compare(struct kredist_node *, struct kredist_node *);
 int    kif_compare(struct kif_node *, struct kif_node *);
 
-struct kroute_node     *kroute_find(struct ktable *, const struct bgpd_addr *,
+struct kroute  *kroute_find(struct ktable *, const struct bgpd_addr *,
                            uint8_t, uint8_t);
-struct kroute_node     *kroute_matchgw(struct kroute_node *,
-                           struct bgpd_addr *);
-int                     kroute_insert(struct ktable *, struct kroute_node *);
-int                     kroute_remove(struct ktable *, struct kroute_node *);
-void                    kroute_clear(struct ktable *);
+struct kroute  *kroute_matchgw(struct kroute *, struct bgpd_addr *);
+int             kroute_insert(struct ktable *, struct kroute *);
+int             kroute_remove(struct ktable *, struct kroute *);
+void            kroute_clear(struct ktable *);
 
-struct kroute6_node    *kroute6_find(struct ktable *, const struct bgpd_addr *,
+struct kroute6 *kroute6_find(struct ktable *, const struct bgpd_addr *,
                            uint8_t, uint8_t);
-struct kroute6_node    *kroute6_matchgw(struct kroute6_node *,
-                           struct bgpd_addr *);
-int                     kroute6_insert(struct ktable *, struct kroute6_node *);
-int                     kroute6_remove(struct ktable *, struct kroute6_node *);
-void                    kroute6_clear(struct ktable *);
-
-struct knexthop_node   *knexthop_find(struct ktable *, struct bgpd_addr *);
-int                     knexthop_insert(struct ktable *,
-                           struct knexthop_node *);
-int                     knexthop_remove(struct ktable *,
-                           struct knexthop_node *);
-void                    knexthop_clear(struct ktable *);
-
-struct kif_node                *kif_find(int);
-int                     kif_insert(struct kif_node *);
-int                     kif_remove(struct kif_node *);
-void                    kif_clear(void);
-
-int                     kif_kr_insert(struct kroute_node *);
-int                     kif_kr_remove(struct kroute_node *);
-
-int                     kif_kr6_insert(struct kroute6_node *);
-int                     kif_kr6_remove(struct kroute6_node *);
-
-int                     kroute_validate(struct kroute *);
-int                     kroute6_validate(struct kroute6 *);
-void                    knexthop_validate(struct ktable *,
-                           struct knexthop_node *);
-void                    knexthop_track(struct ktable *, void *);
-void                    knexthop_send_update(struct knexthop_node *);
-struct kroute_node     *kroute_match(struct ktable *, struct bgpd_addr *, int);
-struct kroute6_node    *kroute6_match(struct ktable *, struct bgpd_addr *,
-                           int);
-void                    kroute_detach_nexthop(struct ktable *,
-                           struct knexthop_node *);
+struct kroute6 *kroute6_matchgw(struct kroute6 *, struct bgpd_addr *);
+int             kroute6_insert(struct ktable *, struct kroute6 *);
+int             kroute6_remove(struct ktable *, struct kroute6 *);
+void            kroute6_clear(struct ktable *);
+
+struct knexthop        *knexthop_find(struct ktable *, struct bgpd_addr *);
+int             knexthop_insert(struct ktable *, struct knexthop *);
+int             knexthop_remove(struct ktable *, struct knexthop *);
+void            knexthop_clear(struct ktable *);
+
+struct kif_node        *kif_find(int);
+int             kif_insert(struct kif_node *);
+int             kif_remove(struct kif_node *);
+void            kif_clear(void);
+
+int             kif_kr_insert(struct kroute *);
+int             kif_kr_remove(struct kroute *);
+
+int             kif_kr6_insert(struct kroute6 *);
+int             kif_kr6_remove(struct kroute6 *);
+
+int             kroute_validate(struct kroute *);
+int             kroute6_validate(struct kroute6 *);
+void            knexthop_validate(struct ktable *, struct knexthop *);
+void            knexthop_track(struct ktable *, void *);
+void            knexthop_send_update(struct knexthop *);
+struct kroute  *kroute_match(struct ktable *, struct bgpd_addr *, int);
+struct kroute6 *kroute6_match(struct ktable *, struct bgpd_addr *, int);
+void            kroute_detach_nexthop(struct ktable *, struct knexthop *);
 
 uint8_t                prefixlen_classful(in_addr_t);
 uint8_t                mask2prefixlen(in_addr_t);
@@ -214,14 +199,14 @@ int               dispatch_rtmsg_addr(struct rt_msghdr *, struct kroute_full *);
 int            kr_fib_delete(struct ktable *, struct kroute_full *, int);
 int            kr_fib_change(struct ktable *, struct kroute_full *, int, int);
 
-RB_PROTOTYPE(kroute_tree, kroute_node, entry, kroute_compare)
-RB_GENERATE(kroute_tree, kroute_node, entry, kroute_compare)
+RB_PROTOTYPE(kroute_tree, kroute, entry, kroute_compare)
+RB_GENERATE(kroute_tree, kroute, entry, kroute_compare)
 
-RB_PROTOTYPE(kroute6_tree, kroute6_node, entry, kroute6_compare)
-RB_GENERATE(kroute6_tree, kroute6_node, entry, kroute6_compare)
+RB_PROTOTYPE(kroute6_tree, kroute6, entry, kroute6_compare)
+RB_GENERATE(kroute6_tree, kroute6, entry, kroute6_compare)
 
-RB_PROTOTYPE(knexthop_tree, knexthop_node, entry, knexthop_compare)
-RB_GENERATE(knexthop_tree, knexthop_node, entry, knexthop_compare)
+RB_PROTOTYPE(knexthop_tree, knexthop, entry, knexthop_compare)
+RB_GENERATE(knexthop_tree, knexthop, entry, knexthop_compare)
 
 RB_PROTOTYPE(kredist_tree, kredist_node, entry, kredist_compare)
 RB_GENERATE(kredist_tree, kredist_node, entry, kredist_compare)
@@ -503,9 +488,9 @@ kr_change(u_int rtableid, struct kroute_full *kl)
 int
 kr4_change(struct ktable *kt, struct kroute_full *kl)
 {
-       struct kroute_node      *kr;
-       int                      action = RTM_ADD;
-       uint16_t                 labelid;
+       struct kroute   *kr;
+       int              action = RTM_ADD;
+       uint16_t         labelid;
 
        /* for blackhole and reject routes nexthop needs to be 127.0.0.1 */
        if (kl->flags & (F_BLACKHOLE|F_REJECT))
@@ -526,34 +511,34 @@ kr4_change(struct ktable *kt, struct kroute_full *kl)
                        log_warn("%s", __func__);
                        return (-1);
                }
-               kr->r.prefix.s_addr = kl->prefix.v4.s_addr;
-               kr->r.prefixlen = kl->prefixlen;
-               kr->r.nexthop.s_addr = kl->nexthop.v4.s_addr;
-               kr->r.flags = kl->flags | F_BGPD;
-               kr->r.priority = RTP_MINE;
-               kr->r.labelid = labelid;
+               kr->prefix.s_addr = kl->prefix.v4.s_addr;
+               kr->prefixlen = kl->prefixlen;
+               kr->nexthop.s_addr = kl->nexthop.v4.s_addr;
+               kr->flags = kl->flags | F_BGPD;
+               kr->priority = RTP_MINE;
+               kr->labelid = labelid;
 
                if (kroute_insert(kt, kr) == -1) {
-                       rtlabel_unref(kr->r.labelid);
+                       rtlabel_unref(kr->labelid);
                        free(kr);
                        return (-1);
                }
        } else {
-               kr->r.nexthop.s_addr = kl->nexthop.v4.s_addr;
-               rtlabel_unref(kr->r.labelid);
-               kr->r.labelid = labelid;
+               kr->nexthop.s_addr = kl->nexthop.v4.s_addr;
+               rtlabel_unref(kr->labelid);
+               kr->labelid = labelid;
                if (kl->flags & F_BLACKHOLE)
-                       kr->r.flags |= F_BLACKHOLE;
+                       kr->flags |= F_BLACKHOLE;
                else
-                       kr->r.flags &= ~F_BLACKHOLE;
+                       kr->flags &= ~F_BLACKHOLE;
                if (kl->flags & F_REJECT)
-                       kr->r.flags |= F_REJECT;
+                       kr->flags |= F_REJECT;
                else
-                       kr->r.flags &= ~F_REJECT;
+                       kr->flags &= ~F_REJECT;
        }
 
-       if (send_rtmsg(kr_state.fd, action, kt, &kr->r))
-               kr->r.flags |= F_BGPD_INSERTED;
+       if (send_rtmsg(kr_state.fd, action, kt, kr))
+               kr->flags |= F_BGPD_INSERTED;
 
        return (0);
 }
@@ -561,10 +546,10 @@ kr4_change(struct ktable *kt, struct kroute_full *kl)
 int
 kr6_change(struct ktable *kt, struct kroute_full *kl)
 {
-       struct kroute6_node     *kr6;
-       struct in6_addr          lo6 = IN6ADDR_LOOPBACK_INIT;
-       int                      action = RTM_ADD;
-       uint16_t                 labelid;
+       struct kroute6  *kr6;
+       struct in6_addr  lo6 = IN6ADDR_LOOPBACK_INIT;
+       int              action = RTM_ADD;
+       uint16_t         labelid;
 
        /* for blackhole and reject routes nexthop needs to be ::1 */
        if (kl->flags & (F_BLACKHOLE|F_REJECT))
@@ -584,36 +569,34 @@ kr6_change(struct ktable *kt, struct kroute_full *kl)
                        log_warn("%s", __func__);
                        return (-1);
                }
-               memcpy(&kr6->r.prefix, &kl->prefix.v6, sizeof(struct in6_addr));
-               kr6->r.prefixlen = kl->prefixlen;
-               memcpy(&kr6->r.nexthop, &kl->nexthop.v6,
-                   sizeof(struct in6_addr));
-               kr6->r.flags = kl->flags | F_BGPD;
-               kr6->r.priority = RTP_MINE;
-               kr6->r.labelid = labelid;
+               memcpy(&kr6->prefix, &kl->prefix.v6, sizeof(struct in6_addr));
+               kr6->prefixlen = kl->prefixlen;
+               memcpy(&kr6->nexthop, &kl->nexthop.v6, sizeof(struct in6_addr));
+               kr6->flags = kl->flags | F_BGPD;
+               kr6->priority = RTP_MINE;
+               kr6->labelid = labelid;
 
                if (kroute6_insert(kt, kr6) == -1) {
-                       rtlabel_unref(kr6->r.labelid);
+                       rtlabel_unref(kr6->labelid);
                        free(kr6);
                        return (-1);
                }
        } else {
-               memcpy(&kr6->r.nexthop, &kl->nexthop.v6,
-                   sizeof(struct in6_addr));
-               rtlabel_unref(kr6->r.labelid);
-               kr6->r.labelid = labelid;
+               memcpy(&kr6->nexthop, &kl->nexthop.v6, sizeof(struct in6_addr));
+               rtlabel_unref(kr6->labelid);
+               kr6->labelid = labelid;
                if (kl->flags & F_BLACKHOLE)
-                       kr6->r.flags |= F_BLACKHOLE;
+                       kr6->flags |= F_BLACKHOLE;
                else
-                       kr6->r.flags &= ~F_BLACKHOLE;
+                       kr6->flags &= ~F_BLACKHOLE;
                if (kl->flags & F_REJECT)
-                       kr6->r.flags |= F_REJECT;
+                       kr6->flags |= F_REJECT;
                else
-                       kr6->r.flags &= ~F_REJECT;
+                       kr6->flags &= ~F_REJECT;
        }
 
-       if (send_rt6msg(kr_state.fd, action, kt, &kr6->r))
-               kr6->r.flags |= F_BGPD_INSERTED;
+       if (send_rt6msg(kr_state.fd, action, kt, kr6))
+               kr6->flags |= F_BGPD_INSERTED;
 
        return (0);
 }
@@ -621,10 +604,10 @@ kr6_change(struct ktable *kt, struct kroute_full *kl)
 int
 krVPN4_change(struct ktable *kt, struct kroute_full *kl)
 {
-       struct kroute_node      *kr;
-       int                      action = RTM_ADD;
-       uint32_t                 mplslabel = 0;
-       uint16_t                 labelid;
+       struct kroute   *kr;
+       int              action = RTM_ADD;
+       uint32_t         mplslabel = 0;
+       uint16_t         labelid;
 
        /* nexthop within 127/8 -> ignore silently */
        if ((kl->nexthop.v4.s_addr & htonl(IN_CLASSA_NET)) ==
@@ -657,49 +640,49 @@ krVPN4_change(struct ktable *kt, struct kroute_full *kl)
                        log_warn("%s", __func__);
                        return (-1);
                }
-               kr->r.prefix.s_addr = kl->prefix.v4.s_addr;
-               kr->r.prefixlen = kl->prefixlen;
-               kr->r.nexthop.s_addr = kl->nexthop.v4.s_addr;
-               kr->r.flags = kl->flags | F_BGPD | F_MPLS;
-               kr->r.priority = RTP_MINE;
-               kr->r.labelid = labelid;
-               kr->r.mplslabel = mplslabel;
-               kr->r.ifindex = kl->ifindex;
+               kr->prefix.s_addr = kl->prefix.v4.s_addr;
+               kr->prefixlen = kl->prefixlen;
+               kr->nexthop.s_addr = kl->nexthop.v4.s_addr;
+               kr->flags = kl->flags | F_BGPD | F_MPLS;
+               kr->priority = RTP_MINE;
+               kr->labelid = labelid;
+               kr->mplslabel = mplslabel;
+               kr->ifindex = kl->ifindex;
 
                if (kroute_insert(kt, kr) == -1) {
-                       rtlabel_unref(kr->r.labelid);
+                       rtlabel_unref(kr->labelid);
                        free(kr);
                        return (-1);
                }
        } else {
-               kr->r.mplslabel = mplslabel;
-               kr->r.ifindex = kl->ifindex;
-               kr->r.nexthop.s_addr = kl->nexthop.v4.s_addr;
-               rtlabel_unref(kr->r.labelid);
-               kr->r.labelid = labelid;
+               kr->mplslabel = mplslabel;
+               kr->ifindex = kl->ifindex;
+               kr->nexthop.s_addr = kl->nexthop.v4.s_addr;
+               rtlabel_unref(kr->labelid);
+               kr->labelid = labelid;
                if (kl->flags & F_BLACKHOLE)
-                       kr->r.flags |= F_BLACKHOLE;
+                       kr->flags |= F_BLACKHOLE;
                else
-                       kr->r.flags &= ~F_BLACKHOLE;
+                       kr->flags &= ~F_BLACKHOLE;
                if (kl->flags & F_REJECT)
-                       kr->r.flags |= F_REJECT;
+                       kr->flags |= F_REJECT;
                else
-                       kr->r.flags &= ~F_REJECT;
+                       kr->flags &= ~F_REJECT;
        }
 
-       if (send_rtmsg(kr_state.fd, action, kt, &kr->r))
-               kr->r.flags |= F_BGPD_INSERTED;
+       if (send_rtmsg(kr_state.fd, action, kt, kr))
+               kr->flags |= F_BGPD_INSERTED;
        return (0);
 }
 
 int
 krVPN6_change(struct ktable *kt, struct kroute_full *kl)
 {
-       struct kroute6_node     *kr6;
-       struct in6_addr          lo6 = IN6ADDR_LOOPBACK_INIT;
-       int                      action = RTM_ADD;
-       uint32_t                 mplslabel = 0;
-       uint16_t                 labelid;
+       struct kroute6  *kr6;
+       struct in6_addr  lo6 = IN6ADDR_LOOPBACK_INIT;
+       int              action = RTM_ADD;
+       uint32_t         mplslabel = 0;
+       uint16_t         labelid;
 
        /* nexthop to loopback -> ignore silently */
        if (IN6_IS_ADDR_LOOPBACK(&kl->nexthop.v6))
@@ -731,40 +714,38 @@ krVPN6_change(struct ktable *kt, struct kroute_full *kl)
                        log_warn("%s", __func__);
                        return (-1);
                }
-               memcpy(&kr6->r.prefix, &kl->prefix.v6, sizeof(struct in6_addr));
-               kr6->r.prefixlen = kl->prefixlen;
-               memcpy(&kr6->r.nexthop, &kl->nexthop.v6,
-                   sizeof(struct in6_addr));
-               kr6->r.flags = kl->flags | F_BGPD | F_MPLS;
-               kr6->r.priority = RTP_MINE;
-               kr6->r.labelid = labelid;
-               kr6->r.mplslabel = mplslabel;
-               kr6->r.ifindex = kl->ifindex;
+               memcpy(&kr6->prefix, &kl->prefix.v6, sizeof(struct in6_addr));
+               kr6->prefixlen = kl->prefixlen;
+               memcpy(&kr6->nexthop, &kl->nexthop.v6, sizeof(struct in6_addr));
+               kr6->flags = kl->flags | F_BGPD | F_MPLS;
+               kr6->priority = RTP_MINE;
+               kr6->labelid = labelid;
+               kr6->mplslabel = mplslabel;
+               kr6->ifindex = kl->ifindex;
 
                if (kroute6_insert(kt, kr6) == -1) {
-                       rtlabel_unref(kr6->r.labelid);
+                       rtlabel_unref(kr6->labelid);
                        free(kr6);
                        return (-1);
                }
        } else {
-               kr6->r.mplslabel = mplslabel;
-               kr6->r.ifindex = kl->ifindex;
-               memcpy(&kr6->r.nexthop, &kl->nexthop.v6,
-                   sizeof(struct in6_addr));
-               rtlabel_unref(kr6->r.labelid);
-               kr6->r.labelid = labelid;
+               kr6->mplslabel = mplslabel;
+               kr6->ifindex = kl->ifindex;
+               memcpy(&kr6->nexthop, &kl->nexthop.v6, sizeof(struct in6_addr));
+               rtlabel_unref(kr6->labelid);
+               kr6->labelid = labelid;
                if (kl->flags & F_BLACKHOLE)
-                       kr6->r.flags |= F_BLACKHOLE;
+                       kr6->flags |= F_BLACKHOLE;
                else
-                       kr6->r.flags &= ~F_BLACKHOLE;
+                       kr6->flags &= ~F_BLACKHOLE;
                if (kl->flags & F_REJECT)
-                       kr6->r.flags |= F_REJECT;
+                       kr6->flags |= F_REJECT;
                else
-                       kr6->r.flags &= ~F_REJECT;
+                       kr6->flags &= ~F_REJECT;
        }
 
-       if (send_rt6msg(kr_state.fd, action, kt, &kr6->r))
-               kr6->r.flags |= F_BGPD_INSERTED;
+       if (send_rt6msg(kr_state.fd, action, kt, kr6))
+               kr6->flags |= F_BGPD_INSERTED;
 
        return (0);
 }
@@ -795,26 +776,25 @@ kr_delete(u_int rtableid, struct kroute_full *kl)
 int
 kr_flush(u_int rtableid)
 {
-       struct ktable           *kt;
-       struct kroute_node      *kr, *next;
-       struct kroute6_node     *kr6, *next6;
+       struct ktable   *kt;
+       struct kroute   *kr, *next;
+       struct kroute6  *kr6, *next6;
 
        if ((kt = ktable_get(rtableid)) == NULL)
                /* too noisy during reloads, just ignore */
                return (0);
 
        RB_FOREACH_SAFE(kr, kroute_tree, &kt->krt, next)
-               if ((kr->r.flags & F_BGPD_INSERTED)) {
+               if ((kr->flags & F_BGPD_INSERTED)) {
                        if (kt->fib_sync)       /* coupled */
-                               send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r);
+                               send_rtmsg(kr_state.fd, RTM_DELETE, kt, kr);
                        if (kroute_remove(kt, kr) == -1)
                                return (-1);
                }
        RB_FOREACH_SAFE(kr6, kroute6_tree, &kt->krt6, next6)
-               if ((kr6->r.flags & F_BGPD_INSERTED)) {
+               if ((kr6->flags & F_BGPD_INSERTED)) {
                        if (kt->fib_sync)       /* coupled */
-                               send_rt6msg(kr_state.fd, RTM_DELETE, kt,
-                                   &kr6->r);
+                               send_rt6msg(kr_state.fd, RTM_DELETE, kt, kr6);
                        if (kroute6_remove(kt, kr6) == -1)
                                return (-1);
                }
@@ -826,16 +806,16 @@ kr_flush(u_int rtableid)
 int
 kr4_delete(struct ktable *kt, struct kroute_full *kl)
 {
-       struct kroute_node      *kr;
+       struct kroute   *kr;
 
        if ((kr = kroute_find(kt, &kl->prefix, kl->prefixlen,
            RTP_MINE)) == NULL)
                return (0);
 
-       if (!(kr->r.flags & F_BGPD_INSERTED))
+       if (!(kr->flags & F_BGPD_INSERTED))
                return (0);
 
-       send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r);
+       send_rtmsg(kr_state.fd, RTM_DELETE, kt, kr);
 
        if (kroute_remove(kt, kr) == -1)
                return (-1);
@@ -846,16 +826,16 @@ kr4_delete(struct ktable *kt, struct kroute_full *kl)
 int
 kr6_delete(struct ktable *kt, struct kroute_full *kl)
 {
-       struct kroute6_node     *kr6;
+       struct kroute6  *kr6;
 
        if ((kr6 = kroute6_find(kt, &kl->prefix, kl->prefixlen,
            RTP_MINE)) == NULL)
                return (0);
 
-       if (!(kr6->r.flags & F_BGPD_INSERTED))
+       if (!(kr6->flags & F_BGPD_INSERTED))
                return (0);
 
-       send_rt6msg(kr_state.fd, RTM_DELETE, kt, &kr6->r);
+       send_rt6msg(kr_state.fd, RTM_DELETE, kt, kr6);
 
        if (kroute6_remove(kt, kr6) == -1)
                return (-1);
@@ -866,16 +846,16 @@ kr6_delete(struct ktable *kt, struct kroute_full *kl)
 int
 krVPN4_delete(struct ktable *kt, struct kroute_full *kl)
 {
-       struct kroute_node      *kr;
+       struct kroute   *kr;
 
        if ((kr = kroute_find(kt, &kl->prefix, kl->prefixlen,
            RTP_MINE)) == NULL)
                return (0);
 
-       if (!(kr->r.flags & F_BGPD_INSERTED))
+       if (!(kr->flags & F_BGPD_INSERTED))
                return (0);
 
-       send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r);
+       send_rtmsg(kr_state.fd, RTM_DELETE, kt, kr);
 
        if (kroute_remove(kt, kr) == -1)
                return (-1);
@@ -886,16 +866,16 @@ krVPN4_delete(struct ktable *kt, struct kroute_full *kl)
 int
 krVPN6_delete(struct ktable *kt, struct kroute_full *kl)
 {
-       struct kroute6_node     *kr6;
+       struct kroute6  *kr6;
 
        if ((kr6 = kroute6_find(kt, &kl->prefix, kl->prefixlen,
            RTP_MINE)) == NULL)
                return (0);
 
-       if (!(kr6->r.flags & F_BGPD_INSERTED))
+       if (!(kr6->flags & F_BGPD_INSERTED))
                return (0);
 
-       send_rt6msg(kr_state.fd, RTM_DELETE, kt, &kr6->r);
+       send_rt6msg(kr_state.fd, RTM_DELETE, kt, kr6);
 
        if (kroute6_remove(kt, kr6) == -1)
                return (-1);
@@ -917,9 +897,9 @@ kr_shutdown(void)
 void
 kr_fib_couple(u_int rtableid)
 {
-       struct ktable           *kt;
-       struct kroute_node      *kr;
-       struct kroute6_node     *kr6;
+       struct ktable   *kt;
+       struct kroute   *kr;
+       struct kroute6  *kr6;
 
        if ((kt = ktable_get(rtableid)) == NULL)  /* table does not exist */
                return;
@@ -930,14 +910,14 @@ kr_fib_couple(u_int rtableid)
        kt->fib_sync = 1;
 
        RB_FOREACH(kr, kroute_tree, &kt->krt)
-               if (kr->r.flags & F_BGPD) {
-                       if (send_rtmsg(kr_state.fd, RTM_ADD, kt, &kr->r))
-                               kr->r.flags |= F_BGPD_INSERTED;
+               if (kr->flags & F_BGPD) {
+                       if (send_rtmsg(kr_state.fd, RTM_ADD, kt, kr))
+                               kr->flags |= F_BGPD_INSERTED;
                }
        RB_FOREACH(kr6, kroute6_tree, &kt->krt6)
-               if (kr6->r.flags & F_BGPD) {
-                       if (send_rt6msg(kr_state.fd, RTM_ADD, kt, &kr6->r))
-                               kr6->r.flags |= F_BGPD_INSERTED;
+               if (kr6->flags & F_BGPD) {
+                       if (send_rt6msg(kr_state.fd, RTM_ADD, kt, kr6))
+                               kr6->flags |= F_BGPD_INSERTED;
                }
        log_info("kernel routing table %u (%s) coupled", kt->rtableid,
            kt->descr);
@@ -955,9 +935,9 @@ kr_fib_couple_all(void)
 void
 kr_fib_decouple(u_int rtableid)
 {
-       struct ktable           *kt;
-       struct kroute_node      *kr;
-       struct kroute6_node     *kr6;
+       struct ktable   *kt;
+       struct kroute   *kr;
+       struct kroute6  *kr6;
 
        if ((kt = ktable_get(rtableid)) == NULL)  /* table does not exist */
                return;
@@ -966,14 +946,14 @@ kr_fib_decouple(u_int rtableid)
                return;
 
        RB_FOREACH(kr, kroute_tree, &kt->krt)
-               if ((kr->r.flags & F_BGPD_INSERTED)) {
-                       if (send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r))
-                               kr->r.flags &= ~F_BGPD_INSERTED;
+               if ((kr->flags & F_BGPD_INSERTED)) {
+                       if (send_rtmsg(kr_state.fd, RTM_DELETE, kt, kr))
+                               kr->flags &= ~F_BGPD_INSERTED;
                }
        RB_FOREACH(kr6, kroute6_tree, &kt->krt6)
-               if ((kr6->r.flags & F_BGPD_INSERTED)) {
-                       if (send_rt6msg(kr_state.fd, RTM_DELETE, kt, &kr6->r))
-                               kr6->r.flags &= ~F_BGPD_INSERTED;
+               if ((kr6->flags & F_BGPD_INSERTED)) {
+                       if (send_rt6msg(kr_state.fd, RTM_DELETE, kt, kr6))
+                               kr6->flags &= ~F_BGPD_INSERTED;
                }
 
        kt->fib_sync = 0;
@@ -1006,8 +986,8 @@ kr_dispatch_msg(void)
 int
 kr_nexthop_add(u_int rtableid, struct bgpd_addr *addr)
 {
-       struct ktable           *kt;
-       struct knexthop_node    *h;
+       struct ktable   *kt;
+       struct knexthop *h;
 
        if ((kt = ktable_get(rtableid)) == NULL) {
                log_warnx("%s: non-existent rtableid %d", __func__, rtableid);
@@ -1033,8 +1013,8 @@ kr_nexthop_add(u_int rtableid, struct bgpd_addr *addr)
 void
 kr_nexthop_delete(u_int rtableid, struct bgpd_addr *addr)
 {
-       struct ktable           *kt;
-       struct knexthop_node    *kn;
+       struct ktable   *kt;
+       struct knexthop *kn;
 
        if ((kt = ktable_get(rtableid)) == NULL) {
                log_warnx("%s: non-existent rtableid %d", __func__,
@@ -1075,13 +1055,13 @@ void
 kr_show_route(struct imsg *imsg)
 {
        struct ktable           *kt;
-       struct kroute_node      *kr, *kn;
-       struct kroute6_node     *kr6, *kn6;
+       struct kroute           *kr, *kn;
+       struct kroute6          *kr6, *kn6;
        struct bgpd_addr        *addr;
        int                      flags;
        sa_family_t              af;
        struct ctl_show_nexthop  snh;
-       struct knexthop_node    *h;
+       struct knexthop         *h;
        struct kif_node         *kif;
        u_int                    i;
        u_short                  ifindex = 0;
@@ -1103,23 +1083,23 @@ kr_show_route(struct imsg *imsg)
                memcpy(&af, (char *)imsg->data + sizeof(flags), sizeof(af));
                if (!af || af == AF_INET)
                        RB_FOREACH(kr, kroute_tree, &kt->krt) {
-                               if (flags && (kr->r.flags & flags) == 0)
+                               if (flags && (kr->flags & flags) == 0)
                                        continue;
                                kn = kr;
                                do {
                                        send_imsg_session(IMSG_CTL_KROUTE,
-                                           imsg->hdr.pid, kr_tofull(&kn->r),
+                                           imsg->hdr.pid, kr_tofull(kn),
                                            sizeof(struct kroute_full));
                                } while ((kn = kn->next) != NULL);
                        }
                if (!af || af == AF_INET6)
                        RB_FOREACH(kr6, kroute6_tree, &kt->krt6) {
-                               if (flags && (kr6->r.flags & flags) == 0)
+                               if (flags && (kr6->flags & flags) == 0)
                                        continue;
                                kn6 = kr6;
                                do {
                                        send_imsg_session(IMSG_CTL_KROUTE,
-                                           imsg->hdr.pid, kr6_tofull(&kn6->r),
+                                           imsg->hdr.pid, kr6_tofull(kn6),
                                            sizeof(struct kroute_full));
                                } while ((kn6 = kn6->next) != NULL);
                        }
@@ -1143,14 +1123,14 @@ kr_show_route(struct imsg *imsg)
                        kr = kroute_match(kt, addr, 1);
                        if (kr != NULL)
                                send_imsg_session(IMSG_CTL_KROUTE,
-                                   imsg->hdr.pid, kr_tofull(&kr->r),
+                                   imsg->hdr.pid, kr_tofull(kr),
                                    sizeof(struct kroute_full));
                        break;
                case AID_INET6:
                        kr6 = kroute6_match(kt, addr, 1);
                        if (kr6 != NULL)
                                send_imsg_session(IMSG_CTL_KROUTE,
-                                   imsg->hdr.pid, kr6_tofull(&kr6->r),
+                                   imsg->hdr.pid, kr6_tofull(kr6),
                                    sizeof(struct kroute_full));
                        break;
                }
@@ -1169,17 +1149,17 @@ kr_show_route(struct imsg *imsg)
                                switch (h->nexthop.aid) {
                                case AID_INET:
                                        kr = h->kroute;
-                                       snh.valid = kroute_validate(&kr->r);
+                                       snh.valid = kroute_validate(kr);
                                        snh.krvalid = 1;
-                                       snh.kr = *kr_tofull(&kr->r);
-                                       ifindex = kr->r.ifindex;
+                                       snh.kr = *kr_tofull(kr);
+                                       ifindex = kr->ifindex;
                                        break;
                                case AID_INET6:
                                        kr6 = h->kroute;
-                                       snh.valid = kroute6_validate(&kr6->r);
+                                       snh.valid = kroute6_validate(kr6);
                                        snh.krvalid = 1;
-                                       snh.kr = *kr6_tofull(&kr6->r);
-                                       ifindex = kr6->r.ifindex;
+                                       snh.kr = *kr6_tofull(kr6);
+                                       ifindex = kr6->ifindex;
                                        break;
                                }
                                if ((kif = kif_find(ifindex)) != NULL)
@@ -1556,13 +1536,13 @@ ktable_postload(void)
 int
 kr_reload(void)
 {
-       struct ktable           *kt;
-       struct kroute_node      *kr;
-       struct kroute6_node     *kr6;
-       struct knexthop_node    *nh;
-       struct network          *n;
-       u_int                    rid;
-       int                      hasdyn = 0;
+       struct ktable   *kt;
+       struct kroute   *kr;
+       struct kroute6  *kr6;
+       struct knexthop *nh;
+       struct network  *n;
+       u_int            rid;
+       int              hasdyn = 0;
 
        for (rid = 0; rid < krt_size; rid++) {
                if ((kt = ktable_get(rid)) == NULL)
@@ -1583,9 +1563,9 @@ kr_reload(void)
                if (hasdyn) {
                        /* only evaluate the full tree if we need */
                        RB_FOREACH(kr, kroute_tree, &kt->krt)
-                               kr_redistribute(IMSG_NETWORK_ADD, kt, &kr->r);
+                               kr_redistribute(IMSG_NETWORK_ADD, kt, kr);
                        RB_FOREACH(kr6, kroute6_tree, &kt->krt6)
-                               kr_redistribute6(IMSG_NETWORK_ADD, kt, &kr6->r);
+                               kr_redistribute6(IMSG_NETWORK_ADD, kt, kr6);
                }
        }
 
@@ -1639,56 +1619,56 @@ kr6_tofull(struct kroute6 *kr6)
  */
 
 int
-kroute_compare(struct kroute_node *a, struct kroute_node *b)
+kroute_compare(struct kroute *a, struct kroute *b)
 {
-       if (ntohl(a->r.prefix.s_addr) < ntohl(b->r.prefix.s_addr))
+       if (ntohl(a->prefix.s_addr) < ntohl(b->prefix.s_addr))
                return (-1);
-       if (ntohl(a->r.prefix.s_addr) > ntohl(b->r.prefix.s_addr))
+       if (ntohl(a->prefix.s_addr) > ntohl(b->prefix.s_addr))
                return (1);
-       if (a->r.prefixlen < b->r.prefixlen)
+       if (a->prefixlen < b->prefixlen)
                return (-1);
-       if (a->r.prefixlen > b->r.prefixlen)
+       if (a->prefixlen > b->prefixlen)
                return (1);
 
        /* if the priority is RTP_ANY finish on the first address hit */
-       if (a->r.priority == RTP_ANY || b->r.priority == RTP_ANY)
+       if (a->priority == RTP_ANY || b->priority == RTP_ANY)
                return (0);
-       if (a->r.priority < b->r.priority)
+       if (a->priority < b->priority)
                return (-1);
-       if (a->r.priority > b->r.priority)
+       if (a->priority > b->priority)
                return (1);
        return (0);
 }
 
 int
-kroute6_compare(struct kroute6_node *a, struct kroute6_node *b)
+kroute6_compare(struct kroute6 *a, struct kroute6 *b)
 {
        int i;
 
        for (i = 0; i < 16; i++) {
-               if (a->r.prefix.s6_addr[i] < b->r.prefix.s6_addr[i])
+               if (a->prefix.s6_addr[i] < b->prefix.s6_addr[i])
                        return (-1);
-               if (a->r.prefix.s6_addr[i] > b->r.prefix.s6_addr[i])
+               if (a->prefix.s6_addr[i] > b->prefix.s6_addr[i])
                        return (1);
        }
 
-       if (a->r.prefixlen < b->r.prefixlen)
+       if (a->prefixlen < b->prefixlen)
                return (-1);
-       if (a->r.prefixlen > b->r.prefixlen)
+       if (a->prefixlen > b->prefixlen)
                return (1);
 
        /* if the priority is RTP_ANY finish on the first address hit */
-       if (a->r.priority == RTP_ANY || b->r.priority == RTP_ANY)
+       if (a->priority == RTP_ANY || b->priority == RTP_ANY)
                return (0);
-       if (a->r.priority < b->r.priority)
+       if (a->priority < b->priority)
                return (-1);
-       if (a->r.priority > b->r.priority)
+       if (a->priority > b->priority)
                return (1);
        return (0);
 }
 
 int
-knexthop_compare(struct knexthop_node *a, struct knexthop_node *b)
+knexthop_compare(struct knexthop *a, struct knexthop *b)
 {
        int     i;
 
@@ -1768,16 +1748,16 @@ kif_compare(struct kif_node *a, struct kif_node *b)
  * tree management functions
  */
 
-struct kroute_node *
+struct kroute *
 kroute_find(struct ktable *kt, const struct bgpd_addr *prefix,
     uint8_t prefixlen, uint8_t prio)
 {
-       struct kroute_node      s;
-       struct kroute_node      *kn, *tmp;
+       struct kroute    s;
+       struct kroute   *kn, *tmp;
 
-       s.r.prefix = prefix->v4;
-       s.r.prefixlen = prefixlen;
-       s.r.priority = prio;
+       s.prefix = prefix->v4;
+       s.prefixlen = prefixlen;
+       s.priority = prio;
 
        kn = RB_FIND(kroute_tree, &kt->krt, &s);
        if (kn && prio == RTP_ANY) {
@@ -1793,8 +1773,8 @@ kroute_find(struct ktable *kt, const struct bgpd_addr *prefix,
        return (kn);
 }
 
-struct kroute_node *
-kroute_matchgw(struct kroute_node *kr, struct bgpd_addr *gw)
+struct kroute *
+kroute_matchgw(struct kroute *kr, struct bgpd_addr *gw)
 {
        in_addr_t       nexthop;
 
@@ -1805,7 +1785,7 @@ kroute_matchgw(struct kroute_node *kr, struct bgpd_addr *gw)
        nexthop = gw->v4.s_addr;
 
        do {
-               if (kr->r.nexthop.s_addr == nexthop)
+               if (kr->nexthop.s_addr == nexthop)
                        return (kr);
                kr = kr->next;
        } while (kr);
@@ -1814,11 +1794,11 @@ kroute_matchgw(struct kroute_node *kr, struct bgpd_addr *gw)
 }
 
 int
-kroute_insert(struct ktable *kt, struct kroute_node *kr)
+kroute_insert(struct ktable *kt, struct kroute *kr)
 {
-       struct kroute_node      *krm;
-       struct knexthop_node    *h;
-       struct in_addr           ina, inb;
+       struct kroute   *krm;
+       struct knexthop *h;
+       struct in_addr   ina, inb;
 
        if ((krm = RB_INSERT(kroute_tree, &kt->krt, kr)) != NULL) {
                /* multipath route, add at end of list */
@@ -1829,37 +1809,37 @@ kroute_insert(struct ktable *kt, struct kroute_node *kr)
        }
 
        /* XXX this is wrong for nexthop validated via BGP */
-       if (kr->r.flags & F_KERNEL) {
-               inet4applymask(&ina, &kr->r.prefix, kr->r.prefixlen);
+       if (kr->flags & F_KERNEL) {
+               inet4applymask(&ina, &kr->prefix, kr->prefixlen);
                RB_FOREACH(h, knexthop_tree, KT2KNT(kt))
                        if (h->nexthop.aid == AID_INET) {
                                inet4applymask(&inb, &h->nexthop.v4,
-                                   kr->r.prefixlen);
+                                   kr->prefixlen);
                                if (memcmp(&ina, &inb, sizeof(ina)) == 0)
                                        knexthop_validate(kt, h);
                        }
 
-               if (kr->r.flags & F_CONNECTED)
+               if (kr->flags & F_CONNECTED)
                        if (kif_kr_insert(kr) == -1)
                                return (-1);
 
                if (krm == NULL)
                        /* redistribute multipath routes only once */
-                       kr_redistribute(IMSG_NETWORK_ADD, kt, &kr->r);
+                       kr_redistribute(IMSG_NETWORK_ADD, kt, kr);
        }
        return (0);
 }
 
 
 int
-kroute_remove(struct ktable *kt, struct kroute_node *kr)
+kroute_remove(struct ktable *kt, struct kroute *kr)
 {
-       struct kroute_node      *krm;
-       struct knexthop_node    *s;
+       struct kroute   *krm;
+       struct knexthop *s;
 
        if ((krm = RB_FIND(kroute_tree, &kt->krt, kr)) == NULL) {
                log_warnx("%s: failed to find %s/%u", __func__,
-                   inet_ntoa(kr->r.prefix), kr->r.prefixlen);
+                   inet_ntoa(kr->prefix), kr->prefixlen);
                return (-1);
        }
 
@@ -1867,14 +1847,14 @@ kroute_remove(struct ktable *kt, struct kroute_node *kr)
                /* head element */
                if (RB_REMOVE(kroute_tree, &kt->krt, kr) == NULL) {
                        log_warnx("%s: failed for %s/%u", __func__,
-                           inet_ntoa(kr->r.prefix), kr->r.prefixlen);
+                           inet_ntoa(kr->prefix), kr->prefixlen);
                        return (-1);
                }
                if (kr->next != NULL) {
                        if (RB_INSERT(kroute_tree, &kt->krt, kr->next) !=
                            NULL) {
                                log_warnx("%s: failed to add %s/%u", __func__,
-                                   inet_ntoa(kr->r.prefix), kr->r.prefixlen);
+                                   inet_ntoa(kr->prefix), kr->prefixlen);
                                return (-1);
                        }
                }
@@ -1883,32 +1863,31 @@ kroute_remove(struct ktable *kt, struct kroute_node *kr)
                while (krm->next != kr && krm->next != NULL)
                        krm = krm->next;
                if (krm->next == NULL) {
-                       log_warnx("%s: multipath list corrupted "
-                           "for %s/%u", inet_ntoa(kr->r.prefix), __func__,
-                           kr->r.prefixlen);
+                       log_warnx("%s: multipath list corrupted for %s/%u",
+                           __func__, inet_ntoa(kr->prefix), kr->prefixlen);
                        return (-1);
                }
                krm->next = kr->next;
        }
 
        /* check whether a nexthop depends on this kroute */
-       if (kr->r.flags & F_NEXTHOP)
+       if (kr->flags & F_NEXTHOP)
                RB_FOREACH(s, knexthop_tree, KT2KNT(kt))
                        if (s->kroute == kr)
                                knexthop_validate(kt, s);
 
-       if (kr->r.flags & F_KERNEL && kr == krm && kr->next == NULL)
+       if (kr->flags & F_KERNEL && kr == krm && kr->next == NULL)
                /* again remove only once */
-               kr_redistribute(IMSG_NETWORK_REMOVE, kt, &kr->r);
+               kr_redistribute(IMSG_NETWORK_REMOVE, kt, kr);
 
-       if (kr->r.flags & F_CONNECTED)
+       if (kr->flags & F_CONNECTED)
                if (kif_kr_remove(kr) == -1) {
-                       rtlabel_unref(kr->r.labelid);
+                       rtlabel_unref(kr->labelid);
                        free(kr);
                        return (-1);
                }
 
-       rtlabel_unref(kr->r.labelid);
+       rtlabel_unref(kr->labelid);
 
        free(kr);
        return (0);
@@ -1917,22 +1896,22 @@ kroute_remove(struct ktable *kt, struct kroute_node *kr)
 void
 kroute_clear(struct ktable *kt)
 {
-       struct kroute_node      *kr;
+       struct kroute   *kr;
 
        while ((kr = RB_MIN(kroute_tree, &kt->krt)) != NULL)
                kroute_remove(kt, kr);
 }
 
-struct kroute6_node *
+struct kroute6 *
 kroute6_find(struct ktable *kt, const struct bgpd_addr *prefix,
     uint8_t prefixlen, uint8_t prio)
 {
-       struct kroute6_node     s;
-       struct kroute6_node     *kn6, *tmp;
+       struct kroute6  s;
+       struct kroute6  *kn6, *tmp;
 
-       s.r.prefix = prefix->v6;
-       s.r.prefixlen = prefixlen;
-       s.r.priority = prio;
+       s.prefix = prefix->v6;
+       s.prefixlen = prefixlen;
+       s.priority = prio;
 
        kn6 = RB_FIND(kroute6_tree, &kt->krt6, &s);
        if (kn6 && prio == RTP_ANY) {
@@ -1948,8 +1927,8 @@ kroute6_find(struct ktable *kt, const struct bgpd_addr *prefix,
        return (kn6);
 }
 
-struct kroute6_node *
-kroute6_matchgw(struct kroute6_node *kr, struct bgpd_addr *gw)
+struct kroute6 *
+kroute6_matchgw(struct kroute6 *kr, struct bgpd_addr *gw)
 {
        struct in6_addr nexthop;
 
@@ -1960,7 +1939,7 @@ kroute6_matchgw(struct kroute6_node *kr, struct bgpd_addr *gw)
        nexthop = gw->v6;
 
        do {
-               if (memcmp(&kr->r.nexthop, &nexthop, sizeof(nexthop)) == 0)
+               if (memcmp(&kr->nexthop, &nexthop, sizeof(nexthop)) == 0)
                        return (kr);
                kr = kr->next;
        } while (kr);
@@ -1969,11 +1948,11 @@ kroute6_matchgw(struct kroute6_node *kr, struct bgpd_addr *gw)
 }
 
 int
-kroute6_insert(struct ktable *kt, struct kroute6_node *kr)
+kroute6_insert(struct ktable *kt, struct kroute6 *kr)
 {
-       struct kroute6_node     *krm;
-       struct knexthop_node    *h;
-       struct in6_addr          ina, inb;
+       struct kroute6  *krm;
+       struct knexthop *h;
+       struct in6_addr  ina, inb;
 
        if ((krm = RB_INSERT(kroute6_tree, &kt->krt6, kr)) != NULL) {
                /* multipath route, add at end of list */
@@ -1984,37 +1963,37 @@ kroute6_insert(struct ktable *kt, struct kroute6_node *kr)
        }
 
        /* XXX this is wrong for nexthop validated via BGP */
-       if (kr->r.flags & F_KERNEL) {
-               inet6applymask(&ina, &kr->r.prefix, kr->r.prefixlen);
+       if (kr->flags & F_KERNEL) {
+               inet6applymask(&ina, &kr->prefix, kr->prefixlen);
                RB_FOREACH(h, knexthop_tree, KT2KNT(kt))
                        if (h->nexthop.aid == AID_INET6) {
                                inet6applymask(&inb, &h->nexthop.v6,
-                                   kr->r.prefixlen);
+                                   kr->prefixlen);
                                if (memcmp(&ina, &inb, sizeof(ina)) == 0)
                                        knexthop_validate(kt, h);
                        }
 
-               if (kr->r.flags & F_CONNECTED)
+               if (kr->flags & F_CONNECTED)
                        if (kif_kr6_insert(kr) == -1)
                                return (-1);
 
                if (krm == NULL)
                        /* redistribute multipath routes only once */
-                       kr_redistribute6(IMSG_NETWORK_ADD, kt, &kr->r);
+                       kr_redistribute6(IMSG_NETWORK_ADD, kt, kr);
        }
 
        return (0);
 }
 
 int
-kroute6_remove(struct ktable *kt, struct kroute6_node *kr)
+kroute6_remove(struct ktable *kt, struct kroute6 *kr)
 {
-       struct kroute6_node     *krm;
-       struct knexthop_node    *s;
+       struct kroute6  *krm;
+       struct knexthop *s;
 
        if ((krm = RB_FIND(kroute6_tree, &kt->krt6, kr)) == NULL) {
                log_warnx("%s: failed for %s/%u", __func__,
-                   log_in6addr(&kr->r.prefix), kr->r.prefixlen);
+                   log_in6addr(&kr->prefix), kr->prefixlen);
                return (-1);
        }
 
@@ -2022,15 +2001,14 @@ kroute6_remove(struct ktable *kt, struct kroute6_node *kr)
                /* head element */
                if (RB_REMOVE(kroute6_tree, &kt->krt6, kr) == NULL) {
                        log_warnx("%s: failed for %s/%u", __func__,
-                           log_in6addr(&kr->r.prefix), kr->r.prefixlen);
+                           log_in6addr(&kr->prefix), kr->prefixlen);
                        return (-1);
                }
                if (kr->next != NULL) {
                        if (RB_INSERT(kroute6_tree, &kt->krt6, kr->next) !=
                            NULL) {
                                log_warnx("%s: failed to add %s/%u", __func__,
-                                   log_in6addr(&kr->r.prefix),
-                                   kr->r.prefixlen);
+                                   log_in6addr(&kr->prefix), kr->prefixlen);
                                return (-1);
                        }
                }
@@ -2039,32 +2017,31 @@ kroute6_remove(struct ktable *kt, struct kroute6_node *kr)
                while (krm->next != kr && krm->next != NULL)
                        krm = krm->next;
                if (krm->next == NULL) {
-                       log_warnx("%s: multipath list corrupted "
-                           "for %s/%u", __func__, log_in6addr(&kr->r.prefix),
-                           kr->r.prefixlen);
+                       log_warnx("%s: multipath list corrupted for %s/%u",
+                           __func__, log_in6addr(&kr->prefix), kr->prefixlen);
                        return (-1);
                }
                krm->next = kr->next;
        }
 
        /* check whether a nexthop depends on this kroute */
-       if (kr->r.flags & F_NEXTHOP)
+       if (kr->flags & F_NEXTHOP)
                RB_FOREACH(s, knexthop_tree, KT2KNT(kt))
                        if (s->kroute == kr)
                                knexthop_validate(kt, s);
 
-       if (kr->r.flags & F_KERNEL && kr == krm && kr->next == NULL)
+       if (kr->flags & F_KERNEL && kr == krm && kr->next == NULL)
                /* again remove only once */
-               kr_redistribute6(IMSG_NETWORK_REMOVE, kt, &kr->r);
+               kr_redistribute6(IMSG_NETWORK_REMOVE, kt, kr);
 
-       if (kr->r.flags & F_CONNECTED)
+       if (kr->flags & F_CONNECTED)
                if (kif_kr6_remove(kr) == -1) {
-                       rtlabel_unref(kr->r.labelid);
+                       rtlabel_unref(kr->labelid);
                        free(kr);
                        return (-1);
                }
 
-       rtlabel_unref(kr->r.labelid);
+       rtlabel_unref(kr->labelid);
 
        free(kr);
        return (0);
@@ -2073,16 +2050,16 @@ kroute6_remove(struct ktable *kt, struct kroute6_node *kr)
 void
 kroute6_clear(struct ktable *kt)
 {
-       struct kroute6_node     *kr;
+       struct kroute6  *kr;
 
        while ((kr = RB_MIN(kroute6_tree, &kt->krt6)) != NULL)
                kroute6_remove(kt, kr);
 }
 
-struct knexthop_node *
+struct knexthop *
 knexthop_find(struct ktable *kt, struct bgpd_addr *addr)
 {
-       struct knexthop_node    s;
+       struct knexthop s;
 
        bzero(&s, sizeof(s));
        memcpy(&s.nexthop, addr, sizeof(s.nexthop));
@@ -2091,7 +2068,7 @@ knexthop_find(struct ktable *kt, struct bgpd_addr *addr)
 }
 
 int
-knexthop_insert(struct ktable *kt, struct knexthop_node *kn)
+knexthop_insert(struct ktable *kt, struct knexthop *kn)
 {
        if (RB_INSERT(knexthop_tree, KT2KNT(kt), kn) != NULL) {
                log_warnx("%s: failed for %s", __func__,
@@ -2106,7 +2083,7 @@ knexthop_insert(struct ktable *kt, struct knexthop_node *kn)
 }
 
 int
-knexthop_remove(struct ktable *kt, struct knexthop_node *kn)
+knexthop_remove(struct ktable *kt, struct knexthop *kn)
 {
        kroute_detach_nexthop(kt, kn);
 
@@ -2123,7 +2100,7 @@ knexthop_remove(struct ktable *kt, struct knexthop_node *kn)
 void
 knexthop_clear(struct ktable *kt)
 {
-       struct knexthop_node    *kn;
+       struct knexthop *kn;
 
        while ((kn = RB_MIN(knexthop_tree, KT2KNT(kt))) != NULL)
                knexthop_remove(kt, kn);
@@ -2172,14 +2149,14 @@ kif_remove(struct kif_node *kif)
 
        while ((kkr = LIST_FIRST(&kif->kroute_l)) != NULL) {
                LIST_REMOVE(kkr, entry);
-               kkr->kr->r.flags &= ~F_NEXTHOP;
+               kkr->kr->flags &= ~F_NEXTHOP;
                kroute_remove(kt, kkr->kr);
                free(kkr);
        }
 
        while ((kkr6 = LIST_FIRST(&kif->kroute6_l)) != NULL) {
                LIST_REMOVE(kkr6, entry);
-               kkr6->kr->r.flags &= ~F_NEXTHOP;
+               kkr6->kr->flags &= ~F_NEXTHOP;
                kroute6_remove(kt, kkr6->kr);
                free(kkr6);
        }
@@ -2198,22 +2175,22 @@ kif_clear(void)
 }
 
 int
-kif_kr_insert(struct kroute_node *kr)
+kif_kr_insert(struct kroute *kr)
 {
        struct kif_node *kif;
        struct kif_kr   *kkr;
 
-       if ((kif = kif_find(kr->r.ifindex)) == NULL) {
-               if (kr->r.ifindex)
+       if ((kif = kif_find(kr->ifindex)) == NULL) {
+               if (kr->ifindex)
                        log_warnx("%s: interface with index %u not found",
-                           __func__, kr->r.ifindex);
+                           __func__, kr->ifindex);
                return (0);
        }
 
        if (kif->k.nh_reachable)
-               kr->r.flags &= ~F_DOWN;
+               kr->flags &= ~F_DOWN;
        else
-               kr->r.flags |= F_DOWN;
+               kr->flags |= F_DOWN;
 
        if ((kkr = calloc(1, sizeof(*kkr))) == NULL) {
                log_warn("%s", __func__);
@@ -2228,15 +2205,15 @@ kif_kr_insert(struct kroute_node *kr)
 }
 
 int
-kif_kr_remove(struct kroute_node *kr)
+kif_kr_remove(struct kroute *kr)
 {
        struct kif_node *kif;
        struct kif_kr   *kkr;
 
-       if ((kif = kif_find(kr->r.ifindex)) == NULL) {
-               if (kr->r.ifindex)
+       if ((kif = kif_find(kr->ifindex)) == NULL) {
+               if (kr->ifindex)
                        log_warnx("%s: interface with index %u not found",
-                           __func__, kr->r.ifindex);
+                           __func__, kr->ifindex);
                return (0);
        }
 
@@ -2246,7 +2223,7 @@ kif_kr_remove(struct kroute_node *kr)
 
        if (kkr == NULL) {
                log_warnx("%s: can't remove connected route from interface "
-                   "with index %u: not found", __func__, kr->r.ifindex);
+                   "with index %u: not found", __func__, kr->ifindex);
                return (-1);
        }
 
@@ -2257,22 +2234,22 @@ kif_kr_remove(struct kroute_node *kr)
 }
 
 int
-kif_kr6_insert(struct kroute6_node *kr)
+kif_kr6_insert(struct kroute6 *kr)
 {
        struct kif_node *kif;
        struct kif_kr6  *kkr6;
 
-       if ((kif = kif_find(kr->r.ifindex)) == NULL) {
-               if (kr->r.ifindex)
+       if ((kif = kif_find(kr->ifindex)) == NULL) {
+               if (kr->ifindex)
                        log_warnx("%s: interface with index %u not found",
-                           __func__, kr->r.ifindex);
+                           __func__, kr->ifindex);
                return (0);
        }
 
        if (kif->k.nh_reachable)
-               kr->r.flags &= ~F_DOWN;
+               kr->flags &= ~F_DOWN;
        else
-               kr->r.flags |= F_DOWN;
+               kr->flags |= F_DOWN;
 
        if ((kkr6 = calloc(1, sizeof(*kkr6))) == NULL) {
                log_warn("%s", __func__);
@@ -2287,15 +2264,15 @@ kif_kr6_insert(struct kroute6_node *kr)
 }
 
 int
-kif_kr6_remove(struct kroute6_node *kr)
+kif_kr6_remove(struct kroute6 *kr)
 {
        struct kif_node *kif;
        struct kif_kr6  *kkr6;
 
-       if ((kif = kif_find(kr->r.ifindex)) == NULL) {
-               if (kr->r.ifindex)
+       if ((kif = kif_find(kr->ifindex)) == NULL) {
+               if (kr->ifindex)
                        log_warnx("%s: interface with index %u not found",
-                           __func__, kr->r.ifindex);
+                           __func__, kr->ifindex);
                return (0);
        }
 
@@ -2305,7 +2282,7 @@ kif_kr6_remove(struct kroute6_node *kr)
 
        if (kkr6 == NULL) {
                log_warnx("%s: can't remove connected route from interface "
-                   "with index %u: not found", __func__, kr->r.ifindex);
+                   "with index %u: not found", __func__, kr->ifindex);
                return (-1);
        }
 
@@ -2398,11 +2375,11 @@ kroute6_validate(struct kroute6 *kr)
 }
 
 void
-knexthop_validate(struct ktable *kt, struct knexthop_node *kn)
+knexthop_validate(struct ktable *kt, struct knexthop *kn)
 {
-       void                    *oldk;
-       struct kroute_node      *kr;
-       struct kroute6_node     *kr6;
+       void            *oldk;
+       struct kroute   *kr;
+       struct kroute6  *kr6;
 
        oldk = kn->kroute;
        kroute_detach_nexthop(kt, kn);
@@ -2416,7 +2393,7 @@ knexthop_validate(struct ktable *kt, struct knexthop_node *kn)
 
                if (kr) {
                        kn->kroute = kr;
-                       kr->r.flags |= F_NEXTHOP;
+                       kr->flags |= F_NEXTHOP;
                }
 
                /*
@@ -2432,7 +2409,7 @@ knexthop_validate(struct ktable *kt, struct knexthop_node *kn)
 
                if (kr6) {
                        kn->kroute = kr6;
-                       kr6->r.flags |= F_NEXTHOP;
+                       kr6->flags |= F_NEXTHOP;
                }
 
                if (kr6 != oldk)
@@ -2444,7 +2421,7 @@ knexthop_validate(struct ktable *kt, struct knexthop_node *kn)
 void
 knexthop_track(struct ktable *kt, void *krp)
 {
-       struct knexthop_node    *kn;
+       struct knexthop *kn;
 
        RB_FOREACH(kn, knexthop_tree, KT2KNT(kt))
                if (kn->kroute == krp)
@@ -2452,11 +2429,11 @@ knexthop_track(struct ktable *kt, void *krp)
 }
 
 void
-knexthop_send_update(struct knexthop_node *kn)
+knexthop_send_update(struct knexthop *kn)
 {
        struct kroute_nexthop    n;
-       struct kroute_node      *kr;
-       struct kroute6_node     *kr6;
+       struct kroute           *kr;
+       struct kroute6          *kr6;
 
        bzero(&n, sizeof(n));
        memcpy(&n.nexthop, &kn->nexthop, sizeof(n.nexthop));
@@ -2470,69 +2447,69 @@ knexthop_send_update(struct knexthop_node *kn)
        switch (kn->nexthop.aid) {
        case AID_INET:
                kr = kn->kroute;
-               n.valid = kroute_validate(&kr->r);
-               n.connected = kr->r.flags & F_CONNECTED;
-               if (kr->r.nexthop.s_addr != 0) {
+               n.valid = kroute_validate(kr);
+               n.connected = kr->flags & F_CONNECTED;
+               if (kr->nexthop.s_addr != 0) {
                        n.gateway.aid = AID_INET;
-                       n.gateway.v4.s_addr = kr->r.nexthop.s_addr;
+                       n.gateway.v4.s_addr = kr->nexthop.s_addr;
                }
                if (n.connected) {
                        n.net.aid = AID_INET;
-                       n.net.v4.s_addr = kr->r.prefix.s_addr;
-                       n.netlen = kr->r.prefixlen;
+                       n.net.v4.s_addr = kr->prefix.s_addr;
+                       n.netlen = kr->prefixlen;
                }
                break;
        case AID_INET6:
                kr6 = kn->kroute;
-               n.valid = kroute6_validate(&kr6->r);
-               n.connected = kr6->r.flags & F_CONNECTED;
-               if (memcmp(&kr6->r.nexthop, &in6addr_any,
+               n.valid = kroute6_validate(kr6);
+               n.connected = kr6->flags & F_CONNECTED;
+               if (memcmp(&kr6->nexthop, &in6addr_any,
                    sizeof(struct in6_addr)) != 0) {
                        n.gateway.aid = AID_INET6;
-                       memcpy(&n.gateway.v6, &kr6->r.nexthop,
+                       memcpy(&n.gateway.v6, &kr6->nexthop,
                            sizeof(struct in6_addr));
                }
                if (n.connected) {
                        n.net.aid = AID_INET6;
-                       memcpy(&n.net.v6, &kr6->r.prefix,
+                       memcpy(&n.net.v6, &kr6->prefix,
                            sizeof(struct in6_addr));
-                       n.netlen = kr6->r.prefixlen;
+                       n.netlen = kr6->prefixlen;
                }
                break;
        }
        send_nexthop_update(&n);
 }
 
-struct kroute_node *
+struct kroute *
 kroute_match(struct ktable *kt, struct bgpd_addr *key, int matchall)
 {
        int                      i;
-       struct kroute_node      *kr;
+       struct kroute           *kr;
        struct bgpd_addr         masked;
 
        for (i = 32; i >= 0; i--) {
                applymask(&masked, key, i);
                if ((kr = kroute_find(kt, &masked, i, RTP_ANY)) != NULL)
                        if (matchall ||
-                           bgpd_filternexthop(kr_tofull(&kr->r)) == 0)
+                           bgpd_filternexthop(kr_tofull(kr)) == 0)
                                return (kr);
        }
 
        return (NULL);
 }
 
-struct kroute6_node *
+struct kroute6 *
 kroute6_match(struct ktable *kt, struct bgpd_addr *key, int matchall)
 {
        int                      i;
-       struct kroute6_node     *kr6;
+       struct kroute6          *kr6;
        struct bgpd_addr         masked;
 
        for (i = 128; i >= 0; i--) {
                applymask(&masked, key, i);
                if ((kr6 = kroute6_find(kt, &masked, i, RTP_ANY)) != NULL)
                        if (matchall ||
-                           bgpd_filternexthop(kr6_tofull(&kr6->r)) == 0)
+                           bgpd_filternexthop(kr6_tofull(kr6)) == 0)
                                return (kr6);
        }
 
@@ -2540,11 +2517,11 @@ kroute6_match(struct ktable *kt, struct bgpd_addr *key, int matchall)
 }
 
 void
-kroute_detach_nexthop(struct ktable *kt, struct knexthop_node *kn)
+kroute_detach_nexthop(struct ktable *kt, struct knexthop *kn)
 {
-       struct knexthop_node    *s;
-       struct kroute_node      *k;
-       struct kroute6_node     *k6;
+       struct knexthop *s;
+       struct kroute   *k;
+       struct kroute6  *k6;
 
        if (kn->kroute == NULL)
                return;
@@ -2561,11 +2538,11 @@ kroute_detach_nexthop(struct ktable *kt, struct knexthop_node *kn)
                switch (kn->nexthop.aid) {
                case AID_INET:
                        k = kn->kroute;
-                       k->r.flags &= ~F_NEXTHOP;
+                       k->flags &= ~F_NEXTHOP;
                        break;
                case AID_INET6:
                        k6 = kn->kroute;
-                       k6->r.flags &= ~F_NEXTHOP;
+                       k6->flags &= ~F_NEXTHOP;
                        break;
                }
        }
@@ -2761,9 +2738,9 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
 
        LIST_FOREACH(kkr, &kif->kroute_l, entry) {
                if (reachable)
-                       kkr->kr->r.flags &= ~F_DOWN;
+                       kkr->kr->flags &= ~F_DOWN;
                else
-                       kkr->kr->r.flags |= F_DOWN;
+                       kkr->kr->flags |= F_DOWN;
 
                if (kt == NULL)
                        continue;
@@ -2772,9 +2749,9 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
        }
        LIST_FOREACH(kkr6, &kif->kroute6_l, entry) {
                if (reachable)
-                       kkr6->kr->r.flags &= ~F_DOWN;
+                       kkr6->kr->flags &= ~F_DOWN;
                else
-                       kkr6->kr->r.flags |= F_DOWN;
+                       kkr6->kr->flags |= F_DOWN;
 
                if (kt == NULL)
                        continue;
@@ -3135,8 +3112,8 @@ fetchtable(struct ktable *kt)
        char                    *buf = NULL, *next, *lim;
        struct rt_msghdr        *rtm;
        struct kroute_full       kl;
-       struct kroute_node      *kr;
-       struct kroute6_node     *kr6;
+       struct kroute           *kr;
+       struct kroute6          *kr6;
 
        mib[0] = CTL_NET;
        mib[1] = PF_ROUTE;
@@ -3179,18 +3156,18 @@ fetchtable(struct ktable *kt)
                                log_warn("%s", __func__);
                                return (-1);
                        }
-                       kr->r.prefix.s_addr = kl.prefix.v4.s_addr;
-                       kr->r.prefixlen = kl.prefixlen;
+                       kr->prefix.s_addr = kl.prefix.v4.s_addr;
+                       kr->prefixlen = kl.prefixlen;
                        if (kl.nexthop.aid == AID_INET)
-                               kr->r.nexthop.s_addr = kl.nexthop.v4.s_addr;
-                       kr->r.flags = kl.flags;
-                       kr->r.ifindex = kl.ifindex;
-                       kr->r.priority = kl.priority;
-                       kr->r.labelid = rtlabel_name2id(kl.label);
+                               kr->nexthop.s_addr = kl.nexthop.v4.s_addr;
+                       kr->flags = kl.flags;
+                       kr->ifindex = kl.ifindex;
+                       kr->priority = kl.priority;
+                       kr->labelid = rtlabel_name2id(kl.label);
 
                        if (kl.priority == kr_state.fib_prio) {
-                               send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r);
-                               rtlabel_unref(kr->r.labelid);
+                               send_rtmsg(kr_state.fd, RTM_DELETE, kt, kr);
+                               rtlabel_unref(kr->labelid);
                                free(kr);
                        } else
                                kroute_insert(kt, kr);
@@ -3199,21 +3176,20 @@ fetchtable(struct ktable *kt)
                                log_warn("%s", __func__);
                                return (-1);
                        }
-                       kr6->r.prefix = kl.prefix.v6;
-                       kr6->r.prefixlen = kl.prefixlen;
+                       kr6->prefix = kl.prefix.v6;
+                       kr6->prefixlen = kl.prefixlen;
                        if (kl.nexthop.aid == AID_INET6)
-                               kr6->r.nexthop = kl.nexthop.v6;
+                               kr6->nexthop = kl.nexthop.v6;
                        else
-                               kr6->r.nexthop = in6addr_any;
-                       kr6->r.flags = kl.flags;
-                       kr6->r.ifindex = kl.ifindex;
-                       kr6->r.priority = kl.priority;
-                       kr6->r.labelid = rtlabel_name2id(kl.label);
+                               kr6->nexthop = in6addr_any;
+                       kr6->flags = kl.flags;
+                       kr6->ifindex = kl.ifindex;
+                       kr6->priority = kl.priority;
+                       kr6->labelid = rtlabel_name2id(kl.label);
 
                        if (kl.priority == kr_state.fib_prio) {
-                               send_rt6msg(kr_state.fd, RTM_DELETE, kt,
-                                   &kr6->r);
-                               rtlabel_unref(kr6->r.labelid);
+                               send_rt6msg(kr_state.fd, RTM_DELETE, kt, kr6);
+                               rtlabel_unref(kr6->labelid);
                                free(kr6);
                        } else
                                kroute6_insert(kt, kr6);
@@ -3472,15 +3448,15 @@ dispatch_rtmsg_addr(struct rt_msghdr *rtm, struct kroute_full *kl)
 int
 kr_fib_delete(struct ktable *kt, struct kroute_full *kl, int mpath)
 {
-       struct kroute_node      *kr;
-       struct kroute6_node     *kr6;
+       struct kroute   *kr;
+       struct kroute6  *kr6;
 
        switch (kl->prefix.aid) {
        case AID_INET:
                if ((kr = kroute_find(kt, &kl->prefix, kl->prefixlen,
                    kl->priority)) == NULL)
                        return (0);
-               if (!(kr->r.flags & F_KERNEL))
+               if (!(kr->flags & F_KERNEL))
                        return (0);
 
                if (mpath) {
@@ -3498,7 +3474,7 @@ kr_fib_delete(struct ktable *kt, struct kroute_full *kl, int mpath)
                if ((kr6 = kroute6_find(kt, &kl->prefix, kl->prefixlen,
                    kl->priority)) == NULL)
                        return (0);
-               if (!(kr6->r.flags & F_KERNEL))
+               if (!(kr6->flags & F_KERNEL))
                        return (0);
 
                if (mpath) {
@@ -3520,18 +3496,18 @@ kr_fib_delete(struct ktable *kt, struct kroute_full *kl, int mpath)
 int
 kr_fib_change(struct ktable *kt, struct kroute_full *kl, int type, int mpath)
 {
-       struct kroute_node      *kr;
-       struct kroute6_node     *kr6;
-       int                      flags, oflags;
-       int                      changed = 0, rtlabel_changed = 0;
-       uint16_t                 new_labelid;
+       struct kroute   *kr;
+       struct kroute6  *kr6;
+       int              flags, oflags;
+       int              changed = 0, rtlabel_changed = 0;
+       uint16_t         new_labelid;
 
        flags = kl->flags;
        switch (kl->prefix.aid) {
        case AID_INET:
                if ((kr = kroute_find(kt, &kl->prefix, kl->prefixlen,
                    kl->priority)) != NULL) {
-                       if (kr->r.flags & F_KERNEL) {
+                       if (kr->flags & F_KERNEL) {
                                /* get the correct route */
                                if (mpath && type == RTM_CHANGE &&
                                    (kr = kroute_matchgw(kr, &kl->nexthop)) ==
@@ -3543,51 +3519,51 @@ kr_fib_change(struct ktable *kt, struct kroute_full *kl, int type, int mpath)
                                        goto add4;
 
                                if (kl->nexthop.aid == AID_INET) {
-                                       if (kr->r.nexthop.s_addr !=
+                                       if (kr->nexthop.s_addr !=
                                            kl->nexthop.v4.s_addr)
                                                changed = 1;
-                                       kr->r.nexthop.s_addr =
+                                       kr->nexthop.s_addr =
                                            kl->nexthop.v4.s_addr;
-                                       kr->r.ifindex = kl->ifindex;
+                                       kr->ifindex = kl->ifindex;
                                } else {
-                                       if (kr->r.nexthop.s_addr != 0)
+                                       if (kr->nexthop.s_addr != 0)
                                                changed = 1;
-                                       kr->r.nexthop.s_addr = 0;
-                                       kr->r.ifindex = kl->ifindex;
+                                       kr->nexthop.s_addr = 0;
+                                       kr->ifindex = kl->ifindex;
                                }
 
-                               if (kr->r.flags & F_NEXTHOP)
+                               if (kr->flags & F_NEXTHOP)
                                        flags |= F_NEXTHOP;
 
                                new_labelid = rtlabel_name2id(kl->label);
-                               if (kr->r.labelid != new_labelid) {
-                                       rtlabel_unref(kr->r.labelid);
-                                       kr->r.labelid = new_labelid;
+                               if (kr->labelid != new_labelid) {
+                                       rtlabel_unref(kr->labelid);
+                                       kr->labelid = new_labelid;
                                        rtlabel_changed = 1;
                                }
 
-                               oflags = kr->r.flags;
+                               oflags = kr->flags;
                                if (flags != oflags)
                                        changed = 1;
-                               kr->r.flags = flags;
+                               kr->flags = flags;
 
                                if (rtlabel_changed)
                                        kr_redistribute(IMSG_NETWORK_ADD,
-                                           kt, &kr->r);
+                                           kt, kr);
 
                                if ((oflags & F_CONNECTED) &&
                                    !(flags & F_CONNECTED)) {
                                        kif_kr_remove(kr);
                                        kr_redistribute(IMSG_NETWORK_ADD,
-                                           kt, &kr->r);
+                                           kt, kr);
                                }
                                if ((flags & F_CONNECTED) &&
                                    !(oflags & F_CONNECTED)) {
                                        kif_kr_insert(kr);
                                        kr_redistribute(IMSG_NETWORK_ADD,
-                                           kt, &kr->r);
+                                           kt, kr);
                                }
-                               if (kr->r.flags & F_NEXTHOP && changed)
+                               if (kr->flags & F_NEXTHOP && changed)
                                        knexthop_track(kt, kr);
                        }
                } else {
@@ -3596,14 +3572,14 @@ add4:
                                log_warn("%s", __func__);
                                return (-1);
                        }
-                       kr->r.prefix.s_addr = kl->prefix.v4.s_addr;
-                       kr->r.prefixlen = kl->prefixlen;
+                       kr->prefix.s_addr = kl->prefix.v4.s_addr;
+                       kr->prefixlen = kl->prefixlen;
                        if (kl->nexthop.aid == AID_INET)
-                               kr->r.nexthop.s_addr = kl->nexthop.v4.s_addr;
-                       kr->r.flags = flags;
-                       kr->r.ifindex = kl->ifindex;
-                       kr->r.priority = kl->priority;
-                       kr->r.labelid = rtlabel_name2id(kl->label);
+                               kr->nexthop.s_addr = kl->nexthop.v4.s_addr;
+                       kr->flags = flags;
+                       kr->ifindex = kl->ifindex;
+                       kr->priority = kl->priority;
+                       kr->labelid = rtlabel_name2id(kl->label);
 
                        kroute_insert(kt, kr);
                }
@@ -3611,7 +3587,7 @@ add4:
        case AID_INET6:
                if ((kr6 = kroute6_find(kt, &kl->prefix, kl->prefixlen,
                    kl->priority)) != NULL) {
-                       if (kr6->r.flags & F_KERNEL) {
+                       if (kr6->flags & F_KERNEL) {
                                /* get the correct route */
                                if (mpath && type == RTM_CHANGE &&
                                    (kr6 = kroute6_matchgw(kr6, &kl->nexthop))
@@ -3623,54 +3599,54 @@ add4:
                                        goto add6;
 
                                if (kl->nexthop.aid == AID_INET6) {
-                                       if (memcmp(&kr6->r.nexthop,
+                                       if (memcmp(&kr6->nexthop,
                                            &kl->nexthop.v6,
                                            sizeof(struct in6_addr)))
                                                changed = 1;
-                                       kr6->r.nexthop = kl->nexthop.v6;
-                                       kr6->r.ifindex = kl->ifindex;
+                                       kr6->nexthop = kl->nexthop.v6;
+                                       kr6->ifindex = kl->ifindex;
                                } else {
-                                       if (memcmp(&kr6->r.nexthop,
+                                       if (memcmp(&kr6->nexthop,
                                            &in6addr_any,
                                            sizeof(struct in6_addr)))
                                                changed = 1;
-                                       kr6->r.nexthop = in6addr_any;
-                                       kr6->r.ifindex = kl->ifindex;
+                                       kr6->nexthop = in6addr_any;
+                                       kr6->ifindex = kl->ifindex;
                                }
 
-                               if (kr6->r.flags & F_NEXTHOP)
+                               if (kr6->flags & F_NEXTHOP)
                                        flags |= F_NEXTHOP;
 
                                new_labelid = rtlabel_name2id(kl->label);
-                               if (kr6->r.labelid != new_labelid) {
-                                       rtlabel_unref(kr6->r.labelid);
-                                       kr6->r.labelid = new_labelid;
+                               if (kr6->labelid != new_labelid) {
+                                       rtlabel_unref(kr6->labelid);
+                                       kr6->labelid = new_labelid;
                                        rtlabel_changed = 1;
                                }
 
-                               oflags = kr6->r.flags;
+                               oflags = kr6->flags;
                                if (flags != oflags)
                                        changed = 1;
-                               kr6->r.flags = flags;
+                               kr6->flags = flags;
 
                                if (rtlabel_changed)
                                        kr_redistribute6(IMSG_NETWORK_ADD,
-                                           kt, &kr6->r);
+                                           kt, kr6);
 
                                if ((oflags & F_CONNECTED) &&
                                    !(flags & F_CONNECTED)) {
                                        kif_kr6_remove(kr6);
                                        kr_redistribute6(IMSG_NETWORK_ADD,
-                                           kt, &kr6->r);
+                                           kt, kr6);
                                }
                                if ((flags & F_CONNECTED) &&
                                    !(oflags & F_CONNECTED)) {
                                        kif_kr6_insert(kr6);
                                        kr_redistribute6(IMSG_NETWORK_ADD,
-                                           kt, &kr6->r);
+                                           kt, kr6);
                                }
 
-                               if (kr6->r.flags & F_NEXTHOP && changed)
+                               if (kr6->flags & F_NEXTHOP && changed)
                                        knexthop_track(kt, kr6);
                        }
                } else {
@@ -3679,16 +3655,16 @@ add6:
                                log_warn("%s", __func__);
                                return (-1);
                        }
-                       kr6->r.prefix = kl->prefix.v6;
-                       kr6->r.prefixlen = kl->prefixlen;
+                       kr6->prefix = kl->prefix.v6;
+                       kr6->prefixlen = kl->prefixlen;
                        if (kl->nexthop.aid == AID_INET6)
-                               kr6->r.nexthop = kl->nexthop.v6;
+                               kr6->nexthop = kl->nexthop.v6;
                        else
-                               kr6->r.nexthop = in6addr_any;
-                       kr6->r.flags = flags;
-                       kr6->r.ifindex = kl->ifindex;
-                       kr6->r.priority = kl->priority;
-                       kr6->r.labelid = rtlabel_name2id(kl->label);
+                               kr6->nexthop = in6addr_any;
+                       kr6->flags = flags;
+                       kr6->ifindex = kl->ifindex;
+                       kr6->priority = kl->priority;
+                       kr6->labelid = rtlabel_name2id(kl->label);
 
                        kroute6_insert(kt, kr6);
                }