From: Roy Marples Date: Mon, 2 Mar 2015 09:39:34 +0000 (+0000) Subject: Stop pretending that OpenBSD route priority is like Linux route metric. X-Git-Tag: v6.8.0~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79b9d69d50cffc998a62bb1d7922f79976d14690;p=thirdparty%2Fdhcpcd.git Stop pretending that OpenBSD route priority is like Linux route metric. --- diff --git a/if-bsd.c b/if-bsd.c index b3b4f226..9ac2a840 100644 --- a/if-bsd.c +++ b/if-bsd.c @@ -514,9 +514,6 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct rt *rt, struct rt_msghdr *rtm) else rt->net.s_addr = INADDR_BROADCAST; COPYOUT(rt->gate, rti_info[RTAX_GATEWAY]); -#ifdef SIOCGIFPRIORITY - rt->metric = rtm->rtm_priority; -#endif if (rtm->rtm_index) rt->iface = if_findindex(ctx, rtm->rtm_index); @@ -591,9 +588,6 @@ if_route(unsigned char cmd, const struct rt *rt, struct rt *srt) if (cmd != RTM_ADD) rtm.hdr.rtm_flags |= RTF_PINNED; #endif -#ifdef SIOCGIFPRIORITY - rtm.hdr.rtm_priority = rt->metric; -#endif if (cmd != RTM_DELETE) { rtm.hdr.rtm_addrs |= RTA_IFA | RTA_IFP; @@ -602,6 +596,11 @@ if_route(unsigned char cmd, const struct rt *rt, struct rt *srt) rt->net.s_addr != state->net.s_addr || rt->dest.s_addr != (state->addr.s_addr & state->net.s_addr)) rtm.hdr.rtm_flags |= RTF_STATIC; + else { +#ifdef RTF_CLONING + rtm.hdr.rtm_flags |= RTF_CLONING; +#endif + } } if (rt->dest.s_addr == rt->gate.s_addr && rt->net.s_addr == INADDR_BROADCAST) @@ -879,9 +878,6 @@ if_copyrt6(struct dhcpcd_ctx *ctx, struct rt6 *rt, struct rt_msghdr *rtm) } else ipv6_mask(&rt->net, 128); COPYOUT6(rt->gate, rti_info[RTAX_GATEWAY]); -#ifdef SIOCGIFPRIORITY - rt->metric = rtm->rtm_priority; -#endif if (rtm->rtm_index) rt->iface = if_findindex(ctx, rtm->rtm_index); @@ -952,15 +948,12 @@ if_route6(unsigned char cmd, const struct rt6 *rt, struct rt6 *srt) rtm.hdr.rtm_flags |= RTF_PINNED; #endif rtm.hdr.rtm_addrs = RTA_DST | RTA_NETMASK; -#ifdef SIOCGIFPRIORITY - rtm.hdr.rtm_priority = rt->metric; -#endif /* None interface subnet routes are static. */ if (IN6_IS_ADDR_UNSPECIFIED(&rt->gate)) { #ifdef RTF_CLONING rtm.hdr.rtm_flags |= RTF_CLONING; #endif - } else + } else rtm.hdr.rtm_flags |= RTF_GATEWAY | RTF_STATIC; if (cmd == RTM_ADD) diff --git a/if.h b/if.h index e33b7874..e105a0cc 100644 --- a/if.h +++ b/if.h @@ -28,15 +28,14 @@ #ifndef INTERFACE_H #define INTERFACE_H -#include /* for SIOCGIFPRIORITY */ - #include #include /* for RTM_ADD et all */ #include -/* Some systems have route metrics */ +/* Some systems have route metrics. + * OpenBSD route priority is not this. */ #ifndef HAVE_ROUTE_METRIC -# if defined(__linux__) || defined(SIOCGIFPRIORITY) +# if defined(__linux__) # define HAVE_ROUTE_METRIC 1 # endif #endif