From: Roy Marples Date: Thu, 24 Mar 2011 17:08:31 +0000 (+0000) Subject: When the leased address changes on the interface but existing routes X-Git-Tag: v5.2.12~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33b768dae8ed78b3c23b18e10df850c5e8458c92;p=thirdparty%2Fdhcpcd.git When the leased address changes on the interface but existing routes remain the same, we need to change the routes so that the source address changes as well. --- diff --git a/configure.c b/configure.c index 01d0f813..2003268f 100644 --- a/configure.c +++ b/configure.c @@ -1,6 +1,6 @@ /* * dhcpcd - DHCP client daemon - * Copyright (c) 2006-2010 Roy Marples + * Copyright (c) 2006-2011 Roy Marples * 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 6d859302..16ba1683 100644 --- a/net.h +++ b/net.h @@ -1,6 +1,6 @@ /* * dhcpcd - DHCP client daemon - * Copyright (c) 2006-2010 Roy Marples + * Copyright (c) 2006-2011 Roy Marples * 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; };