diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-03-23 14:47:16 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-03-23 14:47:16 +0100 |
commit | 70172ed2d29e5b11b468e94fc018ad339f253315 (patch) | |
tree | ba403fcc71d154d56891bd4501c195add3ac3127 | |
parent | 818db8e92e481f89b790dc93795ac208465aa142 (diff) | |
download | pingu-70172ed2d29e5b11b468e94fc018ad339f253315.tar.bz2 pingu-70172ed2d29e5b11b468e94fc018ad339f253315.tar.xz |
pingu_iface: del renewed gateways via broken ISPs
If we get a new default gateway for an interface
that is marked "down", remove the default gw again
from main table and let pingu detect that it went up
This solves the case when dhcp will renew a lease,
recreates the default gw and ISP is broke a bit
futher down the road.
-rw-r--r-- | pingu_iface.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pingu_iface.c b/pingu_iface.c index 065eea3..ec35628 100644 --- a/pingu_iface.c +++ b/pingu_iface.c @@ -166,6 +166,19 @@ void pingu_iface_gw_action(struct pingu_iface *iface, case RTM_NEWROUTE: pingu_route_add(&iface->route_list, gw); log_debug("%s: added route", iface->name); + /* if we get a new default gateway for an interface + * that is marked "down", remove the default gw again + * from main table and let pingu detect that it went up + * + * This solves the case when dhcp will renew a lease, + * recreates the default gw and ISP is broke a bit + * futher down the road. + */ + if (is_default_gw(gw) && !pingu_iface_gw_is_online(iface)) { + pingu_iface_update_routes(iface, RTM_DELROUTE); + /* avoid doing the multipath twice*/ + return; + } break; case RTM_DELROUTE: pingu_route_del(&iface->route_list, gw); |