aboutsummaryrefslogtreecommitdiffstats
path: root/pingu_gateway.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-08-15 16:59:02 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2011-08-15 16:59:02 +0200
commitfeddb5d300640855717c4eca3002a0e4887f5da3 (patch)
tree64738e351b3fba57606be08b9c84b8c6e70fa81e /pingu_gateway.c
parentff0c3156353830540028400aa20eadc9e86fa55f (diff)
downloadpingu-feddb5d300640855717c4eca3002a0e4887f5da3.tar.bz2
pingu-feddb5d300640855717c4eca3002a0e4887f5da3.tar.xz
pingu_gateway: move is_default_gw
It belongs in pingu_gateway
Diffstat (limited to 'pingu_gateway.c')
-rw-r--r--pingu_gateway.c15
1 files changed, 15 insertions, 0 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;
+}
+