]>
Commit | Line | Data |
---|---|---|
7f660273 | 1 | <diff -Nur NetworkManager-0.4.orig/configure.in NetworkManager-0.4/configure.in |
e9eb136c | 2 | --- NetworkManager-0.4.orig/configure.in 2005-05-19 21:58:50.000000000 +0100 |
3 | +++ NetworkManager-0.4/configure.in 2005-05-20 23:22:23.000000000 +0100 | |
7f660273 | 4 | @@ -60,7 +60,7 @@ |
e9eb136c | 5 | exit 1 |
6 | else | |
7 | case $with_distro in | |
7f660273 PZ |
8 | - redhat|suse|gentoo|debian|slackware) ;; |
9 | + redhat|suse|gentoo|debian|slackware|pld) ;; | |
e9eb136c | 10 | *) |
11 | echo "Your distribution (${with_distro}) is not yet supported! (patches welcome)" | |
12 | exit 1 | |
13 | @@ -68,6 +68,7 @@ | |
14 | AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) | |
15 | AM_CONDITIONAL(TARGET_MANDRAKE, test x"$with_distro" = xmandrake) | |
16 | AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware) | |
17 | +AM_CONDITIONAL(TARGET_PLD, test x"$with_distro" = xpld) | |
18 | ||
19 | AC_CHECK_HEADER(iwlib.h, [], | |
20 | [AC_MSG_ERROR(iwlib.h not found. Install wireless-tools.)], []) | |
21 | diff -Nur NetworkManager-0.4.orig/src/backends/Makefile.am NetworkManager-0.4/src/backends/Makefile.am | |
22 | --- NetworkManager-0.4.orig/src/backends/Makefile.am 2005-05-16 19:35:20.000000000 +0100 | |
23 | +++ NetworkManager-0.4/src/backends/Makefile.am 2005-05-20 23:23:16.000000000 +0100 | |
24 | @@ -24,6 +24,10 @@ | |
25 | libnmbackend_la_SOURCES += NetworkManagerSlackware.c | |
26 | endif | |
27 | ||
28 | +if TARGET_PLD | |
29 | +libnmbackend_la_SOURCES += NetworkManagerPLD.c | |
30 | +endif | |
31 | + | |
32 | libnmbackend_la_LIBADD = $(DBUS_LIBS) $(GTHREAD_LIBS) | |
33 | libnmbackend_la_CPPFLAGS = $(DBUS_CFLAGS) \ | |
34 | $(GTHREAD_CFLAGS) \ | |
7f660273 PZ |
35 | diff -Nur NetworkManager-0.5.1/src/backends/NetworkManagerPLD.c NetworkManager-0.5.1-patrys/src/backends/NetworkManagerPLD.c |
36 | --- NetworkManager-0.5.1/src/backends/NetworkManagerPLD.c 1970-01-01 01:00:00.000000000 +0100 | |
37 | +++ NetworkManager-0.5.1-patrys/src/backends/NetworkManagerPLD.c 2005-12-27 12:58:21.682174250 +0100 | |
38 | @@ -0,0 +1,356 @@ | |
e9eb136c | 39 | +/* NetworkManager -- Network link manager |
40 | + * | |
41 | + * Narayan Newton <narayan_newton@yahoo.com> | |
42 | + * | |
43 | + * This program is free software; you can redistribute it and/or modify | |
44 | + * it under the terms of the GNU General Public License as published by | |
45 | + * the Free Software Foundation; either version 2 of the License, or | |
46 | + * (at your option) any later version. | |
47 | + * | |
48 | + * This program is distributed in the hope that it will be useful, | |
49 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
50 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
51 | + * GNU General Public License for more details. | |
52 | + * | |
53 | + * You should have received a copy of the GNU General Public License | |
54 | + * along with this program; if not, write to the Free Software | |
55 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
56 | + * | |
57 | + * (C) Copyright 2004 RedHat, Inc. | |
58 | + * (C) Copyright 2004 Narayan Newton | |
59 | + * (C) Copyright 2005 wrobell <wrobell@pld-linux.org> | |
7f660273 | 60 | + * (C) Copyright 2005 Patryk Zawadzki <patrys@pld-linux.org> |
e9eb136c | 61 | + */ |
62 | + | |
63 | +#include <stdio.h> | |
64 | +#include <sys/types.h> | |
65 | +#include <signal.h> | |
66 | +#include "NetworkManagerSystem.h" | |
67 | +#include "NetworkManagerUtils.h" | |
68 | +#include "NetworkManagerDevice.h" | |
69 | + | |
70 | +/* | |
71 | + * PLD specific backend based on Slackware backend. | |
72 | + */ | |
73 | + | |
74 | +/* | |
75 | + * nm_system_init | |
76 | + * | |
77 | + * Initializes the distribution-specific system backend | |
78 | + * | |
79 | + */ | |
80 | +void nm_system_init (void) | |
81 | +{ | |
7f660273 | 82 | + nm_system_kill_all_dhcp_daemons(); |
e9eb136c | 83 | +} |
84 | + | |
85 | +/* | |
86 | + * nm_system_device_flush_routes | |
87 | + * | |
88 | + * Flush all routes associated with a network device | |
89 | + * | |
90 | + */ | |
91 | +void nm_system_device_flush_routes (NMDevice *dev) | |
92 | +{ | |
93 | + char buf [100]; | |
94 | + | |
95 | + g_return_if_fail (dev != NULL); | |
96 | + | |
97 | + /* Not really applicable for test devices */ | |
98 | + if (nm_device_is_test_device (dev)) | |
99 | + return; | |
100 | + | |
7f660273 PZ |
101 | + nm_system_device_flush_routes_with_iface (nm_device_get_iface (dev)); |
102 | +} | |
103 | + | |
104 | +/* | |
105 | + * nm_system_device_flush_routes_with_iface | |
106 | + * | |
107 | + * Flush all routes associated with a network device | |
108 | + * | |
109 | + */ | |
110 | +void nm_system_device_flush_routes_with_iface (const char *iface) | |
111 | +{ | |
112 | + char *buf; | |
113 | + | |
114 | + g_return_if_fail (iface != NULL); | |
115 | + | |
e9eb136c | 116 | + /* Remove routing table entries */ |
7f660273 | 117 | + buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface); |
e9eb136c | 118 | + nm_spawn_process (buf); |
7f660273 | 119 | + g_free (buf); |
e9eb136c | 120 | +} |
121 | + | |
e9eb136c | 122 | +/* |
123 | + * nm_system_device_flush_addresses | |
124 | + * | |
125 | + * Flush all network addresses associated with a network device | |
126 | + * | |
127 | + */ | |
128 | +void nm_system_device_flush_addresses (NMDevice *dev) | |
129 | +{ | |
130 | + char buf [100]; | |
131 | + | |
132 | + g_return_if_fail (dev != NULL); | |
133 | + | |
134 | + /* Not really applicable for test devices */ | |
135 | + if (nm_device_is_test_device (dev)) | |
136 | + return; | |
7f660273 PZ |
137 | + nm_system_device_flush_addresses_with_iface (nm_device_get_iface (dev)); |
138 | +} | |
139 | + | |
140 | +/* | |
141 | + * nm_system_device_flush_addresses_with_iface | |
142 | + * | |
143 | + * Flush all network addresses associated with a network device | |
144 | + * | |
145 | + */ | |
146 | +void nm_system_device_flush_addresses_with_iface (const char *iface) | |
147 | +{ | |
148 | + char *buf; | |
149 | + | |
150 | + g_return_if_fail (iface != NULL); | |
e9eb136c | 151 | + |
152 | + /* Remove all IP addresses for a device */ | |
7f660273 | 153 | + buf = g_strdup_printf ("/sbin/ip addr flush dev %s", iface); |
e9eb136c | 154 | + nm_spawn_process (buf); |
7f660273 | 155 | + g_free (buf); |
e9eb136c | 156 | +} |
157 | + | |
e9eb136c | 158 | +/* |
159 | + * nm_system_device_setup_static_ip4_config | |
160 | + * | |
161 | + * Set up the device with a particular IPv4 address/netmask/gateway. | |
162 | + * | |
163 | + * Returns: TRUE on success | |
164 | + * FALSE on error | |
165 | + * | |
166 | + */ | |
167 | +gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev) | |
168 | +{ | |
169 | + syslog (LOG_WARNING, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n"); | |
170 | +} | |
171 | + | |
e9eb136c | 172 | +/* |
7f660273 | 173 | + * nm_system_device_get_system_config |
e9eb136c | 174 | + * |
175 | + * Retrieve any relevant configuration info for a particular device | |
176 | + * from the system network configuration information. Clear out existing | |
177 | + * info before setting stuff too. | |
178 | + * | |
179 | + */ | |
7f660273 | 180 | +void *nm_system_device_get_system_config (NMDevice *dev) |
e9eb136c | 181 | +{ |
7f660273 | 182 | + return NULL; |
e9eb136c | 183 | +} |
184 | + | |
7f660273 PZ |
185 | +/* |
186 | + * nm_system_device_has_active_routes | |
187 | + * | |
188 | + * Find out whether the specified device has any routes in the routing | |
189 | + * table. | |
190 | + * | |
191 | + */ | |
192 | +gboolean nm_system_device_has_active_routes (NMDevice *dev) | |
193 | +{ | |
194 | + return FALSE; | |
195 | +} | |
e9eb136c | 196 | + |
197 | +/* | |
198 | + * nm_system_enable_loopback | |
199 | + * | |
200 | + * Bring up the loopback interface | |
201 | + * | |
202 | + */ | |
203 | +void nm_system_enable_loopback (void) | |
204 | +{ | |
205 | + nm_spawn_process ("/sbin/ip link set dev lo up"); | |
206 | + nm_spawn_process ("/sbin/ip addr add 127.0.0.1/8 brd 127.255.255.255 dev lo label loopback"); | |
207 | +} | |
208 | + | |
e9eb136c | 209 | +/* |
210 | + * nm_system_delete_default_route | |
211 | + * | |
212 | + * Remove the old default route in preparation for a new one | |
213 | + * | |
214 | + */ | |
215 | +void nm_system_delete_default_route (void) | |
216 | +{ | |
217 | + nm_spawn_process ("/sbin/ip route del default"); | |
218 | +} | |
219 | + | |
e9eb136c | 220 | +/* |
221 | + * nm_system_kill_all_dhcp_daemons | |
222 | + * | |
223 | + * Kill all DHCP daemons currently running, done at startup. | |
224 | + * | |
225 | + */ | |
226 | +void nm_system_kill_all_dhcp_daemons (void) | |
227 | +{ | |
c8c5be70 | 228 | + nm_spawn_process ("/bin/killall -q dhcpcd"); |
e9eb136c | 229 | +} |
230 | + | |
e9eb136c | 231 | +/* |
232 | + * nm_system_update_dns | |
233 | + * | |
234 | + * Make glibc/nscd aware of any changes to the resolv.conf file by | |
235 | + * restarting nscd. | |
236 | + * | |
237 | + */ | |
238 | +void nm_system_update_dns (void) | |
239 | +{ | |
7f660273 | 240 | + /* I'm not running nscd */ |
e9eb136c | 241 | +} |
242 | + | |
e9eb136c | 243 | +/* |
244 | + * nm_system_restart_mdns_responder | |
245 | + * | |
246 | + * Restart the multicast DNS responder so that it knows about new | |
247 | + * network interfaces and IP addresses. | |
248 | + * | |
249 | + */ | |
250 | +void nm_system_restart_mdns_responder (void) | |
251 | +{ | |
7f660273 | 252 | + /* not implemented */ |
e9eb136c | 253 | +} |
254 | + | |
e9eb136c | 255 | +/* |
256 | + * nm_system_device_add_ip6_link_address | |
257 | + * | |
258 | + * Add a default link-local IPv6 address to a device. | |
259 | + * | |
260 | + */ | |
261 | +void nm_system_device_add_ip6_link_address (NMDevice *dev) | |
262 | +{ | |
7f660273 PZ |
263 | + char *buf; |
264 | + struct ether_addr hw_addr; | |
265 | + unsigned char eui[8]; | |
266 | + | |
267 | + nm_device_get_hw_address (dev, &hw_addr); | |
268 | + | |
269 | + memcpy (eui, &(hw_addr.ether_addr_octet), sizeof (hw_addr.ether_addr_octet)); | |
270 | + memmove (eui+5, eui+3, 3); | |
271 | + eui[3] = 0xff; | |
272 | + eui[4] = 0xfe; | |
273 | + eui[0] ^= 2; | |
274 | + | |
275 | + /* Add the default link-local IPv6 address to a device */ | |
276 | + buf = g_strdup_printf ("/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s", | |
277 | + eui[0], eui[1], eui[2], eui[3], eui[4], eui[5], | |
278 | + eui[6], eui[7], nm_device_get_iface (dev)); | |
279 | + nm_spawn_process (buf); | |
280 | + g_free (buf); | |
e9eb136c | 281 | +} |
282 | + | |
7f660273 PZ |
283 | +/* |
284 | + * nm_system_device_add_route_via_device_with_iface | |
285 | + * | |
286 | + * Add route to the given device | |
287 | + * | |
288 | + */ | |
289 | +void nm_system_device_add_route_via_device_with_iface (const char *iface, const char *route) | |
290 | +{ | |
291 | + char *buf; | |
292 | + | |
293 | + g_return_if_fail (iface != NULL); | |
294 | + | |
295 | + /* Add default gateway */ | |
296 | + buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface); | |
297 | + nm_spawn_process (buf); | |
298 | + g_free (buf); | |
299 | +} | |
e9eb136c | 300 | + |
301 | +/* | |
302 | + * nm_system_device_add_default_route_via_device | |
303 | + * | |
304 | + * Flush all routes associated with a network device | |
305 | + * | |
306 | + */ | |
307 | +void nm_system_device_add_default_route_via_device (NMDevice *dev) | |
308 | +{ | |
7f660273 PZ |
309 | + g_return_if_fail (dev != NULL); |
310 | + | |
311 | + /* Not really applicable for test devices */ | |
312 | + if (nm_device_is_test_device (dev)) | |
313 | + return; | |
314 | + | |
315 | + nm_system_device_add_default_route_via_device_with_iface (nm_device_get_iface (dev)); | |
316 | +} | |
317 | + | |
318 | +/* | |
319 | + * * nm_system_device_add_default_route_via_device_with_iface | |
320 | + * * | |
321 | + * * Add default route to the given device | |
322 | + * * | |
323 | + * */ | |
324 | +void nm_system_device_add_default_route_via_device_with_iface (const char *iface) | |
325 | +{ | |
326 | + char *buf; | |
327 | + | |
328 | + g_return_if_fail (iface != NULL); | |
329 | + | |
330 | + /* Add default gateway */ | |
331 | + buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface); | |
332 | + nm_spawn_process (buf); | |
333 | + g_free (buf); | |
e9eb136c | 334 | +} |
7f660273 | 335 | + |
e9eb136c | 336 | +/* |
337 | + * nm_system_flush_loopback_routes | |
338 | + * | |
339 | + * Flush all routes associated with the loopback device, because it | |
340 | + * sometimes gets the first route for ZeroConf/Link-Local traffic. | |
341 | + * | |
342 | + */ | |
343 | +void nm_system_flush_loopback_routes (void) | |
344 | +{ | |
7f660273 PZ |
345 | + /* Remove routing table entries for lo */ |
346 | + nm_spawn_process ("/sbin/ip route flush dev lo"); | |
e9eb136c | 347 | +} |
348 | + | |
e9eb136c | 349 | +/* |
350 | + * nm_system_flush_arp_cache | |
351 | + * | |
352 | + * Flush all entries in the arp cache. | |
353 | + * | |
354 | + */ | |
355 | +void nm_system_flush_arp_cache (void) | |
356 | +{ | |
7f660273 PZ |
357 | + nm_spawn_process ("/sbin/ip neigh flush all"); |
358 | +} | |
359 | + | |
360 | +void nm_system_deactivate_all_dialup (GSList *list) | |
361 | +{ | |
362 | +} | |
363 | + | |
364 | +gboolean nm_system_activate_dialup (GSList *list, const char *dialup) | |
365 | +{ | |
366 | + return FALSE; | |
367 | +} | |
368 | + | |
369 | +/* | |
370 | + * nm_system_get_dialup_config | |
371 | + * | |
372 | + * Enumerate dial up options on this system, allocate NMDialUpConfig's, | |
373 | + * fill them out, and return. | |
374 | + * | |
375 | + */ | |
376 | +GSList * nm_system_get_dialup_config (void) | |
377 | +{ | |
378 | + return NULL; | |
379 | +} | |
380 | + | |
381 | +void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data) | |
382 | +{ | |
383 | +} | |
384 | + | |
385 | +NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev) | |
386 | +{ | |
387 | + return NULL; | |
388 | +} | |
389 | + | |
390 | +gboolean nm_system_device_get_use_dhcp (NMDevice *dev) | |
391 | +{ | |
392 | + return TRUE; | |
e9eb136c | 393 | +} |
394 | + |