diff options
-rw-r--r-- | pingu_gateway.c | 15 | ||||
-rw-r--r-- | pingu_gateway.h | 7 | ||||
-rw-r--r-- | pingu_netlink.c | 14 |
3 files changed, 19 insertions, 17 deletions
diff --git a/pingu_gateway.c b/pingu_gateway.c index cdc31c4..c56f282 100644 --- a/pingu_gateway.c +++ b/pingu_gateway.c @@ -102,3 +102,18 @@ void pingu_gateway_del(struct list_head *gateway_list, list_del(&gw->gateway_list_entry); free(gw); } + +int is_default_gw(struct pingu_gateway *route) +{ + switch (route->dest.sa.sa_family) { + case AF_INET: + return ((route->dest.sin.sin_addr.s_addr == 0) + && (route->gw_addr.sin.sin_addr.s_addr != 0)); + break; + case AF_INET6: + log_debug("TODO: ipv6"); + break; + } + return 0; +} + diff --git a/pingu_gateway.h b/pingu_gateway.h index 62c576b..9cfea89 100644 --- a/pingu_gateway.h +++ b/pingu_gateway.h @@ -10,11 +10,11 @@ struct pingu_gateway { union sockaddr_any src; unsigned char dst_len; unsigned char src_len; - + int metric; unsigned char protocol; unsigned char scope; - unsigned char type; + unsigned char type; struct list_head gateway_list_entry; }; @@ -23,7 +23,8 @@ void pingu_gateway_add(struct list_head *gateway_list, struct pingu_gateway *gw); void pingu_gateway_del(struct list_head *gateway_list, struct pingu_gateway *gw); - +int is_default_gw(struct pingu_gateway *route); + #endif diff --git a/pingu_netlink.c b/pingu_netlink.c index c6800d4..8c8f2e5 100644 --- a/pingu_netlink.c +++ b/pingu_netlink.c @@ -455,20 +455,6 @@ static void log_route_change(struct pingu_gateway *route, deststr, route->dst_len, gwstr, ifname, table); } -static int is_default_gw(struct pingu_gateway *route) -{ - switch (route->dest.sa.sa_family) { - case AF_INET: - return ((route->dest.sin.sin_addr.s_addr == 0) - && (route->gw_addr.sin.sin_addr.s_addr != 0)); - break; - case AF_INET6: - log_debug("TODO: ipv6"); - break; - } - return FALSE; -} - static void netlink_route_cb_action(struct nlmsghdr *msg, int action) { struct pingu_iface *iface; |