]>
Commit | Line | Data |
---|---|---|
f2294add JB |
1 | --- geoclue-0.12.99/configure.ac.orig 2019-10-02 16:24:07.407947415 +0200 |
2 | +++ geoclue-0.12.99/configure.ac 2019-10-04 20:51:53.104774152 +0200 | |
3 | @@ -146,7 +146,7 @@ | |
4 | if test "x$enable_networkmanager" != "xno"; then | |
5 | PKG_CHECK_MODULES(NETWORK_MANAGER, | |
6 | [ | |
7 | - NetworkManager libnm-glib libnm-util | |
8 | + libnm | |
9 | ], have_networkmanager="yes", have_networkmanager="no") | |
10 | ||
11 | if test "x$have_networkmanager" = "xyes"; then | |
12 | --- geoclue-0.12.99/src/connectivity-networkmanager.h.orig 2012-07-31 18:47:05.000000000 +0200 | |
13 | +++ geoclue-0.12.99/src/connectivity-networkmanager.h 2019-10-04 21:12:16.438146786 +0200 | |
14 | @@ -26,7 +26,7 @@ | |
15 | #define _CONNECTIVITY_NETWORKMANAGER_H | |
16 | ||
17 | #include <glib-object.h> | |
18 | -#include <nm-client.h> | |
19 | +#include <NetworkManager.h> | |
20 | #include "connectivity.h" | |
21 | ||
22 | ||
23 | --- geoclue-0.12.99/src/connectivity-networkmanager.c.orig 2012-07-31 18:47:05.000000000 +0200 | |
24 | +++ geoclue-0.12.99/src/connectivity-networkmanager.c 2019-10-05 06:53:55.835747194 +0200 | |
25 | @@ -34,10 +34,6 @@ | |
26 | ||
27 | #include <NetworkManager.h> /*for DBus strings */ | |
28 | ||
29 | -#include <nm-client.h> | |
30 | -#include <nm-device-wifi.h> | |
31 | -#include <nm-setting-ip4-config.h> | |
32 | - | |
33 | #if !defined(NM_CHECK_VERSION) | |
34 | #define NM_CHECK_VERSION(x,y,z) 0 | |
35 | #endif | |
36 | @@ -106,7 +102,7 @@ | |
37 | char *ap_mac; | |
38 | int strength; | |
39 | ||
40 | - ap_mac = g_strdup (nm_access_point_get_hw_address (ap)); | |
41 | + ap_mac = g_strdup (nm_access_point_get_bssid (ap)); | |
42 | strength = nm_access_point_get_strength (ap); | |
43 | g_hash_table_insert (ht, ap_mac, GINT_TO_POINTER (strength_to_dbm (strength))); | |
44 | } | |
45 | @@ -161,39 +157,22 @@ | |
46 | return mac_strup (mac); | |
47 | } | |
48 | ||
49 | -static gchar * | |
50 | -ip4_address_as_string (guint32 ip) | |
51 | -{ | |
52 | - struct in_addr tmp_addr; | |
53 | - char buf[INET_ADDRSTRLEN+1]; | |
54 | - | |
55 | - memset (&buf, '\0', sizeof (buf)); | |
56 | - tmp_addr.s_addr = ip; | |
57 | - | |
58 | - if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN)) | |
59 | - return g_strdup (buf); | |
60 | - | |
61 | - return NULL; | |
62 | -} | |
63 | - | |
64 | static char * | |
65 | get_router_mac (GeoclueConnectivity *iface) | |
66 | { | |
67 | GeoclueNetworkManager *self = GEOCLUE_NETWORKMANAGER (iface); | |
68 | const GPtrArray *devices; | |
69 | - char *gateway, *mac; | |
70 | + char *mac; | |
71 | + const char *gateway = NULL; | |
72 | guint i; | |
73 | ||
74 | devices = nm_client_get_devices (self->client); | |
75 | if (devices == NULL) | |
76 | return NULL; | |
77 | ||
78 | - gateway = NULL; | |
79 | - | |
80 | for (i = 0; i < devices->len; i++) { | |
81 | NMDevice *device = g_ptr_array_index (devices, i); | |
82 | - NMIP4Config *cfg4; | |
83 | - GSList *iter; | |
84 | + NMIPConfig *cfg4; | |
85 | ||
86 | if (nm_device_get_state (device) != NM_DEVICE_STATE_ACTIVATED) | |
87 | continue; | |
88 | @@ -202,19 +181,12 @@ | |
89 | if (cfg4 == NULL) | |
90 | continue; | |
91 | ||
92 | - for (iter = (GSList *) nm_ip4_config_get_addresses (cfg4); iter; iter = g_slist_next (iter)) { | |
93 | - NMIP4Address *addr = (NMIP4Address *) iter->data; | |
94 | - | |
95 | - gateway = ip4_address_as_string (nm_ip4_address_get_gateway (addr)); | |
96 | - if (gateway != NULL) | |
97 | - break; | |
98 | - } | |
99 | + gateway = nm_ip_config_get_gateway (cfg4); | |
100 | } | |
101 | if (gateway == NULL) | |
102 | return NULL; | |
103 | ||
104 | mac = get_mac_for_gateway (gateway); | |
105 | - g_free (gateway); | |
106 | ||
107 | return mac; | |
108 | } | |
109 | @@ -235,7 +207,7 @@ | |
110 | strength = nm_access_point_get_strength (ap); | |
111 | if (strength > self->ap_strength) { | |
112 | g_free (self->cache_ap_mac); | |
113 | - self->cache_ap_mac = g_strdup (nm_access_point_get_hw_address (ap)); | |
114 | + self->cache_ap_mac = g_strdup (nm_access_point_get_bssid (ap)); | |
115 | self->ap_strength = strength; | |
116 | } | |
117 | } | |
118 | @@ -317,7 +289,7 @@ | |
119 | ||
120 | old_status = self->status; | |
121 | ||
122 | - if (nm_client_get_manager_running (self->client)) { | |
123 | + if (nm_client_get_nm_running (self->client)) { | |
124 | state = nm_client_get_state (self->client); | |
125 | self->status = nmstate_to_geocluenetworkstatus (state); | |
126 | cache_ap_mac (self); | |
127 | @@ -341,7 +313,7 @@ | |
128 | geoclue_networkmanager_init (GeoclueNetworkManager *self) | |
129 | { | |
130 | self->status = GEOCLUE_CONNECTIVITY_UNKNOWN; | |
131 | - self->client = nm_client_new (); | |
132 | + self->client = nm_client_new (NULL, NULL); | |
133 | if (self->client == NULL) { | |
134 | g_warning ("%s was unable to create a connection to NetworkManager", | |
135 | G_OBJECT_TYPE_NAME (self)); |