diff options
| author | Roy Marples <roy@marples.name> | 2008-12-02 00:24:25 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-12-02 00:24:25 +0000 |
| commit | 38d187ed862825023856489bab14fbe8d6ff523a (patch) | |
| tree | dfedb3bf7f33c41e276ec94eff256ba510eb5022 /configure.c | |
| parent | a4d0de41b3f6a586160d74cb939198ff39cfc919 (diff) | |
| download | dhcpcd-38d187ed862825023856489bab14fbe8d6ff523a.tar.xz | |
Ensure we de-reference the old pointer from the open routes correctly when building lists.
Diffstat (limited to 'configure.c')
| -rw-r--r-- | configure.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/configure.c b/configure.c index d185f378..005d54c4 100644 --- a/configure.c +++ b/configure.c @@ -370,7 +370,7 @@ remove_routes(const struct interface *iface) static void build_routes(void) { - struct rt *nrs = NULL, *dnr, *or, *rt, *rtn, *rtl; + struct rt *nrs = NULL, *dnr, *or, *rt, *rtn, *rtl, *lrt = NULL; const struct interface *ifp; for (ifp = ifaces; ifp; ifp = ifp->next) { @@ -378,7 +378,7 @@ build_routes(void) continue; dnr = get_option_routes(ifp->state->new); dnr = add_subnet_route(dnr, ifp); - for (rt = dnr; rt && (rtn = rt->next, 1); rt = rtn) { + for (rt = dnr; rt && (rtn = rt->next, 1); lrt = rt, rt = rtn) { rt->iface = ifp; /* Is this route already in our table? */ if ((find_route(nrs, rt, NULL, NULL))) @@ -391,6 +391,8 @@ build_routes(void) else routes = or->next; rt = or; + rt->iface = ifp; + lrt = NULL; } else { if (c_route(or, rt, ifp) == 0) { if (rtl) @@ -407,7 +409,8 @@ build_routes(void) } if (dnr == rt) dnr = rtn; - rt->iface = ifp; + else if (lrt) + lrt->next = rtn; rt->next = nrs; nrs = rt; } @@ -466,7 +469,6 @@ configure(struct interface *iface, const char *reason) remove_routes(iface); delete_address(iface); } - run_script(iface, reason); return 0; } @@ -498,6 +500,7 @@ configure(struct interface *iface, const char *reason) (rt.net.s_addr != iface->net.s_addr || rt.dest.s_addr !=(iface->addr.s_addr & iface->net.s_addr))) #else + rt.iface = iface; if (!find_route(routes, &rt, NULL, NULL)) #endif del_route(iface, &rt.dest, &rt.net, &rt.gate, 0); |
