]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
sun: Use lo0 if we can't find an interface for our route
authorRoy Marples <roy@marples.name>
Sun, 14 Apr 2019 10:48:29 +0000 (13:48 +0300)
committerRoy Marples <roy@marples.name>
Sun, 14 Apr 2019 10:48:29 +0000 (13:48 +0300)
We need to operate on the route, and dhcpcd needs an interface for
each route. This seems to work for now.

src/if-sun.c

index 942b283237f74f7e7acdc8e0d19eca5a1041d2b0..d65347550240cb41fb7473b19c82989a1bb5a916 100644 (file)
@@ -1012,7 +1012,6 @@ if_plumbif(const struct dhcpcd_ctx *ctx, int af, const char *ifname)
        }
 
 done:
-       logerrx("plumb %d %d %d", mux_fd, fd, arp_fd);
        retval = 0;
 
 out:
@@ -1263,8 +1262,11 @@ if_walkrt(struct dhcpcd_ctx *ctx, char *data, size_t len)
                         * This sucks, so we need to call RTM_GET to
                         * work out the interface. */
                        if (if_route_get(ctx, &rt) == NULL) {
-                               logerr(__func__);
-                               continue;
+                               rt.rt_ifp = if_loopback(ctx);
+                               if (rt.rt_ifp == NULL) {
+                                       logerr(__func__);
+                                       continue;
+                               }
                        }
                        if_finishrt(ctx, &rt);
                }
@@ -1319,8 +1321,11 @@ if_walkrt6(struct dhcpcd_ctx *ctx, char *data, size_t len)
                         * This sucks, so we need to call RTM_GET to
                         * work out the interface. */
                        if (if_route_get(ctx, &rt) == NULL) {
-                               logerr(__func__);
-                               continue;
+                               rt.rt_ifp = if_loopback(ctx);
+                               if (rt.rt_ifp == NULL) {
+                                       logerr(__func__);
+                                       continue;
+                               }
                        }
                        if_finishrt(ctx, &rt);
                }