]> git.pld-linux.org Git - packages/NetworkManager.git/blob - NetworkManager-pld.patch
- 0.6.5
[packages/NetworkManager.git] / NetworkManager-pld.patch
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
4 @@ -60,7 +60,7 @@
5         exit 1
6  else
7         case $with_distro in
8 -               redhat|suse|gentoo|debian|slackware|arch) ;;
9 +               redhat|suse|gentoo|debian|slackware|arch|pld) ;;
10                 *)
11                         echo "Your distribution (${with_distro}) is not yet supported!  (patches welcome)"
12                         exit 1
13 @@ -72,6 +72,7 @@
14  AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
15  AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
16  AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
17 +AM_CONDITIONAL(TARGET_PLD, test x"$with_distro" = xpld)
18  
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 @@
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)                               \
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,426 @@
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>
60 + * (C) Copyright 2005 Patryk Zawadzki <patrys@pld-linux.org>
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 "nm-device.h"
69 +#include "nm-device-802-3-ethernet.h"
70 +#include "nm-device-802-11-wireless.h"
71 +#include "nm-utils.h"
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 +{
85 +        nm_system_kill_all_dhcp_daemons();
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 +
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 +
119 +       /* Remove routing table entries */
120 +       buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface);
121 +       nm_spawn_process (buf);
122 +       g_free (buf);
123 +}
124 +
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;
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);
154 +
155 +       /* Remove all IP addresses for a device */
156 +       buf = g_strdup_printf ("/sbin/ip addr flush dev %s", iface);
157 +       nm_spawn_process (buf);
158 +       g_free (buf);
159 +}
160 +
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 +
175 +/*
176 + * nm_system_device_get_system_config
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 + */
183 +void *nm_system_device_get_system_config (NMDevice *dev, struct NMData *data)
184 +{
185 +       return NULL;
186 +}
187 +
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 +}
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 +
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 +
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 +{
231 +       nm_spawn_process ("/bin/killall -q dhcpcd");
232 +}
233 +
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 +{
243 +       /* I'm not running nscd */
244 +}
245 +
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 +{
255 +       /* not implemented */
256 +}
257 +
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 +{
266 +       char *buf;
267 +       struct ether_addr hw_addr;
268 +       unsigned char eui[8];
269 +
270 +       nm_device_get_hw_address (dev, &hw_addr);
271 +       memcpy (eui, &(hw_addr.ether_addr_octet), sizeof (hw_addr.ether_addr_octet));
272 +       memmove (eui+5, eui+3, 3);
273 +       eui[3] = 0xff;
274 +       eui[4] = 0xfe;
275 +       eui[0] ^= 2;
276 +
277 +       /* Add the default link-local IPv6 address to a device */
278 +       buf = g_strdup_printf ("/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
279 +                                       eui[0], eui[1], eui[2], eui[3], eui[4], eui[5],
280 +                                       eui[6], eui[7], nm_device_get_iface (dev));
281 +       nm_spawn_process (buf);
282 +       g_free (buf);
283 +}
284 +
285 +/*
286 + * nm_system_device_add_route_via_device_with_iface
287 + *
288 + * Add route to the given device
289 + *
290 + */
291 +void nm_system_device_add_route_via_device_with_iface (const char *iface, const char *route)
292 +{
293 +       char    *buf;
294 +
295 +       g_return_if_fail (iface != NULL);
296 +
297 +       /* Add default gateway */
298 +       buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface);
299 +       nm_spawn_process (buf);
300 +       g_free (buf);
301 +}
302 +
303 +/*
304 + * nm_system_device_add_default_route_via_device
305 + *
306 + * Flush all routes associated with a network device
307 + *
308 + */
309 +void nm_system_device_add_default_route_via_device (NMDevice *dev)
310 +{
311 +       g_return_if_fail (dev != NULL);
312 +
313 +       /* Not really applicable for test devices */
314 +       if (nm_device_is_test_device (dev))
315 +               return;
316 +
317 +       nm_system_device_add_default_route_via_device_with_iface (nm_device_get_iface (dev));
318 +}
319 +
320 +/*
321 + *  * nm_system_device_add_default_route_via_device_with_iface
322 + *   *
323 + *    * Add default route to the given device
324 + *     *
325 + *      */
326 +void nm_system_device_add_default_route_via_device_with_iface (const char *iface)
327 +{
328 +       char    *buf;
329 +
330 +       g_return_if_fail (iface != NULL);
331 +
332 +       /* Add default gateway */
333 +       buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface);
334 +       nm_spawn_process (buf);
335 +       g_free (buf);
336 +}
337 +
338 +/*
339 + * nm_system_flush_loopback_routes
340 + *
341 + * Flush all routes associated with the loopback device, because it
342 + * sometimes gets the first route for ZeroConf/Link-Local traffic.
343 + *
344 + */
345 +void nm_system_flush_loopback_routes (void)
346 +{
347 +       /* Remove routing table entries for lo */
348 +       nm_spawn_process ("/sbin/ip route flush dev lo");
349 +}
350 +
351 +/*
352 + * nm_system_flush_arp_cache
353 + *
354 + * Flush all entries in the arp cache.
355 + *
356 + */
357 +void nm_system_flush_arp_cache (void)
358 +{
359 +       nm_spawn_process ("/sbin/ip neigh flush all");
360 +}
361 +
362 +void nm_system_deactivate_all_dialup (GSList *list)
363 +{
364 +}
365 +
366 +gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
367 +{
368 +       return FALSE;
369 +}
370 +
371 +gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
372 +{
373 +       return FALSE;
374 +}
375 +
376 +/*
377 + * nm_system_get_dialup_config
378 + *
379 + * Enumerate dial up options on this system, allocate NMDialUpConfig's,
380 + * fill them out, and return.
381 + *
382 + */
383 +GSList * nm_system_get_dialup_config (void)
384 +{
385 +       return NULL;
386 +}
387 +
388 +void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data)
389 +{
390 +}
391 +
392 +NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
393 +{
394 +               return NULL;
395 +}
396 +
397 +gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
398 +{
399 +               return TRUE;
400 +}
401 +
402 +/*
403 + * nm_system_device_get_disabled
404 + *
405 + * Return whether the distro-specific system config tells us to use
406 + * dhcp for this device.
407 + *
408 + */
409 +gboolean nm_system_device_get_disabled (NMDevice *dev)
410 +{
411 +       return FALSE;
412 +}
413 +
414 +/*
415 + * nm_system_activate_nis
416 + *
417 + * set up the nis domain and write a yp.conf
418 + *
419 + */
420 +void nm_system_activate_nis (NMIP4Config *config)
421 +{
422 +}
423 +
424 +/*
425 + * nm_system_shutdown_nis
426 + *
427 + * shutdown ypbind
428 + *
429 + */
430 +void nm_system_shutdown_nis (void)
431 +{
432 +}
433 +
434 +/*
435 + * nm_system_set_hostname
436 + *
437 + * set the hostname
438 + *
439 + */
440 +void nm_system_set_hostname (NMIP4Config *config)
441 +{
442 +}
443 +
444 +/*
445 + * nm_system_should_modify_resolv_conf
446 + *
447 + * Can NM update resolv.conf, or is it locked down?
448 + */
449 +gboolean nm_system_should_modify_resolv_conf (void)
450 +{
451 +       return TRUE;
452 +}
453 +
454 +
455 +/*
456 + * nm_system_get_mtu
457 + *
458 + * Return a user-provided or system-mandated MTU for this device or zero if
459 + * no such MTU is provided.
460 + */
461 +unsigned int nm_system_get_mtu (NMDevice *dev)
462 +{
463 +       return 0;
464 +}
This page took 0.123947 seconds and 4 git commands to generate.