From c761f12b0a67412cde8a4693f1e8d6aa14c0b70e Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 29 Jul 2011 14:27:46 +0200 Subject: pingu: remove default gw from main route table when isp goes down --- pingu_host.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pingu_host.c') diff --git a/pingu_host.c b/pingu_host.c index 427fe9a..640b928 100644 --- a/pingu_host.c +++ b/pingu_host.c @@ -1,4 +1,7 @@ +#include +#include + #include #include #include @@ -221,6 +224,7 @@ static void execute_action(const char *action) int pingu_host_set_status(struct pingu_host *host, int status) { const char *action; + int route_action = 0; host->burst.active = 0; if (host->status == status) { log_debug("%s: %s: status is still %i", @@ -233,13 +237,16 @@ int pingu_host_set_status(struct pingu_host *host, int status) switch (host->status) { case 0: action = host->down_action; + route_action = RTM_DELROUTE; break; case 1: action = host->up_action; + route_action = RTM_NEWROUTE; break; } if (action != NULL) execute_action(action); + pingu_iface_update_routes(host->iface, route_action); exec_route_change_hook(); return status; } -- cgit v1.2.3