Hi, The kernel uses rtm_addrs as a bit field for addresses that are included in the routing message. The significance of the bits has to be consistent with the order of the addresss. In route(8) store addresses in ascending order of RTA values. This allows to use MPLS routes together with route labels.
ok? bluhm Index: sbin/route/route.c =================================================================== RCS file: /data/mirror/openbsd/cvs/src/sbin/route/route.c,v retrieving revision 1.231 diff -u -p -r1.231 route.c --- sbin/route/route.c 29 Aug 2019 14:28:34 -0000 1.231 +++ sbin/route/route.c 29 Aug 2019 20:44:35 -0000 @@ -68,7 +68,7 @@ const struct if_status_description if_status_descriptions[] = LINK_STATE_DESCRIPTIONS; -union sockunion so_dst, so_gate, so_mask, so_ifa, so_ifp, so_label, so_src; +union sockunion so_dst, so_gate, so_mask, so_ifa, so_ifp, so_src, so_label; typedef union sockunion *sup; pid_t pid; @@ -1087,13 +1087,14 @@ rtmsg(int cmd, int flags, int fmask, uin if (rtm_addrs & RTA_NETMASK) mask_addr(&so_dst, &so_mask, RTA_DST); + /* store addresses in ascending order of RTA values */ NEXTADDR(RTA_DST, so_dst); NEXTADDR(RTA_GATEWAY, so_gate); NEXTADDR(RTA_NETMASK, so_mask); NEXTADDR(RTA_IFP, so_ifp); NEXTADDR(RTA_IFA, so_ifa); - NEXTADDR(RTA_LABEL, so_label); NEXTADDR(RTA_SRC, so_src); + NEXTADDR(RTA_LABEL, so_label); rtm.rtm_msglen = l = cp - (char *)&m_rtmsg; if (verbose) print_rtmsg(&rtm, l);