From ce82fe2d549bb573517d55a712ab0b858e58574f Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 8 Sep 2011 13:39:02 +0200 Subject: pingu_gateway: implement pingu_gateway_first_default() Finds first default gateway in list. --- pingu_gateway.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pingu_gateway.c') diff --git a/pingu_gateway.c b/pingu_gateway.c index c56f282..de9b094 100644 --- a/pingu_gateway.c +++ b/pingu_gateway.c @@ -117,3 +117,12 @@ int is_default_gw(struct pingu_gateway *route) return 0; } +struct pingu_gateway *pingu_gateway_first_default(struct list_head *gateway_list) +{ + struct pingu_gateway *entry; + list_for_each_entry(entry, gateway_list, gateway_list_entry) { + if (is_default_gw(entry)) + return entry; + } + return NULL; +} -- cgit v1.2.3