]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Stop pretending that OpenBSD route priority is like Linux route metric.
authorRoy Marples <roy@marples.name>
Mon, 2 Mar 2015 09:39:34 +0000 (09:39 +0000)
committerRoy Marples <roy@marples.name>
Mon, 2 Mar 2015 09:39:34 +0000 (09:39 +0000)
if-bsd.c
if.h

index b3b4f226d3ca0a85498020853a87ef2aa0b9464c..9ac2a8404878c09b6e345f454f2068b474db7c5b 100644 (file)
--- 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 e33b7874c210518fea790605ff57c3f6fcff842a..e105a0cc29b710707a472063f589cd1c7d5c8458 100644 (file)
--- a/if.h
+++ b/if.h
 #ifndef INTERFACE_H
 #define INTERFACE_H
 
-#include <sys/ioctl.h>         /* for SIOCGIFPRIORITY */
-
 #include <net/if.h>
 #include <net/route.h>         /* for RTM_ADD et all */
 #include <netinet/in.h>
 
-/* 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