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
8 - redhat|suse|gentoo|debian|slackware|arch) ;;
9 + redhat|suse|gentoo|debian|slackware|arch|pld) ;;
11 echo "Your distribution (${with_distro}) is not yet supported! (patches welcome)"
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)
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
25 libnmbackend_la_SOURCES += NetworkManagerSlackware.c
29 +libnmbackend_la_SOURCES += NetworkManagerPLD.c
32 libnmbackend_la_LIBADD = $(DBUS_LIBS) $(GTHREAD_LIBS)
33 libnmbackend_la_CPPFLAGS = $(DBUS_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
39 +/* NetworkManager -- Network link manager
41 + * Narayan Newton <narayan_newton@yahoo.com>
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.
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.
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.
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>
64 +#include <sys/types.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"
74 + * PLD specific backend based on Slackware backend.
80 + * Initializes the distribution-specific system backend
83 +void nm_system_init (void)
85 + nm_system_kill_all_dhcp_daemons();
89 + * nm_system_device_flush_routes
91 + * Flush all routes associated with a network device
94 +void nm_system_device_flush_routes (NMDevice *dev)
98 + g_return_if_fail (dev != NULL);
100 + /* Not really applicable for test devices */
101 + if (nm_device_is_test_device (dev))
104 + nm_system_device_flush_routes_with_iface (nm_device_get_iface (dev));
108 + * nm_system_device_flush_routes_with_iface
110 + * Flush all routes associated with a network device
113 +void nm_system_device_flush_routes_with_iface (const char *iface)
117 + g_return_if_fail (iface != NULL);
119 + /* Remove routing table entries */
120 + buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface);
121 + nm_spawn_process (buf);
126 + * nm_system_device_flush_addresses
128 + * Flush all network addresses associated with a network device
131 +void nm_system_device_flush_addresses (NMDevice *dev)
135 + g_return_if_fail (dev != NULL);
137 + /* Not really applicable for test devices */
138 + if (nm_device_is_test_device (dev))
140 + nm_system_device_flush_addresses_with_iface (nm_device_get_iface (dev));
144 + * nm_system_device_flush_addresses_with_iface
146 + * Flush all network addresses associated with a network device
149 +void nm_system_device_flush_addresses_with_iface (const char *iface)
153 + g_return_if_fail (iface != NULL);
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);
162 + * nm_system_device_setup_static_ip4_config
164 + * Set up the device with a particular IPv4 address/netmask/gateway.
166 + * Returns: TRUE on success
170 +gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
172 + syslog (LOG_WARNING, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
176 + * nm_system_device_get_system_config
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.
183 +void *nm_system_device_get_system_config (NMDevice *dev, struct NMData *data)
189 + * nm_system_device_has_active_routes
191 + * Find out whether the specified device has any routes in the routing
195 +gboolean nm_system_device_has_active_routes (NMDevice *dev)
201 + * nm_system_enable_loopback
203 + * Bring up the loopback interface
206 +void nm_system_enable_loopback (void)
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");
213 + * nm_system_delete_default_route
215 + * Remove the old default route in preparation for a new one
218 +void nm_system_delete_default_route (void)
220 + nm_spawn_process ("/sbin/ip route del default");
224 + * nm_system_kill_all_dhcp_daemons
226 + * Kill all DHCP daemons currently running, done at startup.
229 +void nm_system_kill_all_dhcp_daemons (void)
231 + nm_spawn_process ("/bin/killall -q dhcpcd");
235 + * nm_system_update_dns
237 + * Make glibc/nscd aware of any changes to the resolv.conf file by
241 +void nm_system_update_dns (void)
243 + /* I'm not running nscd */
247 + * nm_system_restart_mdns_responder
249 + * Restart the multicast DNS responder so that it knows about new
250 + * network interfaces and IP addresses.
253 +void nm_system_restart_mdns_responder (void)
255 + /* not implemented */
259 + * nm_system_device_add_ip6_link_address
261 + * Add a default link-local IPv6 address to a device.
264 +void nm_system_device_add_ip6_link_address (NMDevice *dev)
267 + struct ether_addr hw_addr;
268 + unsigned char eui[8];
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);
275 + memcpy (eui, &(hw_addr.ether_addr_octet), sizeof (hw_addr.ether_addr_octet));
276 + memmove (eui+5, eui+3, 3);
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);
290 + * nm_system_device_add_route_via_device_with_iface
292 + * Add route to the given device
295 +void nm_system_device_add_route_via_device_with_iface (const char *iface, const char *route)
299 + g_return_if_fail (iface != NULL);
301 + /* Add default gateway */
302 + buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface);
303 + nm_spawn_process (buf);
308 + * nm_system_device_add_default_route_via_device
310 + * Flush all routes associated with a network device
313 +void nm_system_device_add_default_route_via_device (NMDevice *dev)
315 + g_return_if_fail (dev != NULL);
317 + /* Not really applicable for test devices */
318 + if (nm_device_is_test_device (dev))
321 + nm_system_device_add_default_route_via_device_with_iface (nm_device_get_iface (dev));
325 + * * nm_system_device_add_default_route_via_device_with_iface
327 + * * Add default route to the given device
330 +void nm_system_device_add_default_route_via_device_with_iface (const char *iface)
334 + g_return_if_fail (iface != NULL);
336 + /* Add default gateway */
337 + buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface);
338 + nm_spawn_process (buf);
343 + * nm_system_flush_loopback_routes
345 + * Flush all routes associated with the loopback device, because it
346 + * sometimes gets the first route for ZeroConf/Link-Local traffic.
349 +void nm_system_flush_loopback_routes (void)
351 + /* Remove routing table entries for lo */
352 + nm_spawn_process ("/sbin/ip route flush dev lo");
356 + * nm_system_flush_arp_cache
358 + * Flush all entries in the arp cache.
361 +void nm_system_flush_arp_cache (void)
363 + nm_spawn_process ("/sbin/ip neigh flush all");
366 +void nm_system_deactivate_all_dialup (GSList *list)
370 +gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
375 +gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
381 + * nm_system_get_dialup_config
383 + * Enumerate dial up options on this system, allocate NMDialUpConfig's,
384 + * fill them out, and return.
387 +GSList * nm_system_get_dialup_config (void)
392 +void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data)
396 +NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
401 +gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
407 + * nm_system_device_get_disabled
409 + * Return whether the distro-specific system config tells us to use
410 + * dhcp for this device.
413 +gboolean nm_system_device_get_disabled (NMDevice *dev)
419 + * nm_system_activate_nis
421 + * set up the nis domain and write a yp.conf
424 +void nm_system_activate_nis (NMIP4Config *config)
429 + * nm_system_shutdown_nis
434 +void nm_system_shutdown_nis (void)
439 + * nm_system_set_hostname
444 +void nm_system_set_hostname (NMIP4Config *config)
449 + * nm_system_should_modify_resolv_conf
451 + * Can NM update resolv.conf, or is it locked down?
453 +gboolean nm_system_should_modify_resolv_conf (void)
460 + * nm_system_get_mtu
462 + * Return a user-provided or system-mandated MTU for this device or zero if
463 + * no such MTU is provided.
465 +unsigned int nm_system_get_mtu (NMDevice *dev)