diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-09 14:20:40 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-09 14:20:40 +0200 |
commit | 50d9faf2d2c5ddcf9a0bd6591d73d4e45d09641b (patch) | |
tree | 763cdcff2760d882633dc4f2b2e54cd023ae7f94 /pingu_netlink.c | |
parent | f8ea0da3d82ec64ac88a33631ca259a091111a41 (diff) | |
download | pingu-50d9faf2d2c5ddcf9a0bd6591d73d4e45d09641b.tar.bz2 pingu-50d9faf2d2c5ddcf9a0bd6591d73d4e45d09641b.tar.xz |
pingu_netlink: delete multipath route if there are no paths
The normal action is to replace but if all ISPs goes down we need
to explicit delete the multipath route. Otherwise we will have the last
default gw hanging around.
Diffstat (limited to 'pingu_netlink.c')
-rw-r--r-- | pingu_netlink.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pingu_netlink.c b/pingu_netlink.c index 5c63a51..e9781fa 100644 --- a/pingu_netlink.c +++ b/pingu_netlink.c @@ -375,8 +375,10 @@ static int add_nexthops(struct nlmsghdr *nlh, size_t nlh_size, host = pingu_host_find_by_iface(iface); if ((!iface->balance) || iface->index == 0 || (host != NULL && host->status == PINGU_HOST_STATUS_OFFLINE) - || route == NULL) + || route == NULL) { + iface->has_multipath = 0; continue; + } iface->has_multipath = 1; break; case RTM_DELROUTE: @@ -430,7 +432,7 @@ int netlink_route_multipath(struct netlink_fd *fd, int action_type, count = add_nexthops(&req.nlh, sizeof(req), iface_list, action_type); if (count == 0) - return 0; + req.nlh.nlmsg_type = RTM_DELROUTE; if (!netlink_talk(fd, &req.nlh, sizeof(req), &req.nlh)) return -1; |