]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When the leased address changes on the interface but existing routes
authorRoy Marples <roy@marples.name>
Thu, 24 Mar 2011 17:08:31 +0000 (17:08 +0000)
committerRoy Marples <roy@marples.name>
Thu, 24 Mar 2011 17:08:31 +0000 (17:08 +0000)
remain the same, we need to change the routes so that the source address
changes as well.

configure.c
net.h

index 01d0f8130e31664916b8b896e36053cc257f3455..2003268fb422db2cb598209f902d38fa86a60d1a 100644 (file)
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2010 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2011 Roy Marples <roy@marples.name>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -664,9 +664,11 @@ build_routes(void)
                        /* Is this route already in our table? */
                        if ((find_route(nrs, rt, NULL, NULL)) != NULL)
                                continue;
+                       rt->src.s_addr = ifp->addr.s_addr;
                        /* Do we already manage it? */
                        if ((or = find_route(routes, rt, &rtl, NULL))) {
                                if (or->iface != ifp ||
+                                   or->src.s_addr != ifp->addr.s_addr ||
                                    rt->gate.s_addr != or->gate.s_addr)
                                {
                                        if (c_route(or, rt, ifp) != 0)
diff --git a/net.h b/net.h
index 6d8593024204a812216ba318f76c40ce491b093a..16ba168320b2b1bcbde2b78baaa8ff325a5202ef 100644 (file)
--- a/net.h
+++ b/net.h
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2010 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2011 Roy Marples <roy@marples.name>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -84,6 +84,7 @@ struct rt {
        struct in_addr net;
        struct in_addr gate;
        const struct interface *iface;
+       struct in_addr src;
        struct rt *next;
 };