aboutsummaryrefslogtreecommitdiffstats
path: root/pingu_gateway.c
diff options
context:
space:
mode:
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;
+}
+