From 39eb92db66600bd1bf8a63f24145c9ff1fd7f966 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 28 Jul 2011 17:43:12 +0200 Subject: pingu: add gw to list and minor cleanup - add default gateways to our gw list - use sockaddr_init to init our gw - implement sockaddr_to_string TODO: delete default gateways from list --- pingu_netlink.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pingu_netlink.c') diff --git a/pingu_netlink.c b/pingu_netlink.c index 18d5082..9e670ed 100644 --- a/pingu_netlink.c +++ b/pingu_netlink.c @@ -383,7 +383,7 @@ static void netlink_addr_del_cb(struct nlmsghdr *nlmsg) pingu_iface_set_addr(iface, 0, NULL, 0); } -static void netlink_route_cb_action(struct nlmsghdr *msg, int action) +static void netlink_route_cb_action(struct nlmsghdr *msg, int action) { struct pingu_iface *iface; struct rtmsg *rtm = NLMSG_DATA(msg); @@ -426,7 +426,11 @@ static void netlink_route_cb_action(struct nlmsghdr *msg, int action) netlink_route_modify(&talk_fd, action, destination, rtm->rtm_dst_len, gateway, metric, - iface->index, rtm->rtm_table); + iface->index, rtm->rtm_table); + + if (destination == 0 && gateway != 0) + pingu_iface_gateway(iface, rtm->rtm_family, &gateway, + metric, action); } static void netlink_route_new_cb(struct nlmsghdr *msg) -- cgit v1.2.3