]>
Commit | Line | Data |
---|---|---|
1 | diff -urN NetworkManager-0.6.5.orig/configure.in NetworkManager-0.6.5/configure.in | |
2 | --- NetworkManager-0.6.5.orig/configure.in 2007-07-23 19:44:13.000000000 +0200 | |
3 | +++ NetworkManager-0.6.5/configure.in 2007-07-23 20:09:37.000000000 +0200 | |
4 | @@ -72,7 +72,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 | @@ -85,6 +85,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.5.orig/src/backends/Makefile.am NetworkManager-0.6.5/src/backends/Makefile.am | |
22 | --- NetworkManager-0.6.5.orig/src/backends/Makefile.am 2007-07-23 19:44:13.000000000 +0200 | |
23 | +++ NetworkManager-0.6.5/src/backends/Makefile.am 2007-07-23 20:12:37.000000000 +0200 | |
24 | @@ -42,6 +42,12 @@ | |
25 | libnmbackend_la_SOURCES += NetworkManagerArch.c | |
26 | endif | |
27 | ||
28 | +if TARGET_PLD | |
29 | +libnmbackend_la_SOURCES += NetworkManagerPLD.c \ | |
30 | + shvar.c \ | |
31 | + shvar.h | |
32 | +endif | |
33 | + | |
34 | libnmbackend_la_LIBADD = $(DBUS_LIBS) $(GTHREAD_LIBS) | |
35 | libnmbackend_la_CPPFLAGS = $(DBUS_CFLAGS) \ | |
36 | $(GTHREAD_CFLAGS) \ | |
37 | diff -urN NetworkManager-0.6.5.orig/src/backends/NetworkManagerPLD.c NetworkManager-0.6.5/src/backends/NetworkManagerPLD.c | |
38 | --- NetworkManager-0.6.5.orig/src/backends/NetworkManagerPLD.c 1970-01-01 01:00:00.000000000 +0100 | |
39 | +++ NetworkManager-0.6.5/src/backends/NetworkManagerPLD.c 2007-10-29 23:09:06.000000000 +0100 | |
40 | @@ -0,0 +1,694 @@ | |
41 | +/* NetworkManager -- Network link manager | |
42 | + * | |
43 | + * Narayan Newton <narayan_newton@yahoo.com> | |
44 | + * | |
45 | + * This program is free software; you can redistribute it and/or modify | |
46 | + * it under the terms of the GNU General Public License as published by | |
47 | + * the Free Software Foundation; either version 2 of the License, or | |
48 | + * (at your option) any later version. | |
49 | + * | |
50 | + * This program is distributed in the hope that it will be useful, | |
51 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
52 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
53 | + * GNU General Public License for more details. | |
54 | + * | |
55 | + * You should have received a copy of the GNU General Public License | |
56 | + * along with this program; if not, write to the Free Software | |
57 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
58 | + * | |
59 | + * (C) Copyright 2004 RedHat, Inc. | |
60 | + * (C) Copyright 2004 Narayan Newton | |
61 | + * (C) Copyright 2005 wrobell <wrobell@pld-linux.org> | |
62 | + * (C) Copyright 2005 Patryk Zawadzki <patrys@pld-linux.org> | |
63 | + * (C) Copyright 2007 Marcin Banasiak <megabajt@pld-linux.org> | |
64 | + */ | |
65 | + | |
66 | +#include <stdio.h> | |
67 | +#include <sys/types.h> | |
68 | +#include <signal.h> | |
69 | +#include "NetworkManagerSystem.h" | |
70 | +#include "NetworkManagerUtils.h" | |
71 | +#include "nm-device.h" | |
72 | +#include "nm-device-802-3-ethernet.h" | |
73 | +#include "nm-device-802-11-wireless.h" | |
74 | +#include "nm-utils.h" | |
75 | +#include "shvar.h" | |
76 | + | |
77 | +/* | |
78 | + * nm_system_init | |
79 | + * | |
80 | + * Initializes the distribution-specific system backend | |
81 | + * | |
82 | + */ | |
83 | +void nm_system_init (void) | |
84 | +{ | |
85 | + /* Kill any dhclients lying around */ | |
86 | + nm_system_kill_all_dhcp_daemons(); | |
87 | +} | |
88 | + | |
89 | +/* | |
90 | + * nm_system_device_flush_routes | |
91 | + * | |
92 | + * Flush all routes associated with a network device | |
93 | + * | |
94 | + */ | |
95 | +void nm_system_device_flush_routes (NMDevice *dev) | |
96 | +{ | |
97 | + g_return_if_fail (dev != NULL); | |
98 | + | |
99 | + /* Not really applicable for test devices */ | |
100 | + if (nm_device_is_test_device (dev)) | |
101 | + return; | |
102 | + | |
103 | + nm_system_device_flush_routes_with_iface (nm_device_get_iface (dev)); | |
104 | +} | |
105 | + | |
106 | +/* | |
107 | + * nm_system_device_flush_routes_with_iface | |
108 | + * | |
109 | + * Flush all routes associated with a network device | |
110 | + * | |
111 | + */ | |
112 | +void nm_system_device_flush_routes_with_iface (const char *iface) | |
113 | +{ | |
114 | + char *buf; | |
115 | + | |
116 | + g_return_if_fail (iface != NULL); | |
117 | + | |
118 | + /* Remove routing table entries */ | |
119 | + buf = g_strdup_printf (IP_BINARY_PATH" route flush dev %s", iface); | |
120 | + nm_spawn_process (buf); | |
121 | + g_free (buf); | |
122 | +} | |
123 | + | |
124 | +/* | |
125 | + * nm_system_device_flush_addresses | |
126 | + * | |
127 | + * Flush all network addresses associated with a network device | |
128 | + * | |
129 | + */ | |
130 | +void nm_system_device_flush_addresses (NMDevice *dev) | |
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; | |
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); | |
151 | + | |
152 | + /* Remove all IP addresses for a device */ | |
153 | + buf = g_strdup_printf (IP_BINARY_PATH" addr flush dev %s", iface); | |
154 | + nm_spawn_process (buf); | |
155 | + g_free (buf); | |
156 | +} | |
157 | + | |
158 | +typedef struct PLDSystemConfigData | |
159 | +{ | |
160 | + NMIP4Config *config; | |
161 | + gboolean use_dhcp; | |
162 | +} PLDSystemConfigData; | |
163 | + | |
164 | +/* | |
165 | + * set_ip4_config_from_resolv_conf | |
166 | + * | |
167 | + * Add nameservers and search names from a resolv.conf format file. | |
168 | + * | |
169 | + */ | |
170 | +static void set_ip4_config_from_resolv_conf (const char *filename, NMIP4Config *ip4_config) | |
171 | +{ | |
172 | + char *contents = NULL; | |
173 | + char **split_contents = NULL; | |
174 | + int i, len; | |
175 | + | |
176 | + g_return_if_fail (filename != NULL); | |
177 | + g_return_if_fail (ip4_config != NULL); | |
178 | + | |
179 | + if (!g_file_get_contents (filename, &contents, NULL, NULL) || (contents == NULL)) | |
180 | + return; | |
181 | + | |
182 | + if (!(split_contents = g_strsplit (contents, "\n", 0))) | |
183 | + goto out; | |
184 | + | |
185 | + len = g_strv_length (split_contents); | |
186 | + for (i = 0; i < len; i++) | |
187 | + { | |
188 | + char *line = split_contents[i]; | |
189 | + | |
190 | + /* Ignore comments */ | |
191 | + if (!line || (line[0] == ';') || (line[0] == '#')) | |
192 | + continue; | |
193 | + | |
194 | + line = g_strstrip (line); | |
195 | + if ((strncmp (line, "search", 6) == 0) && (strlen (line) > 6)) | |
196 | + { | |
197 | + char *searches = g_strdup (line + 7); | |
198 | + char **split_searches = NULL; | |
199 | + | |
200 | + if (!searches || !strlen (searches)) | |
201 | + continue; | |
202 | + | |
203 | + /* Allow space-separated search domains */ | |
204 | + if ((split_searches = g_strsplit (searches, " ", 0))) | |
205 | + { | |
206 | + int m, srch_len; | |
207 | + | |
208 | + srch_len = g_strv_length (split_searches); | |
209 | + for (m = 0; m < srch_len; m++) | |
210 | + { | |
211 | + if (split_searches[m]) | |
212 | + nm_ip4_config_add_domain (ip4_config, split_searches[m]); | |
213 | + } | |
214 | + g_strfreev (split_searches); | |
215 | + } | |
216 | + else | |
217 | + { | |
218 | + /* Only 1 item, add the whole line */ | |
219 | + nm_ip4_config_add_domain (ip4_config, searches); | |
220 | + } | |
221 | + | |
222 | + g_free (searches); | |
223 | + } | |
224 | + else if ((strncmp (line, "nameserver", 10) == 0) && (strlen (line) > 10)) | |
225 | + { | |
226 | + guint32 addr = (guint32) (inet_addr (line + 11)); | |
227 | + | |
228 | + if (addr != (guint32) -1) | |
229 | + nm_ip4_config_add_nameserver (ip4_config, addr); | |
230 | + } | |
231 | + } | |
232 | + | |
233 | + g_strfreev (split_contents); | |
234 | + | |
235 | +out: | |
236 | + g_free (contents); | |
237 | +} | |
238 | + | |
239 | +/* | |
240 | + * nm_system_device_get_system_config | |
241 | + * | |
242 | + * Retrieve any relevant configuration info for a particular device | |
243 | + * from the system network configuration information. Clear out existing | |
244 | + * info before setting stuff too. | |
245 | + * | |
246 | + */ | |
247 | +void *nm_system_device_get_system_config (NMDevice *dev, NMData *app_data) | |
248 | +{ | |
249 | + char *cfg_file_path = NULL; | |
250 | + shvarFile *file, *gateway_file; | |
251 | + char *buf = NULL; | |
252 | + int i, ip[4], prefix; | |
253 | + PLDSystemConfigData *sys_data = NULL; | |
254 | + gboolean error = FALSE; | |
255 | + | |
256 | + g_return_val_if_fail (dev != NULL, NULL); | |
257 | + | |
258 | + /* PLD stores this information in | |
259 | + * /etc/sysconfig/interfaces/ifcfg-* where * is the interface | |
260 | + * name. | |
261 | + */ | |
262 | + | |
263 | + sys_data = g_malloc0 (sizeof (PLDSystemConfigData)); | |
264 | + sys_data->use_dhcp = TRUE; | |
265 | + | |
266 | + cfg_file_path = g_strdup_printf (SYSCONFDIR"/sysconfig/interfaces/ifcfg-%s", nm_device_get_iface (dev)); | |
267 | + if (!cfg_file_path) | |
268 | + return sys_data; | |
269 | + | |
270 | + if (!(file = svNewFile (cfg_file_path))) | |
271 | + { | |
272 | + g_free (cfg_file_path); | |
273 | + return sys_data; | |
274 | + } | |
275 | + g_free (cfg_file_path); | |
276 | + | |
277 | + /* Make sure this config file is for this device */ | |
278 | + buf = svGetValue (file, "DEVICE"); | |
279 | + if (!buf || strcmp (buf, nm_device_get_iface (dev))) | |
280 | + { | |
281 | + free (buf); | |
282 | + goto out; | |
283 | + } | |
284 | + | |
285 | + if ((buf = svGetValue (file, "BOOTPROTO"))) | |
286 | + { | |
287 | + if (strcasecmp (buf, "dhcp")) | |
288 | + sys_data->use_dhcp = FALSE; | |
289 | + free (buf); | |
290 | + } | |
291 | + | |
292 | + sys_data->config = nm_ip4_config_new (); | |
293 | + | |
294 | + if (!(sys_data->use_dhcp)) | |
295 | + { | |
296 | + if ((buf = svGetValue (file, "IPADDR"))) | |
297 | + { | |
298 | + sscanf (buf, "%d.%d.%d.%d/%d", &ip[0], &ip[1], &ip[2], &ip[3], &prefix); | |
299 | + sprintf (buf, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); | |
300 | + nm_ip4_config_set_address (sys_data->config, inet_addr (buf)); | |
301 | + | |
302 | + if (prefix >= 0 && prefix <= 32) | |
303 | + { | |
304 | + for (i = 0; i <= 3; i++) | |
305 | + { | |
306 | + switch (prefix) | |
307 | + { | |
308 | + case 7: | |
309 | + ip[i] = 254; | |
310 | + break; | |
311 | + case 6: | |
312 | + ip[i] = 252; | |
313 | + break; | |
314 | + case 5: | |
315 | + ip[i] = 248; | |
316 | + break; | |
317 | + case 4: | |
318 | + ip[i] = 240; | |
319 | + break; | |
320 | + case 3: | |
321 | + ip[i] = 224; | |
322 | + break; | |
323 | + case 2: | |
324 | + ip[i] = 192; | |
325 | + break; | |
326 | + case 1: | |
327 | + ip[i] = 128; | |
328 | + break; | |
329 | + default: | |
330 | + if (prefix >= 8) | |
331 | + { | |
332 | + ip[i] = 255; | |
333 | + } | |
334 | + else | |
335 | + { | |
336 | + ip[i] = 0; | |
337 | + } | |
338 | + } | |
339 | + prefix = prefix - 8; | |
340 | + } | |
341 | + sprintf (buf, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); | |
342 | + nm_ip4_config_set_netmask (sys_data->config, inet_addr (buf)); | |
343 | + free (buf); | |
344 | + } | |
345 | + else | |
346 | + { | |
347 | + nm_warning ("Prefix for device '%s' was invalid (should be between 0 and 32). " | |
348 | + "Try to make default. ", nm_device_get_iface (dev)); | |
349 | + | |
350 | + guint32 addr = nm_ip4_config_get_address (sys_data->config); | |
351 | + | |
352 | + if (((ntohl (addr) & 0xFF000000) >> 24) <= 127) | |
353 | + nm_ip4_config_set_netmask (sys_data->config, htonl (0xFF000000)); | |
354 | + else if (((ntohl (addr) & 0xFF000000) >> 24) <= 191) | |
355 | + nm_ip4_config_set_netmask (sys_data->config, htonl (0xFFFF0000)); | |
356 | + else | |
357 | + nm_ip4_config_set_netmask (sys_data->config, htonl (0xFFFFFF00)); | |
358 | + } | |
359 | + } | |
360 | + else | |
361 | + { | |
362 | + nm_warning ("Network configuration for device '%s' was invalid (non-DHCP configuration, " | |
363 | + "but no IP address specified. Will use DHCP instead.", nm_device_get_iface (dev)); | |
364 | + error = TRUE; | |
365 | + goto out; | |
366 | + } | |
367 | + | |
368 | + if (gateway_file = svNewFile (SYSCONFDIR"/sysconfig/network")) | |
369 | + { | |
370 | + buf = svGetValue (gateway_file, "GATEWAYDEV"); | |
371 | + | |
372 | + /* Make sure that GATEWAY is set for this device */ | |
373 | + if (!buf || strcmp (buf, nm_device_get_iface (dev))) | |
374 | + { | |
375 | + nm_warning ("Network configuration for device '%s' was invalid (non-DHCP configuration, " | |
376 | + "but no gateway specified - GATEWAYDEV set for other device or unset). Will " | |
377 | + "use DHCP instead.", nm_device_get_iface (dev)); | |
378 | + | |
379 | + free (buf); | |
380 | + svCloseFile (gateway_file); | |
381 | + error = TRUE; | |
382 | + goto out; | |
383 | + } | |
384 | + | |
385 | + if ((buf = svGetValue (gateway_file, "GATEWAY"))) | |
386 | + { | |
387 | + nm_ip4_config_set_gateway (sys_data->config, inet_addr (buf)); | |
388 | + free (buf); | |
389 | + svCloseFile (gateway_file); | |
390 | + } | |
391 | + else | |
392 | + { | |
393 | + nm_warning ("Network configuration for device '%s' was invalid (non-DHCP configuration, " | |
394 | + "but no gateway specified. Will use DHCP instead.", nm_device_get_iface (dev)); | |
395 | + svCloseFile (gateway_file); | |
396 | + error = TRUE; | |
397 | + goto out; | |
398 | + } | |
399 | + } | |
400 | + | |
401 | + if ((buf = svGetValue (file, "BROADCAST"))) | |
402 | + { | |
403 | + nm_ip4_config_set_broadcast (sys_data->config, inet_addr (buf)); | |
404 | + free (buf); | |
405 | + } | |
406 | + else | |
407 | + { | |
408 | + guint32 broadcast = ((nm_ip4_config_get_address (sys_data->config) & nm_ip4_config_get_netmask (sys_data->config)) | |
409 | + | ~nm_ip4_config_get_netmask (sys_data->config)); | |
410 | + nm_ip4_config_set_broadcast (sys_data->config, broadcast); | |
411 | + } | |
412 | + } | |
413 | + | |
414 | + /* If we're using Static IP, grab DNS servers from the config file */ | |
415 | + if (!sys_data->use_dhcp) | |
416 | + { | |
417 | + set_ip4_config_from_resolv_conf (SYSCONFDIR"/resolv.conf", sys_data->config); | |
418 | + } | |
419 | + | |
420 | +out: | |
421 | + svCloseFile (file); | |
422 | + | |
423 | + if (error) | |
424 | + { | |
425 | + sys_data->use_dhcp = TRUE; | |
426 | + /* Clear out the config */ | |
427 | + nm_ip4_config_unref (sys_data->config); | |
428 | + sys_data->config = NULL; | |
429 | + } | |
430 | + | |
431 | + return (void *)sys_data; | |
432 | +} | |
433 | + | |
434 | +/* | |
435 | + * nm_system_device_has_active_routes | |
436 | + * | |
437 | + * Find out whether the specified device has any routes in the routing | |
438 | + * table. | |
439 | + * | |
440 | + */ | |
441 | +gboolean nm_system_device_has_active_routes (NMDevice *dev) | |
442 | +{ | |
443 | + return FALSE; | |
444 | +} | |
445 | + | |
446 | +/* | |
447 | + * nm_system_enable_loopback | |
448 | + * | |
449 | + * Bring up the loopback interface | |
450 | + * | |
451 | + */ | |
452 | +void nm_system_enable_loopback (void) | |
453 | +{ | |
454 | + nm_system_device_set_up_down_with_iface ("lo", TRUE); | |
455 | + nm_spawn_process (IP_BINARY_PATH" addr add 127.0.0.1/8 brd 127.255.255.255 dev lo scope host label loopback"); | |
456 | +} | |
457 | + | |
458 | +/* | |
459 | + * nm_system_delete_default_route | |
460 | + * | |
461 | + * Remove the old default route in preparation for a new one | |
462 | + * | |
463 | + */ | |
464 | +void nm_system_delete_default_route (void) | |
465 | +{ | |
466 | + nm_spawn_process (IP_BINARY_PATH" route del default"); | |
467 | +} | |
468 | + | |
469 | +/* | |
470 | + * nm_system_kill_all_dhcp_daemons | |
471 | + * | |
472 | + * Kill all DHCP daemons currently running, done at startup. | |
473 | + * | |
474 | + */ | |
475 | +void nm_system_kill_all_dhcp_daemons (void) | |
476 | +{ | |
477 | + nm_spawn_process ("/bin/killall -q dhclient"); | |
478 | +} | |
479 | + | |
480 | +/* | |
481 | + * nm_system_update_dns | |
482 | + * | |
483 | + * Make glibc/nscd aware of any changes to the resolv.conf file by | |
484 | + * restarting nscd. | |
485 | + * | |
486 | + */ | |
487 | +void nm_system_update_dns (void) | |
488 | +{ | |
489 | + /* I'm not running nscd */ | |
490 | +} | |
491 | + | |
492 | +/* | |
493 | + * nm_system_restart_mdns_responder | |
494 | + * | |
495 | + * Restart the multicast DNS responder so that it knows about new | |
496 | + * network interfaces and IP addresses. | |
497 | + * | |
498 | + */ | |
499 | +void nm_system_restart_mdns_responder (void) | |
500 | +{ | |
501 | + /* not implemented */ | |
502 | +} | |
503 | + | |
504 | +/* | |
505 | + * nm_system_device_add_ip6_link_address | |
506 | + * | |
507 | + * Add a default link-local IPv6 address to a device. | |
508 | + * | |
509 | + */ | |
510 | +void nm_system_device_add_ip6_link_address (NMDevice *dev) | |
511 | +{ | |
512 | + char *buf; | |
513 | + struct ether_addr hw_addr; | |
514 | + unsigned char eui[8]; | |
515 | + | |
516 | + nm_device_get_hw_address (dev, &hw_addr); | |
517 | + memcpy (eui, &(hw_addr.ether_addr_octet), sizeof (hw_addr.ether_addr_octet)); | |
518 | + memmove (eui+5, eui+3, 3); | |
519 | + eui[3] = 0xff; | |
520 | + eui[4] = 0xfe; | |
521 | + eui[0] ^= 2; | |
522 | + | |
523 | + /* Add the default link-local IPv6 address to a device */ | |
524 | + buf = g_strdup_printf (IP_BINARY_PATH" -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s", | |
525 | + eui[0], eui[1], eui[2], eui[3], eui[4], eui[5], | |
526 | + eui[6], eui[7], nm_device_get_iface (dev)); | |
527 | + nm_spawn_process (buf); | |
528 | + g_free (buf); | |
529 | +} | |
530 | + | |
531 | +/* | |
532 | + * nm_system_device_add_route_via_device_with_iface | |
533 | + * | |
534 | + * Add route to the given device | |
535 | + * | |
536 | + */ | |
537 | +void nm_system_device_add_route_via_device_with_iface (const char *iface, const char *route) | |
538 | +{ | |
539 | + char *buf; | |
540 | + | |
541 | + g_return_if_fail (iface != NULL); | |
542 | + | |
543 | + /* Add default gateway */ | |
544 | + buf = g_strdup_printf (IP_BINARY_PATH" route add %s dev %s", route, iface); | |
545 | + nm_spawn_process (buf); | |
546 | + g_free (buf); | |
547 | +} | |
548 | + | |
549 | +/* | |
550 | + * nm_system_device_add_default_route_via_device | |
551 | + * | |
552 | + * Flush all routes associated with a network device | |
553 | + * | |
554 | + */ | |
555 | +void nm_system_device_add_default_route_via_device (NMDevice *dev) | |
556 | +{ | |
557 | + g_return_if_fail (dev != NULL); | |
558 | + | |
559 | + /* Not really applicable for test devices */ | |
560 | + if (nm_device_is_test_device (dev)) | |
561 | + return; | |
562 | + | |
563 | + nm_system_device_add_default_route_via_device_with_iface (nm_device_get_iface (dev)); | |
564 | +} | |
565 | + | |
566 | +/* | |
567 | + * * nm_system_device_add_default_route_via_device_with_iface | |
568 | + * * | |
569 | + * * Add default route to the given device | |
570 | + * * | |
571 | + * */ | |
572 | +void nm_system_device_add_default_route_via_device_with_iface (const char *iface) | |
573 | +{ | |
574 | + char *buf; | |
575 | + | |
576 | + g_return_if_fail (iface != NULL); | |
577 | + | |
578 | + /* Add default gateway */ | |
579 | + buf = g_strdup_printf (IP_BINARY_PATH" route add default dev %s", iface); | |
580 | + nm_spawn_process (buf); | |
581 | + g_free (buf); | |
582 | +} | |
583 | + | |
584 | +/* | |
585 | + * nm_system_flush_loopback_routes | |
586 | + * | |
587 | + * Flush all routes associated with the loopback device, because it | |
588 | + * sometimes gets the first route for ZeroConf/Link-Local traffic. | |
589 | + * | |
590 | + */ | |
591 | +void nm_system_flush_loopback_routes (void) | |
592 | +{ | |
593 | + /* Remove routing table entries for lo */ | |
594 | + nm_spawn_process (IP_BINARY_PATH" route flush dev lo"); | |
595 | +} | |
596 | + | |
597 | +/* | |
598 | + * nm_system_flush_arp_cache | |
599 | + * | |
600 | + * Flush all entries in the arp cache. | |
601 | + * | |
602 | + */ | |
603 | +void nm_system_flush_arp_cache (void) | |
604 | +{ | |
605 | + nm_spawn_process (IP_BINARY_PATH" neigh flush all"); | |
606 | +} | |
607 | + | |
608 | +void nm_system_deactivate_all_dialup (GSList *list) | |
609 | +{ | |
610 | +} | |
611 | + | |
612 | +gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup) | |
613 | +{ | |
614 | + return FALSE; | |
615 | +} | |
616 | + | |
617 | +gboolean nm_system_activate_dialup (GSList *list, const char *dialup) | |
618 | +{ | |
619 | + return FALSE; | |
620 | +} | |
621 | + | |
622 | +/* | |
623 | + * nm_system_get_dialup_config | |
624 | + * | |
625 | + * Enumerate dial up options on this system, allocate NMDialUpConfig's, | |
626 | + * fill them out, and return. | |
627 | + * | |
628 | + */ | |
629 | +GSList * nm_system_get_dialup_config (void) | |
630 | +{ | |
631 | + return NULL; | |
632 | +} | |
633 | + | |
634 | +void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data) | |
635 | +{ | |
636 | + PLDSystemConfigData *sys_data = (PLDSystemConfigData *)system_config_data; | |
637 | + | |
638 | + g_return_if_fail (dev != NULL); | |
639 | + | |
640 | + if (!sys_data) | |
641 | + return; | |
642 | + | |
643 | + if (sys_data->config) | |
644 | + nm_ip4_config_unref (sys_data->config); | |
645 | +} | |
646 | + | |
647 | +NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev) | |
648 | +{ | |
649 | + PLDSystemConfigData *sys_data; | |
650 | + NMIP4Config *new_config = NULL; | |
651 | + | |
652 | + g_return_val_if_fail (dev != NULL, NULL); | |
653 | + | |
654 | + if ((sys_data = nm_device_get_system_config_data (dev))) | |
655 | + new_config = nm_ip4_config_copy (sys_data->config); | |
656 | + | |
657 | + return new_config; | |
658 | +} | |
659 | + | |
660 | +gboolean nm_system_device_get_use_dhcp (NMDevice *dev) | |
661 | +{ | |
662 | + PLDSystemConfigData *sys_data; | |
663 | + | |
664 | + g_return_val_if_fail (dev != NULL, TRUE); | |
665 | + | |
666 | + if ((sys_data = nm_device_get_system_config_data (dev))) | |
667 | + return sys_data->use_dhcp; | |
668 | + | |
669 | + return TRUE; | |
670 | +} | |
671 | + | |
672 | +/* | |
673 | + * nm_system_device_get_disabled | |
674 | + * | |
675 | + * Return whether the distro-specific system config tells us to use | |
676 | + * dhcp for this device. | |
677 | + * | |
678 | + */ | |
679 | +gboolean nm_system_device_get_disabled (NMDevice *dev) | |
680 | +{ | |
681 | + return FALSE; | |
682 | +} | |
683 | + | |
684 | +/* | |
685 | + * nm_system_activate_nis | |
686 | + * | |
687 | + * set up the nis domain and write a yp.conf | |
688 | + * | |
689 | + */ | |
690 | +void nm_system_activate_nis (NMIP4Config *config) | |
691 | +{ | |
692 | +} | |
693 | + | |
694 | +/* | |
695 | + * nm_system_shutdown_nis | |
696 | + * | |
697 | + * shutdown ypbind | |
698 | + * | |
699 | + */ | |
700 | +void nm_system_shutdown_nis (void) | |
701 | +{ | |
702 | +} | |
703 | + | |
704 | +/* | |
705 | + * nm_system_set_hostname | |
706 | + * | |
707 | + * set the hostname | |
708 | + * | |
709 | + */ | |
710 | +void nm_system_set_hostname (NMIP4Config *config) | |
711 | +{ | |
712 | +} | |
713 | + | |
714 | +/* | |
715 | + * nm_system_should_modify_resolv_conf | |
716 | + * | |
717 | + * Can NM update resolv.conf, or is it locked down? | |
718 | + */ | |
719 | +gboolean nm_system_should_modify_resolv_conf (void) | |
720 | +{ | |
721 | + return TRUE; | |
722 | +} | |
723 | + | |
724 | + | |
725 | +/* | |
726 | + * nm_system_get_mtu | |
727 | + * | |
728 | + * Return a user-provided or system-mandated MTU for this device or zero if | |
729 | + * no such MTU is provided. | |
730 | + */ | |
731 | +unsigned int nm_system_get_mtu (NMDevice *dev) | |
732 | +{ | |
733 | + return 0; | |
734 | +} |