[PATCH 3/3] Use the 'get_router_mac_fallback' method if the connectivity implementation fails to get it.

Javier Fernandez jfernandez at igalia.com
Mon Aug 23 08:49:07 PDT 2010


Even though there would be an implementation of the 'get_router_mac'
method of the Connectivity Iface, perhaps it could not be able
to get the default gateway MAC address, even being under online
state. In that case, the 'fallback' method could be useful to
get it, assuming the limitations of this mechanism.
---
 src/connectivity.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/connectivity.c b/src/connectivity.c
index 3bc8a6c..0149d4d 100644
--- a/src/connectivity.c
+++ b/src/connectivity.c
@@ -221,9 +221,11 @@ mac_strup (char *mac)
 char *
 geoclue_connectivity_get_router_mac (GeoclueConnectivity *self)
 {
+	char *mac = NULL;
+
 	if (self == NULL ||
-	    GEOCLUE_CONNECTIVITY_GET_INTERFACE (self)->get_router_mac == NULL) {
-		char *mac = NULL;
+	    GEOCLUE_CONNECTIVITY_GET_INTERFACE (self)->get_router_mac == NULL ||
+	    (mac = GEOCLUE_CONNECTIVITY_GET_INTERFACE (self)->get_router_mac (self)) == NULL) {
 		guint i;
 		int ret_val;
 
@@ -237,7 +239,7 @@ geoclue_connectivity_get_router_mac (GeoclueConnectivity *self)
 		}
 	}
 
-	return GEOCLUE_CONNECTIVITY_GET_INTERFACE (self)->get_router_mac (self);
+	return mac_strup (mac);
 }
 
 char *
-- 
1.6.3.3



More information about the GeoClue mailing list