]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Forgot these from merge
authorRoy Marples <roy@marples.name>
Wed, 17 Apr 2019 08:17:07 +0000 (08:17 +0000)
committerRoy Marples <roy@marples.name>
Wed, 17 Apr 2019 08:17:07 +0000 (08:17 +0000)
src/ipv4.h
src/route.c

index 1f8c3a301ffd307f37c9119c0825e162e28dbe96..388a5870a97b5520d3aaa9e11e927fb5b57e956a 100644 (file)
@@ -116,7 +116,7 @@ int inet_cidrtoaddr(int, struct in_addr *);
 uint32_t ipv4_getnetmask(uint32_t);
 int ipv4_hasaddr(const struct interface *);
 
-bool inet_getroutes(struct dhcpcd_ctx *, rb_tree_t *);
+bool inet_getroutes(struct dhcpcd_ctx *, rb_tree_t *, rb_tree_t *);
 
 #define STATE_ADDED            0x01
 #define STATE_FAKE             0x02
index 20e6f679f68659de2858accf9008ed55a7c344e6..b6190565e7fdfc515acf52d225339838b9bcdc58 100644 (file)
@@ -585,18 +585,19 @@ rt_doroute(rb_tree_t *kroutes, struct rt *rt)
 void
 rt_build(struct dhcpcd_ctx *ctx, int af)
 {
-       rb_tree_t kroutes, routes, added;
+       rb_tree_t routes, added, kroutes;
        struct rt *rt, *rtn;
        unsigned long long o;
 
-       rb_tree_init(&kroutes, &rt_compare_os_ops);
        rb_tree_init(&routes, &rt_compare_list_ops);
        rb_tree_init(&added, &rt_compare_os_ops);
+       rb_tree_init(&kroutes, &rt_compare_os_ops);
+       if_initrt(ctx, &kroutes, af);
 
        switch (af) {
 #ifdef INET
        case AF_INET:
-               if (!inet_getroutes(ctx, &routes))
+               if (!inet_getroutes(ctx, &routes, &kroutes))
                        goto getfail;
                break;
 #endif
@@ -608,8 +609,6 @@ rt_build(struct dhcpcd_ctx *ctx, int af)
 #endif
        }
 
-       if_initrt(ctx, &kroutes, af);
-
        RB_TREE_FOREACH_SAFE(rt, &routes, rtn) {
                if (rt->rt_dest.sa_family != af &&
                    rt->rt_gateway.sa_family != af)