]>
Commit | Line | Data |
---|---|---|
d3bb33da | 1 | diff -urN NetworkManager-0.6.2-o/configure.in NetworkManager-0.6.2/configure.in |
2 | --- NetworkManager-0.6.2-o/configure.in 2006-03-27 09:05:17.000000000 -0700 | |
3 | +++ NetworkManager-0.6.2/configure.in 2006-04-03 13:39:20.000000000 -0600 | |
7f660273 | 4 | @@ -60,7 +60,7 @@ |
e9eb136c | 5 | exit 1 |
6 | else | |
7 | case $with_distro in | |
ed122f58 PZ |
8 | - redhat|suse|gentoo|debian|slackware|arch) ;; |
9 | + redhat|suse|gentoo|debian|slackware|arch|pld) ;; | |
e9eb136c | 10 | *) |
11 | echo "Your distribution (${with_distro}) is not yet supported! (patches welcome)" | |
12 | exit 1 | |
d3bb33da | 13 | @@ -72,6 +72,7 @@ |
e9eb136c | 14 | AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) |
e9eb136c | 15 | AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware) |
ed122f58 | 16 | AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch) |
e9eb136c | 17 | +AM_CONDITIONAL(TARGET_PLD, test x"$with_distro" = xpld) |
18 | ||
d3bb33da | 19 | AC_MSG_CHECKING([for wireless-tools >= 28pre9]) |
20 | AC_TRY_COMPILE([#include <iwlib.h>], | |
21 | diff -urN NetworkManager-0.6.2-o/src/backends/Makefile.am NetworkManager-0.6.2/src/backends/Makefile.am | |
22 | --- NetworkManager-0.6.2-o/src/backends/Makefile.am 2006-03-09 13:52:16.000000000 -0700 | |
23 | +++ NetworkManager-0.6.2/src/backends/Makefile.am 2006-04-03 13:39:20.000000000 -0600 | |
24 | @@ -38,6 +38,10 @@ | |
e9eb136c | 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) \ | |
d3bb33da | 35 | diff -urN NetworkManager-0.6.2-o/src/backends/NetworkManagerPLD.c NetworkManager-0.6.2/src/backends/NetworkManagerPLD.c |
36 | --- NetworkManager-0.6.2-o/src/backends/NetworkManagerPLD.c 1969-12-31 17:00:00.000000000 -0700 | |
37 | +++ NetworkManager-0.6.2/src/backends/NetworkManagerPLD.c 2006-04-03 13:39:45.000000000 -0600 | |
38 | @@ -0,0 +1,430 @@ | |
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" | |
d3bb33da | 68 | +#include "nm-device.h" |
69 | +#include "nm-device-802-3-ethernet.h" | |
70 | +#include "nm-device-802-11-wireless.h" | |
71 | +#include "nm-utils.h" | |
e9eb136c | 72 | + |
73 | +/* | |
74 | + * PLD specific backend based on Slackware backend. | |
75 | + */ | |
76 | + | |
77 | +/* | |
78 | + * nm_system_init | |
79 | + * | |
80 | + * Initializes the distribution-specific system backend | |
81 | + * | |
82 | + */ | |
83 | +void nm_system_init (void) | |
84 | +{ | |
7f660273 | 85 | + nm_system_kill_all_dhcp_daemons(); |
e9eb136c | 86 | +} |
87 | + | |
88 | +/* | |
89 | + * nm_system_device_flush_routes | |
90 | + * | |
91 | + * Flush all routes associated with a network device | |
92 | + * | |
93 | + */ | |
94 | +void nm_system_device_flush_routes (NMDevice *dev) | |
95 | +{ | |
96 | + char buf [100]; | |
97 | + | |
98 | + g_return_if_fail (dev != NULL); | |
99 | + | |
100 | + /* Not really applicable for test devices */ | |
101 | + if (nm_device_is_test_device (dev)) | |
102 | + return; | |
103 | + | |
7f660273 PZ |
104 | + nm_system_device_flush_routes_with_iface (nm_device_get_iface (dev)); |
105 | +} | |
106 | + | |
107 | +/* | |
108 | + * nm_system_device_flush_routes_with_iface | |
109 | + * | |
110 | + * Flush all routes associated with a network device | |
111 | + * | |
112 | + */ | |
113 | +void nm_system_device_flush_routes_with_iface (const char *iface) | |
114 | +{ | |
115 | + char *buf; | |
116 | + | |
117 | + g_return_if_fail (iface != NULL); | |
118 | + | |
e9eb136c | 119 | + /* Remove routing table entries */ |
7f660273 | 120 | + buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface); |
e9eb136c | 121 | + nm_spawn_process (buf); |
7f660273 | 122 | + g_free (buf); |
e9eb136c | 123 | +} |
124 | + | |
e9eb136c | 125 | +/* |
126 | + * nm_system_device_flush_addresses | |
127 | + * | |
128 | + * Flush all network addresses associated with a network device | |
129 | + * | |
130 | + */ | |
131 | +void nm_system_device_flush_addresses (NMDevice *dev) | |
132 | +{ | |
133 | + char buf [100]; | |
134 | + | |
135 | + g_return_if_fail (dev != NULL); | |
136 | + | |
137 | + /* Not really applicable for test devices */ | |
138 | + if (nm_device_is_test_device (dev)) | |
139 | + return; | |
7f660273 PZ |
140 | + nm_system_device_flush_addresses_with_iface (nm_device_get_iface (dev)); |
141 | +} | |
142 | + | |
143 | +/* | |
144 | + * nm_system_device_flush_addresses_with_iface | |
145 | + * | |
146 | + * Flush all network addresses associated with a network device | |
147 | + * | |
148 | + */ | |
149 | +void nm_system_device_flush_addresses_with_iface (const char *iface) | |
150 | +{ | |
151 | + char *buf; | |
152 | + | |
153 | + g_return_if_fail (iface != NULL); | |
e9eb136c | 154 | + |
155 | + /* Remove all IP addresses for a device */ | |
7f660273 | 156 | + buf = g_strdup_printf ("/sbin/ip addr flush dev %s", iface); |
e9eb136c | 157 | + nm_spawn_process (buf); |
7f660273 | 158 | + g_free (buf); |
e9eb136c | 159 | +} |
160 | + | |
e9eb136c | 161 | +/* |
162 | + * nm_system_device_setup_static_ip4_config | |
163 | + * | |
164 | + * Set up the device with a particular IPv4 address/netmask/gateway. | |
165 | + * | |
166 | + * Returns: TRUE on success | |
167 | + * FALSE on error | |
168 | + * | |
169 | + */ | |
170 | +gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev) | |
171 | +{ | |
172 | + syslog (LOG_WARNING, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n"); | |
173 | +} | |
174 | + | |
e9eb136c | 175 | +/* |
7f660273 | 176 | + * nm_system_device_get_system_config |
e9eb136c | 177 | + * |
178 | + * Retrieve any relevant configuration info for a particular device | |
179 | + * from the system network configuration information. Clear out existing | |
180 | + * info before setting stuff too. | |
181 | + * | |
182 | + */ | |
d3bb33da | 183 | +void *nm_system_device_get_system_config (NMDevice *dev, struct NMData *data) |
e9eb136c | 184 | +{ |
7f660273 | 185 | + return NULL; |
e9eb136c | 186 | +} |
187 | + | |
7f660273 PZ |
188 | +/* |
189 | + * nm_system_device_has_active_routes | |
190 | + * | |
191 | + * Find out whether the specified device has any routes in the routing | |
192 | + * table. | |
193 | + * | |
194 | + */ | |
195 | +gboolean nm_system_device_has_active_routes (NMDevice *dev) | |
196 | +{ | |
197 | + return FALSE; | |
198 | +} | |
e9eb136c | 199 | + |
200 | +/* | |
201 | + * nm_system_enable_loopback | |
202 | + * | |
203 | + * Bring up the loopback interface | |
204 | + * | |
205 | + */ | |
206 | +void nm_system_enable_loopback (void) | |
207 | +{ | |
208 | + nm_spawn_process ("/sbin/ip link set dev lo up"); | |
209 | + nm_spawn_process ("/sbin/ip addr add 127.0.0.1/8 brd 127.255.255.255 dev lo label loopback"); | |
210 | +} | |
211 | + | |
e9eb136c | 212 | +/* |
213 | + * nm_system_delete_default_route | |
214 | + * | |
215 | + * Remove the old default route in preparation for a new one | |
216 | + * | |
217 | + */ | |
218 | +void nm_system_delete_default_route (void) | |
219 | +{ | |
220 | + nm_spawn_process ("/sbin/ip route del default"); | |
221 | +} | |
222 | + | |
e9eb136c | 223 | +/* |
224 | + * nm_system_kill_all_dhcp_daemons | |
225 | + * | |
226 | + * Kill all DHCP daemons currently running, done at startup. | |
227 | + * | |
228 | + */ | |
229 | +void nm_system_kill_all_dhcp_daemons (void) | |
230 | +{ | |
c8c5be70 | 231 | + nm_spawn_process ("/bin/killall -q dhcpcd"); |
e9eb136c | 232 | +} |
233 | + | |
e9eb136c | 234 | +/* |
235 | + * nm_system_update_dns | |
236 | + * | |
237 | + * Make glibc/nscd aware of any changes to the resolv.conf file by | |
238 | + * restarting nscd. | |
239 | + * | |
240 | + */ | |
241 | +void nm_system_update_dns (void) | |
242 | +{ | |
7f660273 | 243 | + /* I'm not running nscd */ |
e9eb136c | 244 | +} |
245 | + | |
e9eb136c | 246 | +/* |
247 | + * nm_system_restart_mdns_responder | |
248 | + * | |
249 | + * Restart the multicast DNS responder so that it knows about new | |
250 | + * network interfaces and IP addresses. | |
251 | + * | |
252 | + */ | |
253 | +void nm_system_restart_mdns_responder (void) | |
254 | +{ | |
7f660273 | 255 | + /* not implemented */ |
e9eb136c | 256 | +} |
257 | + | |
e9eb136c | 258 | +/* |
259 | + * nm_system_device_add_ip6_link_address | |
260 | + * | |
261 | + * Add a default link-local IPv6 address to a device. | |
262 | + * | |
263 | + */ | |
264 | +void nm_system_device_add_ip6_link_address (NMDevice *dev) | |
265 | +{ | |
7f660273 PZ |
266 | + char *buf; |
267 | + struct ether_addr hw_addr; | |
268 | + unsigned char eui[8]; | |
269 | + | |
d3bb33da | 270 | + if (nm_device_is_802_3_ethernet (dev)) |
271 | + nm_device_802_3_ethernet_get_address (NM_DEVICE_802_3_ETHERNET (dev), &hw_addr); | |
272 | + else if (nm_device_is_802_11_wireless (dev)) | |
273 | + nm_device_802_11_wireless_get_address (NM_DEVICE_802_11_WIRELESS (dev), &hw_addr); | |
7f660273 PZ |
274 | + |
275 | + memcpy (eui, &(hw_addr.ether_addr_octet), sizeof (hw_addr.ether_addr_octet)); | |
276 | + memmove (eui+5, eui+3, 3); | |
277 | + eui[3] = 0xff; | |
278 | + eui[4] = 0xfe; | |
279 | + eui[0] ^= 2; | |
280 | + | |
281 | + /* Add the default link-local IPv6 address to a device */ | |
282 | + buf = g_strdup_printf ("/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s", | |
283 | + eui[0], eui[1], eui[2], eui[3], eui[4], eui[5], | |
284 | + eui[6], eui[7], nm_device_get_iface (dev)); | |
285 | + nm_spawn_process (buf); | |
286 | + g_free (buf); | |
e9eb136c | 287 | +} |
288 | + | |
7f660273 PZ |
289 | +/* |
290 | + * nm_system_device_add_route_via_device_with_iface | |
291 | + * | |
292 | + * Add route to the given device | |
293 | + * | |
294 | + */ | |
295 | +void nm_system_device_add_route_via_device_with_iface (const char *iface, const char *route) | |
296 | +{ | |
297 | + char *buf; | |
298 | + | |
299 | + g_return_if_fail (iface != NULL); | |
300 | + | |
301 | + /* Add default gateway */ | |
302 | + buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface); | |
303 | + nm_spawn_process (buf); | |
304 | + g_free (buf); | |
305 | +} | |
e9eb136c | 306 | + |
307 | +/* | |
308 | + * nm_system_device_add_default_route_via_device | |
309 | + * | |
310 | + * Flush all routes associated with a network device | |
311 | + * | |
312 | + */ | |
313 | +void nm_system_device_add_default_route_via_device (NMDevice *dev) | |
314 | +{ | |
7f660273 PZ |
315 | + g_return_if_fail (dev != NULL); |
316 | + | |
317 | + /* Not really applicable for test devices */ | |
318 | + if (nm_device_is_test_device (dev)) | |
319 | + return; | |
320 | + | |
321 | + nm_system_device_add_default_route_via_device_with_iface (nm_device_get_iface (dev)); | |
322 | +} | |
323 | + | |
324 | +/* | |
325 | + * * nm_system_device_add_default_route_via_device_with_iface | |
326 | + * * | |
327 | + * * Add default route to the given device | |
328 | + * * | |
329 | + * */ | |
330 | +void nm_system_device_add_default_route_via_device_with_iface (const char *iface) | |
331 | +{ | |
332 | + char *buf; | |
333 | + | |
334 | + g_return_if_fail (iface != NULL); | |
335 | + | |
336 | + /* Add default gateway */ | |
337 | + buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface); | |
338 | + nm_spawn_process (buf); | |
339 | + g_free (buf); | |
e9eb136c | 340 | +} |
7f660273 | 341 | + |
e9eb136c | 342 | +/* |
343 | + * nm_system_flush_loopback_routes | |
344 | + * | |
345 | + * Flush all routes associated with the loopback device, because it | |
346 | + * sometimes gets the first route for ZeroConf/Link-Local traffic. | |
347 | + * | |
348 | + */ | |
349 | +void nm_system_flush_loopback_routes (void) | |
350 | +{ | |
7f660273 PZ |
351 | + /* Remove routing table entries for lo */ |
352 | + nm_spawn_process ("/sbin/ip route flush dev lo"); | |
e9eb136c | 353 | +} |
354 | + | |
e9eb136c | 355 | +/* |
356 | + * nm_system_flush_arp_cache | |
357 | + * | |
358 | + * Flush all entries in the arp cache. | |
359 | + * | |
360 | + */ | |
361 | +void nm_system_flush_arp_cache (void) | |
362 | +{ | |
7f660273 PZ |
363 | + nm_spawn_process ("/sbin/ip neigh flush all"); |
364 | +} | |
365 | + | |
366 | +void nm_system_deactivate_all_dialup (GSList *list) | |
367 | +{ | |
368 | +} | |
369 | + | |
d3bb33da | 370 | +gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup) |
371 | +{ | |
372 | + return FALSE; | |
373 | +} | |
374 | + | |
7f660273 PZ |
375 | +gboolean nm_system_activate_dialup (GSList *list, const char *dialup) |
376 | +{ | |
377 | + return FALSE; | |
378 | +} | |
379 | + | |
380 | +/* | |
381 | + * nm_system_get_dialup_config | |
382 | + * | |
383 | + * Enumerate dial up options on this system, allocate NMDialUpConfig's, | |
384 | + * fill them out, and return. | |
385 | + * | |
386 | + */ | |
387 | +GSList * nm_system_get_dialup_config (void) | |
388 | +{ | |
389 | + return NULL; | |
390 | +} | |
391 | + | |
392 | +void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data) | |
393 | +{ | |
394 | +} | |
395 | + | |
396 | +NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev) | |
397 | +{ | |
398 | + return NULL; | |
399 | +} | |
400 | + | |
401 | +gboolean nm_system_device_get_use_dhcp (NMDevice *dev) | |
402 | +{ | |
403 | + return TRUE; | |
e9eb136c | 404 | +} |
405 | + | |
d3bb33da | 406 | +/* |
407 | + * nm_system_device_get_disabled | |
408 | + * | |
409 | + * Return whether the distro-specific system config tells us to use | |
410 | + * dhcp for this device. | |
411 | + * | |
412 | + */ | |
413 | +gboolean nm_system_device_get_disabled (NMDevice *dev) | |
414 | +{ | |
415 | + return FALSE; | |
416 | +} | |
417 | + | |
418 | +/* | |
419 | + * nm_system_activate_nis | |
420 | + * | |
421 | + * set up the nis domain and write a yp.conf | |
422 | + * | |
423 | + */ | |
424 | +void nm_system_activate_nis (NMIP4Config *config) | |
425 | +{ | |
426 | +} | |
427 | + | |
428 | +/* | |
429 | + * nm_system_shutdown_nis | |
430 | + * | |
431 | + * shutdown ypbind | |
432 | + * | |
433 | + */ | |
434 | +void nm_system_shutdown_nis (void) | |
435 | +{ | |
436 | +} | |
437 | + | |
438 | +/* | |
439 | + * nm_system_set_hostname | |
440 | + * | |
441 | + * set the hostname | |
442 | + * | |
443 | + */ | |
444 | +void nm_system_set_hostname (NMIP4Config *config) | |
445 | +{ | |
446 | +} | |
447 | + | |
448 | +/* | |
449 | + * nm_system_should_modify_resolv_conf | |
450 | + * | |
451 | + * Can NM update resolv.conf, or is it locked down? | |
452 | + */ | |
453 | +gboolean nm_system_should_modify_resolv_conf (void) | |
454 | +{ | |
455 | + return TRUE; | |
456 | +} | |
457 | + | |
458 | + | |
459 | +/* | |
460 | + * nm_system_get_mtu | |
461 | + * | |
462 | + * Return a user-provided or system-mandated MTU for this device or zero if | |
463 | + * no such MTU is provided. | |
464 | + */ | |
465 | +unsigned int nm_system_get_mtu (NMDevice *dev) | |
466 | +{ | |
467 | + return 0; | |
468 | +} |