Merge tag 'upstream/1.2.4'
Upstream version 1.2.4
Michael Biebl
7 years ago
215 | 215 | $(top_srcdir)/build-aux/tap-driver.sh ABOUT-NLS AUTHORS \ |
216 | 216 | COPYING ChangeLog INSTALL NEWS README TODO build-aux/compile \ |
217 | 217 | build-aux/config.guess build-aux/config.rpath \ |
218 | build-aux/config.sub build-aux/depcomp build-aux/install-sh \ | |
219 | build-aux/ltmain.sh build-aux/missing | |
218 | build-aux/config.sub build-aux/install-sh build-aux/ltmain.sh \ | |
219 | build-aux/missing | |
220 | 220 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
221 | 221 | distdir = $(PACKAGE)-$(VERSION) |
222 | 222 | top_distdir = $(distdir) |
392 | 392 | NM = @NM@ |
393 | 393 | NMEDIT = @NMEDIT@ |
394 | 394 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
395 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
395 | 396 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
396 | 397 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
397 | 398 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
0 | ============================================== | |
1 | NetworkManager-1.2.4 | |
2 | Overview of changes since NetworkManager-1.2.2 | |
3 | ============================================== | |
4 | ||
5 | This is a new stable release of NetworkManager. Notable changes include: | |
6 | ||
7 | * The timeout for requests of secrets to agents has been increased from 25 to | |
8 | 120 seconds. | |
9 | * NetworkManager now follows symlinks when accessing resolv.conf and | |
10 | 'rc-manager=file'. | |
11 | * Added new values 'symlink' and 'unmanaged' to rc-manager configuration option. | |
12 | * It is now possible to configure the default rc-manager option at compile time. | |
13 | * Name servers passed to dnsmasq now specify an egress interface to avoid | |
14 | problems with multiple active connections. | |
15 | * Reverse DNS entries for IPv6 are now added to dnsmasq, and IPv4 reverse | |
16 | entries now honor the network prefix. | |
17 | * A new 'dns-priority' property of ipv4 and ipv6 settings can be used to tweak | |
18 | the order of servers in resolv.conf when multiple connections are active. | |
19 | * Added a 'Reload' D-Bus method to reload configuration and reapply DNS | |
20 | configuration. | |
21 | * Now devices are disconnected before the system suspends, executing dispatcher | |
22 | scripts. This allows external applications to be notified of the change in | |
23 | connectivity. | |
24 | * Devices without L3 configuration are not more put in DOWN state on shutdown. | |
25 | * MTU settings are now applied also to devices without IPv4 configuration. | |
26 | * Improved VPN support in nmcli. | |
27 | * Many bug fixes. | |
28 | ||
0 | 29 | ============================================ |
1 | 30 | NetworkManager-1.2.2 |
2 | 31 | Overview of changes since NetworkManager-1.2 |
21 | 50 | |
22 | 51 | This is a new stable release of NetworkManager. Notable changes include: |
23 | 52 | |
24 | * Added an option to enable use of random MAC addresses for Wi-Fi access | |
25 | point scanning (defaults to disabled). Controlled with | |
26 | 'wifi.mac-address-randomization' property (MAC_ADDRESS_RANDOMIZATION key in | |
27 | ifcfg files). | |
53 | * MAC addresses during Wi-Fi access point scanning are now randomized | |
54 | if wpa_supplicant supports PreassocMacAddr. | |
55 | * Added an option to enable random MAC addresses for association to Wi-Fi access | |
56 | point (defaults to disabled). Controlled with 'wifi.mac-address-randomization' | |
57 | property (MAC_ADDRESS_RANDOMIZATION key in ifcfg files). Requires support from | |
58 | wpa_supplicant. | |
28 | 59 | * Wi-Fi scanning now utilizes wpa_supplicant's AP list. |
29 | 60 | * Added support for Wi-Fi powersave, configured with POWERSAVE key in ifcfg |
30 | 61 | files. |
405 | 405 | NM = @NM@ |
406 | 406 | NMEDIT = @NMEDIT@ |
407 | 407 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
408 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
408 | 409 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
409 | 410 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
410 | 411 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
525 | 525 | NM = @NM@ |
526 | 526 | NMEDIT = @NMEDIT@ |
527 | 527 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
528 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
528 | 529 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
529 | 530 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
530 | 531 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
359 | 359 | NM = @NM@ |
360 | 360 | NMEDIT = @NMEDIT@ |
361 | 361 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
362 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
362 | 363 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
363 | 364 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
364 | 365 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
340 | 340 | NM = @NM@ |
341 | 341 | NMEDIT = @NMEDIT@ |
342 | 342 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
343 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
343 | 344 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
344 | 345 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
345 | 346 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
414 | 414 | char *dest = NULL, *plen = NULL; |
415 | 415 | const char *next_hop = NULL; |
416 | 416 | const char *canon_dest; |
417 | long int prefix = max_prefix, metric = -1; | |
417 | long int prefix = max_prefix; | |
418 | unsigned long int tmp_ulong; | |
418 | 419 | NMIPRoute *route = NULL; |
419 | 420 | gboolean success = FALSE; |
420 | 421 | GError *local = NULL; |
422 | gint64 metric = -1; | |
421 | 423 | |
422 | 424 | g_return_val_if_fail (family == AF_INET || family == AF_INET6, FALSE); |
423 | 425 | g_return_val_if_fail (first != NULL, FALSE); |
443 | 445 | next_hop = second; |
444 | 446 | else { |
445 | 447 | /* 'second' can be a metric */ |
446 | if (!nmc_string_to_int (second, TRUE, 0, G_MAXUINT32, &metric)) { | |
448 | if (!nmc_string_to_uint (second, TRUE, 0, G_MAXUINT32, &tmp_ulong)) { | |
447 | 449 | g_set_error (error, 1, 0, _("the second component of route ('%s') is neither " |
448 | 450 | "a next hop address nor a metric"), second); |
449 | 451 | goto finish; |
450 | 452 | } |
453 | metric = tmp_ulong; | |
451 | 454 | } |
452 | 455 | } |
453 | 456 | |
454 | 457 | if (third) { |
455 | if (!nmc_string_to_int (third, TRUE, 0, G_MAXUINT32, &metric)) { | |
458 | if (!nmc_string_to_uint (third, TRUE, 0, G_MAXUINT32, &tmp_ulong)) { | |
456 | 459 | g_set_error (error, 1, 0, _("invalid metric '%s'"), third); |
457 | 460 | goto finish; |
458 | 461 | } |
462 | metric = tmp_ulong; | |
459 | 463 | } |
460 | 464 | |
461 | 465 | route = nm_ip_route_new (family, dest, prefix, next_hop, metric, &local); |
51 | 51 | #define PROMPT_ACTIVE_CONNECTIONS _("Connection(s) (name, UUID, path or apath): ") |
52 | 52 | #define PROMPT_IP_TUNNEL_MODE _("Tunnel mode: ") |
53 | 53 | #define PROMPT_MACVLAN_MODE _("MACVLAN mode: ") |
54 | ||
55 | static const char *nmc_known_vpns[] = { | |
56 | "openvpn", | |
57 | "vpnc", | |
58 | "pptp", | |
59 | "openconnect", | |
60 | "openswan", | |
61 | "libreswan", | |
62 | "strongswan", | |
63 | "ssh", | |
64 | "l2tp", | |
65 | "iodine", | |
66 | "fortisslvpn", | |
67 | NULL | |
68 | }; | |
69 | 54 | |
70 | 55 | /* Available fields for 'connection show' */ |
71 | 56 | static NmcOutputField nmc_fields_con_show[] = { |
1977 | 1962 | && state == NM_DEVICE_STATE_FAILED) { |
1978 | 1963 | if (nmc->print_output == NMC_PRINT_PRETTY) |
1979 | 1964 | nmc_terminal_erase_line (); |
1980 | g_print (_("Error: Connection activation failed.")); | |
1965 | g_print (_("Error: Connection activation failed.\n")); | |
1981 | 1966 | quit (); |
1982 | 1967 | } else if (active && ac_state != NM_ACTIVE_CONNECTION_STATE_ACTIVATING) { |
1983 | 1968 | g_string_printf (nmc->return_text, _("Error: Connection activation failed.")); |
2930 | 2915 | GError *tmp_err = NULL; |
2931 | 2916 | int i; |
2932 | 2917 | |
2933 | g_return_val_if_fail (val, NULL); | |
2934 | 2918 | g_return_val_if_fail (array, NULL); |
2935 | 2919 | |
2936 | 2920 | /* Create a temporary array that can be used in nmc_string_is_valid() */ |
5903 | 5887 | const char *user_c = NULL; |
5904 | 5888 | char *user = NULL; |
5905 | 5889 | const char *st; |
5906 | char *service_type = NULL; | |
5890 | gs_free char *service_type_free = NULL; | |
5891 | const char *service_type = NULL; | |
5907 | 5892 | nmc_arg_t exp_args[] = { {"vpn-type", TRUE, &vpn_type, !ask}, |
5908 | 5893 | {"user", TRUE, &user_c, FALSE}, |
5909 | 5894 | {NULL} }; |
5895 | gs_free const char **plugin_names = NULL; | |
5910 | 5896 | |
5911 | 5897 | if (!nmc_parse_args (exp_args, FALSE, &argc, &argv, error)) |
5912 | 5898 | return FALSE; |
5921 | 5907 | if (vpn_type_ask) |
5922 | 5908 | vpn_type = g_strstrip (vpn_type_ask); |
5923 | 5909 | |
5924 | if (!(st = nmc_string_is_valid (vpn_type, nmc_known_vpns, NULL))) { | |
5910 | plugin_names = nm_vpn_get_plugin_names (FALSE); | |
5911 | if (!(st = nmc_string_is_valid (vpn_type, plugin_names, NULL))) { | |
5925 | 5912 | g_print (_("Warning: 'vpn-type': %s not known.\n"), vpn_type); |
5926 | 5913 | st = vpn_type; |
5927 | 5914 | } |
5928 | service_type = g_strdup_printf ("%s.%s", NM_DBUS_INTERFACE, st); | |
5915 | ||
5916 | service_type = nm_vpn_get_service_for_name (st); | |
5917 | if (!service_type) | |
5918 | service_type = service_type_free = nm_vpn_get_service_for_name_default (st); | |
5929 | 5919 | |
5930 | 5920 | /* Also ask for all optional arguments if '--ask' is specified. */ |
5931 | 5921 | user = g_strdup (user_c); |
5942 | 5932 | success = TRUE; |
5943 | 5933 | cleanup_vpn: |
5944 | 5934 | g_free (vpn_type_ask); |
5945 | g_free (service_type); | |
5946 | 5935 | g_free (user); |
5947 | 5936 | if (!success) |
5948 | 5937 | return FALSE; |
6710 | 6699 | static char * |
6711 | 6700 | gen_func_vpn_types (const char *text, int state) |
6712 | 6701 | { |
6713 | return nmc_rl_gen_func_basic (text, state, nmc_known_vpns); | |
6702 | gs_free const char **plugin_names = NULL; | |
6703 | ||
6704 | plugin_names = nm_vpn_get_plugin_names (FALSE); | |
6705 | return nmc_rl_gen_func_basic (text, state, plugin_names); | |
6714 | 6706 | } |
6715 | 6707 | |
6716 | 6708 | static char * |
10689 | 10681 | } |
10690 | 10682 | |
10691 | 10683 | /* Import VPN configuration */ |
10692 | plugin = nm_vpn_get_plugin_by_service (type, &error); | |
10684 | plugin = nm_vpn_lookup_plugin (type, NULL, &error); | |
10693 | 10685 | if (!plugin) { |
10694 | 10686 | g_string_printf (nmc->return_text, _("Error: failed to load VPN plugin: %s."), |
10695 | 10687 | error->message); |
10796 | 10788 | type = nm_setting_vpn_get_service_type (nm_connection_get_setting_vpn (connection)); |
10797 | 10789 | |
10798 | 10790 | /* Export VPN configuration */ |
10799 | plugin = nm_vpn_get_plugin_by_service (type, &error); | |
10791 | plugin = nm_vpn_lookup_plugin (type, NULL, &error); | |
10800 | 10792 | if (!plugin) { |
10801 | 10793 | g_string_printf (nmc->return_text, _("Error: failed to load VPN plugin: %s."), |
10802 | 10794 | error->message); |
1715 | 1715 | nmc->nowait_flag = (nmc->timeout == 0); |
1716 | 1716 | nmc->should_wait++; |
1717 | 1717 | |
1718 | nmc->connections = nm_client_get_connections (nmc->client); | |
1719 | ||
1718 | 1720 | /* Create secret agent */ |
1719 | 1721 | nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-connect"); |
1720 | 1722 | if (nmc->secret_agent) |
24 | 24 | #include "polkit-agent.h" |
25 | 25 | #include "utils.h" |
26 | 26 | #include "general.h" |
27 | #include "nm-common-macros.h" | |
27 | 28 | |
28 | 29 | #include "devices.h" |
29 | 30 | #include "connections.h" |
386 | 387 | return TRUE; |
387 | 388 | } |
388 | 389 | |
389 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK "org.freedesktop.NetworkManager.enable-disable-network" | |
390 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI "org.freedesktop.NetworkManager.enable-disable-wifi" | |
391 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN "org.freedesktop.NetworkManager.enable-disable-wwan" | |
392 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX "org.freedesktop.NetworkManager.enable-disable-wimax" | |
393 | #define NM_AUTH_PERMISSION_SLEEP_WAKE "org.freedesktop.NetworkManager.sleep-wake" | |
394 | #define NM_AUTH_PERMISSION_NETWORK_CONTROL "org.freedesktop.NetworkManager.network-control" | |
395 | #define NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED "org.freedesktop.NetworkManager.wifi.share.protected" | |
396 | #define NM_AUTH_PERMISSION_WIFI_SHARE_OPEN "org.freedesktop.NetworkManager.wifi.share.open" | |
397 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM "org.freedesktop.NetworkManager.settings.modify.system" | |
398 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN "org.freedesktop.NetworkManager.settings.modify.own" | |
399 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME "org.freedesktop.NetworkManager.settings.modify.hostname" | |
400 | ||
401 | 390 | static const char * |
402 | 391 | permission_to_string (NMClientPermission perm) |
403 | 392 | { |
424 | 413 | return NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN; |
425 | 414 | case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME: |
426 | 415 | return NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME; |
416 | case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS: | |
417 | return NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS; | |
418 | case NM_CLIENT_PERMISSION_RELOAD: | |
419 | return NM_AUTH_PERMISSION_RELOAD; | |
427 | 420 | default: |
428 | 421 | return _("unknown"); |
429 | 422 | } |
432 | 425 | static const char * |
433 | 426 | permission_result_to_string (NMClientPermissionResult perm_result) |
434 | 427 | { |
435 | ||
436 | 428 | switch (perm_result) { |
437 | 429 | case NM_CLIENT_PERMISSION_RESULT_YES: |
438 | 430 | return _("yes"); |
493 | 493 | ;; |
494 | 494 | vpn-type) |
495 | 495 | if [[ "${#words[@]}" -eq 2 ]]; then |
496 | _nmcli_list "vpnc openvpn pptp openconnect openswan libreswan ssh l2tp iodine" | |
496 | _nmcli_list "vpnc openvpn pptp openconnect openswan libreswan strongswan ssh l2tp iodine fortisslvpn" | |
497 | 497 | return 0 |
498 | 498 | fi |
499 | 499 | ;; |
578 | 578 | user| \ |
579 | 579 | username| \ |
580 | 580 | service| \ |
581 | password| \ | |
581 | password) | |
582 | if [[ "${#words[@]}" -eq 2 ]]; then | |
583 | return 0 | |
584 | fi | |
585 | ;; | |
582 | 586 | passwd-file| \ |
583 | 587 | file) |
584 | 588 | if [[ "${#words[@]}" -eq 2 ]]; then |
589 | compopt -o default | |
590 | COMPREPLY=() | |
585 | 591 | return 0 |
586 | 592 | fi |
587 | 593 | ;; |
1378 | 1384 | |
1379 | 1385 | OPTIONS=(type file) |
1380 | 1386 | OPTIONS_MANDATORY=(type file) |
1381 | ALIASES=("type:vpn-type") | |
1382 | _nmcli_compl_ARGS ${ALIASES[@]} | |
1387 | _nmcli_compl_ARGS type:vpn-type | |
1383 | 1388 | return 0 |
1384 | 1389 | fi |
1385 | 1390 | ;; |
250 | 250 | { "dhcp-timeout", "A timeout for a DHCP transaction in seconds." }, |
251 | 251 | { "dns", "Array of IP addresses of DNS servers." }, |
252 | 252 | { "dns-options", "Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties." }, |
253 | { "dns-priority", "DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used." }, | |
253 | 254 | { "dns-search", "Array of DNS search domains." }, |
254 | 255 | { "gateway", "The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set." }, |
255 | 256 | { "ignore-auto-dns", "When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used." }, |
271 | 272 | { "dhcp-timeout", "A timeout for a DHCP transaction in seconds." }, |
272 | 273 | { "dns", "Array of IP addresses of DNS servers." }, |
273 | 274 | { "dns-options", "Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties." }, |
275 | { "dns-priority", "DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used." }, | |
274 | 276 | { "dns-search", "Array of DNS search domains." }, |
275 | 277 | { "gateway", "The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set." }, |
276 | 278 | { "ignore-auto-dns", "When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used." }, |
422 | 424 | { "gsm", setting_gsm, 13 }, |
423 | 425 | { "infiniband", setting_infiniband, 6 }, |
424 | 426 | { "ip-tunnel", setting_ip_tunnel, 13 }, |
425 | { "ipv4", setting_ipv4, 19 }, | |
426 | { "ipv6", setting_ipv6, 19 }, | |
427 | { "ipv4", setting_ipv4, 20 }, | |
428 | { "ipv6", setting_ipv6, 20 }, | |
427 | 429 | { "macvlan", setting_macvlan, 5 }, |
428 | 430 | { "ppp", setting_ppp, 19 }, |
429 | 431 | { "pppoe", setting_pppoe, 5 }, |
271 | 271 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS), /* 2 */ |
272 | 272 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH), /* 3 */ |
273 | 273 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_OPTIONS), /* 4 */ |
274 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES), /* 5 */ | |
275 | SETTING_FIELD (NM_SETTING_IP_CONFIG_GATEWAY), /* 6 */ | |
276 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES), /* 7 */ | |
277 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTE_METRIC), /* 8 */ | |
278 | SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES), /* 9 */ | |
279 | SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS), /* 10 */ | |
280 | SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID), /* 11 */ | |
281 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_TIMEOUT), /* 12 */ | |
282 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME), /* 13 */ | |
283 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME), /* 14 */ | |
284 | SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_FQDN), /* 15 */ | |
285 | SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT), /* 16 */ | |
286 | SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL), /* 17 */ | |
287 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DAD_TIMEOUT), /* 18 */ | |
274 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_PRIORITY), /* 5 */ | |
275 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES), /* 6 */ | |
276 | SETTING_FIELD (NM_SETTING_IP_CONFIG_GATEWAY), /* 7 */ | |
277 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES), /* 8 */ | |
278 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTE_METRIC), /* 9 */ | |
279 | SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES), /* 10 */ | |
280 | SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS), /* 11 */ | |
281 | SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID), /* 12 */ | |
282 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_TIMEOUT), /* 13 */ | |
283 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME), /* 14 */ | |
284 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME), /* 15 */ | |
285 | SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_FQDN), /* 16 */ | |
286 | SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT), /* 17 */ | |
287 | SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL), /* 18 */ | |
288 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DAD_TIMEOUT), /* 19 */ | |
288 | 289 | {NULL, NULL, 0, NULL, FALSE, FALSE, 0} |
289 | 290 | }; |
290 | 291 | #define NMC_FIELDS_SETTING_IP4_CONFIG_ALL "name"","\ |
292 | 293 | NM_SETTING_IP_CONFIG_DNS","\ |
293 | 294 | NM_SETTING_IP_CONFIG_DNS_SEARCH","\ |
294 | 295 | NM_SETTING_IP_CONFIG_DNS_OPTIONS","\ |
296 | NM_SETTING_IP_CONFIG_DNS_PRIORITY","\ | |
295 | 297 | NM_SETTING_IP_CONFIG_ADDRESSES","\ |
296 | 298 | NM_SETTING_IP_CONFIG_GATEWAY","\ |
297 | 299 | NM_SETTING_IP_CONFIG_ROUTES","\ |
314 | 316 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS), /* 2 */ |
315 | 317 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_SEARCH), /* 3 */ |
316 | 318 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_OPTIONS), /* 4 */ |
317 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES), /* 5 */ | |
318 | SETTING_FIELD (NM_SETTING_IP_CONFIG_GATEWAY), /* 6 */ | |
319 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES), /* 7 */ | |
320 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTE_METRIC), /* 8 */ | |
321 | SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES), /* 9 */ | |
322 | SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS), /* 10 */ | |
323 | SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT), /* 11 */ | |
324 | SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL), /* 12 */ | |
325 | SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY), /* 13 */ | |
326 | SETTING_FIELD (NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE), /* 14 */ | |
327 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME), /* 15 */ | |
328 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME), /* 16 */ | |
319 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DNS_PRIORITY), /* 5 */ | |
320 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ADDRESSES), /* 6 */ | |
321 | SETTING_FIELD (NM_SETTING_IP_CONFIG_GATEWAY), /* 7 */ | |
322 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTES), /* 8 */ | |
323 | SETTING_FIELD (NM_SETTING_IP_CONFIG_ROUTE_METRIC), /* 9 */ | |
324 | SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES), /* 10 */ | |
325 | SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS), /* 11 */ | |
326 | SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT), /* 12 */ | |
327 | SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL), /* 13 */ | |
328 | SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY), /* 14 */ | |
329 | SETTING_FIELD (NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE), /* 15 */ | |
330 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME), /* 16 */ | |
331 | SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME), /* 17 */ | |
329 | 332 | {NULL, NULL, 0, NULL, FALSE, FALSE, 0} |
330 | 333 | }; |
331 | 334 | #define NMC_FIELDS_SETTING_IP6_CONFIG_ALL "name"","\ |
333 | 336 | NM_SETTING_IP_CONFIG_DNS","\ |
334 | 337 | NM_SETTING_IP_CONFIG_DNS_SEARCH","\ |
335 | 338 | NM_SETTING_IP_CONFIG_DNS_OPTIONS","\ |
339 | NM_SETTING_IP_CONFIG_DNS_PRIORITY","\ | |
336 | 340 | NM_SETTING_IP_CONFIG_ADDRESSES","\ |
337 | 341 | NM_SETTING_IP_CONFIG_GATEWAY","\ |
338 | 342 | NM_SETTING_IP_CONFIG_ROUTES","\ |
1040 | 1044 | } |
1041 | 1045 | |
1042 | 1046 | static char * |
1043 | nmc_property_802_1X_get_client_cert (NMSetting *setting, NmcPropertyGetType get_type) | |
1047 | nmc_property_802_1X_get_client_cert (NMSetting *setting, | |
1048 | NmcPropertyGetType get_type, | |
1049 | gboolean show_secrets) | |
1044 | 1050 | { |
1045 | 1051 | NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); |
1046 | 1052 | NMSetting8021xCKScheme scheme; |
1047 | char *client_cert_str = NULL; | |
1053 | char *cert_str = NULL; | |
1048 | 1054 | |
1049 | 1055 | scheme = nm_setting_802_1x_get_client_cert_scheme (s_8021X); |
1050 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) | |
1051 | client_cert_str = bytes_to_string (nm_setting_802_1x_get_client_cert_blob (s_8021X)); | |
1052 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) | |
1053 | client_cert_str = g_strdup (nm_setting_802_1x_get_client_cert_path (s_8021X)); | |
1054 | ||
1055 | return client_cert_str; | |
1056 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) { | |
1057 | if (show_secrets) | |
1058 | cert_str = bytes_to_string (nm_setting_802_1x_get_client_cert_blob (s_8021X)); | |
1059 | else | |
1060 | cert_str = g_strdup (_("<hidden>")); | |
1061 | } else if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) | |
1062 | cert_str = g_strdup (nm_setting_802_1x_get_client_cert_path (s_8021X)); | |
1063 | ||
1064 | return cert_str; | |
1065 | } | |
1066 | ||
1067 | static char * | |
1068 | nmc_property_802_1X_get_client_cert_full (NMSetting *setting, NmcPropertyGetType get_type) | |
1069 | { | |
1070 | return nmc_property_802_1X_get_client_cert (setting, get_type, TRUE); | |
1056 | 1071 | } |
1057 | 1072 | |
1058 | 1073 | static char * |
1072 | 1087 | } |
1073 | 1088 | |
1074 | 1089 | static char * |
1075 | nmc_property_802_1X_get_phase2_client_cert (NMSetting *setting, NmcPropertyGetType get_type) | |
1090 | nmc_property_802_1X_get_phase2_client_cert (NMSetting *setting, | |
1091 | NmcPropertyGetType get_type, | |
1092 | gboolean show_secrets) | |
1076 | 1093 | { |
1077 | 1094 | NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); |
1078 | 1095 | NMSetting8021xCKScheme scheme; |
1079 | char *phase2_client_cert_str = NULL; | |
1096 | char *cert_str = NULL; | |
1080 | 1097 | |
1081 | 1098 | scheme = nm_setting_802_1x_get_phase2_client_cert_scheme (s_8021X); |
1082 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) | |
1083 | phase2_client_cert_str = bytes_to_string (nm_setting_802_1x_get_phase2_client_cert_blob (s_8021X)); | |
1084 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) | |
1085 | phase2_client_cert_str = g_strdup (nm_setting_802_1x_get_phase2_client_cert_path (s_8021X)); | |
1086 | ||
1087 | return phase2_client_cert_str; | |
1099 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) { | |
1100 | if (show_secrets) | |
1101 | cert_str = bytes_to_string (nm_setting_802_1x_get_phase2_client_cert_blob (s_8021X)); | |
1102 | else | |
1103 | cert_str = g_strdup (_("<hidden>")); | |
1104 | } else if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) | |
1105 | cert_str = g_strdup (nm_setting_802_1x_get_phase2_client_cert_path (s_8021X)); | |
1106 | ||
1107 | return cert_str; | |
1108 | } | |
1109 | ||
1110 | static char * | |
1111 | nmc_property_802_1X_get_phase2_client_cert_full (NMSetting *setting, NmcPropertyGetType get_type) | |
1112 | { | |
1113 | return nmc_property_802_1X_get_phase2_client_cert (setting, get_type, TRUE); | |
1088 | 1114 | } |
1089 | 1115 | |
1090 | 1116 | static char * |
1095 | 1121 | } |
1096 | 1122 | |
1097 | 1123 | static char * |
1098 | nmc_property_802_1X_get_private_key (NMSetting *setting, NmcPropertyGetType get_type) | |
1124 | nmc_property_802_1X_get_private_key (NMSetting *setting, | |
1125 | NmcPropertyGetType get_type, | |
1126 | gboolean show_secrets) | |
1099 | 1127 | { |
1100 | 1128 | NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); |
1101 | 1129 | NMSetting8021xCKScheme scheme; |
1102 | char *private_key_str = NULL; | |
1130 | char *key_str = NULL; | |
1103 | 1131 | |
1104 | 1132 | scheme = nm_setting_802_1x_get_private_key_scheme (s_8021X); |
1105 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) | |
1106 | private_key_str = bytes_to_string (nm_setting_802_1x_get_private_key_blob (s_8021X)); | |
1107 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) | |
1108 | private_key_str = g_strdup (nm_setting_802_1x_get_private_key_path (s_8021X)); | |
1109 | ||
1110 | return private_key_str; | |
1133 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) { | |
1134 | if (show_secrets) | |
1135 | key_str = bytes_to_string (nm_setting_802_1x_get_private_key_blob (s_8021X)); | |
1136 | else | |
1137 | key_str = g_strdup (_("<hidden>")); | |
1138 | } else if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) | |
1139 | key_str = g_strdup (nm_setting_802_1x_get_private_key_path (s_8021X)); | |
1140 | ||
1141 | return key_str; | |
1111 | 1142 | } |
1112 | 1143 | |
1113 | 1144 | static char * |
1114 | nmc_property_802_1X_get_phase2_private_key (NMSetting *setting, NmcPropertyGetType get_type) | |
1145 | nmc_property_802_1X_get_private_key_full (NMSetting *setting, NmcPropertyGetType get_type) | |
1146 | { | |
1147 | return nmc_property_802_1X_get_private_key (setting, get_type, TRUE); | |
1148 | } | |
1149 | ||
1150 | static char * | |
1151 | nmc_property_802_1X_get_phase2_private_key (NMSetting *setting, | |
1152 | NmcPropertyGetType get_type, | |
1153 | gboolean show_secrets) | |
1115 | 1154 | { |
1116 | 1155 | NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); |
1117 | 1156 | NMSetting8021xCKScheme scheme; |
1118 | char *phase2_private_key_str = NULL; | |
1157 | char *key_str = NULL; | |
1119 | 1158 | |
1120 | 1159 | scheme = nm_setting_802_1x_get_phase2_private_key_scheme (s_8021X); |
1121 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) | |
1122 | phase2_private_key_str = bytes_to_string (nm_setting_802_1x_get_phase2_private_key_blob (s_8021X)); | |
1123 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) | |
1124 | phase2_private_key_str = g_strdup (nm_setting_802_1x_get_phase2_private_key_path (s_8021X)); | |
1125 | ||
1126 | return phase2_private_key_str; | |
1160 | if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) { | |
1161 | if (show_secrets) | |
1162 | key_str = bytes_to_string (nm_setting_802_1x_get_phase2_private_key_blob (s_8021X)); | |
1163 | else | |
1164 | key_str = g_strdup (_("<hidden>")); | |
1165 | } else if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) | |
1166 | key_str = g_strdup (nm_setting_802_1x_get_phase2_private_key_path (s_8021X)); | |
1167 | ||
1168 | return key_str; | |
1169 | } | |
1170 | ||
1171 | static char * | |
1172 | nmc_property_802_1X_get_phase2_private_key_full (NMSetting *setting, NmcPropertyGetType get_type) | |
1173 | { | |
1174 | return nmc_property_802_1X_get_phase2_private_key (setting, get_type, TRUE); | |
1127 | 1175 | } |
1128 | 1176 | |
1129 | 1177 | /* --- NM_SETTING_ADSL_SETTING_NAME property get functions --- */ |
1443 | 1491 | DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP_CONFIG_DNS) |
1444 | 1492 | DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH) |
1445 | 1493 | DEFINE_GETTER_WITH_DEFAULT (nmc_property_ipv4_get_dns_options, NM_SETTING_IP_CONFIG_DNS_OPTIONS, !nm_setting_ip_config_has_dns_options ((NMSettingIPConfig *) setting)) |
1494 | DEFINE_GETTER (nmc_property_ipv4_get_dns_priority, NM_SETTING_IP_CONFIG_DNS_PRIORITY) | |
1446 | 1495 | |
1447 | 1496 | static char * |
1448 | 1497 | nmc_property_ip_get_addresses (NMSetting *setting, NmcPropertyGetType get_type) |
1563 | 1612 | DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP_CONFIG_DNS) |
1564 | 1613 | DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP_CONFIG_DNS_SEARCH) |
1565 | 1614 | DEFINE_GETTER_WITH_DEFAULT (nmc_property_ipv6_get_dns_options, NM_SETTING_IP_CONFIG_DNS_OPTIONS, !nm_setting_ip_config_has_dns_options ((NMSettingIPConfig *) setting)) |
1615 | DEFINE_GETTER (nmc_property_ipv6_get_dns_priority, NM_SETTING_IP_CONFIG_DNS_PRIORITY) | |
1566 | 1616 | |
1567 | 1617 | static char * |
1568 | 1618 | nmc_property_ipv6_get_routes (NMSetting *setting, NmcPropertyGetType get_type) |
5708 | 5758 | NULL, |
5709 | 5759 | NULL); |
5710 | 5760 | nmc_add_prop_funcs (GLUE (802_1X, CLIENT_CERT), |
5711 | nmc_property_802_1X_get_client_cert, | |
5761 | nmc_property_802_1X_get_client_cert_full, | |
5712 | 5762 | nmc_property_802_1X_set_client_cert, |
5713 | 5763 | NULL, |
5714 | 5764 | nmc_property_802_1X_describe_client_cert, |
5785 | 5835 | NULL, |
5786 | 5836 | NULL); |
5787 | 5837 | nmc_add_prop_funcs (GLUE (802_1X, PHASE2_CLIENT_CERT), |
5788 | nmc_property_802_1X_get_phase2_client_cert, | |
5838 | nmc_property_802_1X_get_phase2_client_cert_full, | |
5789 | 5839 | nmc_property_802_1X_set_phase2_client_cert, |
5790 | 5840 | NULL, |
5791 | 5841 | nmc_property_802_1X_describe_phase2_client_cert, |
5820 | 5870 | NULL, |
5821 | 5871 | NULL); |
5822 | 5872 | nmc_add_prop_funcs (GLUE (802_1X, PRIVATE_KEY), |
5823 | nmc_property_802_1X_get_private_key, | |
5873 | nmc_property_802_1X_get_private_key_full, | |
5824 | 5874 | nmc_property_802_1X_set_private_key, |
5825 | 5875 | NULL, |
5826 | 5876 | nmc_property_802_1X_describe_private_key, |
5841 | 5891 | NULL, |
5842 | 5892 | NULL); |
5843 | 5893 | nmc_add_prop_funcs (GLUE (802_1X, PHASE2_PRIVATE_KEY), |
5844 | nmc_property_802_1X_get_phase2_private_key, | |
5894 | nmc_property_802_1X_get_phase2_private_key_full, | |
5845 | 5895 | nmc_property_802_1X_set_phase2_private_key, |
5846 | 5896 | NULL, |
5847 | 5897 | nmc_property_802_1X_describe_private_key, |
6451 | 6501 | NULL, |
6452 | 6502 | NULL, |
6453 | 6503 | NULL); |
6504 | nmc_add_prop_funcs (GLUE_IP (4, DNS_PRIORITY), | |
6505 | nmc_property_ipv4_get_dns_priority, | |
6506 | nmc_property_set_int, | |
6507 | NULL, | |
6508 | NULL, | |
6509 | NULL, | |
6510 | NULL); | |
6454 | 6511 | nmc_add_prop_funcs (GLUE_IP (4, ADDRESSES), |
6455 | 6512 | nmc_property_ip_get_addresses, |
6456 | 6513 | nmc_property_ipv4_set_addresses, |
6576 | 6633 | nmc_property_ipv6_get_dns_options, |
6577 | 6634 | nmc_property_ipv6_set_dns_options, |
6578 | 6635 | nmc_property_ipv6_remove_dns_option, |
6636 | NULL, | |
6637 | NULL, | |
6638 | NULL); | |
6639 | nmc_add_prop_funcs (GLUE_IP (6, DNS_PRIORITY), | |
6640 | nmc_property_ipv6_get_dns_priority, | |
6641 | nmc_property_set_int, | |
6642 | NULL, | |
6579 | 6643 | NULL, |
6580 | 6644 | NULL, |
6581 | 6645 | NULL); |
7998 | 8062 | set_val_str (arr, 7, nmc_property_802_1X_get_subject_match (setting, NMC_PROPERTY_GET_PRETTY)); |
7999 | 8063 | set_val_str (arr, 8, nmc_property_802_1X_get_altsubject_matches (setting, NMC_PROPERTY_GET_PRETTY)); |
8000 | 8064 | set_val_str (arr, 9, nmc_property_802_1X_get_domain_suffix_match (setting, NMC_PROPERTY_GET_PRETTY)); |
8001 | set_val_str (arr, 10, nmc_property_802_1X_get_client_cert (setting, NMC_PROPERTY_GET_PRETTY)); | |
8065 | set_val_str (arr, 10, nmc_property_802_1X_get_client_cert (setting, NMC_PROPERTY_GET_PRETTY, secrets)); | |
8002 | 8066 | set_val_str (arr, 11, nmc_property_802_1X_get_phase1_peapver (setting, NMC_PROPERTY_GET_PRETTY)); |
8003 | 8067 | set_val_str (arr, 12, nmc_property_802_1X_get_phase1_peaplabel (setting, NMC_PROPERTY_GET_PRETTY)); |
8004 | 8068 | set_val_str (arr, 13, nmc_property_802_1X_get_phase1_fast_provisioning (setting, NMC_PROPERTY_GET_PRETTY)); |
8009 | 8073 | set_val_str (arr, 18, nmc_property_802_1X_get_phase2_subject_match (setting, NMC_PROPERTY_GET_PRETTY)); |
8010 | 8074 | set_val_str (arr, 19, nmc_property_802_1X_get_phase2_altsubject_matches (setting, NMC_PROPERTY_GET_PRETTY)); |
8011 | 8075 | set_val_str (arr, 20, nmc_property_802_1X_get_phase2_domain_suffix_match (setting, NMC_PROPERTY_GET_PRETTY)); |
8012 | set_val_str (arr, 21, nmc_property_802_1X_get_phase2_client_cert (setting, NMC_PROPERTY_GET_PRETTY)); | |
8076 | set_val_str (arr, 21, nmc_property_802_1X_get_phase2_client_cert (setting, NMC_PROPERTY_GET_PRETTY, secrets)); | |
8013 | 8077 | set_val_str (arr, 22, GET_SECRET (secrets, setting, nmc_property_802_1X_get_password)); |
8014 | 8078 | set_val_str (arr, 23, nmc_property_802_1X_get_password_flags (setting, NMC_PROPERTY_GET_PRETTY)); |
8015 | 8079 | set_val_str (arr, 24, GET_SECRET (secrets, setting, nmc_property_802_1X_get_password_raw)); |
8016 | 8080 | set_val_str (arr, 25, nmc_property_802_1X_get_password_raw_flags (setting, NMC_PROPERTY_GET_PRETTY)); |
8017 | set_val_str (arr, 26, nmc_property_802_1X_get_private_key (setting, NMC_PROPERTY_GET_PRETTY)); | |
8081 | set_val_str (arr, 26, nmc_property_802_1X_get_private_key (setting, NMC_PROPERTY_GET_PRETTY, secrets)); | |
8018 | 8082 | set_val_str (arr, 27, GET_SECRET (secrets, setting, nmc_property_802_1X_get_private_key_password)); |
8019 | 8083 | set_val_str (arr, 28, nmc_property_802_1X_get_private_key_password_flags (setting, NMC_PROPERTY_GET_PRETTY)); |
8020 | set_val_str (arr, 29, nmc_property_802_1X_get_phase2_private_key (setting, NMC_PROPERTY_GET_PRETTY)); | |
8084 | set_val_str (arr, 29, nmc_property_802_1X_get_phase2_private_key (setting, NMC_PROPERTY_GET_PRETTY, secrets)); | |
8021 | 8085 | set_val_str (arr, 30, GET_SECRET (secrets, setting, nmc_property_802_1X_get_phase2_private_key_password)); |
8022 | 8086 | set_val_str (arr, 31, nmc_property_802_1X_get_phase2_private_key_password_flags (setting, NMC_PROPERTY_GET_PRETTY)); |
8023 | 8087 | set_val_str (arr, 32, GET_SECRET (secrets, setting, nmc_property_802_1X_get_pin)); |
8134 | 8198 | set_val_str (arr, 2, nmc_property_ipv4_get_dns (setting, NMC_PROPERTY_GET_PRETTY)); |
8135 | 8199 | set_val_str (arr, 3, nmc_property_ipv4_get_dns_search (setting, NMC_PROPERTY_GET_PRETTY)); |
8136 | 8200 | set_val_str (arr, 4, nmc_property_ipv4_get_dns_options (setting, NMC_PROPERTY_GET_PRETTY)); |
8137 | set_val_str (arr, 5, nmc_property_ip_get_addresses (setting, NMC_PROPERTY_GET_PRETTY)); | |
8138 | set_val_str (arr, 6, nmc_property_ipv4_get_gateway (setting, NMC_PROPERTY_GET_PRETTY)); | |
8139 | set_val_str (arr, 7, nmc_property_ipv4_get_routes (setting, NMC_PROPERTY_GET_PRETTY)); | |
8140 | set_val_str (arr, 8, nmc_property_ipv4_get_route_metric (setting, NMC_PROPERTY_GET_PRETTY)); | |
8141 | set_val_str (arr, 9, nmc_property_ipv4_get_ignore_auto_routes (setting, NMC_PROPERTY_GET_PRETTY)); | |
8142 | set_val_str (arr, 10, nmc_property_ipv4_get_ignore_auto_dns (setting, NMC_PROPERTY_GET_PRETTY)); | |
8143 | set_val_str (arr, 11, nmc_property_ipv4_get_dhcp_client_id (setting, NMC_PROPERTY_GET_PRETTY)); | |
8144 | set_val_str (arr, 12, nmc_property_ipv4_get_dhcp_timeout (setting, NMC_PROPERTY_GET_PRETTY)); | |
8145 | set_val_str (arr, 13, nmc_property_ipv4_get_dhcp_send_hostname (setting, NMC_PROPERTY_GET_PRETTY)); | |
8146 | set_val_str (arr, 14, nmc_property_ipv4_get_dhcp_hostname (setting, NMC_PROPERTY_GET_PRETTY)); | |
8147 | set_val_str (arr, 15, nmc_property_ipv4_get_dhcp_fqdn (setting, NMC_PROPERTY_GET_PRETTY)); | |
8148 | set_val_str (arr, 16, nmc_property_ipv4_get_never_default (setting, NMC_PROPERTY_GET_PRETTY)); | |
8149 | set_val_str (arr, 17, nmc_property_ipv4_get_may_fail (setting, NMC_PROPERTY_GET_PRETTY)); | |
8150 | set_val_str (arr, 18, nmc_property_ipv4_get_dad_timeout (setting, NMC_PROPERTY_GET_PRETTY)); | |
8201 | set_val_str (arr, 5, nmc_property_ipv4_get_dns_priority (setting, NMC_PROPERTY_GET_PRETTY)); | |
8202 | set_val_str (arr, 6, nmc_property_ip_get_addresses (setting, NMC_PROPERTY_GET_PRETTY)); | |
8203 | set_val_str (arr, 7, nmc_property_ipv4_get_gateway (setting, NMC_PROPERTY_GET_PRETTY)); | |
8204 | set_val_str (arr, 8, nmc_property_ipv4_get_routes (setting, NMC_PROPERTY_GET_PRETTY)); | |
8205 | set_val_str (arr, 9, nmc_property_ipv4_get_route_metric (setting, NMC_PROPERTY_GET_PRETTY)); | |
8206 | set_val_str (arr, 10, nmc_property_ipv4_get_ignore_auto_routes (setting, NMC_PROPERTY_GET_PRETTY)); | |
8207 | set_val_str (arr, 11, nmc_property_ipv4_get_ignore_auto_dns (setting, NMC_PROPERTY_GET_PRETTY)); | |
8208 | set_val_str (arr, 12, nmc_property_ipv4_get_dhcp_client_id (setting, NMC_PROPERTY_GET_PRETTY)); | |
8209 | set_val_str (arr, 13, nmc_property_ipv4_get_dhcp_timeout (setting, NMC_PROPERTY_GET_PRETTY)); | |
8210 | set_val_str (arr, 14, nmc_property_ipv4_get_dhcp_send_hostname (setting, NMC_PROPERTY_GET_PRETTY)); | |
8211 | set_val_str (arr, 15, nmc_property_ipv4_get_dhcp_hostname (setting, NMC_PROPERTY_GET_PRETTY)); | |
8212 | set_val_str (arr, 16, nmc_property_ipv4_get_dhcp_fqdn (setting, NMC_PROPERTY_GET_PRETTY)); | |
8213 | set_val_str (arr, 17, nmc_property_ipv4_get_never_default (setting, NMC_PROPERTY_GET_PRETTY)); | |
8214 | set_val_str (arr, 18, nmc_property_ipv4_get_may_fail (setting, NMC_PROPERTY_GET_PRETTY)); | |
8215 | set_val_str (arr, 19, nmc_property_ipv4_get_dad_timeout (setting, NMC_PROPERTY_GET_PRETTY)); | |
8151 | 8216 | g_ptr_array_add (nmc->output_data, arr); |
8152 | 8217 | |
8153 | 8218 | print_data (nmc); /* Print all data */ |
8177 | 8242 | set_val_str (arr, 2, nmc_property_ipv6_get_dns (setting, NMC_PROPERTY_GET_PRETTY)); |
8178 | 8243 | set_val_str (arr, 3, nmc_property_ipv6_get_dns_search (setting, NMC_PROPERTY_GET_PRETTY)); |
8179 | 8244 | set_val_str (arr, 4, nmc_property_ipv6_get_dns_options (setting, NMC_PROPERTY_GET_PRETTY)); |
8180 | set_val_str (arr, 5, nmc_property_ip_get_addresses (setting, NMC_PROPERTY_GET_PRETTY)); | |
8181 | set_val_str (arr, 6, nmc_property_ipv6_get_gateway (setting, NMC_PROPERTY_GET_PRETTY)); | |
8182 | set_val_str (arr, 7, nmc_property_ipv6_get_routes (setting, NMC_PROPERTY_GET_PRETTY)); | |
8183 | set_val_str (arr, 8, nmc_property_ipv6_get_route_metric (setting, NMC_PROPERTY_GET_PRETTY)); | |
8184 | set_val_str (arr, 9, nmc_property_ipv6_get_ignore_auto_routes (setting, NMC_PROPERTY_GET_PRETTY)); | |
8185 | set_val_str (arr, 10, nmc_property_ipv6_get_ignore_auto_dns (setting, NMC_PROPERTY_GET_PRETTY)); | |
8186 | set_val_str (arr, 11, nmc_property_ipv6_get_never_default (setting, NMC_PROPERTY_GET_PRETTY)); | |
8187 | set_val_str (arr, 12, nmc_property_ipv6_get_may_fail (setting, NMC_PROPERTY_GET_PRETTY)); | |
8188 | set_val_str (arr, 13, nmc_property_ipv6_get_ip6_privacy (setting, NMC_PROPERTY_GET_PRETTY)); | |
8189 | set_val_str (arr, 14, nmc_property_ipv6_get_addr_gen_mode (setting, NMC_PROPERTY_GET_PRETTY)); | |
8190 | set_val_str (arr, 15, nmc_property_ipv6_get_dhcp_send_hostname (setting, NMC_PROPERTY_GET_PRETTY)); | |
8191 | set_val_str (arr, 16, nmc_property_ipv6_get_dhcp_hostname (setting, NMC_PROPERTY_GET_PRETTY)); | |
8245 | set_val_str (arr, 5, nmc_property_ipv6_get_dns_priority (setting, NMC_PROPERTY_GET_PRETTY)); | |
8246 | set_val_str (arr, 6, nmc_property_ip_get_addresses (setting, NMC_PROPERTY_GET_PRETTY)); | |
8247 | set_val_str (arr, 7, nmc_property_ipv6_get_gateway (setting, NMC_PROPERTY_GET_PRETTY)); | |
8248 | set_val_str (arr, 8, nmc_property_ipv6_get_routes (setting, NMC_PROPERTY_GET_PRETTY)); | |
8249 | set_val_str (arr, 9, nmc_property_ipv6_get_route_metric (setting, NMC_PROPERTY_GET_PRETTY)); | |
8250 | set_val_str (arr, 10, nmc_property_ipv6_get_ignore_auto_routes (setting, NMC_PROPERTY_GET_PRETTY)); | |
8251 | set_val_str (arr, 11, nmc_property_ipv6_get_ignore_auto_dns (setting, NMC_PROPERTY_GET_PRETTY)); | |
8252 | set_val_str (arr, 12, nmc_property_ipv6_get_never_default (setting, NMC_PROPERTY_GET_PRETTY)); | |
8253 | set_val_str (arr, 13, nmc_property_ipv6_get_may_fail (setting, NMC_PROPERTY_GET_PRETTY)); | |
8254 | set_val_str (arr, 14, nmc_property_ipv6_get_ip6_privacy (setting, NMC_PROPERTY_GET_PRETTY)); | |
8255 | set_val_str (arr, 15, nmc_property_ipv6_get_addr_gen_mode (setting, NMC_PROPERTY_GET_PRETTY)); | |
8256 | set_val_str (arr, 16, nmc_property_ipv6_get_dhcp_send_hostname (setting, NMC_PROPERTY_GET_PRETTY)); | |
8257 | set_val_str (arr, 17, nmc_property_ipv6_get_dhcp_hostname (setting, NMC_PROPERTY_GET_PRETTY)); | |
8192 | 8258 | g_ptr_array_add (nmc->output_data, arr); |
8193 | 8259 | |
8194 | 8260 | print_data (nmc); /* Print all data */ |
35 | 35 | static GSList *plugins = NULL; |
36 | 36 | |
37 | 37 | NMVpnEditorPlugin * |
38 | nm_vpn_get_plugin_by_service (const char *service, GError **error) | |
38 | nm_vpn_lookup_plugin (const char *name, const char *service, GError **error) | |
39 | 39 | { |
40 | 40 | NMVpnEditorPlugin *plugin = NULL; |
41 | 41 | NMVpnPluginInfo *plugin_info; |
42 | char *type = NULL; | |
43 | ||
44 | g_return_val_if_fail (service != NULL, NULL); | |
42 | gs_free_error GError *local = NULL; | |
43 | ||
44 | g_return_val_if_fail (!service ^ !name, NULL); | |
45 | 45 | g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
46 | 46 | |
47 | 47 | if (G_UNLIKELY (!plugins_loaded)) |
48 | 48 | nm_vpn_get_plugins (); |
49 | 49 | |
50 | if (!g_str_has_prefix (service, NM_DBUS_INTERFACE)) | |
51 | service = type = g_strdup_printf ("%s.%s", NM_DBUS_INTERFACE, service); | |
52 | ||
53 | plugin_info = nm_vpn_plugin_info_list_find_by_service (plugins, service); | |
54 | if (plugin_info) { | |
55 | plugin = nm_vpn_plugin_info_get_editor_plugin (plugin_info); | |
56 | if (!plugin) | |
57 | plugin = nm_vpn_plugin_info_load_editor_plugin (plugin_info, error); | |
58 | } else | |
59 | g_set_error_literal (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED, | |
60 | _("could not get VPN plugin info")); | |
61 | g_free (type); | |
50 | if (service) | |
51 | plugin_info = nm_vpn_plugin_info_list_find_by_service (plugins, service); | |
52 | else | |
53 | plugin_info = nm_vpn_plugin_info_list_find_by_name (plugins, name); | |
54 | ||
55 | if (!plugin_info) { | |
56 | g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED, | |
57 | _("unknown VPN plugin \"%s\""), service ?: name); | |
58 | return NULL; | |
59 | } | |
60 | plugin = nm_vpn_plugin_info_get_editor_plugin (plugin_info); | |
61 | if (!plugin) | |
62 | plugin = nm_vpn_plugin_info_load_editor_plugin (plugin_info, &local); | |
63 | ||
64 | if (!plugin) { | |
65 | if ( !nm_vpn_plugin_info_get_plugin (plugin_info) | |
66 | && nm_vpn_plugin_info_lookup_property (plugin_info, NM_VPN_PLUGIN_INFO_KF_GROUP_GNOME, "properties")) { | |
67 | g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED, | |
68 | _("cannot cannot load legacy-only VPN plugin \"%s\" for \"%s\""), | |
69 | nm_vpn_plugin_info_get_name (plugin_info), | |
70 | nm_vpn_plugin_info_get_filename (plugin_info)); | |
71 | } else if (g_error_matches (local, G_FILE_ERROR, G_FILE_ERROR_NOENT)) { | |
72 | g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED, | |
73 | _("cannot load VPN plugin \"%s\" due to missing \"%s\". Missing client plugin?"), | |
74 | nm_vpn_plugin_info_get_name (plugin_info), | |
75 | nm_vpn_plugin_info_get_plugin (plugin_info)); | |
76 | } else { | |
77 | g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED, | |
78 | _("failed to load VPN plugin \"%s\": %s"), | |
79 | nm_vpn_plugin_info_get_name (plugin_info), | |
80 | local->message); | |
81 | } | |
82 | return NULL; | |
83 | } | |
84 | ||
62 | 85 | return plugin; |
63 | 86 | } |
64 | 87 | |
72 | 95 | return plugins; |
73 | 96 | } |
74 | 97 | |
98 | static int | |
99 | _strcmp_data (gconstpointer a, gconstpointer b, gpointer unused) | |
100 | { | |
101 | return strcmp (a, b); | |
102 | } | |
103 | ||
104 | const char ** | |
105 | nm_vpn_get_plugin_names (gboolean only_available_plugins) | |
106 | { | |
107 | GSList *p; | |
108 | const char **list; | |
109 | const char *known_names[] = { | |
110 | "openvpn", | |
111 | "vpnc", | |
112 | "pptp", | |
113 | "openconnect", | |
114 | "openswan", | |
115 | "libreswan", | |
116 | "strongswan", | |
117 | "ssh", | |
118 | "l2tp", | |
119 | "iodine", | |
120 | "fortisslvpn", | |
121 | }; | |
122 | guint i, j, k; | |
123 | ||
124 | p = nm_vpn_get_plugins (); | |
125 | list = g_new0 (const char *, g_slist_length (p) + G_N_ELEMENTS (known_names) + 1); | |
126 | ||
127 | i = 0; | |
128 | for (i = 0; p; p = p->next) | |
129 | list[i++] = nm_vpn_plugin_info_get_name (p->data); | |
130 | if (!only_available_plugins) { | |
131 | for (j = 0; j < G_N_ELEMENTS (known_names); j++) | |
132 | list[i++] = known_names[j]; | |
133 | } | |
134 | ||
135 | g_qsort_with_data (list, i, sizeof (gpointer), _strcmp_data, NULL); | |
136 | ||
137 | /* remove duplicates */ | |
138 | for (k = 0, j = 1; j < i; j++) { | |
139 | if (nm_streq (list[k], list[j])) | |
140 | continue; | |
141 | list[k++] = list[j]; | |
142 | } | |
143 | list[k++] = NULL; | |
144 | ||
145 | return list; | |
146 | } | |
147 | ||
148 | const char * | |
149 | nm_vpn_get_service_for_name (const char *name) | |
150 | { | |
151 | NMVpnPluginInfo *plugin_info; | |
152 | ||
153 | g_return_val_if_fail (name, NULL); | |
154 | ||
155 | plugin_info = nm_vpn_plugin_info_list_find_by_name (nm_vpn_get_plugins (), name); | |
156 | if (plugin_info) { | |
157 | /* this only means we have a .name file (NMVpnPluginInfo). Possibly the | |
158 | * NMVpnEditorPlugin is not loadable. */ | |
159 | return nm_vpn_plugin_info_lookup_property (plugin_info, | |
160 | NM_VPN_PLUGIN_INFO_KF_GROUP_CONNECTION, | |
161 | "service"); | |
162 | } | |
163 | return NULL; | |
164 | } | |
165 | ||
166 | char * | |
167 | nm_vpn_get_service_for_name_default (const char *name) | |
168 | { | |
169 | return g_strdup_printf ("%s.%s", NM_DBUS_INTERFACE, name); | |
170 | } | |
171 | ||
75 | 172 | gboolean |
76 | 173 | nm_vpn_supports_ipv6 (NMConnection *connection) |
77 | 174 | { |
84 | 181 | g_return_val_if_fail (s_vpn != NULL, FALSE); |
85 | 182 | |
86 | 183 | service_type = nm_setting_vpn_get_service_type (s_vpn); |
87 | g_return_val_if_fail (service_type != NULL, FALSE); | |
88 | ||
89 | plugin = nm_vpn_get_plugin_by_service (service_type, NULL); | |
90 | g_return_val_if_fail (plugin != NULL, FALSE); | |
184 | if (!service_type) | |
185 | return FALSE; | |
186 | ||
187 | plugin = nm_vpn_lookup_plugin (NULL, service_type, NULL); | |
188 | if (!plugin) | |
189 | return FALSE; | |
91 | 190 | |
92 | 191 | capabilities = nm_vpn_editor_plugin_get_capabilities (plugin); |
93 | 192 | return NM_FLAGS_HAS (capabilities, NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6); |
29 | 29 | |
30 | 30 | GSList *nm_vpn_get_plugins (void); |
31 | 31 | |
32 | NMVpnEditorPlugin *nm_vpn_get_plugin_by_service (const char *service, GError **error); | |
32 | const char **nm_vpn_get_plugin_names (gboolean only_available_plugins); | |
33 | ||
34 | const char *nm_vpn_get_service_for_name (const char *name); | |
35 | char * nm_vpn_get_service_for_name_default (const char *name); | |
36 | ||
37 | NMVpnEditorPlugin *nm_vpn_lookup_plugin (const char *name, const char *service, GError **error); | |
33 | 38 | |
34 | 39 | gboolean nm_vpn_supports_ipv6 (NMConnection *connection); |
35 | 40 |
428 | 428 | NM = @NM@ |
429 | 429 | NMEDIT = @NMEDIT@ |
430 | 430 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
431 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
431 | 432 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
432 | 433 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
433 | 434 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
329 | 329 | NM = @NM@ |
330 | 330 | NMEDIT = @NMEDIT@ |
331 | 331 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
332 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
332 | 333 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
333 | 334 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
334 | 335 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
183 | 183 | connection = nm_editor_utils_create_connection (type, priv->master, nm_client); |
184 | 184 | nmt_edit_connection (connection); |
185 | 185 | g_object_unref (connection); |
186 | ||
186 | } | |
187 | ||
188 | static void | |
189 | create_connection_and_quit (NmtNewtWidget *widget, gpointer list) | |
190 | { | |
191 | create_connection (widget, list); | |
187 | 192 | nmt_newt_form_quit (list); |
188 | 193 | } |
189 | 194 | |
202 | 207 | |
203 | 208 | listbox = nmt_newt_listbox_new (5, NMT_NEWT_LISTBOX_SCROLL); |
204 | 209 | priv->listbox = NMT_NEWT_LISTBOX (listbox); |
205 | g_signal_connect (priv->listbox, "activated", G_CALLBACK (create_connection), form); | |
210 | g_signal_connect (priv->listbox, "activated", G_CALLBACK (create_connection_and_quit), form); | |
206 | 211 | nmt_newt_grid_add (grid, listbox, 0, 1); |
207 | 212 | nmt_newt_widget_set_padding (listbox, 0, 1, 0, 0); |
208 | 213 | nmt_newt_grid_set_flags (grid, listbox, NMT_NEWT_GRID_EXPAND_X); |
222 | 227 | NMT_NEWT_GRID_FILL_Y); |
223 | 228 | |
224 | 229 | button = g_object_ref_sink (nmt_newt_button_new (_("Create"))); |
225 | g_signal_connect (button, "clicked", G_CALLBACK (create_connection), form); | |
230 | g_signal_connect (button, "clicked", G_CALLBACK (create_connection_and_quit), form); | |
226 | 231 | nmt_newt_grid_add (NMT_NEWT_GRID (buttons), button, 1, 0); |
227 | 232 | |
228 | 233 | nmt_newt_form_set_content (NMT_NEWT_FORM (form), NMT_NEWT_WIDGET (grid)); |
147 | 147 | |
148 | 148 | /* The default value of the auth-polkit configuration option */ |
149 | 149 | #undef NM_CONFIG_DEFAULT_AUTH_POLKIT |
150 | ||
151 | /* Default value for main.rc-manager setting | |
152 | (--with-config-dns-rc-manager-default) */ | |
153 | #undef NM_CONFIG_DEFAULT_DNS_RC_MANAGER | |
150 | 154 | |
151 | 155 | /* The default value of the logging.audit configuration option */ |
152 | 156 | #undef NM_CONFIG_DEFAULT_LOGGING_AUDIT |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.69 for NetworkManager 1.2.2. | |
2 | # Generated by GNU Autoconf 2.69 for NetworkManager 1.2.4. | |
3 | 3 | # |
4 | 4 | # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager>. |
5 | 5 | # |
590 | 590 | # Identity of this package. |
591 | 591 | PACKAGE_NAME='NetworkManager' |
592 | 592 | PACKAGE_TARNAME='NetworkManager' |
593 | PACKAGE_VERSION='1.2.2' | |
594 | PACKAGE_STRING='NetworkManager 1.2.2' | |
593 | PACKAGE_VERSION='1.2.4' | |
594 | PACKAGE_STRING='NetworkManager 1.2.4' | |
595 | 595 | PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager' |
596 | 596 | PACKAGE_URL='' |
597 | 597 | |
697 | 697 | DNSSEC_TRIGGER_SCRIPT |
698 | 698 | DNSMASQ_PATH |
699 | 699 | IPTABLES_PATH |
700 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER | |
700 | 701 | with_netconfig |
701 | 702 | with_resolvconf |
702 | 703 | DHCPCD_PATH |
1059 | 1060 | with_dhcpcd |
1060 | 1061 | with_resolvconf |
1061 | 1062 | with_netconfig |
1063 | with_config_dns_rc_manager_default | |
1062 | 1064 | with_iptables |
1063 | 1065 | with_dnsmasq |
1064 | 1066 | with_dnssec_trigger |
1684 | 1686 | # Omit some internal or obsolete options to make the list less imposing. |
1685 | 1687 | # This message is too long to be a string in the A/UX 3.1 sh. |
1686 | 1688 | cat <<_ACEOF |
1687 | \`configure' configures NetworkManager 1.2.2 to adapt to many kinds of systems. | |
1689 | \`configure' configures NetworkManager 1.2.4 to adapt to many kinds of systems. | |
1688 | 1690 | |
1689 | 1691 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1690 | 1692 | |
1754 | 1756 | |
1755 | 1757 | if test -n "$ac_init_help"; then |
1756 | 1758 | case $ac_init_help in |
1757 | short | recursive ) echo "Configuration of NetworkManager 1.2.2:";; | |
1759 | short | recursive ) echo "Configuration of NetworkManager 1.2.4:";; | |
1758 | 1760 | esac |
1759 | 1761 | cat <<\_ACEOF |
1760 | 1762 | |
1882 | 1884 | --with-resolvconf=yes|no|path |
1883 | 1885 | Enable resolvconf support |
1884 | 1886 | --with-netconfig=yes|no Enable SUSE netconfig support |
1887 | --with-config-dns-rc-manager-default=symlink|file|netconfig|resolvconf | |
1888 | Configure default value for main.rc-manager setting | |
1885 | 1889 | --with-iptables=/path/to/iptables |
1886 | 1890 | path to iptables |
1887 | 1891 | --with-dnsmasq=/path/to/dnsmasq |
2061 | 2065 | test -n "$ac_init_help" && exit $ac_status |
2062 | 2066 | if $ac_init_version; then |
2063 | 2067 | cat <<\_ACEOF |
2064 | NetworkManager configure 1.2.2 | |
2068 | NetworkManager configure 1.2.4 | |
2065 | 2069 | generated by GNU Autoconf 2.69 |
2066 | 2070 | |
2067 | 2071 | Copyright (C) 2012 Free Software Foundation, Inc. |
2788 | 2792 | This file contains any messages produced by compilers while |
2789 | 2793 | running configure, to aid debugging if configure makes a mistake. |
2790 | 2794 | |
2791 | It was created by NetworkManager $as_me 1.2.2, which was | |
2795 | It was created by NetworkManager $as_me 1.2.4, which was | |
2792 | 2796 | generated by GNU Autoconf 2.69. Invocation command line was |
2793 | 2797 | |
2794 | 2798 | $ $0 $@ |
3658 | 3662 | |
3659 | 3663 | # Define the identity of the package. |
3660 | 3664 | PACKAGE='NetworkManager' |
3661 | VERSION='1.2.2' | |
3665 | VERSION='1.2.4' | |
3662 | 3666 | |
3663 | 3667 | |
3664 | 3668 | cat >>confdefs.h <<_ACEOF |
17539 | 17543 | |
17540 | 17544 | NM_MAJOR_VERSION=1 |
17541 | 17545 | NM_MINOR_VERSION=2 |
17542 | NM_MICRO_VERSION=2 | |
17543 | NM_VERSION=1.2.2 | |
17544 | NM_GIT_SHA=8f6d416768cf69932999b1fc2ab4231321761657 | |
17546 | NM_MICRO_VERSION=4 | |
17547 | NM_VERSION=1.2.4 | |
17548 | NM_GIT_SHA=54a84c6b3bd04123ee0831ae371d795ddd694cf9 | |
17545 | 17549 | |
17546 | 17550 | |
17547 | 17551 | |
24466 | 24470 | withval=$with_netconfig; |
24467 | 24471 | fi |
24468 | 24472 | |
24473 | ||
24474 | # Check whether --with-config-dns-rc-manager-default was given. | |
24475 | if test "${with_config_dns_rc_manager_default+set}" = set; then : | |
24476 | withval=$with_config_dns_rc_manager_default; config_dns_rc_manager_default=$withval | |
24477 | fi | |
24478 | ||
24479 | if test "$config_dns_rc_manager_default" != symlink -a "$config_dns_rc_manager_default" != file -a "$config_dns_rc_manager_default" != netconfig -a "$config_dns_rc_manager_default" != resolvconf; then | |
24480 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unknown --with-config-dns-rc-manager-default=$config_dns_rc_manager_default setting." >&5 | |
24481 | $as_echo "$as_me: WARNING: Unknown --with-config-dns-rc-manager-default=$config_dns_rc_manager_default setting." >&2;} | |
24482 | config_dns_rc_manager_default= | |
24483 | fi | |
24469 | 24484 | # Use netconfig by default on SUSE |
24470 | 24485 | if test -z "$with_netconfig"; then : |
24471 | 24486 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /etc/SuSE-release" >&5 |
24545 | 24560 | test -n "$with_resolvconf" || with_resolvconf="no" |
24546 | 24561 | |
24547 | 24562 | fi |
24563 | if test "$with_resolvconf" != "no"; then | |
24564 | if test -z "$config_dns_rc_manager_default"; then : | |
24565 | config_dns_rc_manager_default=resolvconf | |
24566 | fi | |
24567 | fi | |
24548 | 24568 | if test "$with_netconfig" = "yes"; then |
24549 | 24569 | for ac_prog in netconfig |
24550 | 24570 | do |
24594 | 24614 | test -n "$with_netconfig" || with_netconfig="no" |
24595 | 24615 | |
24596 | 24616 | fi |
24617 | if test "$with_netconfig" != "no"; then | |
24618 | if test -z "$config_dns_rc_manager_default"; then : | |
24619 | config_dns_rc_manager_default=netconfig | |
24620 | fi | |
24621 | fi | |
24622 | if test -z "$config_dns_rc_manager_default"; then : | |
24623 | config_dns_rc_manager_default=symlink | |
24624 | fi | |
24597 | 24625 | # Define resolvconf and netconfig paths |
24598 | 24626 | if test "$with_resolvconf" != "no"; then |
24599 | 24627 | |
24609 | 24637 | _ACEOF |
24610 | 24638 | |
24611 | 24639 | fi |
24640 | ||
24641 | cat >>confdefs.h <<_ACEOF | |
24642 | #define NM_CONFIG_DEFAULT_DNS_RC_MANAGER "$config_dns_rc_manager_default" | |
24643 | _ACEOF | |
24644 | ||
24645 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER=$config_dns_rc_manager_default | |
24646 | ||
24612 | 24647 | |
24613 | 24648 | # iptables path |
24614 | 24649 | |
27297 | 27332 | # report actual input values of CONFIG_FILES etc. instead of their |
27298 | 27333 | # values after options handling. |
27299 | 27334 | ac_log=" |
27300 | This file was extended by NetworkManager $as_me 1.2.2, which was | |
27335 | This file was extended by NetworkManager $as_me 1.2.4, which was | |
27301 | 27336 | generated by GNU Autoconf 2.69. Invocation command line was |
27302 | 27337 | |
27303 | 27338 | CONFIG_FILES = $CONFIG_FILES |
27363 | 27398 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
27364 | 27399 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
27365 | 27400 | ac_cs_version="\\ |
27366 | NetworkManager config.status 1.2.2 | |
27401 | NetworkManager config.status 1.2.4 | |
27367 | 27402 | configured by $0, generated by GNU Autoconf 2.69, |
27368 | 27403 | with options \\"\$ac_cs_config\\" |
27369 | 27404 | |
29742 | 29777 | echo "Handlers for /etc/resolv.conf:" |
29743 | 29778 | echo " resolvconf: ${with_resolvconf}" |
29744 | 29779 | echo " netconfig: ${with_netconfig}" |
29780 | echo " config-dns-rc-manager-default: ${config_dns_rc_manager_default}" | |
29745 | 29781 | echo |
29746 | 29782 | |
29747 | 29783 | echo "DHCP clients:" |
2 | 2 | dnl The NM version number |
3 | 3 | m4_define([nm_major_version], [1]) |
4 | 4 | m4_define([nm_minor_version], [2]) |
5 | m4_define([nm_micro_version], [2]) | |
5 | m4_define([nm_micro_version], [4]) | |
6 | 6 | m4_define([nm_version], |
7 | 7 | [nm_major_version.nm_minor_version.nm_micro_version]) |
8 | 8 | m4_define([nm_git_sha], [m4_esyscmd([ ( [ -d ./.git/ ] && [ "$(readlink -f ./.git/)" = "$(readlink -f "$(git rev-parse --git-dir 2>/dev/null)" 2>/dev/null)" ] && git rev-parse --verify -q HEAD 2>/dev/null ) || true ])]) |
762 | 762 | # resolvconf and netconfig support |
763 | 763 | AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support])) |
764 | 764 | AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support])) |
765 | AC_ARG_WITH(config-dns-rc-manager-default, AS_HELP_STRING([--with-config-dns-rc-manager-default=symlink|file|netconfig|resolvconf], [Configure default value for main.rc-manager setting]), [config_dns_rc_manager_default=$withval]) | |
766 | if test "$config_dns_rc_manager_default" != symlink -a "$config_dns_rc_manager_default" != file -a "$config_dns_rc_manager_default" != netconfig -a "$config_dns_rc_manager_default" != resolvconf; then | |
767 | AC_MSG_WARN([Unknown --with-config-dns-rc-manager-default=$config_dns_rc_manager_default setting.]) | |
768 | config_dns_rc_manager_default= | |
769 | fi | |
765 | 770 | # Use netconfig by default on SUSE |
766 | 771 | AS_IF([test -z "$with_netconfig"], AC_CHECK_FILE(/etc/SuSE-release, with_netconfig=yes)) |
767 | 772 | # Otherwise default to "no" |
771 | 776 | if test "$with_resolvconf" = "yes"; then |
772 | 777 | AC_PATH_PROGS(with_resolvconf, resolvconf, no, /sbin:/usr/sbin:/usr/local/sbin) |
773 | 778 | fi |
779 | if test "$with_resolvconf" != "no"; then | |
780 | AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=resolvconf) | |
781 | fi | |
774 | 782 | if test "$with_netconfig" = "yes"; then |
775 | 783 | AC_PATH_PROGS(with_netconfig, netconfig, no, /sbin:/usr/sbin:/usr/local/sbin) |
776 | 784 | fi |
785 | if test "$with_netconfig" != "no"; then | |
786 | AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=netconfig) | |
787 | fi | |
788 | AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=symlink) | |
777 | 789 | # Define resolvconf and netconfig paths |
778 | 790 | if test "$with_resolvconf" != "no"; then |
779 | 791 | AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$with_resolvconf", [Path to resolvconf]) |
781 | 793 | if test "$with_netconfig" != "no"; then |
782 | 794 | AC_DEFINE_UNQUOTED(NETCONFIG_PATH, "$with_netconfig", [Path to netconfig]) |
783 | 795 | fi |
796 | AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_DNS_RC_MANAGER, "$config_dns_rc_manager_default", [Default value for main.rc-manager setting (--with-config-dns-rc-manager-default)]) | |
797 | AC_SUBST(NM_CONFIG_DEFAULT_DNS_RC_MANAGER, $config_dns_rc_manager_default) | |
784 | 798 | |
785 | 799 | # iptables path |
786 | 800 | AC_ARG_WITH(iptables, AS_HELP_STRING([--with-iptables=/path/to/iptables], [path to iptables])) |
1163 | 1177 | echo "Handlers for /etc/resolv.conf:" |
1164 | 1178 | echo " resolvconf: ${with_resolvconf}" |
1165 | 1179 | echo " netconfig: ${with_netconfig}" |
1180 | echo " config-dns-rc-manager-default: ${config_dns_rc_manager_default}" | |
1166 | 1181 | echo |
1167 | 1182 | |
1168 | 1183 | echo "DHCP clients:" |
296 | 296 | NM = @NM@ |
297 | 297 | NMEDIT = @NMEDIT@ |
298 | 298 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
299 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
299 | 300 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
300 | 301 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
301 | 302 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
0 | 0 | [Unit] |
1 | 1 | Description=Network Manager Wait Online |
2 | Documentation=man:nm-online(1) | |
2 | 3 | Requisite=NetworkManager.service |
3 | 4 | After=NetworkManager.service |
4 | 5 | Wants=network.target |
7 | 8 | [Service] |
8 | 9 | Type=oneshot |
9 | 10 | ExecStart=@bindir@/nm-online -s -q --timeout=30 |
11 | RemainAfterExit=yes | |
10 | 12 | |
11 | 13 | [Install] |
12 | 14 | WantedBy=network.target |
0 | 0 | [Unit] |
1 | 1 | Description=Network Manager Wait Online |
2 | Documentation=man:nm-online(1) | |
2 | 3 | Requisite=NetworkManager.service |
3 | 4 | After=NetworkManager.service |
4 | 5 | Before=network-online.target |
6 | 7 | [Service] |
7 | 8 | Type=oneshot |
8 | 9 | ExecStart=@bindir@/nm-online -s -q --timeout=30 |
10 | RemainAfterExit=yes | |
9 | 11 | |
10 | 12 | [Install] |
11 | 13 | WantedBy=network-online.target |
0 | 0 | [Unit] |
1 | 1 | Description=Network Manager |
2 | Documentation=man:NetworkManager(8) | |
2 | 3 | Wants=network.target |
3 | 4 | After=network-pre.target dbus.service |
4 | 5 | Before=network.target @DISTRO_NETWORK_SERVICE@ |
6 | 7 | [Service] |
7 | 8 | Type=dbus |
8 | 9 | BusName=org.freedesktop.NetworkManager |
10 | #ExecReload=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.Reload uint32:0 | |
9 | 11 | ExecReload=/bin/kill -HUP $MAINPID |
10 | 12 | ExecStart=@sbindir@/NetworkManager --no-daemon |
11 | 13 | Restart=on-failure |
327 | 327 | NM = @NM@ |
328 | 328 | NMEDIT = @NMEDIT@ |
329 | 329 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
330 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
330 | 331 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
331 | 332 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
332 | 333 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
273 | 273 | NM = @NM@ |
274 | 274 | NMEDIT = @NMEDIT@ |
275 | 275 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
276 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
276 | 277 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
277 | 278 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
278 | 279 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
63 | 63 | This file is not intended to be modified by the user, but it is read last and can shadow |
64 | 64 | user configuration from <code class="literal">NetworkManager.conf</code>. |
65 | 65 | </p> |
66 | <p> | |
67 | Certain settings from the configuration can be reloaded at runtime either by sending SIGHUP signal or via | |
68 | D-Bus' Reload call. | |
69 | </p> | |
66 | 70 | </div> |
67 | 71 | <div class="refsect1"> |
68 | 72 | <a name="id-1.2.5.6"></a><h2>File Format</h2> |
295 | 299 | configuration with DNSSEC support. The /etc/resolv.conf |
296 | 300 | will be managed by dnssec-trigger daemon.</p> |
297 | 301 | <p><code class="literal">none</code>: NetworkManager will not |
298 | modify resolv.conf.</p> | |
302 | modify resolv.conf. This implies <code class="varname">rc-manager</code> | |
303 | <code class="literal">unmanaged</code></p> | |
299 | 304 | </td> |
300 | 305 | </tr> |
301 | 306 | <tr> |
303 | 308 | <td> |
304 | 309 | <p>Set the <code class="filename">resolv.conf</code> |
305 | 310 | management mode. The default value depends on how NetworkManager |
306 | was built. Regardless of this setting, NetworkManager will | |
311 | was built, whereas this version of NetworkManager was build with | |
312 | a default of "<code class="literal">symlink</code>". | |
313 | Regardless of this setting, NetworkManager will | |
307 | 314 | always write resolv.conf to its runtime state directory.</p> |
308 | <p><code class="literal">none</code>: NetworkManager will symlink | |
315 | <p><code class="literal">symlink</code>: NetworkManager will symlink | |
309 | 316 | <code class="filename">/etc/resolv.conf</code> to its private |
310 | 317 | resolv.conf file in the runtime state directory.</p> |
311 | 318 | <p><code class="literal">file</code>: NetworkManager will write |
312 | <code class="filename">/etc/resolv.conf</code> as file.</p> | |
319 | <code class="filename">/etc/resolv.conf</code> as file. If it finds | |
320 | a symlink, it will follow the symlink and update the target | |
321 | instead.</p> | |
313 | 322 | <p><code class="literal">resolvconf</code>: NetworkManager will run |
314 | 323 | resolvconf to update the DNS configuration.</p> |
315 | 324 | <p><code class="literal">netconfig</code>: NetworkManager will run |
316 | 325 | netconfig to update the DNS configuration.</p> |
326 | <p><code class="literal">unmanaged</code>: don't touch | |
327 | <code class="filename">resolv.conf</code>.</p> | |
328 | <p><code class="literal">none</code>: deprecated alias for | |
329 | <code class="literal">symlink</code>.</p> | |
317 | 330 | </td> |
318 | 331 | </tr> |
319 | 332 | <tr> |
362 | 375 | <tr> |
363 | 376 | <td><p><span class="term"><code class="varname">path</code></span></p></td> |
364 | 377 | <td><p>The location where keyfiles are read and stored. |
365 | This defaults to "<code class="filename">/etc/NetworkManager/conf.d</code>". | |
378 | This defaults to "<code class="filename">${prefix}/etc/NetworkManager/conf.d</code>". | |
366 | 379 | </p></td> |
367 | 380 | </tr> |
368 | 381 | <tr> |
648 | 661 | considered even if the property in question is not present. In |
649 | 662 | the example above, if <code class="literal">[connection-wifi-wlan0]</code> would |
650 | 663 | have <code class="literal">stop-match</code> set to <code class="literal">yes</code>, |
651 | its <code class="literal">ipv6.ip6-privacy</code> value would be | |
652 | unspecified. | |
664 | the device <code class="literal">wlan0</code> would have <code class="literal">ipv6.ip6-privacy</code> | |
665 | property unspecified. That is, the search for the property would not continue | |
666 | in the connection sections <code class="literal">[connection-wifi-other]</code> | |
667 | or <code class="literal">[connection]</code>. | |
653 | 668 | </p></td> |
654 | 669 | </tr> |
655 | 670 | </tbody> |
60 | 60 | <sub name="License" link="license.html"/> |
61 | 61 | </chapters> |
62 | 62 | <functions> |
63 | <keyword type="method" name="The Reload() method" link="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.Reload"/> | |
63 | 64 | <keyword type="method" name="The GetDevices() method" link="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetDevices"/> |
64 | 65 | <keyword type="method" name="The GetAllDevices() method" link="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetAllDevices"/> |
65 | 66 | <keyword type="method" name="The GetDeviceByIpIface() method" link="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetDeviceByIpIface"/> |
316 | 317 | <keyword type="property" name="The "Domains" property" link="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.Domains"/> |
317 | 318 | <keyword type="property" name="The "Searches" property" link="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.Searches"/> |
318 | 319 | <keyword type="property" name="The "DnsOptions" property" link="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsOptions"/> |
320 | <keyword type="property" name="The "DnsPriority" property" link="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority"/> | |
319 | 321 | <keyword type="property" name="The "WinsServers" property" link="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.WinsServers"/> |
320 | 322 | <keyword type="signal" name="The "PropertiesChanged" signal" link="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-signal-org-freedesktop-NetworkManager-IP6Config.PropertiesChanged"/> |
321 | 323 | <keyword type="property" name="The "Addresses" property" link="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Addresses"/> |
327 | 329 | <keyword type="property" name="The "Domains" property" link="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Domains"/> |
328 | 330 | <keyword type="property" name="The "Searches" property" link="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Searches"/> |
329 | 331 | <keyword type="property" name="The "DnsOptions" property" link="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsOptions"/> |
332 | <keyword type="property" name="The "DnsPriority" property" link="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority"/> | |
330 | 333 | <keyword type="method" name="The Connect() method" link="gdbus-org.freedesktop.NetworkManager.VPN.Plugin.html#gdbus-method-org-freedesktop-NetworkManager-VPN-Plugin.Connect"/> |
331 | 334 | <keyword type="method" name="The ConnectInteractive() method" link="gdbus-org.freedesktop.NetworkManager.VPN.Plugin.html#gdbus-method-org-freedesktop-NetworkManager-VPN-Plugin.ConnectInteractive"/> |
332 | 335 | <keyword type="method" name="The NeedSecrets() method" link="gdbus-org.freedesktop.NetworkManager.VPN.Plugin.html#gdbus-method-org-freedesktop-NetworkManager-VPN-Plugin.NeedSecrets"/> |
435 | 435 | The signal causes a reload of NetworkManager's configuration. |
436 | 436 | Note that not all configuration parameters can be changed at |
437 | 437 | runtime and therefore some changes may be applied only after |
438 | the next restart of the daemon. The signal also forces a | |
439 | rewrite of DNS configuration. | |
438 | the next restart of the daemon. | |
439 | A SIGHUP also involves further reloading actions, like doing | |
440 | a DNS update and restarting the DNS plugin. The latter can be | |
441 | useful for example when using the dnsmasq plugin and changing | |
442 | its configuration in /etc/NetworkManager/dnsmasq.d. However, | |
443 | it also means this will shortly interrupt name resolution. | |
444 | In the future, there may be further actions added. | |
445 | A SIGHUP means to update NetworkManager configuration and reload | |
446 | everything that is supported. Note that this does not reload | |
447 | connections from disk. For that there is a D-Bus API and | |
448 | nmcli's reload action | |
440 | 449 | </p></td> |
441 | 450 | </tr> |
442 | 451 | <tr> |
443 | 452 | <td><p><span class="term"><code class="varname">SIGUSR1</code></span></p></td> |
444 | 453 | <td><p> |
445 | The signal forces a rewrite of DNS configuration. | |
454 | The signal forces a rewrite of DNS configuration. Contrary to | |
455 | SIGHUP, this does not restart the DNS plugin and will not interrupt | |
456 | name resolution. | |
457 | In the future, further actions may be added. A SIGUSR1 | |
458 | means to write out data like resolv.conf, or refresh a cache. | |
459 | It is a subset of what is done for SIGHUP without reloading | |
460 | configuration from disk. | |
446 | 461 | </p></td> |
447 | 462 | </tr> |
448 | 463 | <tr> |
449 | 464 | <td><p><span class="term"><code class="varname">SIGUSR2</code></span></p></td> |
450 | 465 | <td><p> |
451 | The signal has no effect at the moment. | |
466 | The signal has no effect at the moment but is reserved for future | |
467 | use. | |
452 | 468 | </p></td> |
453 | 469 | </tr> |
454 | 470 | </tbody> |
455 | 471 | </table></div> |
456 | 472 | <p> |
473 | </p> | |
474 | <p> | |
475 | An alternative to a signal to reload configuration is the Reload D-Bus call. | |
476 | It allows for more fine-grained selection of what to reload, it only returns | |
477 | after the reload is complete, and it is guarded by PolicyKit. | |
457 | 478 | </p> |
458 | 479 | </div> |
459 | 480 | <div class="refsect1"> |
50 | 50 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.Domains" title='The "Domains" property'>Domains</a> readable as |
51 | 51 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.Searches" title='The "Searches" property'>Searches</a> readable as |
52 | 52 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsOptions" title='The "DnsOptions" property'>DnsOptions</a> readable as |
53 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority" title='The "DnsPriority" property'>DnsPriority</a> readable i | |
53 | 54 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.WinsServers" title='The "WinsServers" property'>WinsServers</a> readable au |
54 | 55 | </pre> |
55 | 56 | </div> |
172 | 173 | </div> |
173 | 174 | <hr> |
174 | 175 | <div class="refsect2"> |
176 | <a name="gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority"></a><h3>The "DnsPriority" property</h3> | |
177 | <pre class="programlisting"> | |
178 | DnsPriority readable i | |
179 | </pre> | |
180 | <p> The relative priority of DNS servers. | |
181 | </p> | |
182 | </div> | |
183 | <hr> | |
184 | <div class="refsect2"> | |
175 | 185 | <a name="gdbus-property-org-freedesktop-NetworkManager-IP4Config.WinsServers"></a><h3>The "WinsServers" property</h3> |
176 | 186 | <pre class="programlisting"> |
177 | 187 | WinsServers readable au |
50 | 50 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Domains" title='The "Domains" property'>Domains</a> readable as |
51 | 51 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Searches" title='The "Searches" property'>Searches</a> readable as |
52 | 52 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsOptions" title='The "DnsOptions" property'>DnsOptions</a> readable as |
53 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority" title='The "DnsPriority" property'>DnsPriority</a> readable i | |
53 | 54 | </pre> |
54 | 55 | </div> |
55 | 56 | <div class="refsect1"> |
164 | 165 | resolv.conf(5) manual page for the list of supported options. |
165 | 166 | </p> |
166 | 167 | </div> |
168 | <hr> | |
169 | <div class="refsect2"> | |
170 | <a name="gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority"></a><h3>The "DnsPriority" property</h3> | |
171 | <pre class="programlisting"> | |
172 | DnsPriority readable i | |
173 | </pre> | |
174 | <p> The relative priority of DNS servers. | |
175 | </p> | |
176 | </div> | |
167 | 177 | </div> |
168 | 178 | </div> |
169 | 179 | <div class="footer"> |
35 | 35 | <div class="refsynopsisdiv"> |
36 | 36 | <h2>Methods</h2> |
37 | 37 | <pre class="synopsis"> |
38 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.Reload" title="The Reload() method">Reload</a> (IN u flags); | |
38 | 39 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetDevices" title="The GetDevices() method">GetDevices</a> (OUT ao devices); |
39 | 40 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetAllDevices" title="The GetAllDevices() method">GetAllDevices</a> (OUT ao devices); |
40 | 41 | <a class="link" href="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetDeviceByIpIface" title="The GetDeviceByIpIface() method">GetDeviceByIpIface</a> (IN s iface, |
101 | 102 | <div class="refsect1"> |
102 | 103 | <a name="gdbus-methods-org.freedesktop.NetworkManager"></a><h2>Method Details</h2> |
103 | 104 | <div class="refsect2"> |
105 | <a name="gdbus-method-org-freedesktop-NetworkManager.Reload"></a><h3>The Reload() method</h3> | |
106 | <pre class="programlisting"> | |
107 | Reload (IN u flags); | |
108 | </pre> | |
109 | <p> Reload NetworkManager's configuration and perform certain updates, like flushing a cache or | |
110 | rewriting external state to disk. This is similar to sending SIGHUP to NetworkManager but it | |
111 | allows for more fine-grained control over what to reload (see <em class="parameter"><code>flags</code></em>). It also allows | |
112 | non-root access via PolicyKit and contrary to signals it is synchronous. | |
113 | </p> | |
114 | <p> No flags (0x00) means to reload everything that is supported which is identical to | |
115 | sending a SIGHUP. | |
116 | (0x01) means to reload the NetworkManager.conf configuration from disk. Note that this | |
117 | does not include connections, which can be reloaded via Setting's ReloadConnections. | |
118 | (0x02) means to update DNS configuration, which usually involves writing /etc/resolv.conf | |
119 | anew. | |
120 | (0x04) means to restart the DNS plugin. This is for example useful when using | |
121 | dnsmasq plugin, which uses additional configuration in /etc/NetworkManager/dnsmasq.d. | |
122 | If you edit those files, you can restart the DNS plugin. This action shortly interrupts | |
123 | rename resolution. | |
124 | Note that flags may affect each other. For example, restarting the DNS plugin (0x04) | |
125 | implicitly updates DNS too (0x02). Or when reloading the configuration (0x01), changes | |
126 | to DNS setting also cause a DNS update (0x02). However, (0x01) does not involve restarting | |
127 | the DNS plugin (0x02), unless an entirely different plugin is selected. | |
128 | </p> | |
129 | <div class="variablelist"><table border="0" class="variablelist"> | |
130 | <colgroup> | |
131 | <col align="left" valign="top"> | |
132 | <col> | |
133 | </colgroup> | |
134 | <tbody><tr> | |
135 | <td><p><span class="term"><code class="literal">IN u <em class="parameter"><code>flags</code></em></code>:</span></p></td> | |
136 | <td><p>optional flags to specify which parts shall be reloaded.</p></td> | |
137 | </tr></tbody> | |
138 | </table></div> | |
139 | </div> | |
140 | <hr> | |
141 | <div class="refsect2"> | |
104 | 142 | <a name="gdbus-method-org-freedesktop-NetworkManager.GetDevices"></a><h3>The GetDevices() method</h3> |
105 | 143 | <pre class="programlisting"> |
106 | 144 | GetDevices (OUT ao devices); |
13 | 13 | <div class="titlepage"> |
14 | 14 | <div> |
15 | 15 | <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">NetworkManager Reference Manual</p></th></tr></table></div> |
16 | <div><p class="releaseinfo">Version 1.2.2 | |
16 | <div><p class="releaseinfo">Version 1.2.4 | |
17 | 17 | </p></div> |
18 | 18 | <div><p class="copyright">Copyright © 2012, 2013, 2014, 2015, 2016 The NetworkManager Authors</p></div> |
19 | 19 | <div><div class="legalnotice"> |
52 | 52 | <ANCHOR id="gdbus-org.freedesktop.NetworkManager" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.html"> |
53 | 53 | <ANCHOR id="gdbus-interface-org-freedesktop-NetworkManager" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.html#gdbus-interface-org-freedesktop-NetworkManager"> |
54 | 54 | <ANCHOR id="gdbus-methods-org.freedesktop.NetworkManager" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.html#gdbus-methods-org.freedesktop.NetworkManager"> |
55 | <ANCHOR id="gdbus-method-org-freedesktop-NetworkManager.Reload" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.Reload"> | |
55 | 56 | <ANCHOR id="gdbus-method-org-freedesktop-NetworkManager.GetDevices" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetDevices"> |
56 | 57 | <ANCHOR id="gdbus-method-org-freedesktop-NetworkManager.GetAllDevices" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetAllDevices"> |
57 | 58 | <ANCHOR id="gdbus-method-org-freedesktop-NetworkManager.GetDeviceByIpIface" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetDeviceByIpIface"> |
429 | 430 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP4Config.Domains" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.Domains"> |
430 | 431 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP4Config.Searches" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.Searches"> |
431 | 432 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsOptions" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsOptions"> |
433 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority"> | |
432 | 434 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP4Config.WinsServers" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.WinsServers"> |
433 | 435 | <ANCHOR id="gdbus-org.freedesktop.NetworkManager.IP6Config" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP6Config.html"> |
434 | 436 | <ANCHOR id="gdbus-interface-org-freedesktop-NetworkManager-IP6Config" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-interface-org-freedesktop-NetworkManager-IP6Config"> |
444 | 446 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP6Config.Domains" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Domains"> |
445 | 447 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP6Config.Searches" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Searches"> |
446 | 448 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsOptions" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsOptions"> |
449 | <ANCHOR id="gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority"> | |
447 | 450 | <ANCHOR id="gdbus-org.freedesktop.NetworkManager.VPN.Plugin" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.VPN.Plugin.html"> |
448 | 451 | <ANCHOR id="gdbus-interface-org-freedesktop-NetworkManager-VPN-Plugin" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.VPN.Plugin.html#gdbus-interface-org-freedesktop-NetworkManager-VPN-Plugin"> |
449 | 452 | <ANCHOR id="gdbus-methods-org.freedesktop.NetworkManager.VPN.Plugin" href="NetworkManager/gdbus-org.freedesktop.NetworkManager.VPN.Plugin.html#gdbus-methods-org.freedesktop.NetworkManager.VPN.Plugin"> |
349 | 349 | </dt> |
350 | 350 | <dt>org.freedesktop.NetworkManager.IP4Config:DnsOptions, <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsOptions">The "DnsOptions" property</a> |
351 | 351 | </dt> |
352 | <dt>org.freedesktop.NetworkManager.IP4Config:DnsPriority, <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority">The "DnsPriority" property</a> | |
353 | </dt> | |
352 | 354 | <dt>org.freedesktop.NetworkManager.IP4Config:Domains, <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.Domains">The "Domains" property</a> |
353 | 355 | </dt> |
354 | 356 | <dt>org.freedesktop.NetworkManager.IP4Config:Gateway, <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.IP4Config.html#gdbus-property-org-freedesktop-NetworkManager-IP4Config.Gateway">The "Gateway" property</a> |
372 | 374 | <dt>org.freedesktop.NetworkManager.IP6Config:Addresses, <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Addresses">The "Addresses" property</a> |
373 | 375 | </dt> |
374 | 376 | <dt>org.freedesktop.NetworkManager.IP6Config:DnsOptions, <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsOptions">The "DnsOptions" property</a> |
377 | </dt> | |
378 | <dt>org.freedesktop.NetworkManager.IP6Config:DnsPriority, <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority">The "DnsPriority" property</a> | |
375 | 379 | </dt> |
376 | 380 | <dt>org.freedesktop.NetworkManager.IP6Config:Domains, <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.IP6Config.html#gdbus-property-org-freedesktop-NetworkManager-IP6Config.Domains">The "Domains" property</a> |
377 | 381 | </dt> |
572 | 576 | </dt> |
573 | 577 | <dt>org.freedesktop.NetworkManager.GetPermissions(), <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.GetPermissions">The GetPermissions() method</a> |
574 | 578 | </dt> |
579 | <dt>org.freedesktop.NetworkManager.Reload(), <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.Reload">The Reload() method</a> | |
580 | </dt> | |
575 | 581 | <dt>org.freedesktop.NetworkManager.SetLogging(), <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.SetLogging">The SetLogging() method</a> |
576 | 582 | </dt> |
577 | 583 | <dt>org.freedesktop.NetworkManager.Sleep(), <a class="indexterm" href="gdbus-org.freedesktop.NetworkManager.html#gdbus-method-org-freedesktop-NetworkManager.Sleep">The Sleep() method</a> |
1127 | 1127 | <td>Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.</td> |
1128 | 1128 | </tr> |
1129 | 1129 | <tr> |
1130 | <td align="left">dns-priority</td> | |
1131 | <td align="left">int32</td> | |
1132 | <td align="left">0</td> | |
1133 | <td>DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used.</td> | |
1134 | </tr> | |
1135 | <tr> | |
1130 | 1136 | <td align="left">dns-search</td> |
1131 | 1137 | <td align="left">array of string</td> |
1132 | 1138 | <td align="left">[]</td> |
1264 | 1270 | <td align="left">array of string</td> |
1265 | 1271 | <td align="left">[]</td> |
1266 | 1272 | <td>Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.</td> |
1273 | </tr> | |
1274 | <tr> | |
1275 | <td align="left">dns-priority</td> | |
1276 | <td align="left">int32</td> | |
1277 | <td align="left">0</td> | |
1278 | <td>DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used.</td> | |
1267 | 1279 | </tr> |
1268 | 1280 | <tr> |
1269 | 1281 | <td align="left">dns-search</td> |
126 | 126 | org.freedesktop.NetworkManager.wifi.share.open yes |
127 | 127 | org.freedesktop.NetworkManager.settings.modify.system yes |
128 | 128 | org.freedesktop.NetworkManager.settings.modify.own yes |
129 | org.freedesktop.NetworkManager.settings.modify.hostname auth</pre> | |
129 | org.freedesktop.NetworkManager.settings.modify.hostname auth | |
130 | org.freedesktop.NetworkManager.reload no</pre> | |
130 | 131 | <p> |
131 | 132 | This command shows configured polkit permissions for various NetworkManager |
132 | 133 | operations. These permissions or actions (using polkit language) are configured |
1082 | 1082 | <td>Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.</td> |
1083 | 1083 | </tr> |
1084 | 1084 | <tr> |
1085 | <td><pre class="screen">dns-priority</pre></td> | |
1086 | <td><pre class="screen">int32</pre></td> | |
1087 | <td><pre class="screen">0</pre></td> | |
1088 | <td>DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used.</td> | |
1089 | </tr> | |
1090 | <tr> | |
1085 | 1091 | <td><pre class="screen">dns-search</pre></td> |
1086 | 1092 | <td><pre class="screen">array of string</pre></td> |
1087 | 1093 | <td><pre class="screen">[]</pre></td> |
1222 | 1228 | <td>Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.</td> |
1223 | 1229 | </tr> |
1224 | 1230 | <tr> |
1231 | <td><pre class="screen">dns-priority</pre></td> | |
1232 | <td><pre class="screen">int32</pre></td> | |
1233 | <td><pre class="screen">0</pre></td> | |
1234 | <td>DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used.</td> | |
1235 | </tr> | |
1236 | <tr> | |
1225 | 1237 | <td><pre class="screen">dns-search</pre></td> |
1226 | 1238 | <td><pre class="screen">array of string</pre></td> |
1227 | 1239 | <td><pre class="screen">[]</pre></td> |
157 | 157 | <row><entry><screen>dhcp-timeout</screen></entry><entry><screen>int32</screen></entry><entry><screen>0</screen></entry><entry>A timeout for a DHCP transaction in seconds.</entry></row> |
158 | 158 | <row><entry><screen>dns</screen></entry><entry><screen>array of uint32</screen></entry><entry><screen>[]</screen></entry><entry>Array of IP addresses of DNS servers (as network-byte-order integers)</entry></row> |
159 | 159 | <row><entry><screen>dns-options</screen></entry><entry><screen>array of string</screen></entry><entry><screen>[]</screen></entry><entry>Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.</entry></row> |
160 | <row><entry><screen>dns-priority</screen></entry><entry><screen>int32</screen></entry><entry><screen>0</screen></entry><entry>DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used.</entry></row> | |
160 | 161 | <row><entry><screen>dns-search</screen></entry><entry><screen>array of string</screen></entry><entry><screen>[]</screen></entry><entry>Array of DNS search domains.</entry></row> |
161 | 162 | <row><entry><screen>gateway</screen></entry><entry><screen>string</screen></entry><entry><screen/></entry><entry>The gateway associated with this configuration. This is only meaningful if "addresses" is also set.</entry></row> |
162 | 163 | <row><entry><screen>ignore-auto-dns</screen></entry><entry><screen>boolean</screen></entry><entry><screen>FALSE</screen></entry><entry>When "method" is set to "auto" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the "dns" and "dns-search" properties, if any, are used.</entry></row> |
179 | 180 | <row><entry><screen>dhcp-timeout</screen></entry><entry><screen>int32</screen></entry><entry><screen>0</screen></entry><entry>A timeout for a DHCP transaction in seconds.</entry></row> |
180 | 181 | <row><entry><screen>dns</screen></entry><entry><screen>array of byte array</screen></entry><entry><screen>[]</screen></entry><entry>Array of IP addresses of DNS servers (in network byte order)</entry></row> |
181 | 182 | <row><entry><screen>dns-options</screen></entry><entry><screen>array of string</screen></entry><entry><screen>[]</screen></entry><entry>Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.</entry></row> |
183 | <row><entry><screen>dns-priority</screen></entry><entry><screen>int32</screen></entry><entry><screen>0</screen></entry><entry>DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used.</entry></row> | |
182 | 184 | <row><entry><screen>dns-search</screen></entry><entry><screen>array of string</screen></entry><entry><screen>[]</screen></entry><entry>Array of DNS search domains.</entry></row> |
183 | 185 | <row><entry><screen>gateway</screen></entry><entry><screen>string</screen></entry><entry><screen/></entry><entry>The gateway associated with this configuration. This is only meaningful if "addresses" is also set.</entry></row> |
184 | 186 | <row><entry><screen>ignore-auto-dns</screen></entry><entry><screen>boolean</screen></entry><entry><screen>FALSE</screen></entry><entry>When "method" is set to "auto" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the "dns" and "dns-search" properties, if any, are used.</entry></row> |
270 | 270 | NM = @NM@ |
271 | 271 | NMEDIT = @NMEDIT@ |
272 | 272 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
273 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
273 | 274 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
274 | 275 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
275 | 276 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
797 | 797 | </div> |
798 | 798 | <div class="refsect1"> |
799 | 799 | <a name="NMClient.object-hierarchy"></a><h2>Object Hierarchy</h2> |
800 | <pre class="screen"> GEnum | |
800 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
801 | 801 | <span class="lineart">├──</span> NMClientError |
802 | 802 | <span class="lineart">├──</span> NMClientPermission |
803 | 803 | <span class="lineart">╰──</span> NMClientPermissionResult |
3250 | 3250 | <td class="enum_member_annotations"> </td> |
3251 | 3251 | </tr> |
3252 | 3252 | <tr> |
3253 | <td class="enum_member_name"><p><a name="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-GLOBAL-DNS:CAPS"></a>NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS</p></td> | |
3254 | <td class="enum_member_description"> | |
3255 | <p>modify persistent global | |
3256 | DNS configuration</p> | |
3257 | </td> | |
3258 | <td class="enum_member_annotations"> </td> | |
3259 | </tr> | |
3260 | <tr> | |
3261 | <td class="enum_member_name"><p><a name="NM-CLIENT-PERMISSION-RELOAD:CAPS"></a>NM_CLIENT_PERMISSION_RELOAD</p></td> | |
3262 | <td class="enum_member_description"> | |
3263 | <p>controls access to Reload.</p> | |
3264 | </td> | |
3265 | <td class="enum_member_annotations"> </td> | |
3266 | </tr> | |
3267 | <tr> | |
3253 | 3268 | <td class="enum_member_name"><p><a name="NM-CLIENT-PERMISSION-LAST:CAPS"></a>NM_CLIENT_PERMISSION_LAST</p></td> |
3254 | 3269 | <td class="enum_member_description"> |
3255 | 3270 | <p>a reserved boundary value</p> |
541 | 541 | </div> |
542 | 542 | <div class="refsect1"> |
543 | 543 | <a name="NMConnection.object-hierarchy"></a><h2>Object Hierarchy</h2> |
544 | <pre class="screen"> GFlags | |
544 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GFlags</a> | |
545 | 545 | <span class="lineart">╰──</span> NMConnectionSerializationFlags |
546 | 546 | </pre> |
547 | 547 | </div> |
790 | 790 | </div> |
791 | 791 | <div class="refsect1"> |
792 | 792 | <a name="NMDevice.object-hierarchy"></a><h2>Object Hierarchy</h2> |
793 | <pre class="screen"> GBoxed | |
793 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Boxed-Types.html">GBoxed</a> | |
794 | 794 | <span class="lineart">╰──</span> NMLldpNeighbor |
795 | 795 | GObject |
796 | 796 | <span class="lineart">╰──</span> <a class="link" href="NMObject.html" title="NMObject">NMObject</a> |
218 | 218 | </div> |
219 | 219 | <div class="refsect1"> |
220 | 220 | <a name="NMSetting.object-hierarchy"></a><h2>Object Hierarchy</h2> |
221 | <pre class="screen"> GEnum | |
221 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
222 | 222 | <span class="lineart">├──</span> NMSettingCompareFlags |
223 | 223 | <span class="lineart">├──</span> NMSettingDiffResult |
224 | 224 | <span class="lineart">╰──</span> NMSettingMacRandomization |
225 | GFlags | |
225 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GFlags</a> | |
226 | 226 | <span class="lineart">╰──</span> NMSettingSecretFlags |
227 | 227 | GObject |
228 | 228 | <span class="lineart">╰──</span> NMSetting |
960 | 960 | </div> |
961 | 961 | <div class="refsect1"> |
962 | 962 | <a name="NMSetting8021x.object-hierarchy"></a><h2>Object Hierarchy</h2> |
963 | <pre class="screen"> GEnum | |
963 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
964 | 964 | <span class="lineart">├──</span> NMSetting8021xCKFormat |
965 | 965 | <span class="lineart">╰──</span> NMSetting8021xCKScheme |
966 | 966 | GObject |
472 | 472 | </div> |
473 | 473 | <div class="refsect1"> |
474 | 474 | <a name="NMSettingConnection.object-hierarchy"></a><h2>Object Hierarchy</h2> |
475 | <pre class="screen"> GEnum | |
475 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
476 | 476 | <span class="lineart">├──</span> NMSettingConnectionAutoconnectSlaves |
477 | 477 | <span class="lineart">╰──</span> NMSettingConnectionLldp |
478 | 478 | GObject |
405 | 405 | </div> |
406 | 406 | <div class="refsect1"> |
407 | 407 | <a name="NMSettingDcb.object-hierarchy"></a><h2>Object Hierarchy</h2> |
408 | <pre class="screen"> GFlags | |
408 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GFlags</a> | |
409 | 409 | <span class="lineart">╰──</span> NMSettingDcbFlags |
410 | 410 | GObject |
411 | 411 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
150 | 150 | </div> |
151 | 151 | <div class="refsect1"> |
152 | 152 | <a name="NMSettingIP6Config.object-hierarchy"></a><h2>Object Hierarchy</h2> |
153 | <pre class="screen"> GEnum | |
153 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
154 | 154 | <span class="lineart">├──</span> NMSettingIP6ConfigAddrGenMode |
155 | 155 | <span class="lineart">╰──</span> NMSettingIP6ConfigPrivacy |
156 | 156 | GObject |
508 | 508 | </tr> |
509 | 509 | <tr> |
510 | 510 | <td class="function_type"> |
511 | <span class="returnvalue">gint</span> | |
512 | </td> | |
513 | <td class="function_name"> | |
514 | <a class="link" href="NMSettingIPConfig.html#nm-setting-ip-config-get-dns-priority" title="nm_setting_ip_config_get_dns_priority ()">nm_setting_ip_config_get_dns_priority</a> <span class="c_punctuation">()</span> | |
515 | </td> | |
516 | </tr> | |
517 | <tr> | |
518 | <td class="function_type"> | |
511 | 519 | <span class="returnvalue">guint</span> |
512 | 520 | </td> |
513 | 521 | <td class="function_name"> |
730 | 738 | <td class="property_flags">Read / Write</td> |
731 | 739 | </tr> |
732 | 740 | <tr> |
741 | <td class="property_type"><span class="type">gint</span></td> | |
742 | <td class="property_name"><a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--dns-priority" title="The “dns-priority” property">dns-priority</a></td> | |
743 | <td class="property_flags">Read / Write / Construct</td> | |
744 | </tr> | |
745 | <tr> | |
733 | 746 | <td class="property_type"><span class="type">GStrv</span></td> |
734 | 747 | <td class="property_name"><a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--dns-search" title="The “dns-search” property">dns-search</a></td> |
735 | 748 | <td class="property_flags">Read / Write</td> |
810 | 823 | </tr> |
811 | 824 | <tr> |
812 | 825 | <td class="define_keyword">#define</td> |
826 | <td class="function_name"><a class="link" href="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-PRIORITY:CAPS" title="NM_SETTING_IP_CONFIG_DNS_PRIORITY">NM_SETTING_IP_CONFIG_DNS_PRIORITY</a></td> | |
827 | </tr> | |
828 | <tr> | |
829 | <td class="define_keyword">#define</td> | |
813 | 830 | <td class="function_name"><a class="link" href="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-ADDRESSES:CAPS" title="NM_SETTING_IP_CONFIG_ADDRESSES">NM_SETTING_IP_CONFIG_ADDRESSES</a></td> |
814 | 831 | </tr> |
815 | 832 | <tr> |
925 | 942 | </div> |
926 | 943 | <div class="refsect1"> |
927 | 944 | <a name="NMSettingIPConfig.object-hierarchy"></a><h2>Object Hierarchy</h2> |
928 | <pre class="screen"> GBoxed | |
945 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Boxed-Types.html">GBoxed</a> | |
929 | 946 | <span class="lineart">├──</span> NMIPAddress |
930 | 947 | <span class="lineart">╰──</span> NMIPRoute |
931 | 948 | GObject |
2887 | 2904 | </div> |
2888 | 2905 | <hr> |
2889 | 2906 | <div class="refsect2"> |
2907 | <a name="nm-setting-ip-config-get-dns-priority"></a><h3>nm_setting_ip_config_get_dns_priority ()</h3> | |
2908 | <pre class="programlisting"><span class="returnvalue">gint</span> | |
2909 | nm_setting_ip_config_get_dns_priority (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>);</pre> | |
2910 | <div class="refsect3"> | |
2911 | <a name="id-1.4.19.11.61.4"></a><h4>Parameters</h4> | |
2912 | <div class="informaltable"><table width="100%" border="0"> | |
2913 | <colgroup> | |
2914 | <col width="150px" class="parameters_name"> | |
2915 | <col class="parameters_description"> | |
2916 | <col width="200px" class="parameters_annotations"> | |
2917 | </colgroup> | |
2918 | <tbody><tr> | |
2919 | <td class="parameter_name"><p>setting</p></td> | |
2920 | <td class="parameter_description"><p>the <a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a></p></td> | |
2921 | <td class="parameter_annotations"> </td> | |
2922 | </tr></tbody> | |
2923 | </table></div> | |
2924 | </div> | |
2925 | <div class="refsect3"> | |
2926 | <a name="id-1.4.19.11.61.5"></a><h4>Returns</h4> | |
2927 | <p> the priority of DNS servers</p> | |
2928 | </div> | |
2929 | <p class="since">Since: 1.2.4</p> | |
2930 | </div> | |
2931 | <hr> | |
2932 | <div class="refsect2"> | |
2890 | 2933 | <a name="nm-setting-ip-config-get-num-addresses"></a><h3>nm_setting_ip_config_get_num_addresses ()</h3> |
2891 | 2934 | <pre class="programlisting"><span class="returnvalue">guint</span> |
2892 | 2935 | nm_setting_ip_config_get_num_addresses |
2893 | 2936 | (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>);</pre> |
2894 | 2937 | <div class="refsect3"> |
2895 | <a name="id-1.4.19.11.61.4"></a><h4>Parameters</h4> | |
2938 | <a name="id-1.4.19.11.62.4"></a><h4>Parameters</h4> | |
2896 | 2939 | <div class="informaltable"><table width="100%" border="0"> |
2897 | 2940 | <colgroup> |
2898 | 2941 | <col width="150px" class="parameters_name"> |
2907 | 2950 | </table></div> |
2908 | 2951 | </div> |
2909 | 2952 | <div class="refsect3"> |
2910 | <a name="id-1.4.19.11.61.5"></a><h4>Returns</h4> | |
2953 | <a name="id-1.4.19.11.62.5"></a><h4>Returns</h4> | |
2911 | 2954 | <p> the number of configured addresses</p> |
2912 | 2955 | </div> |
2913 | 2956 | </div> |
2918 | 2961 | nm_setting_ip_config_get_address (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>, |
2919 | 2962 | <em class="parameter"><code><span class="type">int</span> idx</code></em>);</pre> |
2920 | 2963 | <div class="refsect3"> |
2921 | <a name="id-1.4.19.11.62.4"></a><h4>Parameters</h4> | |
2964 | <a name="id-1.4.19.11.63.4"></a><h4>Parameters</h4> | |
2922 | 2965 | <div class="informaltable"><table width="100%" border="0"> |
2923 | 2966 | <colgroup> |
2924 | 2967 | <col width="150px" class="parameters_name"> |
2940 | 2983 | </table></div> |
2941 | 2984 | </div> |
2942 | 2985 | <div class="refsect3"> |
2943 | <a name="id-1.4.19.11.62.5"></a><h4>Returns</h4> | |
2986 | <a name="id-1.4.19.11.63.5"></a><h4>Returns</h4> | |
2944 | 2987 | <p> the address at index <em class="parameter"><code>idx</code></em> |
2945 | 2988 | . </p> |
2946 | 2989 | <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
2955 | 2998 | <p>Adds a new IP address and associated information to the setting. The |
2956 | 2999 | given address is duplicated internally and is not changed by this function.</p> |
2957 | 3000 | <div class="refsect3"> |
2958 | <a name="id-1.4.19.11.63.5"></a><h4>Parameters</h4> | |
3001 | <a name="id-1.4.19.11.64.5"></a><h4>Parameters</h4> | |
2959 | 3002 | <div class="informaltable"><table width="100%" border="0"> |
2960 | 3003 | <colgroup> |
2961 | 3004 | <col width="150px" class="parameters_name"> |
2977 | 3020 | </table></div> |
2978 | 3021 | </div> |
2979 | 3022 | <div class="refsect3"> |
2980 | <a name="id-1.4.19.11.63.6"></a><h4>Returns</h4> | |
3023 | <a name="id-1.4.19.11.64.6"></a><h4>Returns</h4> | |
2981 | 3024 | <p> <code class="literal">TRUE</code> if the address was added; <code class="literal">FALSE</code> if the address was already |
2982 | 3025 | known.</p> |
2983 | 3026 | </div> |
2991 | 3034 | <p>Removes the address at index <em class="parameter"><code>idx</code></em> |
2992 | 3035 | .</p> |
2993 | 3036 | <div class="refsect3"> |
2994 | <a name="id-1.4.19.11.64.5"></a><h4>Parameters</h4> | |
3037 | <a name="id-1.4.19.11.65.5"></a><h4>Parameters</h4> | |
2995 | 3038 | <div class="informaltable"><table width="100%" border="0"> |
2996 | 3039 | <colgroup> |
2997 | 3040 | <col width="150px" class="parameters_name"> |
3023 | 3066 | <p>Removes the address <em class="parameter"><code>address</code></em> |
3024 | 3067 | .</p> |
3025 | 3068 | <div class="refsect3"> |
3026 | <a name="id-1.4.19.11.65.5"></a><h4>Parameters</h4> | |
3069 | <a name="id-1.4.19.11.66.5"></a><h4>Parameters</h4> | |
3027 | 3070 | <div class="informaltable"><table width="100%" border="0"> |
3028 | 3071 | <colgroup> |
3029 | 3072 | <col width="150px" class="parameters_name"> |
3045 | 3088 | </table></div> |
3046 | 3089 | </div> |
3047 | 3090 | <div class="refsect3"> |
3048 | <a name="id-1.4.19.11.65.6"></a><h4>Returns</h4> | |
3091 | <a name="id-1.4.19.11.66.6"></a><h4>Returns</h4> | |
3049 | 3092 | <p> <code class="literal">TRUE</code> if the address was found and removed; <code class="literal">FALSE</code> if it was not.</p> |
3050 | 3093 | </div> |
3051 | 3094 | </div> |
3056 | 3099 | nm_setting_ip_config_clear_addresses (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>);</pre> |
3057 | 3100 | <p>Removes all configured addresses.</p> |
3058 | 3101 | <div class="refsect3"> |
3059 | <a name="id-1.4.19.11.66.5"></a><h4>Parameters</h4> | |
3102 | <a name="id-1.4.19.11.67.5"></a><h4>Parameters</h4> | |
3060 | 3103 | <div class="informaltable"><table width="100%" border="0"> |
3061 | 3104 | <colgroup> |
3062 | 3105 | <col width="150px" class="parameters_name"> |
3077 | 3120 | <pre class="programlisting">const <span class="returnvalue">char</span> * |
3078 | 3121 | nm_setting_ip_config_get_gateway (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>);</pre> |
3079 | 3122 | <div class="refsect3"> |
3080 | <a name="id-1.4.19.11.67.4"></a><h4>Parameters</h4> | |
3123 | <a name="id-1.4.19.11.68.4"></a><h4>Parameters</h4> | |
3081 | 3124 | <div class="informaltable"><table width="100%" border="0"> |
3082 | 3125 | <colgroup> |
3083 | 3126 | <col width="150px" class="parameters_name"> |
3092 | 3135 | </table></div> |
3093 | 3136 | </div> |
3094 | 3137 | <div class="refsect3"> |
3095 | <a name="id-1.4.19.11.67.5"></a><h4>Returns</h4> | |
3138 | <a name="id-1.4.19.11.68.5"></a><h4>Returns</h4> | |
3096 | 3139 | <p> the IP address of the gateway associated with this configuration, or |
3097 | 3140 | <code class="literal">NULL</code>.</p> |
3098 | 3141 | </div> |
3103 | 3146 | <pre class="programlisting"><span class="returnvalue">guint</span> |
3104 | 3147 | nm_setting_ip_config_get_num_routes (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>);</pre> |
3105 | 3148 | <div class="refsect3"> |
3106 | <a name="id-1.4.19.11.68.4"></a><h4>Parameters</h4> | |
3149 | <a name="id-1.4.19.11.69.4"></a><h4>Parameters</h4> | |
3107 | 3150 | <div class="informaltable"><table width="100%" border="0"> |
3108 | 3151 | <colgroup> |
3109 | 3152 | <col width="150px" class="parameters_name"> |
3118 | 3161 | </table></div> |
3119 | 3162 | </div> |
3120 | 3163 | <div class="refsect3"> |
3121 | <a name="id-1.4.19.11.68.5"></a><h4>Returns</h4> | |
3164 | <a name="id-1.4.19.11.69.5"></a><h4>Returns</h4> | |
3122 | 3165 | <p> the number of configured routes</p> |
3123 | 3166 | </div> |
3124 | 3167 | </div> |
3129 | 3172 | nm_setting_ip_config_get_route (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>, |
3130 | 3173 | <em class="parameter"><code><span class="type">int</span> idx</code></em>);</pre> |
3131 | 3174 | <div class="refsect3"> |
3132 | <a name="id-1.4.19.11.69.4"></a><h4>Parameters</h4> | |
3175 | <a name="id-1.4.19.11.70.4"></a><h4>Parameters</h4> | |
3133 | 3176 | <div class="informaltable"><table width="100%" border="0"> |
3134 | 3177 | <colgroup> |
3135 | 3178 | <col width="150px" class="parameters_name"> |
3151 | 3194 | </table></div> |
3152 | 3195 | </div> |
3153 | 3196 | <div class="refsect3"> |
3154 | <a name="id-1.4.19.11.69.5"></a><h4>Returns</h4> | |
3197 | <a name="id-1.4.19.11.70.5"></a><h4>Returns</h4> | |
3155 | 3198 | <p> the route at index <em class="parameter"><code>idx</code></em> |
3156 | 3199 | . </p> |
3157 | 3200 | <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p> |
3166 | 3209 | <p>Adds a new route and associated information to the setting. The |
3167 | 3210 | given route is duplicated internally and is not changed by this function.</p> |
3168 | 3211 | <div class="refsect3"> |
3169 | <a name="id-1.4.19.11.70.5"></a><h4>Parameters</h4> | |
3212 | <a name="id-1.4.19.11.71.5"></a><h4>Parameters</h4> | |
3170 | 3213 | <div class="informaltable"><table width="100%" border="0"> |
3171 | 3214 | <colgroup> |
3172 | 3215 | <col width="150px" class="parameters_name"> |
3188 | 3231 | </table></div> |
3189 | 3232 | </div> |
3190 | 3233 | <div class="refsect3"> |
3191 | <a name="id-1.4.19.11.70.6"></a><h4>Returns</h4> | |
3234 | <a name="id-1.4.19.11.71.6"></a><h4>Returns</h4> | |
3192 | 3235 | <p> <code class="literal">TRUE</code> if the route was added; <code class="literal">FALSE</code> if the route was already known.</p> |
3193 | 3236 | </div> |
3194 | 3237 | </div> |
3201 | 3244 | <p>Removes the route at index <em class="parameter"><code>idx</code></em> |
3202 | 3245 | .</p> |
3203 | 3246 | <div class="refsect3"> |
3204 | <a name="id-1.4.19.11.71.5"></a><h4>Parameters</h4> | |
3247 | <a name="id-1.4.19.11.72.5"></a><h4>Parameters</h4> | |
3205 | 3248 | <div class="informaltable"><table width="100%" border="0"> |
3206 | 3249 | <colgroup> |
3207 | 3250 | <col width="150px" class="parameters_name"> |
3233 | 3276 | <p>Removes the route <em class="parameter"><code>route</code></em> |
3234 | 3277 | .</p> |
3235 | 3278 | <div class="refsect3"> |
3236 | <a name="id-1.4.19.11.72.5"></a><h4>Parameters</h4> | |
3279 | <a name="id-1.4.19.11.73.5"></a><h4>Parameters</h4> | |
3237 | 3280 | <div class="informaltable"><table width="100%" border="0"> |
3238 | 3281 | <colgroup> |
3239 | 3282 | <col width="150px" class="parameters_name"> |
3255 | 3298 | </table></div> |
3256 | 3299 | </div> |
3257 | 3300 | <div class="refsect3"> |
3258 | <a name="id-1.4.19.11.72.6"></a><h4>Returns</h4> | |
3301 | <a name="id-1.4.19.11.73.6"></a><h4>Returns</h4> | |
3259 | 3302 | <p> <code class="literal">TRUE</code> if the route was found and removed; <code class="literal">FALSE</code> if it was not.</p> |
3260 | 3303 | </div> |
3261 | 3304 | </div> |
3266 | 3309 | nm_setting_ip_config_clear_routes (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>);</pre> |
3267 | 3310 | <p>Removes all configured routes.</p> |
3268 | 3311 | <div class="refsect3"> |
3269 | <a name="id-1.4.19.11.73.5"></a><h4>Parameters</h4> | |
3312 | <a name="id-1.4.19.11.74.5"></a><h4>Parameters</h4> | |
3270 | 3313 | <div class="informaltable"><table width="100%" border="0"> |
3271 | 3314 | <colgroup> |
3272 | 3315 | <col width="150px" class="parameters_name"> |
3289 | 3332 | <p>Returns the value contained in the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--route-metric" title="The “route-metric” property"><span class="type">“route-metric”</span></a> |
3290 | 3333 | property.</p> |
3291 | 3334 | <div class="refsect3"> |
3292 | <a name="id-1.4.19.11.74.5"></a><h4>Parameters</h4> | |
3335 | <a name="id-1.4.19.11.75.5"></a><h4>Parameters</h4> | |
3293 | 3336 | <div class="informaltable"><table width="100%" border="0"> |
3294 | 3337 | <colgroup> |
3295 | 3338 | <col width="150px" class="parameters_name"> |
3304 | 3347 | </table></div> |
3305 | 3348 | </div> |
3306 | 3349 | <div class="refsect3"> |
3307 | <a name="id-1.4.19.11.74.6"></a><h4>Returns</h4> | |
3350 | <a name="id-1.4.19.11.75.6"></a><h4>Returns</h4> | |
3308 | 3351 | <p> the route metric that is used for routes that don't explicitly |
3309 | 3352 | specify a metric. See <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--route-metric" title="The “route-metric” property"><span class="type">“route-metric”</span></a> for more details.</p> |
3310 | 3353 | </div> |
3318 | 3361 | <p>Returns the value contained in the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--ignore-auto-routes" title="The “ignore-auto-routes” property"><span class="type">“ignore-auto-routes”</span></a> |
3319 | 3362 | property.</p> |
3320 | 3363 | <div class="refsect3"> |
3321 | <a name="id-1.4.19.11.75.5"></a><h4>Parameters</h4> | |
3364 | <a name="id-1.4.19.11.76.5"></a><h4>Parameters</h4> | |
3322 | 3365 | <div class="informaltable"><table width="100%" border="0"> |
3323 | 3366 | <colgroup> |
3324 | 3367 | <col width="150px" class="parameters_name"> |
3333 | 3376 | </table></div> |
3334 | 3377 | </div> |
3335 | 3378 | <div class="refsect3"> |
3336 | <a name="id-1.4.19.11.75.6"></a><h4>Returns</h4> | |
3379 | <a name="id-1.4.19.11.76.6"></a><h4>Returns</h4> | |
3337 | 3380 | <p> <code class="literal">TRUE</code> if automatically configured (ie via DHCP) routes should be |
3338 | 3381 | ignored.</p> |
3339 | 3382 | </div> |
3347 | 3390 | <p>Returns the value contained in the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--ignore-auto-dns" title="The “ignore-auto-dns” property"><span class="type">“ignore-auto-dns”</span></a> |
3348 | 3391 | property.</p> |
3349 | 3392 | <div class="refsect3"> |
3350 | <a name="id-1.4.19.11.76.5"></a><h4>Parameters</h4> | |
3393 | <a name="id-1.4.19.11.77.5"></a><h4>Parameters</h4> | |
3351 | 3394 | <div class="informaltable"><table width="100%" border="0"> |
3352 | 3395 | <colgroup> |
3353 | 3396 | <col width="150px" class="parameters_name"> |
3362 | 3405 | </table></div> |
3363 | 3406 | </div> |
3364 | 3407 | <div class="refsect3"> |
3365 | <a name="id-1.4.19.11.76.6"></a><h4>Returns</h4> | |
3408 | <a name="id-1.4.19.11.77.6"></a><h4>Returns</h4> | |
3366 | 3409 | <p> <code class="literal">TRUE</code> if automatically configured (ie via DHCP) DNS information |
3367 | 3410 | should be ignored.</p> |
3368 | 3411 | </div> |
3376 | 3419 | <p>Returns the value contained in the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--dhcp-hostname" title="The “dhcp-hostname” property"><span class="type">“dhcp-hostname”</span></a> |
3377 | 3420 | property.</p> |
3378 | 3421 | <div class="refsect3"> |
3379 | <a name="id-1.4.19.11.77.5"></a><h4>Parameters</h4> | |
3422 | <a name="id-1.4.19.11.78.5"></a><h4>Parameters</h4> | |
3380 | 3423 | <div class="informaltable"><table width="100%" border="0"> |
3381 | 3424 | <colgroup> |
3382 | 3425 | <col width="150px" class="parameters_name"> |
3391 | 3434 | </table></div> |
3392 | 3435 | </div> |
3393 | 3436 | <div class="refsect3"> |
3394 | <a name="id-1.4.19.11.77.6"></a><h4>Returns</h4> | |
3437 | <a name="id-1.4.19.11.78.6"></a><h4>Returns</h4> | |
3395 | 3438 | <p> the configured hostname to send to the DHCP server</p> |
3396 | 3439 | </div> |
3397 | 3440 | </div> |
3404 | 3447 | <p>Returns the value contained in the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--dhcp-send-hostname" title="The “dhcp-send-hostname” property"><span class="type">“dhcp-send-hostname”</span></a> |
3405 | 3448 | property.</p> |
3406 | 3449 | <div class="refsect3"> |
3407 | <a name="id-1.4.19.11.78.5"></a><h4>Parameters</h4> | |
3450 | <a name="id-1.4.19.11.79.5"></a><h4>Parameters</h4> | |
3408 | 3451 | <div class="informaltable"><table width="100%" border="0"> |
3409 | 3452 | <colgroup> |
3410 | 3453 | <col width="150px" class="parameters_name"> |
3419 | 3462 | </table></div> |
3420 | 3463 | </div> |
3421 | 3464 | <div class="refsect3"> |
3422 | <a name="id-1.4.19.11.78.6"></a><h4>Returns</h4> | |
3465 | <a name="id-1.4.19.11.79.6"></a><h4>Returns</h4> | |
3423 | 3466 | <p> <code class="literal">TRUE</code> if NetworkManager should send the machine hostname to the |
3424 | 3467 | DHCP server when requesting addresses to allow the server to automatically |
3425 | 3468 | update DNS information for this machine.</p> |
3434 | 3477 | <p>Returns the value contained in the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--never-default" title="The “never-default” property"><span class="type">“never-default”</span></a> |
3435 | 3478 | property.</p> |
3436 | 3479 | <div class="refsect3"> |
3437 | <a name="id-1.4.19.11.79.5"></a><h4>Parameters</h4> | |
3480 | <a name="id-1.4.19.11.80.5"></a><h4>Parameters</h4> | |
3438 | 3481 | <div class="informaltable"><table width="100%" border="0"> |
3439 | 3482 | <colgroup> |
3440 | 3483 | <col width="150px" class="parameters_name"> |
3449 | 3492 | </table></div> |
3450 | 3493 | </div> |
3451 | 3494 | <div class="refsect3"> |
3452 | <a name="id-1.4.19.11.79.6"></a><h4>Returns</h4> | |
3495 | <a name="id-1.4.19.11.80.6"></a><h4>Returns</h4> | |
3453 | 3496 | <p> <code class="literal">TRUE</code> if this connection should never be the default |
3454 | 3497 | connection</p> |
3455 | 3498 | </div> |
3462 | 3505 | <p>Returns the value contained in the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--may-fail" title="The “may-fail” property"><span class="type">“may-fail”</span></a> |
3463 | 3506 | property.</p> |
3464 | 3507 | <div class="refsect3"> |
3465 | <a name="id-1.4.19.11.80.5"></a><h4>Parameters</h4> | |
3508 | <a name="id-1.4.19.11.81.5"></a><h4>Parameters</h4> | |
3466 | 3509 | <div class="informaltable"><table width="100%" border="0"> |
3467 | 3510 | <colgroup> |
3468 | 3511 | <col width="150px" class="parameters_name"> |
3477 | 3520 | </table></div> |
3478 | 3521 | </div> |
3479 | 3522 | <div class="refsect3"> |
3480 | <a name="id-1.4.19.11.80.6"></a><h4>Returns</h4> | |
3523 | <a name="id-1.4.19.11.81.6"></a><h4>Returns</h4> | |
3481 | 3524 | <p> <code class="literal">TRUE</code> if this connection doesn't require this type of IP |
3482 | 3525 | addressing to complete for the connection to succeed.</p> |
3483 | 3526 | </div> |
3488 | 3531 | <pre class="programlisting"><span class="returnvalue">gint</span> |
3489 | 3532 | nm_setting_ip_config_get_dad_timeout (<em class="parameter"><code><a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig"><span class="type">NMSettingIPConfig</span></a> *setting</code></em>);</pre> |
3490 | 3533 | <div class="refsect3"> |
3491 | <a name="id-1.4.19.11.81.4"></a><h4>Parameters</h4> | |
3534 | <a name="id-1.4.19.11.82.4"></a><h4>Parameters</h4> | |
3492 | 3535 | <div class="informaltable"><table width="100%" border="0"> |
3493 | 3536 | <colgroup> |
3494 | 3537 | <col width="150px" class="parameters_name"> |
3503 | 3546 | </table></div> |
3504 | 3547 | </div> |
3505 | 3548 | <div class="refsect3"> |
3506 | <a name="id-1.4.19.11.81.5"></a><h4>Returns</h4> | |
3549 | <a name="id-1.4.19.11.82.5"></a><h4>Returns</h4> | |
3507 | 3550 | <p> the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--dad-timeout" title="The “dad-timeout” property"><span class="type">“dad-timeout”</span></a> property.</p> |
3508 | 3551 | </div> |
3509 | 3552 | <p class="since">Since: 1.2</p> |
3516 | 3559 | <p>Returns the value contained in the <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--dhcp-timeout" title="The “dhcp-timeout” property"><span class="type">“dhcp-timeout”</span></a> |
3517 | 3560 | property.</p> |
3518 | 3561 | <div class="refsect3"> |
3519 | <a name="id-1.4.19.11.82.5"></a><h4>Parameters</h4> | |
3562 | <a name="id-1.4.19.11.83.5"></a><h4>Parameters</h4> | |
3520 | 3563 | <div class="informaltable"><table width="100%" border="0"> |
3521 | 3564 | <colgroup> |
3522 | 3565 | <col width="150px" class="parameters_name"> |
3531 | 3574 | </table></div> |
3532 | 3575 | </div> |
3533 | 3576 | <div class="refsect3"> |
3534 | <a name="id-1.4.19.11.82.6"></a><h4>Returns</h4> | |
3577 | <a name="id-1.4.19.11.83.6"></a><h4>Returns</h4> | |
3535 | 3578 | <p> the configured DHCP timeout in seconds. 0 = default for |
3536 | 3579 | the particular kind of device.</p> |
3537 | 3580 | </div> |
3567 | 3610 | <div class="refsect2"> |
3568 | 3611 | <a name="NM-SETTING-IP-CONFIG-DNS-OPTIONS:CAPS"></a><h3>NM_SETTING_IP_CONFIG_DNS_OPTIONS</h3> |
3569 | 3612 | <pre class="programlisting">#define NM_SETTING_IP_CONFIG_DNS_OPTIONS "dns-options" |
3613 | </pre> | |
3614 | </div> | |
3615 | <hr> | |
3616 | <div class="refsect2"> | |
3617 | <a name="NM-SETTING-IP-CONFIG-DNS-PRIORITY:CAPS"></a><h3>NM_SETTING_IP_CONFIG_DNS_PRIORITY</h3> | |
3618 | <pre class="programlisting">#define NM_SETTING_IP_CONFIG_DNS_PRIORITY "dns-priority" | |
3570 | 3619 | </pre> |
3571 | 3620 | </div> |
3572 | 3621 | <hr> |
3810 | 3859 | distinct from an empty list of properties.</p> |
3811 | 3860 | <p>Flags: Read / Write</p> |
3812 | 3861 | <p class="since">Since: 1.2</p> |
3862 | </div> | |
3863 | <hr> | |
3864 | <div class="refsect2"> | |
3865 | <a name="NMSettingIPConfig--dns-priority"></a><h3>The <code class="literal">“dns-priority”</code> property</h3> | |
3866 | <pre class="programlisting"> “dns-priority” <span class="type">gint</span></pre> | |
3867 | <p>DNS priority.</p> | |
3868 | <p>The relative priority to be used when determining the order of DNS | |
3869 | servers in resolv.conf. A lower value means that servers will be on top | |
3870 | of the file. Zero selects the default value, which is 50 for VPNs and | |
3871 | 100 for other connections. When multiple devices have configurations | |
3872 | with the same priority, the one with an active default route will be | |
3873 | preferred. Note that when using dns=dnsmasq the order is meaningless | |
3874 | since dnsmasq forwards queries to all known servers at the same time.</p> | |
3875 | <p>Negative values have the special effect of excluding other configurations | |
3876 | with a greater priority value; so in presence of at least a negative | |
3877 | priority, only DNS servers from configurations with the lowest priority | |
3878 | value will be used.</p> | |
3879 | <p>Flags: Read / Write / Construct</p> | |
3880 | <p>Default value: 0</p> | |
3881 | <p class="since">Since: 1.2.4</p> | |
3813 | 3882 | </div> |
3814 | 3883 | <hr> |
3815 | 3884 | <div class="refsect2"> |
156 | 156 | </div> |
157 | 157 | <div class="refsect1"> |
158 | 158 | <a name="NMSettingMacvlan.object-hierarchy"></a><h2>Object Hierarchy</h2> |
159 | <pre class="screen"> GEnum | |
159 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
160 | 160 | <span class="lineart">╰──</span> NMSettingMacvlanMode |
161 | 161 | GObject |
162 | 162 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
174 | 174 | </div> |
175 | 175 | <div class="refsect1"> |
176 | 176 | <a name="NMSettingSerial.object-hierarchy"></a><h2>Object Hierarchy</h2> |
177 | <pre class="screen"> GEnum | |
177 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
178 | 178 | <span class="lineart">╰──</span> NMSettingSerialParity |
179 | 179 | GObject |
180 | 180 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
190 | 190 | </div> |
191 | 191 | <div class="refsect1"> |
192 | 192 | <a name="NMSettingTun.object-hierarchy"></a><h2>Object Hierarchy</h2> |
193 | <pre class="screen"> GEnum | |
193 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
194 | 194 | <span class="lineart">╰──</span> NMSettingTunMode |
195 | 195 | GObject |
196 | 196 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
229 | 229 | </div> |
230 | 230 | <div class="refsect1"> |
231 | 231 | <a name="NMSettingVlan.object-hierarchy"></a><h2>Object Hierarchy</h2> |
232 | <pre class="screen"> GEnum | |
232 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
233 | 233 | <span class="lineart">╰──</span> NMVlanPriorityMap |
234 | GFlags | |
234 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GFlags</a> | |
235 | 235 | <span class="lineart">╰──</span> NMVlanFlags |
236 | 236 | GObject |
237 | 237 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
393 | 393 | </div> |
394 | 394 | <div class="refsect1"> |
395 | 395 | <a name="NMSettingWired.object-hierarchy"></a><h2>Object Hierarchy</h2> |
396 | <pre class="screen"> GFlags | |
396 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GFlags</a> | |
397 | 397 | <span class="lineart">╰──</span> NMSettingWiredWakeOnLan |
398 | 398 | GObject |
399 | 399 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
425 | 425 | </div> |
426 | 426 | <div class="refsect1"> |
427 | 427 | <a name="NMSettingWireless.object-hierarchy"></a><h2>Object Hierarchy</h2> |
428 | <pre class="screen"> GEnum | |
428 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
429 | 429 | <span class="lineart">╰──</span> NMSettingWirelessPowersave |
430 | 430 | GObject |
431 | 431 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
482 | 482 | </div> |
483 | 483 | <div class="refsect1"> |
484 | 484 | <a name="NMSettingWirelessSecurity.object-hierarchy"></a><h2>Object Hierarchy</h2> |
485 | <pre class="screen"> GEnum | |
485 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
486 | 486 | <span class="lineart">╰──</span> NMWepKeyType |
487 | 487 | GObject |
488 | 488 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
191 | 191 | </div> |
192 | 192 | <div class="refsect1"> |
193 | 193 | <a name="NMVpnEditorPlugin.object-hierarchy"></a><h2>Object Hierarchy</h2> |
194 | <pre class="screen"> GFlags | |
194 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GFlags</a> | |
195 | 195 | <span class="lineart">╰──</span> NMVpnEditorPluginCapability |
196 | GInterface | |
196 | <a href="/usr/share/gtk-doc/html/gobject/GTypeModule.html">GInterface</a> | |
197 | 197 | <span class="lineart">├──</span> NMVpnEditor |
198 | 198 | <span class="lineart">╰──</span> NMVpnEditorPlugin |
199 | 199 | </pre> |
414 | 414 | </dt> |
415 | 415 | <dd></dd> |
416 | 416 | <dt> |
417 | <a class="link" href="libnm-nm-version.html#NM-AVAILABLE-IN-1-4:CAPS" title="NM_AVAILABLE_IN_1_4">NM_AVAILABLE_IN_1_4</a>, macro in <a class="link" href="libnm-nm-version.html" title="nm-version">nm-version</a> | |
417 | <a class="link" href="libnm-nm-version.html#NM-AVAILABLE-IN-1-2-4:CAPS" title="NM_AVAILABLE_IN_1_2_4">NM_AVAILABLE_IN_1_2_4</a>, macro in <a class="link" href="libnm-nm-version.html" title="nm-version">nm-version</a> | |
418 | 418 | </dt> |
419 | 419 | <dd></dd> |
420 | 420 | <a name="idxB"></a><h3 class="title">B</h3> |
1469 | 1469 | </dt> |
1470 | 1470 | <dd></dd> |
1471 | 1471 | <dt> |
1472 | <a class="link" href="libnm-nm-version.html#NM-DEPRECATED-IN-1-4:CAPS" title="NM_DEPRECATED_IN_1_4">NM_DEPRECATED_IN_1_4</a>, macro in <a class="link" href="libnm-nm-version.html" title="nm-version">nm-version</a> | |
1473 | </dt> | |
1474 | <dd></dd> | |
1475 | <dt> | |
1476 | <a class="link" href="libnm-nm-version.html#NM-DEPRECATED-IN-1-4-FOR:CAPS" title="NM_DEPRECATED_IN_1_4_FOR()">NM_DEPRECATED_IN_1_4_FOR</a>, macro in <a class="link" href="libnm-nm-version.html" title="nm-version">nm-version</a> | |
1477 | </dt> | |
1478 | <dd></dd> | |
1479 | <dt> | |
1480 | 1472 | <a class="link" href="NMDevice.html#NMDevice-struct" title="NMDevice">NMDevice</a>, struct in nm-types |
1481 | 1473 | </dt> |
1482 | 1474 | <dd></dd> |
4299 | 4291 | </dt> |
4300 | 4292 | <dd></dd> |
4301 | 4293 | <dt> |
4294 | <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--dns-priority" title="The “dns-priority” property">NMSettingIPConfig:dns-priority</a>, object property in <a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig">NMSettingIPConfig</a> | |
4295 | </dt> | |
4296 | <dd></dd> | |
4297 | <dt> | |
4302 | 4298 | <a class="link" href="NMSettingIPConfig.html#NMSettingIPConfig--dns-search" title="The “dns-search” property">NMSettingIPConfig:dns-search</a>, object property in <a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig">NMSettingIPConfig</a> |
4303 | 4299 | </dt> |
4304 | 4300 | <dd></dd> |
6567 | 6563 | </dt> |
6568 | 6564 | <dd></dd> |
6569 | 6565 | <dt> |
6566 | <a class="link" href="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-PRIORITY:CAPS" title="NM_SETTING_IP_CONFIG_DNS_PRIORITY">NM_SETTING_IP_CONFIG_DNS_PRIORITY</a>, macro in <a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig">NMSettingIPConfig</a> | |
6567 | </dt> | |
6568 | <dd></dd> | |
6569 | <dt> | |
6570 | 6570 | <a class="link" href="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-SEARCH:CAPS" title="NM_SETTING_IP_CONFIG_DNS_SEARCH">NM_SETTING_IP_CONFIG_DNS_SEARCH</a>, macro in <a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig">NMSettingIPConfig</a> |
6571 | 6571 | </dt> |
6572 | 6572 | <dd></dd> |
6600 | 6600 | <dd></dd> |
6601 | 6601 | <dt> |
6602 | 6602 | <a class="link" href="NMSettingIPConfig.html#nm-setting-ip-config-get-dns-option" title="nm_setting_ip_config_get_dns_option ()">nm_setting_ip_config_get_dns_option</a>, function in <a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig">NMSettingIPConfig</a> |
6603 | </dt> | |
6604 | <dd></dd> | |
6605 | <dt> | |
6606 | <a class="link" href="NMSettingIPConfig.html#nm-setting-ip-config-get-dns-priority" title="nm_setting_ip_config_get_dns_priority ()">nm_setting_ip_config_get_dns_priority</a>, function in <a class="link" href="NMSettingIPConfig.html" title="NMSettingIPConfig">NMSettingIPConfig</a> | |
6603 | 6607 | </dt> |
6604 | 6608 | <dd></dd> |
6605 | 6609 | <dt> |
14 | 14 | <div> |
15 | 15 | <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">libnm Reference Manual</p></th></tr></table></div> |
16 | 16 | <div><p class="releaseinfo"> |
17 | for libnm 1.2.2 | |
17 | for libnm 1.2.4 | |
18 | 18 | |
19 | 19 | The latest version of this documentation can be found on-line at |
20 | 20 | <a class="ulink" href="https://developer.gnome.org/libnm/stable/" target="_top">https://developer.gnome.org/libnm/stable/</a>. |
103 | 103 | <ANCHOR id="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-SYSTEM:CAPS" href="libnm/NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-SYSTEM:CAPS"> |
104 | 104 | <ANCHOR id="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-OWN:CAPS" href="libnm/NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-OWN:CAPS"> |
105 | 105 | <ANCHOR id="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-HOSTNAME:CAPS" href="libnm/NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-HOSTNAME:CAPS"> |
106 | <ANCHOR id="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-GLOBAL-DNS:CAPS" href="libnm/NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-GLOBAL-DNS:CAPS"> | |
107 | <ANCHOR id="NM-CLIENT-PERMISSION-RELOAD:CAPS" href="libnm/NMClient.html#NM-CLIENT-PERMISSION-RELOAD:CAPS"> | |
106 | 108 | <ANCHOR id="NM-CLIENT-PERMISSION-LAST:CAPS" href="libnm/NMClient.html#NM-CLIENT-PERMISSION-LAST:CAPS"> |
107 | 109 | <ANCHOR id="NMClientPermissionResult" href="libnm/NMClient.html#NMClientPermissionResult"> |
108 | 110 | <ANCHOR id="NM-CLIENT-PERMISSION-RESULT-UNKNOWN:CAPS" href="libnm/NMClient.html#NM-CLIENT-PERMISSION-RESULT-UNKNOWN:CAPS"> |
263 | 265 | <ANCHOR id="NM-MANAGER-ERROR-ALREADY-ENABLED-OR-DISABLED:CAPS" href="libnm/libnm-nm-errors.html#NM-MANAGER-ERROR-ALREADY-ENABLED-OR-DISABLED:CAPS"> |
264 | 266 | <ANCHOR id="NM-MANAGER-ERROR-UNKNOWN-LOG-LEVEL:CAPS" href="libnm/libnm-nm-errors.html#NM-MANAGER-ERROR-UNKNOWN-LOG-LEVEL:CAPS"> |
265 | 267 | <ANCHOR id="NM-MANAGER-ERROR-UNKNOWN-LOG-DOMAIN:CAPS" href="libnm/libnm-nm-errors.html#NM-MANAGER-ERROR-UNKNOWN-LOG-DOMAIN:CAPS"> |
268 | <ANCHOR id="NM-MANAGER-ERROR-INVALID-ARGUMENTS:CAPS" href="libnm/libnm-nm-errors.html#NM-MANAGER-ERROR-INVALID-ARGUMENTS:CAPS"> | |
266 | 269 | <ANCHOR id="NMSecretAgentError" href="libnm/libnm-nm-errors.html#NMSecretAgentError"> |
267 | 270 | <ANCHOR id="NM-SECRET-AGENT-ERROR-FAILED:CAPS" href="libnm/libnm-nm-errors.html#NM-SECRET-AGENT-ERROR-FAILED:CAPS"> |
268 | 271 | <ANCHOR id="NM-SECRET-AGENT-ERROR-PERMISSION-DENIED:CAPS" href="libnm/libnm-nm-errors.html#NM-SECRET-AGENT-ERROR-PERMISSION-DENIED:CAPS"> |
1409 | 1412 | <ANCHOR id="nm-setting-ip-config-remove-dns-option" href="libnm/NMSettingIPConfig.html#nm-setting-ip-config-remove-dns-option"> |
1410 | 1413 | <ANCHOR id="nm-setting-ip-config-remove-dns-option-by-value" href="libnm/NMSettingIPConfig.html#nm-setting-ip-config-remove-dns-option-by-value"> |
1411 | 1414 | <ANCHOR id="nm-setting-ip-config-clear-dns-options" href="libnm/NMSettingIPConfig.html#nm-setting-ip-config-clear-dns-options"> |
1415 | <ANCHOR id="nm-setting-ip-config-get-dns-priority" href="libnm/NMSettingIPConfig.html#nm-setting-ip-config-get-dns-priority"> | |
1412 | 1416 | <ANCHOR id="nm-setting-ip-config-get-num-addresses" href="libnm/NMSettingIPConfig.html#nm-setting-ip-config-get-num-addresses"> |
1413 | 1417 | <ANCHOR id="nm-setting-ip-config-get-address" href="libnm/NMSettingIPConfig.html#nm-setting-ip-config-get-address"> |
1414 | 1418 | <ANCHOR id="nm-setting-ip-config-add-address" href="libnm/NMSettingIPConfig.html#nm-setting-ip-config-add-address"> |
1437 | 1441 | <ANCHOR id="NM-SETTING-IP-CONFIG-DNS:CAPS" href="libnm/NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS:CAPS"> |
1438 | 1442 | <ANCHOR id="NM-SETTING-IP-CONFIG-DNS-SEARCH:CAPS" href="libnm/NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-SEARCH:CAPS"> |
1439 | 1443 | <ANCHOR id="NM-SETTING-IP-CONFIG-DNS-OPTIONS:CAPS" href="libnm/NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-OPTIONS:CAPS"> |
1444 | <ANCHOR id="NM-SETTING-IP-CONFIG-DNS-PRIORITY:CAPS" href="libnm/NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-PRIORITY:CAPS"> | |
1440 | 1445 | <ANCHOR id="NM-SETTING-IP-CONFIG-ADDRESSES:CAPS" href="libnm/NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-ADDRESSES:CAPS"> |
1441 | 1446 | <ANCHOR id="NM-SETTING-IP-CONFIG-GATEWAY:CAPS" href="libnm/NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-GATEWAY:CAPS"> |
1442 | 1447 | <ANCHOR id="NM-SETTING-IP-CONFIG-ROUTES:CAPS" href="libnm/NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-ROUTES:CAPS"> |
1473 | 1478 | <ANCHOR id="NMSettingIPConfig--dhcp-timeout" href="libnm/NMSettingIPConfig.html#NMSettingIPConfig--dhcp-timeout"> |
1474 | 1479 | <ANCHOR id="NMSettingIPConfig--dns" href="libnm/NMSettingIPConfig.html#NMSettingIPConfig--dns"> |
1475 | 1480 | <ANCHOR id="NMSettingIPConfig--dns-options" href="libnm/NMSettingIPConfig.html#NMSettingIPConfig--dns-options"> |
1481 | <ANCHOR id="NMSettingIPConfig--dns-priority" href="libnm/NMSettingIPConfig.html#NMSettingIPConfig--dns-priority"> | |
1476 | 1482 | <ANCHOR id="NMSettingIPConfig--dns-search" href="libnm/NMSettingIPConfig.html#NMSettingIPConfig--dns-search"> |
1477 | 1483 | <ANCHOR id="NMSettingIPConfig--gateway" href="libnm/NMSettingIPConfig.html#NMSettingIPConfig--gateway"> |
1478 | 1484 | <ANCHOR id="NMSettingIPConfig--ignore-auto-dns" href="libnm/NMSettingIPConfig.html#NMSettingIPConfig--ignore-auto-dns"> |
3067 | 3073 | <ANCHOR id="NM-DEPRECATED-IN-0-9-10-FOR:CAPS" href="libnm/libnm-nm-version.html#NM-DEPRECATED-IN-0-9-10-FOR:CAPS"> |
3068 | 3074 | <ANCHOR id="NM-DEPRECATED-IN-1-0-FOR:CAPS" href="libnm/libnm-nm-version.html#NM-DEPRECATED-IN-1-0-FOR:CAPS"> |
3069 | 3075 | <ANCHOR id="NM-DEPRECATED-IN-1-2-FOR:CAPS" href="libnm/libnm-nm-version.html#NM-DEPRECATED-IN-1-2-FOR:CAPS"> |
3070 | <ANCHOR id="NM-DEPRECATED-IN-1-4-FOR:CAPS" href="libnm/libnm-nm-version.html#NM-DEPRECATED-IN-1-4-FOR:CAPS"> | |
3071 | 3076 | <ANCHOR id="libnm-nm-version.other_details" href="libnm/libnm-nm-version.html#libnm-nm-version.other_details"> |
3072 | 3077 | <ANCHOR id="NM-DEPRECATED-IN-0-9-10:CAPS" href="libnm/libnm-nm-version.html#NM-DEPRECATED-IN-0-9-10:CAPS"> |
3073 | 3078 | <ANCHOR id="NM-AVAILABLE-IN-0-9-10:CAPS" href="libnm/libnm-nm-version.html#NM-AVAILABLE-IN-0-9-10:CAPS"> |
3075 | 3080 | <ANCHOR id="NM-AVAILABLE-IN-1-0:CAPS" href="libnm/libnm-nm-version.html#NM-AVAILABLE-IN-1-0:CAPS"> |
3076 | 3081 | <ANCHOR id="NM-DEPRECATED-IN-1-2:CAPS" href="libnm/libnm-nm-version.html#NM-DEPRECATED-IN-1-2:CAPS"> |
3077 | 3082 | <ANCHOR id="NM-AVAILABLE-IN-1-2:CAPS" href="libnm/libnm-nm-version.html#NM-AVAILABLE-IN-1-2:CAPS"> |
3078 | <ANCHOR id="NM-DEPRECATED-IN-1-4:CAPS" href="libnm/libnm-nm-version.html#NM-DEPRECATED-IN-1-4:CAPS"> | |
3079 | <ANCHOR id="NM-AVAILABLE-IN-1-4:CAPS" href="libnm/libnm-nm-version.html#NM-AVAILABLE-IN-1-4:CAPS"> | |
3083 | <ANCHOR id="NM-AVAILABLE-IN-1-2-4:CAPS" href="libnm/libnm-nm-version.html#NM-AVAILABLE-IN-1-2-4:CAPS"> | |
3080 | 3084 | <ANCHOR id="libnm-nm-vpn-dbus-interface" href="libnm/libnm-nm-vpn-dbus-interface.html"> |
3081 | 3085 | <ANCHOR id="libnm-nm-vpn-dbus-interface.other" href="libnm/libnm-nm-vpn-dbus-interface.html#libnm-nm-vpn-dbus-interface.other"> |
3082 | 3086 | <ANCHOR id="libnm-nm-vpn-dbus-interface.object-hierarchy" href="libnm/libnm-nm-vpn-dbus-interface.html#libnm-nm-vpn-dbus-interface.object-hierarchy"> |
352 | 352 | </div> |
353 | 353 | <div class="refsect1"> |
354 | 354 | <a name="libnm-nm-dbus-interface.object-hierarchy"></a><h2>Object Hierarchy</h2> |
355 | <pre class="screen"> GEnum | |
355 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
356 | 356 | <span class="lineart">├──</span> NM80211Mode |
357 | 357 | <span class="lineart">├──</span> NMActiveConnectionState |
358 | 358 | <span class="lineart">├──</span> NMConnectivityState |
363 | 363 | <span class="lineart">├──</span> NMMetered |
364 | 364 | <span class="lineart">├──</span> NMState |
365 | 365 | <span class="lineart">╰──</span> NMWimaxNspNetworkType |
366 | GFlags | |
366 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GFlags</a> | |
367 | 367 | <span class="lineart">├──</span> NM80211ApFlags |
368 | 368 | <span class="lineart">├──</span> NM80211ApSecurityFlags |
369 | 369 | <span class="lineart">├──</span> NMBluetoothCapabilities |
183 | 183 | </div> |
184 | 184 | <div class="refsect1"> |
185 | 185 | <a name="libnm-nm-errors.object-hierarchy"></a><h2>Object Hierarchy</h2> |
186 | <pre class="screen"> GEnum | |
186 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
187 | 187 | <span class="lineart">├──</span> NMAgentManagerError |
188 | 188 | <span class="lineart">├──</span> NMConnectionError |
189 | 189 | <span class="lineart">├──</span> NMCryptoError |
710 | 710 | <td class="enum_member_name"><p><a name="NM-MANAGER-ERROR-UNKNOWN-LOG-DOMAIN:CAPS"></a>NM_MANAGER_ERROR_UNKNOWN_LOG_DOMAIN</p></td> |
711 | 711 | <td class="enum_member_description"> |
712 | 712 | <p>Unknown log domain in SetLogging</p> |
713 | </td> | |
714 | <td class="enum_member_annotations"> </td> | |
715 | </tr> | |
716 | <tr> | |
717 | <td class="enum_member_name"><p><a name="NM-MANAGER-ERROR-INVALID-ARGUMENTS:CAPS"></a>NM_MANAGER_ERROR_INVALID_ARGUMENTS</p></td> | |
718 | <td class="enum_member_description"> | |
719 | <p>Invalid arguments for D-Bus request</p> | |
713 | 720 | </td> |
714 | 721 | <td class="enum_member_annotations"> </td> |
715 | 722 | </tr> |
550 | 550 | </div> |
551 | 551 | <div class="refsect1"> |
552 | 552 | <a name="libnm-nm-utils.object-hierarchy"></a><h2>Object Hierarchy</h2> |
553 | <pre class="screen"> GEnum | |
553 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
554 | 554 | <span class="lineart">╰──</span> NMUtilsSecurityType |
555 | 555 | </pre> |
556 | 556 | </div> |
64 | 64 | <a class="link" href="libnm-nm-version.html#NM-DEPRECATED-IN-1-2-FOR:CAPS" title="NM_DEPRECATED_IN_1_2_FOR()">NM_DEPRECATED_IN_1_2_FOR</a><span class="c_punctuation">()</span> |
65 | 65 | </td> |
66 | 66 | </tr> |
67 | <tr> | |
68 | <td class="define_keyword">#define</td> | |
69 | <td class="function_name"> | |
70 | <a class="link" href="libnm-nm-version.html#NM-DEPRECATED-IN-1-4-FOR:CAPS" title="NM_DEPRECATED_IN_1_4_FOR()">NM_DEPRECATED_IN_1_4_FOR</a><span class="c_punctuation">()</span> | |
71 | </td> | |
72 | </tr> | |
73 | 67 | </tbody> |
74 | 68 | </table></div> |
75 | 69 | </div> |
107 | 101 | </tr> |
108 | 102 | <tr> |
109 | 103 | <td class="define_keyword">#define</td> |
110 | <td class="function_name"><a class="link" href="libnm-nm-version.html#NM-DEPRECATED-IN-1-4:CAPS" title="NM_DEPRECATED_IN_1_4">NM_DEPRECATED_IN_1_4</a></td> | |
111 | </tr> | |
112 | <tr> | |
113 | <td class="define_keyword">#define</td> | |
114 | <td class="function_name"><a class="link" href="libnm-nm-version.html#NM-AVAILABLE-IN-1-4:CAPS" title="NM_AVAILABLE_IN_1_4">NM_AVAILABLE_IN_1_4</a></td> | |
104 | <td class="function_name"><a class="link" href="libnm-nm-version.html#NM-AVAILABLE-IN-1-2-4:CAPS" title="NM_AVAILABLE_IN_1_2_4">NM_AVAILABLE_IN_1_2_4</a></td> | |
115 | 105 | </tr> |
116 | 106 | </tbody> |
117 | 107 | </table></div> |
148 | 138 | <div class="refsect2"> |
149 | 139 | <a name="NM-DEPRECATED-IN-1-2-FOR:CAPS"></a><h3>NM_DEPRECATED_IN_1_2_FOR()</h3> |
150 | 140 | <pre class="programlisting"># define NM_DEPRECATED_IN_1_2_FOR(f) G_DEPRECATED_FOR(f) |
151 | </pre> | |
152 | </div> | |
153 | <hr> | |
154 | <div class="refsect2"> | |
155 | <a name="NM-DEPRECATED-IN-1-4-FOR:CAPS"></a><h3>NM_DEPRECATED_IN_1_4_FOR()</h3> | |
156 | <pre class="programlisting"># define NM_DEPRECATED_IN_1_4_FOR(f) G_DEPRECATED_FOR(f) | |
157 | 141 | </pre> |
158 | 142 | </div> |
159 | 143 | </div> |
195 | 179 | </div> |
196 | 180 | <hr> |
197 | 181 | <div class="refsect2"> |
198 | <a name="NM-DEPRECATED-IN-1-4:CAPS"></a><h3>NM_DEPRECATED_IN_1_4</h3> | |
199 | <pre class="programlisting"># define NM_DEPRECATED_IN_1_4 G_DEPRECATED | |
200 | </pre> | |
201 | </div> | |
202 | <hr> | |
203 | <div class="refsect2"> | |
204 | <a name="NM-AVAILABLE-IN-1-4:CAPS"></a><h3>NM_AVAILABLE_IN_1_4</h3> | |
205 | <pre class="programlisting"># define NM_AVAILABLE_IN_1_4 G_UNAVAILABLE(1,4) | |
182 | <a name="NM-AVAILABLE-IN-1-2-4:CAPS"></a><h3>NM_AVAILABLE_IN_1_2_4</h3> | |
183 | <pre class="programlisting"># define NM_AVAILABLE_IN_1_2_4 G_UNAVAILABLE(1.2,4) | |
206 | 184 | </pre> |
207 | 185 | </div> |
208 | 186 | </div> |
292 | 292 | </div> |
293 | 293 | <div class="refsect1"> |
294 | 294 | <a name="libnm-nm-vpn-dbus-interface.object-hierarchy"></a><h2>Object Hierarchy</h2> |
295 | <pre class="screen"> GEnum | |
295 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
296 | 296 | <span class="lineart">├──</span> NMVpnConnectionState |
297 | 297 | <span class="lineart">├──</span> NMVpnConnectionStateReason |
298 | 298 | <span class="lineart">├──</span> NMVpnPluginFailure |
978 | 978 | <keyword type="function" name="nm_setting_ip_config_remove_dns_option ()" link="NMSettingIPConfig.html#nm-setting-ip-config-remove-dns-option" since="1.2"/> |
979 | 979 | <keyword type="function" name="nm_setting_ip_config_remove_dns_option_by_value ()" link="NMSettingIPConfig.html#nm-setting-ip-config-remove-dns-option-by-value" since="1.2"/> |
980 | 980 | <keyword type="function" name="nm_setting_ip_config_clear_dns_options ()" link="NMSettingIPConfig.html#nm-setting-ip-config-clear-dns-options" since="1.2"/> |
981 | <keyword type="function" name="nm_setting_ip_config_get_dns_priority ()" link="NMSettingIPConfig.html#nm-setting-ip-config-get-dns-priority" since="1.2.4"/> | |
981 | 982 | <keyword type="function" name="nm_setting_ip_config_get_num_addresses ()" link="NMSettingIPConfig.html#nm-setting-ip-config-get-num-addresses"/> |
982 | 983 | <keyword type="function" name="nm_setting_ip_config_get_address ()" link="NMSettingIPConfig.html#nm-setting-ip-config-get-address"/> |
983 | 984 | <keyword type="function" name="nm_setting_ip_config_add_address ()" link="NMSettingIPConfig.html#nm-setting-ip-config-add-address"/> |
1005 | 1006 | <keyword type="macro" name="NM_SETTING_IP_CONFIG_DNS" link="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS:CAPS"/> |
1006 | 1007 | <keyword type="macro" name="NM_SETTING_IP_CONFIG_DNS_SEARCH" link="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-SEARCH:CAPS"/> |
1007 | 1008 | <keyword type="macro" name="NM_SETTING_IP_CONFIG_DNS_OPTIONS" link="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-OPTIONS:CAPS"/> |
1009 | <keyword type="macro" name="NM_SETTING_IP_CONFIG_DNS_PRIORITY" link="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-DNS-PRIORITY:CAPS"/> | |
1008 | 1010 | <keyword type="macro" name="NM_SETTING_IP_CONFIG_ADDRESSES" link="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-ADDRESSES:CAPS"/> |
1009 | 1011 | <keyword type="macro" name="NM_SETTING_IP_CONFIG_GATEWAY" link="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-GATEWAY:CAPS"/> |
1010 | 1012 | <keyword type="macro" name="NM_SETTING_IP_CONFIG_ROUTES" link="NMSettingIPConfig.html#NM-SETTING-IP-CONFIG-ROUTES:CAPS"/> |
1040 | 1042 | <keyword type="property" name="The “dhcp-timeout” property" link="NMSettingIPConfig.html#NMSettingIPConfig--dhcp-timeout"/> |
1041 | 1043 | <keyword type="property" name="The “dns” property" link="NMSettingIPConfig.html#NMSettingIPConfig--dns"/> |
1042 | 1044 | <keyword type="property" name="The “dns-options” property" link="NMSettingIPConfig.html#NMSettingIPConfig--dns-options"/> |
1045 | <keyword type="property" name="The “dns-priority” property" link="NMSettingIPConfig.html#NMSettingIPConfig--dns-priority"/> | |
1043 | 1046 | <keyword type="property" name="The “dns-search” property" link="NMSettingIPConfig.html#NMSettingIPConfig--dns-search"/> |
1044 | 1047 | <keyword type="property" name="The “gateway” property" link="NMSettingIPConfig.html#NMSettingIPConfig--gateway"/> |
1045 | 1048 | <keyword type="property" name="The “ignore-auto-dns” property" link="NMSettingIPConfig.html#NMSettingIPConfig--ignore-auto-dns"/> |
2167 | 2170 | <keyword type="macro" name="NM_DEPRECATED_IN_0_9_10_FOR()" link="libnm-nm-version.html#NM-DEPRECATED-IN-0-9-10-FOR:CAPS"/> |
2168 | 2171 | <keyword type="macro" name="NM_DEPRECATED_IN_1_0_FOR()" link="libnm-nm-version.html#NM-DEPRECATED-IN-1-0-FOR:CAPS"/> |
2169 | 2172 | <keyword type="macro" name="NM_DEPRECATED_IN_1_2_FOR()" link="libnm-nm-version.html#NM-DEPRECATED-IN-1-2-FOR:CAPS"/> |
2170 | <keyword type="macro" name="NM_DEPRECATED_IN_1_4_FOR()" link="libnm-nm-version.html#NM-DEPRECATED-IN-1-4-FOR:CAPS"/> | |
2171 | 2173 | <keyword type="macro" name="NM_DEPRECATED_IN_0_9_10" link="libnm-nm-version.html#NM-DEPRECATED-IN-0-9-10:CAPS"/> |
2172 | 2174 | <keyword type="macro" name="NM_AVAILABLE_IN_0_9_10" link="libnm-nm-version.html#NM-AVAILABLE-IN-0-9-10:CAPS"/> |
2173 | 2175 | <keyword type="macro" name="NM_DEPRECATED_IN_1_0" link="libnm-nm-version.html#NM-DEPRECATED-IN-1-0:CAPS"/> |
2174 | 2176 | <keyword type="macro" name="NM_AVAILABLE_IN_1_0" link="libnm-nm-version.html#NM-AVAILABLE-IN-1-0:CAPS"/> |
2175 | 2177 | <keyword type="macro" name="NM_DEPRECATED_IN_1_2" link="libnm-nm-version.html#NM-DEPRECATED-IN-1-2:CAPS"/> |
2176 | 2178 | <keyword type="macro" name="NM_AVAILABLE_IN_1_2" link="libnm-nm-version.html#NM-AVAILABLE-IN-1-2:CAPS"/> |
2177 | <keyword type="macro" name="NM_DEPRECATED_IN_1_4" link="libnm-nm-version.html#NM-DEPRECATED-IN-1-4:CAPS"/> | |
2178 | <keyword type="macro" name="NM_AVAILABLE_IN_1_4" link="libnm-nm-version.html#NM-AVAILABLE-IN-1-4:CAPS"/> | |
2179 | <keyword type="macro" name="NM_AVAILABLE_IN_1_2_4" link="libnm-nm-version.html#NM-AVAILABLE-IN-1-2-4:CAPS"/> | |
2179 | 2180 | <keyword type="macro" name="NM_DBUS_PATH_VPN" link="libnm-nm-vpn-dbus-interface.html#NM-DBUS-PATH-VPN:CAPS"/> |
2180 | 2181 | <keyword type="macro" name="NM_DBUS_INTERFACE_VPN" link="libnm-nm-vpn-dbus-interface.html#NM-DBUS-INTERFACE-VPN:CAPS"/> |
2181 | 2182 | <keyword type="macro" name="NM_DBUS_PATH_VPN_CONNECTION" link="libnm-nm-vpn-dbus-interface.html#NM-DBUS-PATH-VPN-CONNECTION:CAPS"/> |
2268 | 2269 | <keyword type="constant" name="NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM" link="NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-SYSTEM:CAPS"/> |
2269 | 2270 | <keyword type="constant" name="NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN" link="NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-OWN:CAPS"/> |
2270 | 2271 | <keyword type="constant" name="NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME" link="NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-HOSTNAME:CAPS"/> |
2272 | <keyword type="constant" name="NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS" link="NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-GLOBAL-DNS:CAPS"/> | |
2273 | <keyword type="constant" name="NM_CLIENT_PERMISSION_RELOAD" link="NMClient.html#NM-CLIENT-PERMISSION-RELOAD:CAPS"/> | |
2271 | 2274 | <keyword type="constant" name="NM_CLIENT_PERMISSION_LAST" link="NMClient.html#NM-CLIENT-PERMISSION-LAST:CAPS"/> |
2272 | 2275 | <keyword type="constant" name="NM_CLIENT_PERMISSION_RESULT_UNKNOWN" link="NMClient.html#NM-CLIENT-PERMISSION-RESULT-UNKNOWN:CAPS"/> |
2273 | 2276 | <keyword type="constant" name="NM_CLIENT_PERMISSION_RESULT_YES" link="NMClient.html#NM-CLIENT-PERMISSION-RESULT-YES:CAPS"/> |
2317 | 2320 | <keyword type="constant" name="NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED" link="libnm-nm-errors.html#NM-MANAGER-ERROR-ALREADY-ENABLED-OR-DISABLED:CAPS"/> |
2318 | 2321 | <keyword type="constant" name="NM_MANAGER_ERROR_UNKNOWN_LOG_LEVEL" link="libnm-nm-errors.html#NM-MANAGER-ERROR-UNKNOWN-LOG-LEVEL:CAPS"/> |
2319 | 2322 | <keyword type="constant" name="NM_MANAGER_ERROR_UNKNOWN_LOG_DOMAIN" link="libnm-nm-errors.html#NM-MANAGER-ERROR-UNKNOWN-LOG-DOMAIN:CAPS"/> |
2323 | <keyword type="constant" name="NM_MANAGER_ERROR_INVALID_ARGUMENTS" link="libnm-nm-errors.html#NM-MANAGER-ERROR-INVALID-ARGUMENTS:CAPS"/> | |
2320 | 2324 | <keyword type="constant" name="NM_SECRET_AGENT_ERROR_FAILED" link="libnm-nm-errors.html#NM-SECRET-AGENT-ERROR-FAILED:CAPS"/> |
2321 | 2325 | <keyword type="constant" name="NM_SECRET_AGENT_ERROR_PERMISSION_DENIED" link="libnm-nm-errors.html#NM-SECRET-AGENT-ERROR-PERMISSION-DENIED:CAPS"/> |
2322 | 2326 | <keyword type="constant" name="NM_SECRET_AGENT_ERROR_INVALID_CONNECTION" link="libnm-nm-errors.html#NM-SECRET-AGENT-ERROR-INVALID-CONNECTION:CAPS"/> |
84 | 84 | <span class="lineart">├──</span> <a class="link" href="NMClient.html" title="NMClient">NMClient</a> |
85 | 85 | <span class="lineart">├──</span> <a class="link" href="NMSecretAgentOld.html" title="NMSecretAgentOld">NMSecretAgentOld</a> |
86 | 86 | <span class="lineart">╰──</span> <a class="link" href="NMSimpleConnection.html" title="NMSimpleConnection">NMSimpleConnection</a> |
87 | GInterface | |
87 | <a href="/usr/share/gtk-doc/html/gobject/GTypeModule.html">GInterface</a> | |
88 | 88 | <span class="lineart">├──</span> <a class="link" href="NMConnection.html" title="NMConnection">NMConnection</a> |
89 | 89 | <span class="lineart">├──</span> <a class="link" href="NMVpnEditorPlugin.html#NMVpnEditor">NMVpnEditor</a> |
90 | 90 | <span class="lineart">╰──</span> <a class="link" href="NMVpnEditorPlugin.html" title="NMVpnEditorPlugin">NMVpnEditorPlugin</a> |
91 | GFlags | |
91 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GFlags</a> | |
92 | 92 | <span class="lineart">├──</span> <a class="link" href="libnm-nm-dbus-interface.html#NM80211ApFlags" title="enum NM80211ApFlags">NM80211ApFlags</a> |
93 | 93 | <span class="lineart">├──</span> <a class="link" href="libnm-nm-dbus-interface.html#NM80211ApSecurityFlags" title="enum NM80211ApSecurityFlags">NM80211ApSecurityFlags</a> |
94 | 94 | <span class="lineart">├──</span> <a class="link" href="libnm-nm-dbus-interface.html#NMBluetoothCapabilities" title="enum NMBluetoothCapabilities">NMBluetoothCapabilities</a> |
103 | 103 | <span class="lineart">├──</span> <a class="link" href="NMSettingWired.html#NMSettingWiredWakeOnLan" title="enum NMSettingWiredWakeOnLan">NMSettingWiredWakeOnLan</a> |
104 | 104 | <span class="lineart">├──</span> <a class="link" href="NMSettingVlan.html#NMVlanFlags" title="enum NMVlanFlags">NMVlanFlags</a> |
105 | 105 | <span class="lineart">╰──</span> <a class="link" href="NMVpnEditorPlugin.html#NMVpnEditorPluginCapability" title="enum NMVpnEditorPluginCapability">NMVpnEditorPluginCapability</a> |
106 | GEnum | |
106 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
107 | 107 | <span class="lineart">├──</span> <a class="link" href="libnm-nm-errors.html#NMAgentManagerError" title="enum NMAgentManagerError">NMAgentManagerError</a> |
108 | 108 | <span class="lineart">├──</span> <a class="link" href="libnm-nm-errors.html#NMConnectionError" title="enum NMConnectionError">NMConnectionError</a> |
109 | 109 | <span class="lineart">├──</span> <a class="link" href="libnm-nm-errors.html#NMDeviceError" title="enum NMDeviceError">NMDeviceError</a> |
145 | 145 | <span class="lineart">├──</span> <a class="link" href="libnm-nm-vpn-dbus-interface.html#NMVpnServiceState" title="enum NMVpnServiceState">NMVpnServiceState</a> |
146 | 146 | <span class="lineart">├──</span> <a class="link" href="NMSettingWirelessSecurity.html#NMWepKeyType" title="enum NMWepKeyType">NMWepKeyType</a> |
147 | 147 | <span class="lineart">╰──</span> <a class="link" href="libnm-nm-dbus-interface.html#NMWimaxNspNetworkType" title="enum NMWimaxNspNetworkType">NMWimaxNspNetworkType</a> |
148 | GBoxed | |
148 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Boxed-Types.html">GBoxed</a> | |
149 | 149 | <span class="lineart">├──</span> <a class="link" href="NMSettingIPConfig.html#NMIPAddress">NMIPAddress</a> |
150 | 150 | <span class="lineart">├──</span> <a class="link" href="NMSettingIPConfig.html#NMIPRoute">NMIPRoute</a> |
151 | 151 | <span class="lineart">╰──</span> <a class="link" href="NMDevice.html#NMLldpNeighbor">NMLldpNeighbor</a> |
1803 | 1803 | NM_SETTING_IP_CONFIG_DNS |
1804 | 1804 | NM_SETTING_IP_CONFIG_DNS_SEARCH |
1805 | 1805 | NM_SETTING_IP_CONFIG_DNS_OPTIONS |
1806 | NM_SETTING_IP_CONFIG_DNS_PRIORITY | |
1806 | 1807 | NM_SETTING_IP_CONFIG_ADDRESSES |
1807 | 1808 | NM_SETTING_IP_CONFIG_GATEWAY |
1808 | 1809 | NM_SETTING_IP_CONFIG_ROUTES |
1852 | 1853 | nm_setting_ip_config_remove_dns_option |
1853 | 1854 | nm_setting_ip_config_remove_dns_option_by_value |
1854 | 1855 | nm_setting_ip_config_clear_dns_options |
1856 | nm_setting_ip_config_get_dns_priority | |
1855 | 1857 | nm_setting_ip_config_get_num_addresses |
1856 | 1858 | nm_setting_ip_config_get_address |
1857 | 1859 | nm_setting_ip_config_add_address |
2663 | 2665 | NM_DEPRECATED_IN_1_2 |
2664 | 2666 | NM_DEPRECATED_IN_1_2_FOR |
2665 | 2667 | NM_AVAILABLE_IN_1_2 |
2666 | NM_DEPRECATED_IN_1_4 | |
2667 | NM_DEPRECATED_IN_1_4_FOR | |
2668 | NM_AVAILABLE_IN_1_4 | |
2668 | NM_AVAILABLE_IN_1_2_4 | |
2669 | 2669 | </SECTION> |
2670 | 2670 | |
2671 | 2671 | <SECTION> |
270 | 270 | NM = @NM@ |
271 | 271 | NMEDIT = @NMEDIT@ |
272 | 272 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
273 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
273 | 274 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
274 | 275 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
275 | 276 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
2092 | 2092 | <td class="enum_member_annotations"> </td> |
2093 | 2093 | </tr> |
2094 | 2094 | <tr> |
2095 | <td class="enum_member_name"><p><a name="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-GLOBAL-DNS:CAPS"></a>NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS</p></td> | |
2096 | <td class="enum_member_description"> | |
2097 | <p>modify persistent global | |
2098 | DNS configuration</p> | |
2099 | </td> | |
2100 | <td class="enum_member_annotations"> </td> | |
2101 | </tr> | |
2102 | <tr> | |
2103 | <td class="enum_member_name"><p><a name="NM-CLIENT-PERMISSION-RELOAD:CAPS"></a>NM_CLIENT_PERMISSION_RELOAD</p></td> | |
2104 | <td class="enum_member_description"> | |
2105 | <p>controls access to Reload. | |
2106 | persistent hostname can be changed</p> | |
2107 | </td> | |
2108 | <td class="enum_member_annotations"> </td> | |
2109 | </tr> | |
2110 | <tr> | |
2095 | 2111 | <td class="enum_member_name"><p><a name="NM-CLIENT-PERMISSION-LAST:CAPS"></a>NM_CLIENT_PERMISSION_LAST</p></td> |
2096 | 2112 | <td class="enum_member_description"> |
2097 | 2113 | <p>a reserved boundary value</p> |
14 | 14 | <div> |
15 | 15 | <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">libnm-glib Reference Manual</p></th></tr></table></div> |
16 | 16 | <div><p class="releaseinfo"> |
17 | for libnm-glib 1.2.2 | |
17 | for libnm-glib 1.2.4 | |
18 | 18 | |
19 | 19 | The latest version of this documentation can be found on-line at |
20 | 20 | <a class="ulink" href="https://developer.gnome.org/libnm-glib/stable/" target="_top">https://developer.gnome.org/libnm-glib/stable/</a>. |
75 | 75 | <ANCHOR id="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-SYSTEM:CAPS" href="libnm-glib/NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-SYSTEM:CAPS"> |
76 | 76 | <ANCHOR id="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-OWN:CAPS" href="libnm-glib/NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-OWN:CAPS"> |
77 | 77 | <ANCHOR id="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-HOSTNAME:CAPS" href="libnm-glib/NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-HOSTNAME:CAPS"> |
78 | <ANCHOR id="NM-CLIENT-PERMISSION-SETTINGS-MODIFY-GLOBAL-DNS:CAPS" href="libnm-glib/NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-GLOBAL-DNS:CAPS"> | |
79 | <ANCHOR id="NM-CLIENT-PERMISSION-RELOAD:CAPS" href="libnm-glib/NMClient.html#NM-CLIENT-PERMISSION-RELOAD:CAPS"> | |
78 | 80 | <ANCHOR id="NM-CLIENT-PERMISSION-LAST:CAPS" href="libnm-glib/NMClient.html#NM-CLIENT-PERMISSION-LAST:CAPS"> |
79 | 81 | <ANCHOR id="NMClientPermissionResult" href="libnm-glib/NMClient.html#NMClientPermissionResult"> |
80 | 82 | <ANCHOR id="NM-CLIENT-PERMISSION-RESULT-UNKNOWN:CAPS" href="libnm-glib/NMClient.html#NM-CLIENT-PERMISSION-RESULT-UNKNOWN:CAPS"> |
714 | 714 | <keyword type="constant" name="NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM" link="NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-SYSTEM:CAPS"/> |
715 | 715 | <keyword type="constant" name="NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN" link="NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-OWN:CAPS"/> |
716 | 716 | <keyword type="constant" name="NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME" link="NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-HOSTNAME:CAPS"/> |
717 | <keyword type="constant" name="NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS" link="NMClient.html#NM-CLIENT-PERMISSION-SETTINGS-MODIFY-GLOBAL-DNS:CAPS"/> | |
718 | <keyword type="constant" name="NM_CLIENT_PERMISSION_RELOAD" link="NMClient.html#NM-CLIENT-PERMISSION-RELOAD:CAPS"/> | |
717 | 719 | <keyword type="constant" name="NM_CLIENT_PERMISSION_LAST" link="NMClient.html#NM-CLIENT-PERMISSION-LAST:CAPS"/> |
718 | 720 | <keyword type="constant" name="NM_CLIENT_PERMISSION_RESULT_UNKNOWN" link="NMClient.html#NM-CLIENT-PERMISSION-RESULT-UNKNOWN:CAPS"/> |
719 | 721 | <keyword type="constant" name="NM_CLIENT_PERMISSION_RESULT_YES" link="NMClient.html#NM-CLIENT-PERMISSION-RESULT-YES:CAPS"/> |
270 | 270 | NM = @NM@ |
271 | 271 | NMEDIT = @NMEDIT@ |
272 | 272 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
273 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
273 | 274 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
274 | 275 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
275 | 276 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
597 | 597 | </div> |
598 | 598 | <div class="refsect1"> |
599 | 599 | <a name="NMConnection.object-hierarchy"></a><h2>Object Hierarchy</h2> |
600 | <pre class="screen"> GEnum | |
600 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
601 | 601 | <span class="lineart">╰──</span> NMConnectionError |
602 | 602 | GObject |
603 | 603 | <span class="lineart">╰──</span> NMConnection |
270 | 270 | </div> |
271 | 271 | <div class="refsect1"> |
272 | 272 | <a name="NMSetting.object-hierarchy"></a><h2>Object Hierarchy</h2> |
273 | <pre class="screen"> GEnum | |
273 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
274 | 274 | <span class="lineart">├──</span> NMSettingCompareFlags |
275 | 275 | <span class="lineart">├──</span> NMSettingDiffResult |
276 | 276 | <span class="lineart">├──</span> NMSettingError |
922 | 922 | </div> |
923 | 923 | <div class="refsect1"> |
924 | 924 | <a name="NMSetting8021x.object-hierarchy"></a><h2>Object Hierarchy</h2> |
925 | <pre class="screen"> GEnum | |
925 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
926 | 926 | <span class="lineart">├──</span> NMSetting8021xCKFormat |
927 | 927 | <span class="lineart">├──</span> NMSetting8021xCKScheme |
928 | 928 | <span class="lineart">╰──</span> NMSetting8021xError |
235 | 235 | </div> |
236 | 236 | <div class="refsect1"> |
237 | 237 | <a name="NMSettingAdsl.object-hierarchy"></a><h2>Object Hierarchy</h2> |
238 | <pre class="screen"> GEnum | |
238 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
239 | 239 | <span class="lineart">╰──</span> NMSettingAdslError |
240 | 240 | GObject |
241 | 241 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
138 | 138 | </div> |
139 | 139 | <div class="refsect1"> |
140 | 140 | <a name="NMSettingBluetooth.object-hierarchy"></a><h2>Object Hierarchy</h2> |
141 | <pre class="screen"> GEnum | |
141 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
142 | 142 | <span class="lineart">╰──</span> NMSettingBluetoothError |
143 | 143 | GObject |
144 | 144 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
243 | 243 | </div> |
244 | 244 | <div class="refsect1"> |
245 | 245 | <a name="NMSettingBond.object-hierarchy"></a><h2>Object Hierarchy</h2> |
246 | <pre class="screen"> GEnum | |
246 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
247 | 247 | <span class="lineart">╰──</span> NMSettingBondError |
248 | 248 | GObject |
249 | 249 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
232 | 232 | </div> |
233 | 233 | <div class="refsect1"> |
234 | 234 | <a name="NMSettingBridge.object-hierarchy"></a><h2>Object Hierarchy</h2> |
235 | <pre class="screen"> GEnum | |
235 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
236 | 236 | <span class="lineart">╰──</span> NMSettingBridgeError |
237 | 237 | GObject |
238 | 238 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
147 | 147 | </div> |
148 | 148 | <div class="refsect1"> |
149 | 149 | <a name="NMSettingBridgePort.object-hierarchy"></a><h2>Object Hierarchy</h2> |
150 | <pre class="screen"> GEnum | |
150 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
151 | 151 | <span class="lineart">╰──</span> NMSettingBridgePortError |
152 | 152 | GObject |
153 | 153 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
164 | 164 | </div> |
165 | 165 | <div class="refsect1"> |
166 | 166 | <a name="NMSettingCdma.object-hierarchy"></a><h2>Object Hierarchy</h2> |
167 | <pre class="screen"> GEnum | |
167 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
168 | 168 | <span class="lineart">╰──</span> NMSettingCdmaError |
169 | 169 | GObject |
170 | 170 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
402 | 402 | </div> |
403 | 403 | <div class="refsect1"> |
404 | 404 | <a name="NMSettingConnection.object-hierarchy"></a><h2>Object Hierarchy</h2> |
405 | <pre class="screen"> GEnum | |
405 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
406 | 406 | <span class="lineart">╰──</span> NMSettingConnectionError |
407 | 407 | GObject |
408 | 408 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
417 | 417 | </div> |
418 | 418 | <div class="refsect1"> |
419 | 419 | <a name="NMSettingDcb.object-hierarchy"></a><h2>Object Hierarchy</h2> |
420 | <pre class="screen"> GEnum | |
420 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
421 | 421 | <span class="lineart">├──</span> NMSettingDcbError |
422 | 422 | <span class="lineart">╰──</span> NMSettingDcbFlags |
423 | 423 | GObject |
83 | 83 | </div> |
84 | 84 | <div class="refsect1"> |
85 | 85 | <a name="NMSettingGeneric.object-hierarchy"></a><h2>Object Hierarchy</h2> |
86 | <pre class="screen"> GEnum | |
86 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
87 | 87 | <span class="lineart">╰──</span> NMSettingGenericError |
88 | 88 | GObject |
89 | 89 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
295 | 295 | </div> |
296 | 296 | <div class="refsect1"> |
297 | 297 | <a name="NMSettingGsm.object-hierarchy"></a><h2>Object Hierarchy</h2> |
298 | <pre class="screen"> GEnum | |
298 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
299 | 299 | <span class="lineart">├──</span> NMSettingGsmError |
300 | 300 | <span class="lineart">├──</span> NMSettingGsmNetworkBand |
301 | 301 | <span class="lineart">╰──</span> NMSettingGsmNetworkType |
709 | 709 | </div> |
710 | 710 | <div class="refsect1"> |
711 | 711 | <a name="NMSettingIP4Config.object-hierarchy"></a><h2>Object Hierarchy</h2> |
712 | <pre class="screen"> GBoxed | |
712 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Boxed-Types.html">GBoxed</a> | |
713 | 713 | <span class="lineart">├──</span> NMIP4Address |
714 | 714 | <span class="lineart">╰──</span> NMIP4Route |
715 | GEnum | |
715 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
716 | 716 | <span class="lineart">╰──</span> NMSettingIP4ConfigError |
717 | 717 | GObject |
718 | 718 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
676 | 676 | </div> |
677 | 677 | <div class="refsect1"> |
678 | 678 | <a name="NMSettingIP6Config.object-hierarchy"></a><h2>Object Hierarchy</h2> |
679 | <pre class="screen"> GBoxed | |
679 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Boxed-Types.html">GBoxed</a> | |
680 | 680 | <span class="lineart">├──</span> NMIP6Address |
681 | 681 | <span class="lineart">╰──</span> NMIP6Route |
682 | GEnum | |
682 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
683 | 683 | <span class="lineart">├──</span> NMSettingIP6ConfigError |
684 | 684 | <span class="lineart">╰──</span> NMSettingIP6ConfigPrivacy |
685 | 685 | GObject |
181 | 181 | </div> |
182 | 182 | <div class="refsect1"> |
183 | 183 | <a name="NMSettingInfiniband.object-hierarchy"></a><h2>Object Hierarchy</h2> |
184 | <pre class="screen"> GEnum | |
184 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
185 | 185 | <span class="lineart">╰──</span> NMSettingInfinibandError |
186 | 186 | GObject |
187 | 187 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
147 | 147 | </div> |
148 | 148 | <div class="refsect1"> |
149 | 149 | <a name="NMSettingOlpcMesh.object-hierarchy"></a><h2>Object Hierarchy</h2> |
150 | <pre class="screen"> GEnum | |
150 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
151 | 151 | <span class="lineart">╰──</span> NMSettingOlpcMeshError |
152 | 152 | GObject |
153 | 153 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
403 | 403 | </div> |
404 | 404 | <div class="refsect1"> |
405 | 405 | <a name="NMSettingPPP.object-hierarchy"></a><h2>Object Hierarchy</h2> |
406 | <pre class="screen"> GEnum | |
406 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
407 | 407 | <span class="lineart">╰──</span> NMSettingPPPError |
408 | 408 | GObject |
409 | 409 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
164 | 164 | </div> |
165 | 165 | <div class="refsect1"> |
166 | 166 | <a name="NMSettingPPPOE.object-hierarchy"></a><h2>Object Hierarchy</h2> |
167 | <pre class="screen"> GEnum | |
167 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
168 | 168 | <span class="lineart">╰──</span> NMSettingPPPOEError |
169 | 169 | GObject |
170 | 170 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
182 | 182 | </div> |
183 | 183 | <div class="refsect1"> |
184 | 184 | <a name="NMSettingSerial.object-hierarchy"></a><h2>Object Hierarchy</h2> |
185 | <pre class="screen"> GEnum | |
185 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
186 | 186 | <span class="lineart">╰──</span> NMSettingSerialError |
187 | 187 | GObject |
188 | 188 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
130 | 130 | </div> |
131 | 131 | <div class="refsect1"> |
132 | 132 | <a name="NMSettingTeam.object-hierarchy"></a><h2>Object Hierarchy</h2> |
133 | <pre class="screen"> GEnum | |
133 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
134 | 134 | <span class="lineart">╰──</span> NMSettingTeamError |
135 | 135 | GObject |
136 | 136 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
111 | 111 | </div> |
112 | 112 | <div class="refsect1"> |
113 | 113 | <a name="NMSettingTeamPort.object-hierarchy"></a><h2>Object Hierarchy</h2> |
114 | <pre class="screen"> GEnum | |
114 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
115 | 115 | <span class="lineart">╰──</span> NMSettingTeamPortError |
116 | 116 | GObject |
117 | 117 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
255 | 255 | </div> |
256 | 256 | <div class="refsect1"> |
257 | 257 | <a name="NMSettingVPN.object-hierarchy"></a><h2>Object Hierarchy</h2> |
258 | <pre class="screen"> GEnum | |
258 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
259 | 259 | <span class="lineart">╰──</span> NMSettingVpnError |
260 | 260 | GObject |
261 | 261 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
260 | 260 | </div> |
261 | 261 | <div class="refsect1"> |
262 | 262 | <a name="NMSettingVlan.object-hierarchy"></a><h2>Object Hierarchy</h2> |
263 | <pre class="screen"> GEnum | |
263 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
264 | 264 | <span class="lineart">├──</span> NMSettingVlanError |
265 | 265 | <span class="lineart">├──</span> NMVlanFlags |
266 | 266 | <span class="lineart">╰──</span> NMVlanPriorityMap |
130 | 130 | </div> |
131 | 131 | <div class="refsect1"> |
132 | 132 | <a name="NMSettingWimax.object-hierarchy"></a><h2>Object Hierarchy</h2> |
133 | <pre class="screen"> GEnum | |
133 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
134 | 134 | <span class="lineart">╰──</span> NMSettingWimaxError |
135 | 135 | GObject |
136 | 136 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
368 | 368 | </div> |
369 | 369 | <div class="refsect1"> |
370 | 370 | <a name="NMSettingWired.object-hierarchy"></a><h2>Object Hierarchy</h2> |
371 | <pre class="screen"> GEnum | |
371 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
372 | 372 | <span class="lineart">╰──</span> NMSettingWiredError |
373 | 373 | GObject |
374 | 374 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
434 | 434 | </div> |
435 | 435 | <div class="refsect1"> |
436 | 436 | <a name="NMSettingWireless.object-hierarchy"></a><h2>Object Hierarchy</h2> |
437 | <pre class="screen"> GEnum | |
437 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
438 | 438 | <span class="lineart">╰──</span> NMSettingWirelessError |
439 | 439 | GObject |
440 | 440 | <span class="lineart">╰──</span> <a class="link" href="NMSetting.html" title="NMSetting">NMSetting</a> |
497 | 497 | </div> |
498 | 498 | <div class="refsect1"> |
499 | 499 | <a name="NMSettingWirelessSecurity.object-hierarchy"></a><h2>Object Hierarchy</h2> |
500 | <pre class="screen"> GEnum | |
500 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
501 | 501 | <span class="lineart">├──</span> NMSettingWirelessSecurityError |
502 | 502 | <span class="lineart">╰──</span> NMWepKeyType |
503 | 503 | GObject |
14 | 14 | <div> |
15 | 15 | <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">libnm-util Reference Manual</p></th></tr></table></div> |
16 | 16 | <div><p class="releaseinfo"> |
17 | for libnm-util 1.2.2 | |
17 | for libnm-util 1.2.4 | |
18 | 18 | |
19 | 19 | The latest version of this documentation can be found on-line at |
20 | 20 | <a class="ulink" href="https://developer.gnome.org/libnm-util/stable/" target="_top">https://developer.gnome.org/libnm-util/stable/</a>. |
479 | 479 | </div> |
480 | 480 | <div class="refsect1"> |
481 | 481 | <a name="libnm-util-nm-utils.object-hierarchy"></a><h2>Object Hierarchy</h2> |
482 | <pre class="screen"> GEnum | |
482 | <pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
483 | 483 | <span class="lineart">╰──</span> NMUtilsSecurityType |
484 | 484 | </pre> |
485 | 485 | </div> |
51 | 51 | <span class="lineart">│</span> <span class="lineart">├──</span> <a class="link" href="NMSettingWirelessSecurity.html" title="NMSettingWirelessSecurity">NMSettingWirelessSecurity</a> |
52 | 52 | <span class="lineart">│</span> <span class="lineart">╰──</span> <a class="link" href="NMSettingVPN.html" title="NMSettingVPN">NMSettingVPN</a> |
53 | 53 | <span class="lineart">╰──</span> <a class="link" href="NMConnection.html" title="NMConnection">NMConnection</a> |
54 | GEnum | |
54 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html">GEnum</a> | |
55 | 55 | <span class="lineart">├──</span> <a class="link" href="NMConnection.html#NMConnectionError" title="enum NMConnectionError">NMConnectionError</a> |
56 | 56 | <span class="lineart">├──</span> <a class="link" href="NMSetting8021x.html#NMSetting8021xCKFormat" title="enum NMSetting8021xCKFormat">NMSetting8021xCKFormat</a> |
57 | 57 | <span class="lineart">├──</span> <a class="link" href="NMSetting8021x.html#NMSetting8021xCKScheme" title="enum NMSetting8021xCKScheme">NMSetting8021xCKScheme</a> |
94 | 94 | <span class="lineart">├──</span> <a class="link" href="NMSettingVlan.html#NMVlanFlags" title="enum NMVlanFlags">NMVlanFlags</a> |
95 | 95 | <span class="lineart">├──</span> <a class="link" href="NMSettingVlan.html#NMVlanPriorityMap" title="enum NMVlanPriorityMap">NMVlanPriorityMap</a> |
96 | 96 | <span class="lineart">╰──</span> <a class="link" href="NMSettingWirelessSecurity.html#NMWepKeyType" title="enum NMWepKeyType">NMWepKeyType</a> |
97 | GBoxed | |
97 | <a href="/usr/share/gtk-doc/html/gobject/gobject-Boxed-Types.html">GBoxed</a> | |
98 | 98 | <span class="lineart">├──</span> <a class="link" href="NMSettingIP4Config.html#NMIP4Address">NMIP4Address</a> |
99 | 99 | <span class="lineart">├──</span> <a class="link" href="NMSettingIP4Config.html#NMIP4Route">NMIP4Route</a> |
100 | 100 | <span class="lineart">├──</span> <a class="link" href="NMSettingIP6Config.html#NMIP6Address">NMIP6Address</a> |
324 | 324 | NM = @NM@ |
325 | 325 | NMEDIT = @NMEDIT@ |
326 | 326 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
327 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
327 | 328 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
328 | 329 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
329 | 330 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
362 | 362 | NM = @NM@ |
363 | 363 | NMEDIT = @NMEDIT@ |
364 | 364 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
365 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
365 | 366 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
366 | 367 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
367 | 368 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
334 | 334 | NM = @NM@ |
335 | 335 | NMEDIT = @NMEDIT@ |
336 | 336 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
337 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
337 | 338 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
338 | 339 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
339 | 340 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
323 | 323 | NM = @NM@ |
324 | 324 | NMEDIT = @NMEDIT@ |
325 | 325 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
326 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
326 | 327 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
327 | 328 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
328 | 329 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
323 | 323 | NM = @NM@ |
324 | 324 | NMEDIT = @NMEDIT@ |
325 | 325 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
326 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
326 | 327 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
327 | 328 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
328 | 329 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
323 | 323 | NM = @NM@ |
324 | 324 | NMEDIT = @NMEDIT@ |
325 | 325 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
326 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
326 | 327 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
327 | 328 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
328 | 329 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
329 | 329 | NM = @NM@ |
330 | 330 | NMEDIT = @NMEDIT@ |
331 | 331 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
332 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
332 | 333 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
333 | 334 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
334 | 335 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
76 | 76 | <property name="DnsOptions" type="as" access="read"/> |
77 | 77 | |
78 | 78 | <!-- |
79 | DnsPriority: | |
80 | ||
81 | The relative priority of DNS servers. | |
82 | --> | |
83 | <property name="DnsPriority" type="i" access="read"/> | |
84 | ||
85 | <!-- | |
79 | 86 | WinsServers: |
80 | 87 | |
81 | 88 | The Windows Internet Name Service servers associated with the connection. |
76 | 76 | <property name="DnsOptions" type="as" access="read"/> |
77 | 77 | |
78 | 78 | <!-- |
79 | DnsPriority: | |
80 | ||
81 | The relative priority of DNS servers. | |
82 | --> | |
83 | <property name="DnsPriority" type="i" access="read"/> | |
84 | ||
85 | <!-- | |
79 | 86 | PropertiesChanged: |
80 | 87 | @properties: A dictionary mapping property names to variant boxed values |
81 | 88 | --> |
1 | 1 | <node name="/org/freedesktop/NetworkManager"> |
2 | 2 | <interface name="org.freedesktop.NetworkManager"> |
3 | 3 | <annotation name="org.gtk.GDBus.C.Name" value="Manager"/> |
4 | ||
5 | <!-- | |
6 | Reload: | |
7 | @flags: optional flags to specify which parts shall be reloaded. | |
8 | ||
9 | Reload NetworkManager's configuration and perform certain updates, like flushing a cache or | |
10 | rewriting external state to disk. This is similar to sending SIGHUP to NetworkManager but it | |
11 | allows for more fine-grained control over what to reload (see @flags). It also allows | |
12 | non-root access via PolicyKit and contrary to signals it is synchronous. | |
13 | ||
14 | No flags (0x00) means to reload everything that is supported which is identical to | |
15 | sending a SIGHUP. | |
16 | (0x01) means to reload the NetworkManager.conf configuration from disk. Note that this | |
17 | does not include connections, which can be reloaded via Setting's ReloadConnections. | |
18 | (0x02) means to update DNS configuration, which usually involves writing /etc/resolv.conf | |
19 | anew. | |
20 | (0x04) means to restart the DNS plugin. This is for example useful when using | |
21 | dnsmasq plugin, which uses additional configuration in /etc/NetworkManager/dnsmasq.d. | |
22 | If you edit those files, you can restart the DNS plugin. This action shortly interrupts | |
23 | rename resolution. | |
24 | Note that flags may affect each other. For example, restarting the DNS plugin (0x04) | |
25 | implicitly updates DNS too (0x02). Or when reloading the configuration (0x01), changes | |
26 | to DNS setting also cause a DNS update (0x02). However, (0x01) does not involve restarting | |
27 | the DNS plugin (0x02), unless an entirely different plugin is selected. | |
28 | --> | |
29 | <method name="Reload"> | |
30 | <arg name="flags" type="u" direction="in"/> | |
31 | </method> | |
4 | 32 | |
5 | 33 | <!-- |
6 | 34 | GetDevices: |
22 | 22 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP4Config.Domains">Domains</link> readable as |
23 | 23 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP4Config.Searches">Searches</link> readable as |
24 | 24 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsOptions">DnsOptions</link> readable as |
25 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority">DnsPriority</link> readable i | |
25 | 26 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP4Config.WinsServers">WinsServers</link> readable au |
26 | 27 | </synopsis> |
27 | 28 | </refsect1> |
140 | 141 | resolv.conf(5) manual page for the list of supported options. |
141 | 142 | </para> |
142 | 143 | </refsect2> |
144 | <refsect2 role="property" id="gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority"> | |
145 | <title>The "DnsPriority" property</title> | |
146 | <indexterm zone="gdbus-property-org-freedesktop-NetworkManager-IP4Config.DnsPriority"><primary sortas=".IP4Config:DnsPriority">org.freedesktop.NetworkManager.IP4Config:DnsPriority</primary></indexterm> | |
147 | <programlisting> | |
148 | DnsPriority readable i | |
149 | </programlisting> | |
150 | <para> The relative priority of DNS servers. | |
151 | </para> | |
152 | </refsect2> | |
143 | 153 | <refsect2 role="property" id="gdbus-property-org-freedesktop-NetworkManager-IP4Config.WinsServers"> |
144 | 154 | <title>The "WinsServers" property</title> |
145 | 155 | <indexterm zone="gdbus-property-org-freedesktop-NetworkManager-IP4Config.WinsServers"><primary sortas=".IP4Config:WinsServers">org.freedesktop.NetworkManager.IP4Config:WinsServers</primary></indexterm> |
22 | 22 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP6Config.Domains">Domains</link> readable as |
23 | 23 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP6Config.Searches">Searches</link> readable as |
24 | 24 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsOptions">DnsOptions</link> readable as |
25 | <link linkend="gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority">DnsPriority</link> readable i | |
25 | 26 | </synopsis> |
26 | 27 | </refsect1> |
27 | 28 | <refsect1 role="desc" id="gdbus-interface-org-freedesktop-NetworkManager-IP6Config"> |
134 | 135 | resolv.conf(5) manual page for the list of supported options. |
135 | 136 | </para> |
136 | 137 | </refsect2> |
138 | <refsect2 role="property" id="gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority"> | |
139 | <title>The "DnsPriority" property</title> | |
140 | <indexterm zone="gdbus-property-org-freedesktop-NetworkManager-IP6Config.DnsPriority"><primary sortas=".IP6Config:DnsPriority">org.freedesktop.NetworkManager.IP6Config:DnsPriority</primary></indexterm> | |
141 | <programlisting> | |
142 | DnsPriority readable i | |
143 | </programlisting> | |
144 | <para> The relative priority of DNS servers. | |
145 | </para> | |
146 | </refsect2> | |
137 | 147 | </refsect1> |
138 | 148 | </refentry> |
139 | 149 |
7 | 7 | </refmeta> <refnamediv> <refname>org.freedesktop.NetworkManager</refname> <refpurpose></refpurpose> </refnamediv> <refsynopsisdiv role="synopsis"> |
8 | 8 | <title role="synopsis.title">Methods</title> |
9 | 9 | <synopsis> |
10 | <link linkend="gdbus-method-org-freedesktop-NetworkManager.Reload">Reload</link> (IN u flags); | |
10 | 11 | <link linkend="gdbus-method-org-freedesktop-NetworkManager.GetDevices">GetDevices</link> (OUT ao devices); |
11 | 12 | <link linkend="gdbus-method-org-freedesktop-NetworkManager.GetAllDevices">GetAllDevices</link> (OUT ao devices); |
12 | 13 | <link linkend="gdbus-method-org-freedesktop-NetworkManager.GetDeviceByIpIface">GetDeviceByIpIface</link> (IN s iface, |
72 | 73 | </refsect1> |
73 | 74 | <refsect1 role="details" id="gdbus-methods-org.freedesktop.NetworkManager"> |
74 | 75 | <title role="details.title">Method Details</title> |
76 | <refsect2 role="method" id="gdbus-method-org-freedesktop-NetworkManager.Reload"> | |
77 | <title>The Reload() method</title> | |
78 | <indexterm zone="gdbus-method-org-freedesktop-NetworkManager.Reload"><primary sortas="Manager.Reload">org.freedesktop.NetworkManager.Reload()</primary></indexterm> | |
79 | <programlisting> | |
80 | Reload (IN u flags); | |
81 | </programlisting> | |
82 | <para> Reload NetworkManager's configuration and perform certain updates, like flushing a cache or | |
83 | rewriting external state to disk. This is similar to sending SIGHUP to NetworkManager but it | |
84 | allows for more fine-grained control over what to reload (see <parameter>flags</parameter>). It also allows | |
85 | non-root access via PolicyKit and contrary to signals it is synchronous. | |
86 | </para><para> No flags (0x00) means to reload everything that is supported which is identical to | |
87 | sending a SIGHUP. | |
88 | (0x01) means to reload the NetworkManager.conf configuration from disk. Note that this | |
89 | does not include connections, which can be reloaded via Setting's ReloadConnections. | |
90 | (0x02) means to update DNS configuration, which usually involves writing /etc/resolv.conf | |
91 | anew. | |
92 | (0x04) means to restart the DNS plugin. This is for example useful when using | |
93 | dnsmasq plugin, which uses additional configuration in /etc/NetworkManager/dnsmasq.d. | |
94 | If you edit those files, you can restart the DNS plugin. This action shortly interrupts | |
95 | rename resolution. | |
96 | Note that flags may affect each other. For example, restarting the DNS plugin (0x04) | |
97 | implicitly updates DNS too (0x02). Or when reloading the configuration (0x01), changes | |
98 | to DNS setting also cause a DNS update (0x02). However, (0x01) does not involve restarting | |
99 | the DNS plugin (0x02), unless an entirely different plugin is selected. | |
100 | </para> | |
101 | <variablelist role="params"> | |
102 | <varlistentry> | |
103 | <term><literal>IN u <parameter>flags</parameter></literal>:</term> | |
104 | <listitem><para>optional flags to specify which parts shall be reloaded.</para></listitem> | |
105 | </varlistentry> | |
106 | </variablelist> | |
107 | </refsect2> | |
75 | 108 | <refsect2 role="method" id="gdbus-method-org-freedesktop-NetworkManager.GetDevices"> |
76 | 109 | <title>The GetDevices() method</title> |
77 | 110 | <indexterm zone="gdbus-method-org-freedesktop-NetworkManager.GetDevices"><primary sortas="Manager.GetDevices">org.freedesktop.NetworkManager.GetDevices()</primary></indexterm> |
136 | 136 | libnm_la_LIBADD = \ |
137 | 137 | $(top_builddir)/libnm-core/libnm-core.la \ |
138 | 138 | $(top_builddir)/introspection/libnmdbus.la \ |
139 | $(LIBDL) \ | |
139 | 140 | $(GLIB_LIBS) \ |
140 | 141 | $(UUID_LIBS) \ |
141 | 142 | $(GUDEV_LIBS) |
155 | 155 | libnm_la_DEPENDENCIES = $(top_builddir)/libnm-core/libnm-core.la \ |
156 | 156 | $(top_builddir)/introspection/libnmdbus.la \ |
157 | 157 | $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ |
158 | $(am__DEPENDENCIES_1) | |
158 | $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) | |
159 | 159 | am__objects_1 = nm-access-point.lo nm-active-connection.lo \ |
160 | 160 | nm-client.lo nm-dbus-helpers.lo nm-device-adsl.lo \ |
161 | 161 | nm-device-bond.lo nm-device-bridge.lo nm-device-bt.lo \ |
422 | 422 | NM = @NM@ |
423 | 423 | NMEDIT = @NMEDIT@ |
424 | 424 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
425 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
425 | 426 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
426 | 427 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
427 | 428 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
789 | 790 | libnm_la_LIBADD = \ |
790 | 791 | $(top_builddir)/libnm-core/libnm-core.la \ |
791 | 792 | $(top_builddir)/introspection/libnmdbus.la \ |
793 | $(LIBDL) \ | |
792 | 794 | $(GLIB_LIBS) \ |
793 | 795 | $(UUID_LIBS) \ |
794 | 796 | $(GUDEV_LIBS) |
1057 | 1057 | nm_vpn_service_plugin_set_ip6_config; |
1058 | 1058 | nm_vpn_service_plugin_set_login_banner; |
1059 | 1059 | } libnm_1_0_0; |
1060 | ||
1061 | libnm_1_2_4 { | |
1062 | nm_setting_ip_config_get_dns_priority; | |
1063 | } libnm_1_2_0; |
91 | 91 | * owned by the current user can be modified |
92 | 92 | * @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME: controls whether the |
93 | 93 | * persistent hostname can be changed |
94 | * @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS: modify persistent global | |
95 | * DNS configuration | |
96 | * @NM_CLIENT_PERMISSION_RELOAD: controls access to Reload. | |
94 | 97 | * @NM_CLIENT_PERMISSION_LAST: a reserved boundary value |
95 | 98 | * |
96 | 99 | * #NMClientPermission values indicate various permissions that NetworkManager |
109 | 112 | NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM = 9, |
110 | 113 | NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN = 10, |
111 | 114 | NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME = 11, |
112 | ||
113 | NM_CLIENT_PERMISSION_LAST = NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME | |
115 | NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS = 12, | |
116 | NM_CLIENT_PERMISSION_RELOAD = 13, | |
117 | ||
118 | NM_CLIENT_PERMISSION_LAST = 13, | |
114 | 119 | } NMClientPermission; |
115 | 120 | |
116 | 121 | /** |
1721 | 1721 | char *pdown; |
1722 | 1722 | char *vdown; |
1723 | 1723 | GString *str; |
1724 | GParamSpec *name_prop; | |
1724 | 1725 | |
1725 | 1726 | dev_product = nm_device_get_product (device); |
1726 | 1727 | priv->short_product = fixup_desc_string (dev_product); |
1727 | 1728 | |
1728 | 1729 | dev_vendor = nm_device_get_vendor (device); |
1729 | 1730 | priv->short_vendor = fixup_desc_string (dev_vendor); |
1731 | ||
1732 | /* Grab device's preferred name, if any */ | |
1733 | name_prop = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (device)), "name"); | |
1734 | if (name_prop) { | |
1735 | g_object_get (device, "name", &priv->description, NULL); | |
1736 | if (priv->description && priv->description[0]) | |
1737 | return; | |
1738 | g_clear_pointer (&priv->description, g_free); | |
1739 | } | |
1730 | 1740 | |
1731 | 1741 | if (!dev_product || !dev_vendor) { |
1732 | 1742 | priv->description = g_strdup (nm_device_get_iface (device)); |
62 | 62 | { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM", "settings-modify-system" }, |
63 | 63 | { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN", "settings-modify-own" }, |
64 | 64 | { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME", "settings-modify-hostname" }, |
65 | { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS", "settings-modify-global-dns" }, | |
66 | { NM_CLIENT_PERMISSION_RELOAD, "NM_CLIENT_PERMISSION_RELOAD", "reload" }, | |
65 | 67 | { NM_CLIENT_PERMISSION_LAST, "NM_CLIENT_PERMISSION_LAST", "last" }, |
66 | 68 | { 0, NULL, NULL } |
67 | 69 | }; |
25 | 25 | #include <string.h> |
26 | 26 | |
27 | 27 | #include "nm-utils.h" |
28 | #include "nm-common-macros.h" | |
28 | 29 | #include "nm-device-ethernet.h" |
29 | 30 | #include "nm-device-wifi.h" |
30 | 31 | #include "nm-device-private.h" |
200 | 201 | g_signal_connect (priv->manager_proxy, "check-permissions", |
201 | 202 | G_CALLBACK (manager_recheck_permissions), object); |
202 | 203 | } |
203 | ||
204 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK "org.freedesktop.NetworkManager.enable-disable-network" | |
205 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI "org.freedesktop.NetworkManager.enable-disable-wifi" | |
206 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN "org.freedesktop.NetworkManager.enable-disable-wwan" | |
207 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX "org.freedesktop.NetworkManager.enable-disable-wimax" | |
208 | #define NM_AUTH_PERMISSION_SLEEP_WAKE "org.freedesktop.NetworkManager.sleep-wake" | |
209 | #define NM_AUTH_PERMISSION_NETWORK_CONTROL "org.freedesktop.NetworkManager.network-control" | |
210 | #define NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED "org.freedesktop.NetworkManager.wifi.share.protected" | |
211 | #define NM_AUTH_PERMISSION_WIFI_SHARE_OPEN "org.freedesktop.NetworkManager.wifi.share.open" | |
212 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM "org.freedesktop.NetworkManager.settings.modify.system" | |
213 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN "org.freedesktop.NetworkManager.settings.modify.own" | |
214 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME "org.freedesktop.NetworkManager.settings.modify.hostname" | |
215 | 204 | |
216 | 205 | static NMClientPermission |
217 | 206 | nm_permission_to_client (const char *nm) |
238 | 227 | return NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN; |
239 | 228 | else if (!strcmp (nm, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME)) |
240 | 229 | return NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME; |
230 | else if (!strcmp (nm, NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS)) | |
231 | return NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS; | |
232 | else if (!strcmp (nm, NM_AUTH_PERMISSION_RELOAD)) | |
233 | return NM_CLIENT_PERMISSION_RELOAD; | |
241 | 234 | |
242 | 235 | return NM_CLIENT_PERMISSION_NONE; |
243 | 236 | } |
156 | 156 | <property name="dhcp-timeout" type="int32" default="0" description="A timeout for a DHCP transaction in seconds." /> |
157 | 157 | <property name="dns" type="array of uint32" default="[]" description="Array of IP addresses of DNS servers." /> |
158 | 158 | <property name="dns-options" type="array of string" default="[]" description="Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties." /> |
159 | <property name="dns-priority" type="int32" default="0" description="DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used." /> | |
159 | 160 | <property name="dns-search" type="array of string" default="[]" description="Array of DNS search domains." /> |
160 | 161 | <property name="gateway" type="string" description="The gateway associated with this configuration. This is only meaningful if "addresses" is also set." /> |
161 | 162 | <property name="ignore-auto-dns" type="boolean" default="FALSE" description="When "method" is set to "auto" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the "dns" and "dns-search" properties, if any, are used." /> |
176 | 177 | <property name="dhcp-timeout" type="int32" default="0" description="A timeout for a DHCP transaction in seconds." /> |
177 | 178 | <property name="dns" type="array of byte array" default="[]" description="Array of IP addresses of DNS servers." /> |
178 | 179 | <property name="dns-options" type="array of string" default="[]" description="Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties." /> |
180 | <property name="dns-priority" type="int32" default="0" description="DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used." /> | |
179 | 181 | <property name="dns-search" type="array of string" default="[]" description="Array of DNS search domains." /> |
180 | 182 | <property name="gateway" type="string" description="The gateway associated with this configuration. This is only meaningful if "addresses" is also set." /> |
181 | 183 | <property name="ignore-auto-dns" type="boolean" default="FALSE" description="When "method" is set to "auto" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the "dns" and "dns-search" properties, if any, are used." /> |
159 | 159 | <property name="dhcp-timeout" type="int32" default="0" description="A timeout for a DHCP transaction in seconds." /> |
160 | 160 | <property name="dns" type="array of uint32" default="[]" description="Array of IP addresses of DNS servers (as network-byte-order integers)" /> |
161 | 161 | <property name="dns-options" type="array of string" default="[]" description="Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties." /> |
162 | <property name="dns-priority" type="int32" default="0" description="DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used." /> | |
162 | 163 | <property name="dns-search" type="array of string" default="[]" description="Array of DNS search domains." /> |
163 | 164 | <property name="gateway" type="string" description="The gateway associated with this configuration. This is only meaningful if "addresses" is also set." /> |
164 | 165 | <property name="ignore-auto-dns" type="boolean" default="FALSE" description="When "method" is set to "auto" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the "dns" and "dns-search" properties, if any, are used." /> |
181 | 182 | <property name="dhcp-timeout" type="int32" default="0" description="A timeout for a DHCP transaction in seconds." /> |
182 | 183 | <property name="dns" type="array of byte array" default="[]" description="Array of IP addresses of DNS servers (in network byte order)" /> |
183 | 184 | <property name="dns-options" type="array of string" default="[]" description="Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties." /> |
185 | <property name="dns-priority" type="int32" default="0" description="DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used." /> | |
184 | 186 | <property name="dns-search" type="array of string" default="[]" description="Array of DNS search domains." /> |
185 | 187 | <property name="gateway" type="string" description="The gateway associated with this configuration. This is only meaningful if "addresses" is also set." /> |
186 | 188 | <property name="ignore-auto-dns" type="boolean" default="FALSE" description="When "method" is set to "auto" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the "dns" and "dns-search" properties, if any, are used." /> |
562 | 562 | NM = @NM@ |
563 | 563 | NMEDIT = @NMEDIT@ |
564 | 564 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
565 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
565 | 566 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
566 | 567 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
567 | 568 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
457 | 457 | NM = @NM@ |
458 | 458 | NMEDIT = @NMEDIT@ |
459 | 459 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
460 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
460 | 461 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
461 | 462 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
462 | 463 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
723 | 723 | const char *default_ip6_method = NULL; |
724 | 724 | NMSettingIPConfig *s_ip4, *s_ip6; |
725 | 725 | NMSetting *setting; |
726 | gboolean changed = FALSE; | |
726 | 727 | |
727 | 728 | if (parameters) |
728 | 729 | default_ip6_method = g_hash_table_lookup (parameters, NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD); |
755 | 756 | NM_SETTING_IP_CONFIG_METHOD, default_ip4_method, |
756 | 757 | NULL); |
757 | 758 | nm_connection_add_setting (self, setting); |
759 | } else { | |
760 | if ( nm_setting_ip_config_get_gateway (s_ip4) | |
761 | && nm_setting_ip_config_get_never_default (s_ip4)) { | |
762 | g_object_set (s_ip4, NM_SETTING_IP_CONFIG_GATEWAY, NULL, NULL); | |
763 | changed = TRUE; | |
764 | } | |
765 | ||
766 | if ( nm_streq0 (nm_setting_ip_config_get_method (s_ip4), | |
767 | NM_SETTING_IP4_CONFIG_METHOD_DISABLED) | |
768 | && !nm_setting_ip_config_get_may_fail (s_ip4)) { | |
769 | g_object_set (s_ip4, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); | |
770 | changed = TRUE; | |
771 | } | |
758 | 772 | } |
759 | 773 | if (!s_ip6) { |
760 | 774 | setting = nm_setting_ip6_config_new (); |
764 | 778 | NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, |
765 | 779 | NULL); |
766 | 780 | nm_connection_add_setting (self, setting); |
781 | } else { | |
782 | if ( nm_setting_ip_config_get_gateway (s_ip6) | |
783 | && nm_setting_ip_config_get_never_default (s_ip6)) { | |
784 | g_object_set (s_ip6, NM_SETTING_IP_CONFIG_GATEWAY, NULL, NULL); | |
785 | changed = TRUE; | |
786 | } | |
787 | ||
788 | if ( nm_streq0 (nm_setting_ip_config_get_method (s_ip6), | |
789 | NM_SETTING_IP6_CONFIG_METHOD_IGNORE) | |
790 | && !nm_setting_ip_config_get_may_fail (s_ip6)) { | |
791 | g_object_set (s_ip6, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL); | |
792 | changed = TRUE; | |
793 | } | |
767 | 794 | } |
768 | return !s_ip4 || !s_ip6; | |
795 | return !s_ip4 || !s_ip6 || changed; | |
769 | 796 | } |
770 | 797 | } |
771 | 798 |
677 | 677 | { NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED, "NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED", "AlreadyEnabledOrDisabled" }, |
678 | 678 | { NM_MANAGER_ERROR_UNKNOWN_LOG_LEVEL, "NM_MANAGER_ERROR_UNKNOWN_LOG_LEVEL", "UnknownLogLevel" }, |
679 | 679 | { NM_MANAGER_ERROR_UNKNOWN_LOG_DOMAIN, "NM_MANAGER_ERROR_UNKNOWN_LOG_DOMAIN", "UnknownLogDomain" }, |
680 | { NM_MANAGER_ERROR_INVALID_ARGUMENTS, "NM_MANAGER_ERROR_INVALID_ARGUMENTS", "InvalidArguments" }, | |
680 | 681 | { 0, NULL, NULL } |
681 | 682 | }; |
682 | 683 | GType g_define_type_id = |
184 | 184 | * enabled/disabled. |
185 | 185 | * @NM_MANAGER_ERROR_UNKNOWN_LOG_LEVEL: Unknown log level in SetLogging |
186 | 186 | * @NM_MANAGER_ERROR_UNKNOWN_LOG_DOMAIN: Unknown log domain in SetLogging |
187 | * @NM_MANAGER_ERROR_INVALID_ARGUMENTS: Invalid arguments for D-Bus request | |
187 | 188 | * |
188 | 189 | * Errors related to the main "network management" interface of NetworkManager. |
189 | 190 | * These may be returned from #NMClient methods that invoke D-Bus operations on |
203 | 204 | NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED, /*< nick=AlreadyEnabledOrDisabled >*/ |
204 | 205 | NM_MANAGER_ERROR_UNKNOWN_LOG_LEVEL, /*< nick=UnknownLogLevel >*/ |
205 | 206 | NM_MANAGER_ERROR_UNKNOWN_LOG_DOMAIN, /*< nick=UnknownLogDomain >*/ |
207 | NM_MANAGER_ERROR_INVALID_ARGUMENTS, /*< nick=InvalidArguments >*/ | |
206 | 208 | } NMManagerError; |
207 | 209 | |
208 | 210 | GQuark nm_manager_error_quark (void); |
1119 | 1119 | GPtrArray *dns; /* array of IP address strings */ |
1120 | 1120 | GPtrArray *dns_search; /* array of domain name strings */ |
1121 | 1121 | GPtrArray *dns_options;/* array of DNS options */ |
1122 | gint dns_priority; | |
1122 | 1123 | GPtrArray *addresses; /* array of NMIPAddress */ |
1123 | 1124 | GPtrArray *routes; /* array of NMIPRoute */ |
1124 | 1125 | gint64 route_metric; |
1139 | 1140 | PROP_DNS, |
1140 | 1141 | PROP_DNS_SEARCH, |
1141 | 1142 | PROP_DNS_OPTIONS, |
1143 | PROP_DNS_PRIORITY, | |
1142 | 1144 | PROP_ADDRESSES, |
1143 | 1145 | PROP_GATEWAY, |
1144 | 1146 | PROP_ROUTES, |
1680 | 1682 | } |
1681 | 1683 | } |
1682 | 1684 | g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_OPTIONS); |
1685 | } | |
1686 | ||
1687 | /** | |
1688 | * nm_setting_ip_config_get_dns_priority: | |
1689 | * @setting: the #NMSettingIPConfig | |
1690 | * | |
1691 | * Returns: the priority of DNS servers | |
1692 | * | |
1693 | * Since: 1.2.4 | |
1694 | **/ | |
1695 | gint | |
1696 | nm_setting_ip_config_get_dns_priority (NMSettingIPConfig *setting) | |
1697 | { | |
1698 | g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0); | |
1699 | ||
1700 | return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dns_priority; | |
1683 | 1701 | } |
1684 | 1702 | |
1685 | 1703 | /** |
2273 | 2291 | } |
2274 | 2292 | } |
2275 | 2293 | |
2294 | if (priv->gateway && priv->never_default) { | |
2295 | g_set_error (error, | |
2296 | NM_CONNECTION_ERROR, | |
2297 | NM_CONNECTION_ERROR_INVALID_PROPERTY, | |
2298 | _("a gateway is incompatible with '%s'"), | |
2299 | NM_SETTING_IP_CONFIG_NEVER_DEFAULT); | |
2300 | g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_GATEWAY); | |
2301 | return NM_SETTING_VERIFY_NORMALIZABLE_ERROR; | |
2302 | } | |
2303 | ||
2276 | 2304 | return TRUE; |
2277 | 2305 | } |
2278 | 2306 | |
2351 | 2379 | } |
2352 | 2380 | } |
2353 | 2381 | break; |
2382 | case PROP_DNS_PRIORITY: | |
2383 | priv->dns_priority = g_value_get_int (value); | |
2384 | break; | |
2354 | 2385 | case PROP_ADDRESSES: |
2355 | 2386 | g_ptr_array_unref (priv->addresses); |
2356 | 2387 | priv->addresses = _nm_utils_copy_array (g_value_get_boxed (value), |
2422 | 2453 | break; |
2423 | 2454 | case PROP_DNS_OPTIONS: |
2424 | 2455 | g_value_take_boxed (value, priv->dns_options ? _nm_utils_ptrarray_to_strv (priv->dns_options) : NULL); |
2456 | break; | |
2457 | case PROP_DNS_PRIORITY: | |
2458 | g_value_set_int (value, priv->dns_priority); | |
2425 | 2459 | break; |
2426 | 2460 | case PROP_ADDRESSES: |
2427 | 2461 | g_value_take_boxed (value, _nm_utils_copy_array (priv->addresses, |
2573 | 2607 | G_TYPE_STRV, |
2574 | 2608 | G_PARAM_READWRITE | |
2575 | 2609 | G_PARAM_STATIC_STRINGS)); |
2610 | ||
2611 | /** | |
2612 | * NMSettingIPConfig:dns-priority: | |
2613 | * | |
2614 | * DNS priority. | |
2615 | * | |
2616 | * The relative priority to be used when determining the order of DNS | |
2617 | * servers in resolv.conf. A lower value means that servers will be on top | |
2618 | * of the file. Zero selects the default value, which is 50 for VPNs and | |
2619 | * 100 for other connections. When multiple devices have configurations | |
2620 | * with the same priority, the one with an active default route will be | |
2621 | * preferred. Note that when using dns=dnsmasq the order is meaningless | |
2622 | * since dnsmasq forwards queries to all known servers at the same time. | |
2623 | * | |
2624 | * Negative values have the special effect of excluding other configurations | |
2625 | * with a greater priority value; so in presence of at least a negative | |
2626 | * priority, only DNS servers from configurations with the lowest priority | |
2627 | * value will be used. | |
2628 | * | |
2629 | * Since: 1.2.4 | |
2630 | **/ | |
2631 | g_object_class_install_property | |
2632 | (object_class, PROP_DNS_PRIORITY, | |
2633 | g_param_spec_int (NM_SETTING_IP_CONFIG_DNS_PRIORITY, "", "", | |
2634 | G_MININT32, G_MAXINT32, 0, | |
2635 | G_PARAM_READWRITE | | |
2636 | G_PARAM_CONSTRUCT | | |
2637 | G_PARAM_STATIC_STRINGS)); | |
2576 | 2638 | |
2577 | 2639 | /** |
2578 | 2640 | * NMSettingIPConfig:addresses: |
135 | 135 | #define NM_SETTING_IP_CONFIG_DNS "dns" |
136 | 136 | #define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search" |
137 | 137 | #define NM_SETTING_IP_CONFIG_DNS_OPTIONS "dns-options" |
138 | #define NM_SETTING_IP_CONFIG_DNS_PRIORITY "dns-priority" | |
138 | 139 | #define NM_SETTING_IP_CONFIG_ADDRESSES "addresses" |
139 | 140 | #define NM_SETTING_IP_CONFIG_GATEWAY "gateway" |
140 | 141 | #define NM_SETTING_IP_CONFIG_ROUTES "routes" |
218 | 219 | const char *dns_option); |
219 | 220 | void nm_setting_ip_config_clear_dns_options (NMSettingIPConfig *setting, gboolean is_set); |
220 | 221 | |
222 | NM_AVAILABLE_IN_1_2_4 | |
223 | gint nm_setting_ip_config_get_dns_priority (NMSettingIPConfig *setting); | |
224 | ||
221 | 225 | guint nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting); |
222 | 226 | NMIPAddress *nm_setting_ip_config_get_address (NMSettingIPConfig *setting, |
223 | 227 | int idx); |
224 | 224 | return FALSE; |
225 | 225 | } |
226 | 226 | |
227 | /* Failures from here on are NORMALIZABLE... */ | |
228 | ||
229 | if ( !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) | |
230 | && !nm_setting_ip_config_get_may_fail (s_ip)) { | |
231 | g_set_error_literal (error, | |
232 | NM_CONNECTION_ERROR, | |
233 | NM_CONNECTION_ERROR_INVALID_PROPERTY, | |
234 | _("property should be TRUE when method is set to disabled")); | |
235 | g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_MAY_FAIL); | |
236 | return NM_SETTING_VERIFY_NORMALIZABLE; | |
237 | } | |
238 | ||
227 | 239 | return TRUE; |
228 | 240 | } |
229 | 241 |
200 | 200 | return FALSE; |
201 | 201 | } |
202 | 202 | |
203 | /* Failures from here on are NORMALIZABLE... */ | |
204 | ||
205 | if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) | |
206 | && !nm_setting_ip_config_get_may_fail (s_ip)) { | |
207 | g_set_error_literal (error, | |
208 | NM_CONNECTION_ERROR, | |
209 | NM_CONNECTION_ERROR_INVALID_PROPERTY, | |
210 | _("property should be TRUE when method is set to ignore")); | |
211 | g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_MAY_FAIL); | |
212 | return NM_SETTING_VERIFY_NORMALIZABLE; | |
213 | } | |
214 | ||
203 | 215 | return TRUE; |
204 | 216 | } |
205 | 217 |
944 | 944 | } |
945 | 945 | } |
946 | 946 | |
947 | return nm_unauto (&setting); | |
947 | return g_steal_pointer (&setting); | |
948 | 948 | } |
949 | 949 | |
950 | 950 | /** |
2398 | 2398 | const char *extensions[] = { ".der", ".pem", ".p12", ".key", NULL }; |
2399 | 2399 | |
2400 | 2400 | g_return_val_if_fail (filename != NULL, FALSE); |
2401 | g_return_val_if_fail (out_encrypted == NULL || *out_encrypted == FALSE, FALSE); | |
2402 | ||
2401 | ||
2402 | NM_SET_OUT (out_encrypted, FALSE); | |
2403 | 2403 | if (!file_has_extension (filename, extensions)) |
2404 | 2404 | return FALSE; |
2405 | 2405 |
89 | 89 | # define NM_AVAILABLE_IN_1_2 |
90 | 90 | #endif |
91 | 91 | |
92 | #if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_4 | |
93 | # define NM_DEPRECATED_IN_1_4 G_DEPRECATED | |
94 | # define NM_DEPRECATED_IN_1_4_FOR(f) G_DEPRECATED_FOR(f) | |
92 | #if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_2_4 | |
93 | # define NM_AVAILABLE_IN_1_2_4 G_UNAVAILABLE(1.2,4) | |
95 | 94 | #else |
96 | # define NM_DEPRECATED_IN_1_4 | |
97 | # define NM_DEPRECATED_IN_1_4_FOR(f) | |
98 | #endif | |
99 | ||
100 | #if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_4 | |
101 | # define NM_AVAILABLE_IN_1_4 G_UNAVAILABLE(1,4) | |
102 | #else | |
103 | # define NM_AVAILABLE_IN_1_4 | |
95 | # define NM_AVAILABLE_IN_1_2_4 | |
104 | 96 | #endif |
105 | 97 | |
106 | 98 | #endif /* NM_VERSION_H */ |
205 | 205 | return NULL; |
206 | 206 | } |
207 | 207 | |
208 | return nm_unauto (&editor_plugin); | |
208 | return g_steal_pointer (&editor_plugin); | |
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
585 | 585 | NM = @NM@ |
586 | 586 | NMEDIT = @NMEDIT@ |
587 | 587 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
588 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
588 | 589 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
589 | 590 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
590 | 591 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
1967 | 1967 | { NM_SETTING_IP_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A }, |
1968 | 1968 | { NM_SETTING_IP_CONFIG_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A }, |
1969 | 1969 | { NM_SETTING_IP_CONFIG_DAD_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A }, |
1970 | { NM_SETTING_IP_CONFIG_DNS_PRIORITY, NM_SETTING_DIFF_RESULT_IN_A }, | |
1970 | 1971 | { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }, |
1971 | 1972 | } }, |
1972 | 1973 | }; |
3713 | 3714 | nmtst_assert_connection_verifies_after_normalization (con, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY); |
3714 | 3715 | nmtst_connection_normalize (con); |
3715 | 3716 | g_assert_cmpint (65520, ==, nm_setting_infiniband_get_mtu (s_infini)); |
3717 | } | |
3718 | ||
3719 | static void | |
3720 | test_connection_normalize_gateway_never_default (void) | |
3721 | { | |
3722 | gs_unref_object NMConnection *con = NULL; | |
3723 | NMSettingIPConfig *s_ip4, *s_ip6; | |
3724 | NMIPAddress *addr; | |
3725 | gs_free_error GError *error = NULL; | |
3726 | ||
3727 | con = nmtst_create_minimal_connection ("test1", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL); | |
3728 | nmtst_assert_connection_verifies_and_normalizable (con); | |
3729 | ||
3730 | s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); | |
3731 | g_object_set (G_OBJECT (s_ip4), | |
3732 | NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, | |
3733 | NULL); | |
3734 | ||
3735 | addr = nm_ip_address_new (AF_INET, "1.1.1.1", 24, &error); | |
3736 | g_assert_no_error (error); | |
3737 | nm_setting_ip_config_add_address (s_ip4, addr); | |
3738 | nm_ip_address_unref (addr); | |
3739 | ||
3740 | g_object_set (s_ip4, | |
3741 | NM_SETTING_IP_CONFIG_GATEWAY, "1.1.1.254", | |
3742 | NM_SETTING_IP_CONFIG_NEVER_DEFAULT, FALSE, | |
3743 | NULL); | |
3744 | ||
3745 | s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); | |
3746 | g_object_set (s_ip6, | |
3747 | NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, | |
3748 | NULL); | |
3749 | ||
3750 | nm_connection_add_setting (con, (NMSetting *) s_ip4); | |
3751 | nm_connection_add_setting (con, (NMSetting *) s_ip6); | |
3752 | ||
3753 | nmtst_assert_connection_verifies_without_normalization (con); | |
3754 | g_assert_cmpstr ("1.1.1.254", ==, nm_setting_ip_config_get_gateway (s_ip4)); | |
3755 | ||
3756 | /* Now set never-default to TRUE and check that the gateway is | |
3757 | * removed during normalization | |
3758 | * */ | |
3759 | g_object_set (s_ip4, | |
3760 | NM_SETTING_IP_CONFIG_NEVER_DEFAULT, TRUE, | |
3761 | NULL); | |
3762 | ||
3763 | nmtst_assert_connection_verifies_after_normalization (con, | |
3764 | NM_CONNECTION_ERROR, | |
3765 | NM_CONNECTION_ERROR_INVALID_PROPERTY); | |
3766 | nmtst_connection_normalize (con); | |
3767 | g_assert_cmpstr (NULL, ==, nm_setting_ip_config_get_gateway (s_ip4)); | |
3768 | } | |
3769 | ||
3770 | static void | |
3771 | test_connection_normalize_may_fail (void) | |
3772 | { | |
3773 | gs_unref_object NMConnection *con = NULL; | |
3774 | NMSettingIPConfig *s_ip4, *s_ip6; | |
3775 | gs_free_error GError *error = NULL; | |
3776 | ||
3777 | con = nmtst_create_minimal_connection ("test2", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL); | |
3778 | nmtst_assert_connection_verifies_and_normalizable (con); | |
3779 | ||
3780 | s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); | |
3781 | g_object_set (G_OBJECT (s_ip4), | |
3782 | NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, | |
3783 | NM_SETTING_IP_CONFIG_MAY_FAIL, FALSE, | |
3784 | NULL); | |
3785 | ||
3786 | s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new (); | |
3787 | g_object_set (s_ip6, | |
3788 | NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, | |
3789 | NM_SETTING_IP_CONFIG_MAY_FAIL, FALSE, | |
3790 | NULL); | |
3791 | ||
3792 | nm_connection_add_setting (con, (NMSetting *) s_ip4); | |
3793 | nm_connection_add_setting (con, (NMSetting *) s_ip6); | |
3794 | ||
3795 | nmtst_assert_connection_verifies_without_normalization (con); | |
3796 | ||
3797 | /* Now set method=disabled/ignore and check that may-fail becomes TRUE | |
3798 | * after normalization | |
3799 | * */ | |
3800 | g_object_set (s_ip4, | |
3801 | NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, | |
3802 | NULL); | |
3803 | g_object_set (s_ip6, | |
3804 | NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, | |
3805 | NULL); | |
3806 | ||
3807 | nmtst_assert_connection_verifies (con); | |
3808 | nmtst_connection_normalize (con); | |
3809 | g_assert_cmpint (nm_setting_ip_config_get_may_fail (s_ip4), ==, TRUE); | |
3810 | g_assert_cmpint (nm_setting_ip_config_get_may_fail (s_ip6), ==, TRUE); | |
3716 | 3811 | } |
3717 | 3812 | |
3718 | 3813 | static void |
5009 | 5104 | g_test_add_func ("/core/general/test_connection_normalize_slave_type_1", test_connection_normalize_slave_type_1); |
5010 | 5105 | g_test_add_func ("/core/general/test_connection_normalize_slave_type_2", test_connection_normalize_slave_type_2); |
5011 | 5106 | g_test_add_func ("/core/general/test_connection_normalize_infiniband_mtu", test_connection_normalize_infiniband_mtu); |
5107 | g_test_add_func ("/core/general/test_connection_normalize_gateway_never_default", test_connection_normalize_gateway_never_default); | |
5108 | g_test_add_func ("/core/general/test_connection_normalize_may_fail", test_connection_normalize_may_fail); | |
5012 | 5109 | |
5013 | 5110 | g_test_add_func ("/core/general/test_setting_connection_permissions_helpers", test_setting_connection_permissions_helpers); |
5014 | 5111 | g_test_add_func ("/core/general/test_setting_connection_permissions_property", test_setting_connection_permissions_property); |
462 | 462 | NM = @NM@ |
463 | 463 | NMEDIT = @NMEDIT@ |
464 | 464 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
465 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
465 | 466 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
466 | 467 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
467 | 468 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
26 | 26 | #include <string.h> |
27 | 27 | |
28 | 28 | #include "nm-utils.h" |
29 | #include "nm-common-macros.h" | |
29 | 30 | |
30 | 31 | #include "nm-device-ethernet.h" |
31 | 32 | #include "nm-device-wifi.h" |
206 | 207 | priv->client_proxy, |
207 | 208 | property_info); |
208 | 209 | } |
209 | ||
210 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK "org.freedesktop.NetworkManager.enable-disable-network" | |
211 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI "org.freedesktop.NetworkManager.enable-disable-wifi" | |
212 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN "org.freedesktop.NetworkManager.enable-disable-wwan" | |
213 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX "org.freedesktop.NetworkManager.enable-disable-wimax" | |
214 | #define NM_AUTH_PERMISSION_SLEEP_WAKE "org.freedesktop.NetworkManager.sleep-wake" | |
215 | #define NM_AUTH_PERMISSION_NETWORK_CONTROL "org.freedesktop.NetworkManager.network-control" | |
216 | #define NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED "org.freedesktop.NetworkManager.wifi.share.protected" | |
217 | #define NM_AUTH_PERMISSION_WIFI_SHARE_OPEN "org.freedesktop.NetworkManager.wifi.share.open" | |
218 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM "org.freedesktop.NetworkManager.settings.modify.system" | |
219 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN "org.freedesktop.NetworkManager.settings.modify.own" | |
220 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME "org.freedesktop.NetworkManager.settings.modify.hostname" | |
221 | 210 | |
222 | 211 | static NMClientPermission |
223 | 212 | nm_permission_to_client (const char *nm) |
244 | 233 | return NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN; |
245 | 234 | else if (!strcmp (nm, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME)) |
246 | 235 | return NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME; |
236 | else if (!strcmp (nm, NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS)) | |
237 | return NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS; | |
238 | else if (!strcmp (nm, NM_AUTH_PERMISSION_RELOAD)) | |
239 | return NM_CLIENT_PERMISSION_RELOAD; | |
247 | 240 | |
248 | 241 | return NM_CLIENT_PERMISSION_NONE; |
249 | 242 | } |
83 | 83 | * owned by the current user can be modified |
84 | 84 | * @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME: controls whether the |
85 | 85 | * persistent hostname can be changed |
86 | * @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS: modify persistent global | |
87 | * DNS configuration | |
88 | * @NM_CLIENT_PERMISSION_RELOAD: controls access to Reload. | |
89 | * persistent hostname can be changed | |
86 | 90 | * @NM_CLIENT_PERMISSION_LAST: a reserved boundary value |
87 | 91 | * |
88 | 92 | * #NMClientPermission values indicate various permissions that NetworkManager |
101 | 105 | NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM = 9, |
102 | 106 | NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN = 10, |
103 | 107 | NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME = 11, |
104 | ||
105 | NM_CLIENT_PERMISSION_LAST = NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME | |
108 | NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS = 12, | |
109 | NM_CLIENT_PERMISSION_RELOAD = 13, | |
110 | ||
111 | NM_CLIENT_PERMISSION_LAST = 13, | |
106 | 112 | } NMClientPermission; |
107 | 113 | |
108 | 114 | /** |
1768 | 1768 | char *pdown; |
1769 | 1769 | char *vdown; |
1770 | 1770 | GString *str; |
1771 | GParamSpec *name_prop; | |
1771 | 1772 | |
1772 | 1773 | dev_product = nm_device_get_product (device); |
1773 | 1774 | priv->short_product = fixup_desc_string (dev_product); |
1774 | 1775 | |
1775 | 1776 | dev_vendor = nm_device_get_vendor (device); |
1776 | 1777 | priv->short_vendor = fixup_desc_string (dev_vendor); |
1778 | ||
1779 | /* Grab device's preferred name, if any */ | |
1780 | name_prop = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (device)), "name"); | |
1781 | if (name_prop) { | |
1782 | g_object_get (device, "name", &priv->description, NULL); | |
1783 | if (priv->description && priv->description[0]) | |
1784 | return; | |
1785 | g_clear_pointer (&priv->description, g_free); | |
1786 | } | |
1777 | 1787 | |
1778 | 1788 | if (!dev_product || !dev_vendor) { |
1779 | 1789 | priv->description = g_strdup (nm_device_get_iface (device)); |
74 | 74 | { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM", "settings-modify-system" }, |
75 | 75 | { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN", "settings-modify-own" }, |
76 | 76 | { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME", "settings-modify-hostname" }, |
77 | { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS", "settings-modify-global-dns" }, | |
78 | { NM_CLIENT_PERMISSION_RELOAD, "NM_CLIENT_PERMISSION_RELOAD", "reload" }, | |
77 | 79 | { NM_CLIENT_PERMISSION_LAST, "NM_CLIENT_PERMISSION_LAST", "last" }, |
78 | 80 | { 0, NULL, NULL } |
79 | 81 | }; |
546 | 546 | NM = @NM@ |
547 | 547 | NMEDIT = @NMEDIT@ |
548 | 548 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
549 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
549 | 550 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
550 | 551 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
551 | 552 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
454 | 454 | NM = @NM@ |
455 | 455 | NMEDIT = @NMEDIT@ |
456 | 456 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
457 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
457 | 458 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
458 | 459 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
459 | 460 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
89 | 89 | # define NM_AVAILABLE_IN_1_2 |
90 | 90 | #endif |
91 | 91 | |
92 | #if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_4 | |
93 | # define NM_DEPRECATED_IN_1_4 G_DEPRECATED | |
94 | # define NM_DEPRECATED_IN_1_4_FOR(f) G_DEPRECATED_FOR(f) | |
95 | #else | |
96 | # define NM_DEPRECATED_IN_1_4 | |
97 | # define NM_DEPRECATED_IN_1_4_FOR(f) | |
98 | #endif | |
99 | ||
100 | #if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_4 | |
101 | # define NM_AVAILABLE_IN_1_4 G_UNAVAILABLE(1,4) | |
102 | #else | |
103 | # define NM_AVAILABLE_IN_1_4 | |
104 | #endif | |
105 | ||
106 | 92 | #endif /* NM_VERSION_H */ |
580 | 580 | NM = @NM@ |
581 | 581 | NMEDIT = @NMEDIT@ |
582 | 582 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
583 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
583 | 584 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
584 | 585 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
585 | 586 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
313 | 313 | NM = @NM@ |
314 | 314 | NMEDIT = @NMEDIT@ |
315 | 315 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
316 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
316 | 317 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
317 | 318 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
318 | 319 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
1 | 1 | .\" Title: NetworkManager |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: Network management daemons |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NETWORKMANAGER" "8" "" "NetworkManager 1\&.2\&.2" "Network management daemons" | |
9 | .TH "NETWORKMANAGER" "8" "" "NetworkManager 1\&.2\&.4" "Network management daemons" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
273 | 273 | .PP |
274 | 274 | \fISIGHUP\fR |
275 | 275 | .RS 4 |
276 | The signal causes a reload of NetworkManager\*(Aqs configuration\&. Note that not all configuration parameters can be changed at runtime and therefore some changes may be applied only after the next restart of the daemon\&. The signal also forces a rewrite of DNS configuration\&. | |
276 | The signal causes a reload of NetworkManager\*(Aqs configuration\&. Note that not all configuration parameters can be changed at runtime and therefore some changes may be applied only after the next restart of the daemon\&. A SIGHUP also involves further reloading actions, like doing a DNS update and restarting the DNS plugin\&. The latter can be useful for example when using the dnsmasq plugin and changing its configuration in /etc/NetworkManager/dnsmasq\&.d\&. However, it also means this will shortly interrupt name resolution\&. In the future, there may be further actions added\&. A SIGHUP means to update NetworkManager configuration and reload everything that is supported\&. Note that this does not reload connections from disk\&. For that there is a D\-Bus API and nmcli\*(Aqs reload action | |
277 | 277 | .RE |
278 | 278 | .PP |
279 | 279 | \fISIGUSR1\fR |
280 | 280 | .RS 4 |
281 | The signal forces a rewrite of DNS configuration\&. | |
281 | The signal forces a rewrite of DNS configuration\&. Contrary to SIGHUP, this does not restart the DNS plugin and will not interrupt name resolution\&. In the future, further actions may be added\&. A SIGUSR1 means to write out data like resolv\&.conf, or refresh a cache\&. It is a subset of what is done for SIGHUP without reloading configuration from disk\&. | |
282 | 282 | .RE |
283 | 283 | .PP |
284 | 284 | \fISIGUSR2\fR |
285 | 285 | .RS 4 |
286 | The signal has no effect at the moment\&. | |
287 | .RE | |
286 | The signal has no effect at the moment but is reserved for future use\&. | |
287 | .RE | |
288 | .PP | |
289 | An alternative to a signal to reload configuration is the Reload D\-Bus call\&. It allows for more fine\-grained selection of what to reload, it only returns after the reload is complete, and it is guarded by PolicyKit\&. | |
288 | 290 | .SH "DEBUGGING" |
289 | 291 | .PP |
290 | 292 | The following environment variables are supported to help debugging\&. When used in conjunction with the |
1 | 1 | .\" Title: NetworkManager.conf |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: Configuration |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NETWORKMANAGER\&.CON" "5" "" "NetworkManager 1\&.2\&.2" "Configuration" | |
9 | .TH "NETWORKMANAGER\&.CON" "5" "" "NetworkManager 1\&.2\&.4" "Configuration" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
60 | 60 | NetworkManager can overwrite certain user configuration options via D\-Bus or other internal operations\&. In this case it writes those changes to |
61 | 61 | /var/lib/NetworkManager/NetworkManager\-intern\&.conf\&. This file is not intended to be modified by the user, but it is read last and can shadow user configuration from |
62 | 62 | NetworkManager\&.conf\&. |
63 | .PP | |
64 | Certain settings from the configuration can be reloaded at runtime either by sending SIGHUP signal or via D\-Bus\*(Aq Reload call\&. | |
63 | 65 | .SH "FILE FORMAT" |
64 | 66 | .PP |
65 | 67 | The configuration file format is so\-called key file (sort of ini\-style format)\&. It consists of sections (groups) of key\-value pairs\&. Lines beginning with a \*(Aq#\*(Aq and blank lines are considered comments\&. Sections are started by a header line containing the section enclosed in \*(Aq[\*(Aq and \*(Aq]\*(Aq, and ended implicitly by the start of the next section or the end of the file\&. Each key\-value pair must be contained in a section\&. |
210 | 212 | .sp |
211 | 213 | unbound: NetworkManager will talk to unbound and dnssec\-triggerd, providing a "split DNS" configuration with DNSSEC support\&. The /etc/resolv\&.conf will be managed by dnssec\-trigger daemon\&. |
212 | 214 | .sp |
213 | none: NetworkManager will not modify resolv\&.conf\&. | |
215 | none: NetworkManager will not modify resolv\&.conf\&. This implies | |
216 | \fIrc\-manager\fRunmanaged | |
214 | 217 | .RE |
215 | 218 | .PP |
216 | 219 | \fIrc\-manager\fR |
217 | 220 | .RS 4 |
218 | 221 | Set the |
219 | 222 | resolv\&.conf |
220 | management mode\&. The default value depends on how NetworkManager was built\&. Regardless of this setting, NetworkManager will always write resolv\&.conf to its runtime state directory\&. | |
221 | .sp | |
222 | none: NetworkManager will symlink | |
223 | management mode\&. The default value depends on how NetworkManager was built, whereas this version of NetworkManager was build with a default of "symlink"\&. Regardless of this setting, NetworkManager will always write resolv\&.conf to its runtime state directory\&. | |
224 | .sp | |
225 | symlink: NetworkManager will symlink | |
223 | 226 | /etc/resolv\&.conf |
224 | 227 | to its private resolv\&.conf file in the runtime state directory\&. |
225 | 228 | .sp |
226 | 229 | file: NetworkManager will write |
227 | 230 | /etc/resolv\&.conf |
228 | as file\&. | |
231 | as file\&. If it finds a symlink, it will follow the symlink and update the target instead\&. | |
229 | 232 | .sp |
230 | 233 | resolvconf: NetworkManager will run resolvconf to update the DNS configuration\&. |
231 | 234 | .sp |
232 | 235 | netconfig: NetworkManager will run netconfig to update the DNS configuration\&. |
236 | .sp | |
237 | unmanaged: don\*(Aqt touch | |
238 | resolv\&.conf\&. | |
239 | .sp | |
240 | none: deprecated alias for | |
241 | symlink\&. | |
233 | 242 | .RE |
234 | 243 | .PP |
235 | 244 | \fIdebug\fR |
253 | 262 | .PP |
254 | 263 | \fIpath\fR |
255 | 264 | .RS 4 |
256 | The location where keyfiles are read and stored\&. This defaults to "/etc/NetworkManager/conf\&.d"\&. | |
265 | The location where keyfiles are read and stored\&. This defaults to "${prefix}/etc/NetworkManager/conf\&.d"\&. | |
257 | 266 | .RE |
258 | 267 | .PP |
259 | 268 | \fIunmanaged\-devices\fR |
604 | 613 | would have |
605 | 614 | stop\-match |
606 | 615 | set to |
607 | yes, its | |
616 | yes, the device | |
617 | wlan0 | |
618 | would have | |
608 | 619 | ipv6\&.ip6\-privacy |
609 | value would be unspecified\&. | |
620 | property unspecified\&. That is, the search for the property would not continue in the connection sections | |
621 | [connection\-wifi\-other] | |
622 | or | |
623 | [connection]\&. | |
610 | 624 | .RE |
611 | 625 | .SH "CONNECTIVITY SECTION" |
612 | 626 | .PP |
76 | 76 | operations. In this case it writes those changes to <literal>/var/lib/NetworkManager/NetworkManager-intern.conf</literal>. |
77 | 77 | This file is not intended to be modified by the user, but it is read last and can shadow |
78 | 78 | user configuration from <literal>NetworkManager.conf</literal>. |
79 | </para> | |
80 | <para> | |
81 | Certain settings from the configuration can be reloaded at runtime either by sending SIGHUP signal or via | |
82 | D-Bus' Reload call. | |
79 | 83 | </para> |
80 | 84 | |
81 | 85 | </refsect1> |
302 | 306 | configuration with DNSSEC support. The /etc/resolv.conf |
303 | 307 | will be managed by dnssec-trigger daemon.</para> |
304 | 308 | <para><literal>none</literal>: NetworkManager will not |
305 | modify resolv.conf.</para> | |
309 | modify resolv.conf. This implies <varname>rc-manager</varname> | |
310 | <literal>unmanaged</literal></para> | |
306 | 311 | </listitem> |
307 | 312 | </varlistentry> |
308 | 313 | |
310 | 315 | <term><varname>rc-manager</varname></term> |
311 | 316 | <listitem><para>Set the <filename>resolv.conf</filename> |
312 | 317 | management mode. The default value depends on how NetworkManager |
313 | was built. Regardless of this setting, NetworkManager will | |
318 | was built, whereas this version of NetworkManager was build with | |
319 | a default of "<literal>&NM_CONFIG_DEFAULT_DNS_RC_MANAGER;</literal>". | |
320 | Regardless of this setting, NetworkManager will | |
314 | 321 | always write resolv.conf to its runtime state directory.</para> |
315 | <para><literal>none</literal>: NetworkManager will symlink | |
322 | <para><literal>symlink</literal>: NetworkManager will symlink | |
316 | 323 | <filename>/etc/resolv.conf</filename> to its private |
317 | 324 | resolv.conf file in the runtime state directory.</para> |
318 | 325 | <para><literal>file</literal>: NetworkManager will write |
319 | <filename>/etc/resolv.conf</filename> as file.</para> | |
326 | <filename>/etc/resolv.conf</filename> as file. If it finds | |
327 | a symlink, it will follow the symlink and update the target | |
328 | instead.</para> | |
320 | 329 | <para><literal>resolvconf</literal>: NetworkManager will run |
321 | 330 | resolvconf to update the DNS configuration.</para> |
322 | 331 | <para><literal>netconfig</literal>: NetworkManager will run |
323 | 332 | netconfig to update the DNS configuration.</para> |
333 | <para><literal>unmanaged</literal>: don't touch | |
334 | <filename>resolv.conf</filename>.</para> | |
335 | <para><literal>none</literal>: deprecated alias for | |
336 | <literal>symlink</literal>.</para> | |
324 | 337 | </listitem> |
325 | 338 | </varlistentry> |
326 | 339 | |
656 | 669 | considered even if the property in question is not present. In |
657 | 670 | the example above, if <literal>[connection-wifi-wlan0]</literal> would |
658 | 671 | have <literal>stop-match</literal> set to <literal>yes</literal>, |
659 | its <literal>ipv6.ip6-privacy</literal> value would be | |
660 | unspecified. | |
672 | the device <literal>wlan0</literal> would have <literal>ipv6.ip6-privacy</literal> | |
673 | property unspecified. That is, the search for the property would not continue | |
674 | in the connection sections <literal>[connection-wifi-other]</literal> | |
675 | or <literal>[connection]</literal>. | |
661 | 676 | </para></listitem> |
662 | 677 | </varlistentry> |
663 | 678 | </variablelist> |
427 | 427 | The signal causes a reload of NetworkManager's configuration. |
428 | 428 | Note that not all configuration parameters can be changed at |
429 | 429 | runtime and therefore some changes may be applied only after |
430 | the next restart of the daemon. The signal also forces a | |
431 | rewrite of DNS configuration. | |
430 | the next restart of the daemon. | |
431 | A SIGHUP also involves further reloading actions, like doing | |
432 | a DNS update and restarting the DNS plugin. The latter can be | |
433 | useful for example when using the dnsmasq plugin and changing | |
434 | its configuration in /etc/NetworkManager/dnsmasq.d. However, | |
435 | it also means this will shortly interrupt name resolution. | |
436 | In the future, there may be further actions added. | |
437 | A SIGHUP means to update NetworkManager configuration and reload | |
438 | everything that is supported. Note that this does not reload | |
439 | connections from disk. For that there is a D-Bus API and | |
440 | nmcli's reload action | |
432 | 441 | </para></listitem> |
433 | 442 | </varlistentry> |
434 | 443 | <varlistentry> |
435 | 444 | <term><varname>SIGUSR1</varname></term> |
436 | 445 | <listitem><para> |
437 | The signal forces a rewrite of DNS configuration. | |
446 | The signal forces a rewrite of DNS configuration. Contrary to | |
447 | SIGHUP, this does not restart the DNS plugin and will not interrupt | |
448 | name resolution. | |
449 | In the future, further actions may be added. A SIGUSR1 | |
450 | means to write out data like resolv.conf, or refresh a cache. | |
451 | It is a subset of what is done for SIGHUP without reloading | |
452 | configuration from disk. | |
438 | 453 | </para></listitem> |
439 | 454 | </varlistentry> |
440 | 455 | <varlistentry> |
441 | 456 | <term><varname>SIGUSR2</varname></term> |
442 | 457 | <listitem><para> |
443 | The signal has no effect at the moment. | |
458 | The signal has no effect at the moment but is reserved for future | |
459 | use. | |
444 | 460 | </para></listitem> |
445 | 461 | </varlistentry> |
446 | 462 | </variablelist> |
463 | </para> | |
464 | <para> | |
465 | An alternative to a signal to reload configuration is the Reload D-Bus call. | |
466 | It allows for more fine-grained selection of what to reload, it only returns | |
467 | after the reload is complete, and it is guarded by PolicyKit. | |
447 | 468 | </para> |
448 | 469 | </refsect1> |
449 | 470 |
3 | 3 | <!ENTITY NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT "@NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@"> |
4 | 4 | <!ENTITY NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT "@NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@"> |
5 | 5 | <!ENTITY NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT "@NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@"> |
6 | <!ENTITY NM_CONFIG_DEFAULT_DNS_RC_MANAGER "@NM_CONFIG_DEFAULT_DNS_RC_MANAGER@"> |
1 | 1 | .\" Title: nm-online |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: General Commands Manual |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NM\-ONLINE" "1" "" "NetworkManager 1\&.2\&.2" "General Commands Manual" | |
9 | .TH "NM\-ONLINE" "1" "" "NetworkManager 1\&.2\&.4" "General Commands Manual" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
1 | 1 | .\" Title: nm-settings-ifcfg-rh |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: Configuration |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NM\-SETTINGS\-IFCFG\" "5" "" "NetworkManager 1\&.2\&.2" "Configuration" | |
9 | .TH "NM\-SETTINGS\-IFCFG\" "5" "" "NetworkManager 1\&.2\&.4" "Configuration" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
0 | 0 | <?xml version="1.0"?> |
1 | 1 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> |
2 | <refentry id="nm-settings-ifcfg-rh"><refentryinfo><title>nm-settings-ifcfg-rh</title><author>NetworkManager developers</author></refentryinfo><refmeta><refentrytitle>nm-settings-ifcfg-rh</refentrytitle><manvolnum>5</manvolnum><refmiscinfo class="source">NetworkManager</refmiscinfo><refmiscinfo class="manual">Configuration</refmiscinfo><refmiscinfo class="version">1.2.2</refmiscinfo></refmeta><refnamediv><refname>nm-settings-ifcfg-rh</refname><refpurpose>Description of <emphasis>ifcfg-rh</emphasis> settings plugin</refpurpose></refnamediv><refsect1 id="description"><title>Description</title><para> | |
2 | <refentry id="nm-settings-ifcfg-rh"><refentryinfo><title>nm-settings-ifcfg-rh</title><author>NetworkManager developers</author></refentryinfo><refmeta><refentrytitle>nm-settings-ifcfg-rh</refentrytitle><manvolnum>5</manvolnum><refmiscinfo class="source">NetworkManager</refmiscinfo><refmiscinfo class="manual">Configuration</refmiscinfo><refmiscinfo class="version">1.2.4</refmiscinfo></refmeta><refnamediv><refname>nm-settings-ifcfg-rh</refname><refpurpose>Description of <emphasis>ifcfg-rh</emphasis> settings plugin</refpurpose></refnamediv><refsect1 id="description"><title>Description</title><para> | |
3 | 3 | NetworkManager is based on the concept of connection profiles that contain |
4 | 4 | network configuration (see <citerefentry><refentrytitle>nm-settings</refentrytitle><manvolnum>5</manvolnum></citerefentry> for details). The profiles can be |
5 | 5 | stored in various formats. NetworkManager uses plugins for reading and writing |
1 | 1 | .\" Title: nm-settings-keyfile |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: Configuration |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NM\-SETTINGS\-KEYFIL" "5" "" "NetworkManager 1\&.2\&.2" "Configuration" | |
9 | .TH "NM\-SETTINGS\-KEYFIL" "5" "" "NetworkManager 1\&.2\&.4" "Configuration" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
0 | 0 | <?xml version="1.0"?> |
1 | 1 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> |
2 | <refentry id="nm-settings-keyfile"><refentryinfo><title>nm-settings-keyfile</title><author>NetworkManager developers</author></refentryinfo><refmeta><refentrytitle>nm-settings-keyfile</refentrytitle><manvolnum>5</manvolnum><refmiscinfo class="source">NetworkManager</refmiscinfo><refmiscinfo class="manual">Configuration</refmiscinfo><refmiscinfo class="version">1.2.2</refmiscinfo></refmeta><refnamediv><refname>nm-settings-keyfile</refname><refpurpose>Description of <emphasis>keyfile</emphasis> settings plugin</refpurpose></refnamediv><refsect1 id="description"><title>Description</title><para> | |
2 | <refentry id="nm-settings-keyfile"><refentryinfo><title>nm-settings-keyfile</title><author>NetworkManager developers</author></refentryinfo><refmeta><refentrytitle>nm-settings-keyfile</refentrytitle><manvolnum>5</manvolnum><refmiscinfo class="source">NetworkManager</refmiscinfo><refmiscinfo class="manual">Configuration</refmiscinfo><refmiscinfo class="version">1.2.4</refmiscinfo></refmeta><refnamediv><refname>nm-settings-keyfile</refname><refpurpose>Description of <emphasis>keyfile</emphasis> settings plugin</refpurpose></refnamediv><refsect1 id="description"><title>Description</title><para> | |
3 | 3 | NetworkManager is based on the concept of connection profiles that contain |
4 | 4 | network configuration (see <citerefentry><refentrytitle>nm-settings</refentrytitle><manvolnum>5</manvolnum></citerefentry> for details). The profiles can be |
5 | 5 | stored in various formats. NetworkManager uses plugins for reading and writing |
1 | 1 | .\" Title: nm-settings |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: Configuration |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NM\-SETTINGS" "5" "" "NetworkManager 1\&.2\&.2" "Configuration" | |
9 | .TH "NM\-SETTINGS" "5" "" "NetworkManager 1\&.2\&.4" "Configuration" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
1568 | 1568 | l l l l |
1569 | 1569 | l l l l |
1570 | 1570 | l l l l |
1571 | l l l l | |
1571 | 1572 | l l l l. |
1572 | 1573 | T{ |
1573 | 1574 | address\-data |
1658 | 1659 | [] |
1659 | 1660 | T}:T{ |
1660 | 1661 | Array of DNS options\&. NULL means that the options are unset and left at the default\&. In this case NetworkManager will use default options\&. This is distinct from an empty list of properties\&. |
1662 | T} | |
1663 | T{ | |
1664 | dns\-priority | |
1665 | T}:T{ | |
1666 | int32 | |
1667 | T}:T{ | |
1668 | 0 | |
1669 | T}:T{ | |
1670 | DNS priority\&. The relative priority to be used when determining the order of DNS servers in resolv\&.conf\&. A lower value means that servers will be on top of the file\&. Zero selects the default value, which is 50 for VPNs and 100 for other connections\&. When multiple devices have configurations with the same priority, the one with an active default route will be preferred\&. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time\&. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used\&. | |
1661 | 1671 | T} |
1662 | 1672 | T{ |
1663 | 1673 | dns\-search |
1799 | 1809 | l l l l |
1800 | 1810 | l l l l |
1801 | 1811 | l l l l |
1812 | l l l l | |
1802 | 1813 | l l l l. |
1803 | 1814 | T{ |
1804 | 1815 | addr\-gen\-mode |
1880 | 1891 | [] |
1881 | 1892 | T}:T{ |
1882 | 1893 | Array of DNS options\&. NULL means that the options are unset and left at the default\&. In this case NetworkManager will use default options\&. This is distinct from an empty list of properties\&. |
1894 | T} | |
1895 | T{ | |
1896 | dns\-priority | |
1897 | T}:T{ | |
1898 | int32 | |
1899 | T}:T{ | |
1900 | 0 | |
1901 | T}:T{ | |
1902 | DNS priority\&. The relative priority to be used when determining the order of DNS servers in resolv\&.conf\&. A lower value means that servers will be on top of the file\&. Zero selects the default value, which is 50 for VPNs and 100 for other connections\&. When multiple devices have configurations with the same priority, the one with an active default route will be preferred\&. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time\&. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used\&. | |
1883 | 1903 | T} |
1884 | 1904 | T{ |
1885 | 1905 | dns\-search |
0 | 0 | <?xml version="1.0"?> |
1 | 1 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> |
2 | <refentry id="nm-settings"><refentryinfo><title>nm-settings</title><author>NetworkManager developers</author></refentryinfo><refmeta><refentrytitle>nm-settings</refentrytitle><manvolnum>5</manvolnum><refmiscinfo class="source">NetworkManager</refmiscinfo><refmiscinfo class="manual">Configuration</refmiscinfo><refmiscinfo class="version">1.2.2</refmiscinfo></refmeta><refnamediv><refname>nm-settings</refname><refpurpose>Description of settings and properties of NetworkManager connection profiles</refpurpose></refnamediv><refsect1 id="description"><title>Description</title><para> | |
2 | <refentry id="nm-settings"><refentryinfo><title>nm-settings</title><author>NetworkManager developers</author></refentryinfo><refmeta><refentrytitle>nm-settings</refentrytitle><manvolnum>5</manvolnum><refmiscinfo class="source">NetworkManager</refmiscinfo><refmiscinfo class="manual">Configuration</refmiscinfo><refmiscinfo class="version">1.2.4</refmiscinfo></refmeta><refnamediv><refname>nm-settings</refname><refpurpose>Description of settings and properties of NetworkManager connection profiles</refpurpose></refnamediv><refsect1 id="description"><title>Description</title><para> | |
3 | 3 | NetworkManager is based on a concept of connection profiles, sometimes referred to as |
4 | 4 | connections only. These connection profiles contain a network configuration. When |
5 | 5 | NetworkManager activates a connection profile on a network device the configuration will |
189 | 189 | <row><entry align="left">dhcp-timeout</entry><entry align="left">int32</entry><entry align="left">0</entry><entry>A timeout for a DHCP transaction in seconds.</entry></row> |
190 | 190 | <row><entry align="left">dns</entry><entry align="left">array of uint32</entry><entry align="left">[]</entry><entry>Array of IP addresses of DNS servers (as network-byte-order integers)</entry></row> |
191 | 191 | <row><entry align="left">dns-options</entry><entry align="left">array of string</entry><entry align="left">[]</entry><entry>Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.</entry></row> |
192 | <row><entry align="left">dns-priority</entry><entry align="left">int32</entry><entry align="left">0</entry><entry>DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used.</entry></row> | |
192 | 193 | <row><entry align="left">dns-search</entry><entry align="left">array of string</entry><entry align="left">[]</entry><entry>Array of DNS search domains.</entry></row> |
193 | 194 | <row><entry align="left">gateway</entry><entry align="left">string</entry><entry align="left"/><entry>The gateway associated with this configuration. This is only meaningful if "addresses" is also set.</entry></row> |
194 | 195 | <row><entry align="left">ignore-auto-dns</entry><entry align="left">boolean</entry><entry align="left">FALSE</entry><entry>When "method" is set to "auto" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the "dns" and "dns-search" properties, if any, are used.</entry></row> |
211 | 212 | <row><entry align="left">dhcp-timeout</entry><entry align="left">int32</entry><entry align="left">0</entry><entry>A timeout for a DHCP transaction in seconds.</entry></row> |
212 | 213 | <row><entry align="left">dns</entry><entry align="left">array of byte array</entry><entry align="left">[]</entry><entry>Array of IP addresses of DNS servers (in network byte order)</entry></row> |
213 | 214 | <row><entry align="left">dns-options</entry><entry align="left">array of string</entry><entry align="left">[]</entry><entry>Array of DNS options. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.</entry></row> |
215 | <row><entry align="left">dns-priority</entry><entry align="left">int32</entry><entry align="left">0</entry><entry>DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from configurations with the lowest priority value will be used.</entry></row> | |
214 | 216 | <row><entry align="left">dns-search</entry><entry align="left">array of string</entry><entry align="left">[]</entry><entry>Array of DNS search domains.</entry></row> |
215 | 217 | <row><entry align="left">gateway</entry><entry align="left">string</entry><entry align="left"/><entry>The gateway associated with this configuration. This is only meaningful if "addresses" is also set.</entry></row> |
216 | 218 | <row><entry align="left">ignore-auto-dns</entry><entry align="left">boolean</entry><entry align="left">FALSE</entry><entry>When "method" is set to "auto" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the "dns" and "dns-search" properties, if any, are used.</entry></row> |
1 | 1 | .\" Title: nmcli-examples |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: Examples |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NMCLI\-EXAMPLES" "7" "" "NetworkManager 1\&.2\&.2" "Examples" | |
9 | .TH "NMCLI\-EXAMPLES" "7" "" "NetworkManager 1\&.2\&.4" "Examples" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
138 | 138 | org\&.freedesktop\&.NetworkManager\&.settings\&.modify\&.system yes |
139 | 139 | org\&.freedesktop\&.NetworkManager\&.settings\&.modify\&.own yes |
140 | 140 | org\&.freedesktop\&.NetworkManager\&.settings\&.modify\&.hostname auth |
141 | org\&.freedesktop\&.NetworkManager\&.reload no | |
141 | 142 | .fi |
142 | 143 | .if n \{\ |
143 | 144 | .RE |
139 | 139 | org.freedesktop.NetworkManager.wifi.share.open yes |
140 | 140 | org.freedesktop.NetworkManager.settings.modify.system yes |
141 | 141 | org.freedesktop.NetworkManager.settings.modify.own yes |
142 | org.freedesktop.NetworkManager.settings.modify.hostname auth</screen> | |
142 | org.freedesktop.NetworkManager.settings.modify.hostname auth | |
143 | org.freedesktop.NetworkManager.reload no</screen> | |
143 | 144 | <para> |
144 | 145 | This command shows configured polkit permissions for various NetworkManager |
145 | 146 | operations. These permissions or actions (using polkit language) are configured |
1 | 1 | .\" Title: nmcli |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: General Commands Manual |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NMCLI" "1" "" "NetworkManager 1\&.2\&.2" "General Commands Manual" | |
9 | .TH "NMCLI" "1" "" "NetworkManager 1\&.2\&.4" "General Commands Manual" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
1 | 1 | .\" Title: nmtui |
2 | 2 | .\" Author: |
3 | 3 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> |
4 | .\" Date: 05/11/2016 | |
4 | .\" Date: 08/03/2016 | |
5 | 5 | .\" Manual: General Commands Manual |
6 | .\" Source: NetworkManager 1.2.2 | |
6 | .\" Source: NetworkManager 1.2.4 | |
7 | 7 | .\" Language: English |
8 | 8 | .\" |
9 | .TH "NMTUI" "1" "" "NetworkManager 1\&.2\&.2" "General Commands Manual" | |
9 | .TH "NMTUI" "1" "" "NetworkManager 1\&.2\&.4" "General Commands Manual" | |
10 | 10 | .\" ----------------------------------------------------------------- |
11 | 11 | .\" * Define some portability stuff |
12 | 12 | .\" ----------------------------------------------------------------- |
169 | 169 | src/nm-iface-helper.c |
170 | 170 | src/nm-logging.c |
171 | 171 | src/nm-manager.c |
172 | src/nm-sleep-monitor-systemd.c | |
173 | 172 | src/settings/plugins/ibft/plugin.c |
174 | 173 | src/settings/plugins/ifcfg-rh/reader.c |
0 | data/NetworkManager.service.in | |
0 | 1 | examples/python/NetworkManager.py |
1 | 2 | examples/python/systray/eggtrayicon.c |
2 | 3 | policy/org.freedesktop.NetworkManager.policy.in |
294 | 294 | NM = @NM@ |
295 | 295 | NMEDIT = @NMEDIT@ |
296 | 296 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
297 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
297 | 298 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
298 | 299 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
299 | 300 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
14 | 14 | <defaults> |
15 | 15 | <allow_inactive>no</allow_inactive> |
16 | 16 | <allow_active>yes</allow_active> |
17 | </defaults> | |
18 | </action> | |
19 | ||
20 | <action id="org.freedesktop.NetworkManager.reload"> | |
21 | <_description>Reload NetworkManager configuration</_description> | |
22 | <_message>System policy prevents reloading NetworkManager</_message> | |
23 | <defaults> | |
24 | <allow_any>auth_admin_keep</allow_any> | |
25 | <allow_inactive>auth_admin_keep</allow_inactive> | |
26 | <allow_active>auth_admin_keep</allow_active> | |
17 | 27 | </defaults> |
18 | 28 | </action> |
19 | 29 |
0 | 0 | EXTRA_DIST = \ |
1 | 1 | gsystem-local-alloc.h \ |
2 | nm-common-macros.h \ | |
2 | 3 | nm-dbus-compat.h \ |
3 | 4 | nm-default.h \ |
4 | 5 | nm-glib.h \ |
264 | 264 | NM = @NM@ |
265 | 265 | NMEDIT = @NMEDIT@ |
266 | 266 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
267 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
267 | 268 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
268 | 269 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
269 | 270 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
396 | 397 | with_valgrind = @with_valgrind@ |
397 | 398 | EXTRA_DIST = \ |
398 | 399 | gsystem-local-alloc.h \ |
400 | nm-common-macros.h \ | |
399 | 401 | nm-dbus-compat.h \ |
400 | 402 | nm-default.h \ |
401 | 403 | nm-glib.h \ |
0 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | |
1 | /* NetworkManager -- Network link manager | |
2 | * | |
3 | * This library is free software; you can redistribute it and/or | |
4 | * modify it under the terms of the GNU Lesser General Public | |
5 | * License as published by the Free Software Foundation; either | |
6 | * version 2 of the License, or (at your option) any later version. | |
7 | * | |
8 | * This library is distributed in the hope that it will be useful, | |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
11 | * Lesser General Public License for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU Lesser General Public | |
14 | * License along with this library; if not, write to the | |
15 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
16 | * Boston, MA 02110-1301 USA. | |
17 | * | |
18 | * (C) Copyright 2016 Red Hat, Inc. | |
19 | */ | |
20 | ||
21 | #ifndef __NM_COMMON_MACROS_H__ | |
22 | #define __NM_COMMON_MACROS_H__ | |
23 | ||
24 | /******************************************************************************/ | |
25 | ||
26 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK "org.freedesktop.NetworkManager.enable-disable-network" | |
27 | #define NM_AUTH_PERMISSION_SLEEP_WAKE "org.freedesktop.NetworkManager.sleep-wake" | |
28 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI "org.freedesktop.NetworkManager.enable-disable-wifi" | |
29 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN "org.freedesktop.NetworkManager.enable-disable-wwan" | |
30 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX "org.freedesktop.NetworkManager.enable-disable-wimax" | |
31 | #define NM_AUTH_PERMISSION_NETWORK_CONTROL "org.freedesktop.NetworkManager.network-control" | |
32 | #define NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED "org.freedesktop.NetworkManager.wifi.share.protected" | |
33 | #define NM_AUTH_PERMISSION_WIFI_SHARE_OPEN "org.freedesktop.NetworkManager.wifi.share.open" | |
34 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM "org.freedesktop.NetworkManager.settings.modify.system" | |
35 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN "org.freedesktop.NetworkManager.settings.modify.own" | |
36 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME "org.freedesktop.NetworkManager.settings.modify.hostname" | |
37 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS "org.freedesktop.NetworkManager.settings.modify.global-dns" | |
38 | #define NM_AUTH_PERMISSION_RELOAD "org.freedesktop.NetworkManager.reload" | |
39 | ||
40 | /******************************************************************************/ | |
41 | ||
42 | #endif /* __NM_COMMON_MACROS_H__ */ |
373 | 373 | __VA_ARGS__) |
374 | 374 | #endif |
375 | 375 | |
376 | #if !GLIB_CHECK_VERSION(2, 44, 0) | |
377 | static inline gpointer | |
378 | g_steal_pointer (gpointer pp) | |
379 | { | |
380 | gpointer *ptr = (gpointer *) pp; | |
381 | gpointer ref; | |
382 | ||
383 | ref = *ptr; | |
384 | *ptr = NULL; | |
385 | ||
386 | return ref; | |
387 | } | |
388 | ||
389 | /* type safety */ | |
390 | #define g_steal_pointer(pp) \ | |
391 | (0 ? (*(pp)) : (g_steal_pointer) (pp)) | |
392 | #endif | |
393 | ||
376 | 394 | #endif /* __NM_GLIB_H__ */ |
26 | 26 | /********************************************************/ |
27 | 27 | |
28 | 28 | #define _nm_packed __attribute__ ((packed)) |
29 | #define _nm_unused __attribute__ ((unused)) | |
29 | 30 | |
30 | 31 | #define nm_auto(fcn) __attribute__ ((cleanup(fcn))) |
31 | 32 | |
43 | 44 | g_value_unset (v); |
44 | 45 | } |
45 | 46 | #define nm_auto_unset_gvalue nm_auto(_nm_auto_unset_gvalue_impl) |
47 | ||
48 | static inline void | |
49 | _nm_auto_free_gstring_impl (GString **str) | |
50 | { | |
51 | if (*str) | |
52 | g_string_free (*str, TRUE); | |
53 | } | |
54 | #define nm_auto_free_gstring nm_auto(_nm_auto_free_gstring_impl) | |
46 | 55 | |
47 | 56 | /********************************************************/ |
48 | 57 | |
325 | 334 | |
326 | 335 | /*****************************************************************************/ |
327 | 336 | |
328 | #define nm_unauto(pp) \ | |
329 | ({ \ | |
330 | G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ | |
331 | gpointer *_pp = (gpointer *) (pp); \ | |
332 | gpointer _p = *_pp; \ | |
333 | \ | |
334 | *_pp = NULL; \ | |
335 | _p; \ | |
336 | }) | |
337 | ||
338 | /*****************************************************************************/ | |
339 | ||
340 | 337 | static inline gpointer |
341 | 338 | nm_g_object_ref (gpointer obj) |
342 | 339 | { |
44 | 44 | * Evaluates to the micro version number of NetworkManager which this source |
45 | 45 | * compiled against. |
46 | 46 | */ |
47 | #define NM_MICRO_VERSION (2) | |
47 | #define NM_MICRO_VERSION (4) | |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * NM_CHECK_VERSION: |
69 | 69 | #define NM_VERSION_1_2 (NM_ENCODE_VERSION (1, 2, 0)) |
70 | 70 | #define NM_VERSION_1_2_2 (NM_ENCODE_VERSION (1, 2, 2)) |
71 | 71 | #define NM_VERSION_1_2_4 (NM_ENCODE_VERSION (1, 2, 4)) |
72 | #define NM_VERSION_1_2_6 (NM_ENCODE_VERSION (1, 2, 6)) | |
72 | 73 | #define NM_VERSION_1_4 (NM_ENCODE_VERSION (1, 4, 0)) |
73 | 74 | |
74 | #define NM_VERSION_CUR_STABLE NM_VERSION_1_2_2 | |
75 | #define NM_VERSION_NEXT_STABLE NM_VERSION_1_2_4 | |
75 | #define NM_VERSION_CUR_STABLE NM_VERSION_1_2_4 | |
76 | #define NM_VERSION_NEXT_STABLE NM_VERSION_1_2_6 | |
76 | 77 | |
77 | 78 | #endif /* __NM_VERSION_MACROS_H__ */ |
69 | 69 | #define NM_VERSION_1_2 (NM_ENCODE_VERSION (1, 2, 0)) |
70 | 70 | #define NM_VERSION_1_2_2 (NM_ENCODE_VERSION (1, 2, 2)) |
71 | 71 | #define NM_VERSION_1_2_4 (NM_ENCODE_VERSION (1, 2, 4)) |
72 | #define NM_VERSION_1_2_6 (NM_ENCODE_VERSION (1, 2, 6)) | |
72 | 73 | #define NM_VERSION_1_4 (NM_ENCODE_VERSION (1, 4, 0)) |
73 | 74 | |
74 | #define NM_VERSION_CUR_STABLE NM_VERSION_1_2_2 | |
75 | #define NM_VERSION_NEXT_STABLE NM_VERSION_1_2_4 | |
75 | #define NM_VERSION_CUR_STABLE NM_VERSION_1_2_4 | |
76 | #define NM_VERSION_NEXT_STABLE NM_VERSION_1_2_6 | |
76 | 77 | |
77 | 78 | #endif /* __NM_VERSION_MACROS_H__ */ |
304 | 304 | dns-manager/nm-dns-manager.h \ |
305 | 305 | dns-manager/nm-dns-plugin.c \ |
306 | 306 | dns-manager/nm-dns-plugin.h \ |
307 | dns-manager/nm-dns-utils.c \ | |
308 | dns-manager/nm-dns-utils.h \ | |
309 | 307 | \ |
310 | 308 | dnsmasq-manager/nm-dnsmasq-manager.c \ |
311 | 309 | dnsmasq-manager/nm-dnsmasq-manager.h \ |
437 | 435 | nm-rfkill-manager.h \ |
438 | 436 | nm-session-monitor.h \ |
439 | 437 | nm-session-monitor.c \ |
438 | nm-sleep-monitor.c \ | |
440 | 439 | nm-sleep-monitor.h \ |
441 | 440 | nm-types.h \ |
442 | 441 | nm-core-utils.c \ |
444 | 443 | NetworkManagerUtils.c \ |
445 | 444 | NetworkManagerUtils.h |
446 | 445 | |
447 | ||
448 | if SUSPEND_RESUME_UPOWER | |
449 | libNetworkManager_la_SOURCES += nm-sleep-monitor-upower.c | |
450 | else | |
451 | # systemd/consolekit suspend/resume used whenever upower is not enabled | |
452 | libNetworkManager_la_SOURCES += nm-sleep-monitor-systemd.c | |
453 | endif | |
454 | 446 | |
455 | 447 | if WITH_WEXT |
456 | 448 | libNetworkManager_la_SOURCES += \ |
109 | 109 | @ENABLE_TESTS_TRUE@ libNetworkManager-base.la |
110 | 110 | |
111 | 111 | sbin_PROGRAMS = NetworkManager$(EXEEXT) |
112 | @SUSPEND_RESUME_UPOWER_TRUE@am__append_6 = nm-sleep-monitor-upower.c | |
113 | # systemd/consolekit suspend/resume used whenever upower is not enabled | |
114 | @SUSPEND_RESUME_UPOWER_FALSE@am__append_7 = nm-sleep-monitor-systemd.c | |
115 | @WITH_WEXT_TRUE@am__append_8 = \ | |
112 | @WITH_WEXT_TRUE@am__append_6 = \ | |
116 | 113 | @WITH_WEXT_TRUE@ platform/wifi/wifi-utils-wext.c \ |
117 | 114 | @WITH_WEXT_TRUE@ platform/wifi/wifi-utils-wext.h |
118 | 115 | |
119 | @WITH_LIBSOUP_TRUE@am__append_9 = $(LIBSOUP_LIBS) | |
120 | @WITH_WEXT_TRUE@am__append_10 = \ | |
116 | @WITH_LIBSOUP_TRUE@am__append_7 = $(LIBSOUP_LIBS) | |
117 | @WITH_WEXT_TRUE@am__append_8 = \ | |
121 | 118 | @WITH_WEXT_TRUE@ platform/wifi/wifi-utils-wext.c \ |
122 | 119 | @WITH_WEXT_TRUE@ platform/wifi/wifi-utils-wext.h |
123 | 120 | |
196 | 193 | dns-manager/nm-dns-dnsmasq.h dns-manager/nm-dns-unbound.c \ |
197 | 194 | dns-manager/nm-dns-unbound.h dns-manager/nm-dns-manager.c \ |
198 | 195 | dns-manager/nm-dns-manager.h dns-manager/nm-dns-plugin.c \ |
199 | dns-manager/nm-dns-plugin.h dns-manager/nm-dns-utils.c \ | |
200 | dns-manager/nm-dns-utils.h \ | |
196 | dns-manager/nm-dns-plugin.h \ | |
201 | 197 | dnsmasq-manager/nm-dnsmasq-manager.c \ |
202 | 198 | dnsmasq-manager/nm-dnsmasq-manager.h \ |
203 | 199 | dnsmasq-manager/nm-dnsmasq-utils.c \ |
261 | 257 | nm-auth-subject.h nm-auth-utils.c nm-auth-utils.h nm-manager.c \ |
262 | 258 | nm-manager.h nm-multi-index.c nm-multi-index.h nm-policy.c \ |
263 | 259 | nm-policy.h nm-rfkill-manager.c nm-rfkill-manager.h \ |
264 | nm-session-monitor.h nm-session-monitor.c nm-sleep-monitor.h \ | |
265 | nm-types.h nm-core-utils.c nm-core-utils.h \ | |
260 | nm-session-monitor.h nm-session-monitor.c nm-sleep-monitor.c \ | |
261 | nm-sleep-monitor.h nm-types.h nm-core-utils.c nm-core-utils.h \ | |
266 | 262 | NetworkManagerUtils.c NetworkManagerUtils.h \ |
267 | nm-sleep-monitor-upower.c nm-sleep-monitor-systemd.c \ | |
268 | 263 | platform/wifi/wifi-utils-wext.c \ |
269 | 264 | platform/wifi/wifi-utils-wext.h |
270 | 265 | am__objects_1 = |
271 | @SUSPEND_RESUME_UPOWER_TRUE@am__objects_2 = \ | |
272 | @SUSPEND_RESUME_UPOWER_TRUE@ nm-sleep-monitor-upower.lo | |
273 | @SUSPEND_RESUME_UPOWER_FALSE@am__objects_3 = \ | |
274 | @SUSPEND_RESUME_UPOWER_FALSE@ nm-sleep-monitor-systemd.lo | |
275 | @WITH_WEXT_TRUE@am__objects_4 = wifi-utils-wext.lo | |
266 | @WITH_WEXT_TRUE@am__objects_2 = wifi-utils-wext.lo | |
276 | 267 | am_libNetworkManager_la_OBJECTS = $(am__objects_1) $(am__objects_1) \ |
277 | 268 | nm-device.lo nm-lldp-listener.lo nm-arping-manager.lo \ |
278 | 269 | nm-device-ethernet-utils.lo nm-device-factory.lo \ |
279 | 270 | nm-device-generic.lo nm-dhcp-client.lo nm-dhcp-utils.lo \ |
280 | 271 | nm-dhcp-listener.lo nm-dhcp-manager.lo nm-dns-dnsmasq.lo \ |
281 | 272 | nm-dns-unbound.lo nm-dns-manager.lo nm-dns-plugin.lo \ |
282 | nm-dns-utils.lo nm-dnsmasq-manager.lo nm-dnsmasq-utils.lo \ | |
283 | nmp-netns.lo nmp-object.lo nm-platform-utils.lo nm-platform.lo \ | |
273 | nm-dnsmasq-manager.lo nm-dnsmasq-utils.lo nmp-netns.lo \ | |
274 | nmp-object.lo nm-platform-utils.lo nm-platform.lo \ | |
284 | 275 | nm-linux-platform.lo nm-fake-platform.lo wifi-utils-nl80211.lo \ |
285 | 276 | wifi-utils.lo nm-fake-rdisc.lo nm-lndp-rdisc.lo nm-rdisc.lo \ |
286 | 277 | nm-ppp-manager.lo nm-agent-manager.lo nm-inotify-helper.lo \ |
299 | 290 | nm-ip6-config.lo nm-logging.lo nm-auth-manager.lo \ |
300 | 291 | nm-auth-subject.lo nm-auth-utils.lo nm-manager.lo \ |
301 | 292 | nm-multi-index.lo nm-policy.lo nm-rfkill-manager.lo \ |
302 | nm-session-monitor.lo nm-core-utils.lo NetworkManagerUtils.lo \ | |
303 | $(am__objects_2) $(am__objects_3) $(am__objects_4) | |
293 | nm-session-monitor.lo nm-sleep-monitor.lo nm-core-utils.lo \ | |
294 | NetworkManagerUtils.lo $(am__objects_2) | |
304 | 295 | libNetworkManager_la_OBJECTS = $(am_libNetworkManager_la_OBJECTS) |
305 | 296 | libnm_iface_helper_la_DEPENDENCIES = \ |
306 | 297 | $(top_builddir)/libnm-core/libnm-core.la \ |
339 | 330 | nm-lndp-rdisc.lo nm-rdisc.lo nm-route-manager.lo \ |
340 | 331 | nm-exported-object.lo nm-ip4-config.lo nm-ip6-config.lo \ |
341 | 332 | nm-enum-types.lo nm-logging.lo nm-multi-index.lo \ |
342 | nm-core-utils.lo NetworkManagerUtils.lo $(am__objects_4) | |
333 | nm-core-utils.lo NetworkManagerUtils.lo $(am__objects_2) | |
343 | 334 | libnm_iface_helper_la_OBJECTS = $(am_libnm_iface_helper_la_OBJECTS) |
344 | 335 | libsystemd_nm_la_DEPENDENCIES = $(am__DEPENDENCIES_1) |
345 | 336 | am_libsystemd_nm_la_OBJECTS = libsystemd_nm_la-nm-sd.lo \ |
378 | 369 | am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" \ |
379 | 370 | "$(DESTDIR)$(dbusservicedir)" |
380 | 371 | PROGRAMS = $(libexec_PROGRAMS) $(sbin_PROGRAMS) |
381 | am__objects_5 = nm-device-bond.$(OBJEXT) nm-device-bridge.$(OBJEXT) \ | |
372 | am__objects_3 = nm-device-bond.$(OBJEXT) nm-device-bridge.$(OBJEXT) \ | |
382 | 373 | nm-device-ethernet.$(OBJEXT) nm-device-infiniband.$(OBJEXT) \ |
383 | 374 | nm-device-ip-tunnel.$(OBJEXT) nm-device-macvlan.$(OBJEXT) \ |
384 | 375 | nm-device-tun.$(OBJEXT) nm-device-veth.$(OBJEXT) \ |
385 | 376 | nm-device-vlan.$(OBJEXT) nm-device-vxlan.$(OBJEXT) |
386 | am__objects_6 = nm-dhcp-dhclient.$(OBJEXT) \ | |
377 | am__objects_4 = nm-dhcp-dhclient.$(OBJEXT) \ | |
387 | 378 | nm-dhcp-dhclient-utils.$(OBJEXT) nm-dhcp-dhcpcd.$(OBJEXT) \ |
388 | 379 | nm-dhcp-systemd.$(OBJEXT) |
389 | am_NetworkManager_OBJECTS = $(am__objects_5) $(am__objects_1) \ | |
390 | $(am__objects_6) $(am__objects_1) main-utils.$(OBJEXT) \ | |
380 | am_NetworkManager_OBJECTS = $(am__objects_3) $(am__objects_1) \ | |
381 | $(am__objects_4) $(am__objects_1) main-utils.$(OBJEXT) \ | |
391 | 382 | main.$(OBJEXT) |
392 | 383 | NetworkManager_OBJECTS = $(am_NetworkManager_OBJECTS) |
393 | 384 | NetworkManager_DEPENDENCIES = libNetworkManager.la |
684 | 675 | NM = @NM@ |
685 | 676 | NMEDIT = @NMEDIT@ |
686 | 677 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
678 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
687 | 679 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
688 | 680 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
689 | 681 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
1064 | 1056 | dns-manager/nm-dns-dnsmasq.h dns-manager/nm-dns-unbound.c \ |
1065 | 1057 | dns-manager/nm-dns-unbound.h dns-manager/nm-dns-manager.c \ |
1066 | 1058 | dns-manager/nm-dns-manager.h dns-manager/nm-dns-plugin.c \ |
1067 | dns-manager/nm-dns-plugin.h dns-manager/nm-dns-utils.c \ | |
1068 | dns-manager/nm-dns-utils.h \ | |
1059 | dns-manager/nm-dns-plugin.h \ | |
1069 | 1060 | dnsmasq-manager/nm-dnsmasq-manager.c \ |
1070 | 1061 | dnsmasq-manager/nm-dnsmasq-manager.h \ |
1071 | 1062 | dnsmasq-manager/nm-dnsmasq-utils.c \ |
1129 | 1120 | nm-auth-subject.h nm-auth-utils.c nm-auth-utils.h nm-manager.c \ |
1130 | 1121 | nm-manager.h nm-multi-index.c nm-multi-index.h nm-policy.c \ |
1131 | 1122 | nm-policy.h nm-rfkill-manager.c nm-rfkill-manager.h \ |
1132 | nm-session-monitor.h nm-session-monitor.c nm-sleep-monitor.h \ | |
1133 | nm-types.h nm-core-utils.c nm-core-utils.h \ | |
1134 | NetworkManagerUtils.c NetworkManagerUtils.h $(am__append_6) \ | |
1135 | $(am__append_7) $(am__append_8) | |
1123 | nm-session-monitor.h nm-session-monitor.c nm-sleep-monitor.c \ | |
1124 | nm-sleep-monitor.h nm-types.h nm-core-utils.c nm-core-utils.h \ | |
1125 | NetworkManagerUtils.c NetworkManagerUtils.h $(am__append_6) | |
1136 | 1126 | GLIB_GENERATED = nm-enum-types.h nm-enum-types.c |
1137 | 1127 | GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM --fhead '\#include <nm-core-enum-types.h>\n' |
1138 | 1128 | GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM |
1150 | 1140 | $(top_builddir)/introspection/libnmdbus.la libsystemd-nm.la \ |
1151 | 1141 | $(GLIB_LIBS) $(GUDEV_LIBS) $(LIBNL_LIBS) $(SYSTEMD_LOGIN_LIBS) \ |
1152 | 1142 | $(SYSTEMD_JOURNAL_LIBS) $(LIBNDP_LIBS) $(LIBDL) $(LIBM) \ |
1153 | $(SELINUX_LIBS) $(LIBAUDIT_LIBS) $(am__append_9) | |
1143 | $(SELINUX_LIBS) $(LIBAUDIT_LIBS) $(am__append_7) | |
1154 | 1144 | NetworkManager_LDFLAGS = \ |
1155 | 1145 | -rdynamic \ |
1156 | 1146 | -Wl,--version-script="$(srcdir)/NetworkManager.ver" |
1178 | 1168 | nm-ip6-config.c nm-ip6-config.h nm-enum-types.c \ |
1179 | 1169 | nm-enum-types.h nm-logging.c nm-logging.h nm-multi-index.c \ |
1180 | 1170 | nm-multi-index.h nm-core-utils.c nm-core-utils.h \ |
1181 | NetworkManagerUtils.c NetworkManagerUtils.h $(am__append_10) | |
1171 | NetworkManagerUtils.c NetworkManagerUtils.h $(am__append_8) | |
1182 | 1172 | libnm_iface_helper_la_LIBADD = \ |
1183 | 1173 | $(top_builddir)/libnm-core/libnm-core.la \ |
1184 | 1174 | $(top_builddir)/introspection/libnmdbus.la \ |
1490 | 1480 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dns-manager.Plo@am__quote@ |
1491 | 1481 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dns-plugin.Plo@am__quote@ |
1492 | 1482 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dns-unbound.Plo@am__quote@ |
1493 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dns-utils.Plo@am__quote@ | |
1494 | 1483 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dnsmasq-manager.Plo@am__quote@ |
1495 | 1484 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dnsmasq-utils.Plo@am__quote@ |
1496 | 1485 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-enum-types.Plo@am__quote@ |
1521 | 1510 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-settings-connection.Plo@am__quote@ |
1522 | 1511 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-settings-plugin.Plo@am__quote@ |
1523 | 1512 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-settings.Plo@am__quote@ |
1524 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-sleep-monitor-systemd.Plo@am__quote@ | |
1525 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-sleep-monitor-upower.Plo@am__quote@ | |
1513 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-sleep-monitor.Plo@am__quote@ | |
1526 | 1514 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-supplicant-config.Plo@am__quote@ |
1527 | 1515 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-supplicant-interface.Plo@am__quote@ |
1528 | 1516 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-supplicant-manager.Plo@am__quote@ |
1671 | 1659 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dns-manager/nm-dns-plugin.c' object='nm-dns-plugin.lo' libtool=yes @AMDEPBACKSLASH@ |
1672 | 1660 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
1673 | 1661 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm-dns-plugin.lo `test -f 'dns-manager/nm-dns-plugin.c' || echo '$(srcdir)/'`dns-manager/nm-dns-plugin.c |
1674 | ||
1675 | nm-dns-utils.lo: dns-manager/nm-dns-utils.c | |
1676 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm-dns-utils.lo -MD -MP -MF $(DEPDIR)/nm-dns-utils.Tpo -c -o nm-dns-utils.lo `test -f 'dns-manager/nm-dns-utils.c' || echo '$(srcdir)/'`dns-manager/nm-dns-utils.c | |
1677 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nm-dns-utils.Tpo $(DEPDIR)/nm-dns-utils.Plo | |
1678 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dns-manager/nm-dns-utils.c' object='nm-dns-utils.lo' libtool=yes @AMDEPBACKSLASH@ | |
1679 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
1680 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm-dns-utils.lo `test -f 'dns-manager/nm-dns-utils.c' || echo '$(srcdir)/'`dns-manager/nm-dns-utils.c | |
1681 | 1662 | |
1682 | 1663 | nm-dnsmasq-manager.lo: dnsmasq-manager/nm-dnsmasq-manager.c |
1683 | 1664 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm-dnsmasq-manager.lo -MD -MP -MF $(DEPDIR)/nm-dnsmasq-manager.Tpo -c -o nm-dnsmasq-manager.lo `test -f 'dnsmasq-manager/nm-dnsmasq-manager.c' || echo '$(srcdir)/'`dnsmasq-manager/nm-dnsmasq-manager.c |
22 | 22 | |
23 | 23 | #include "NetworkManagerUtils.h" |
24 | 24 | |
25 | #include "nm-common-macros.h" | |
25 | 26 | #include "nm-utils.h" |
26 | 27 | #include "nm-setting-connection.h" |
27 | 28 | #include "nm-setting-ip4-config.h" |
323 | 323 | NM = @NM@ |
324 | 324 | NMEDIT = @NMEDIT@ |
325 | 325 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
326 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
326 | 327 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
327 | 328 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
328 | 329 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
350 | 350 | NM = @NM@ |
351 | 351 | NMEDIT = @NMEDIT@ |
352 | 352 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
353 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
353 | 354 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
354 | 355 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
355 | 356 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
371 | 371 | NM = @NM@ |
372 | 372 | NMEDIT = @NMEDIT@ |
373 | 373 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
374 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
374 | 375 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
375 | 376 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
376 | 377 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
53 | 53 | gboolean usable; |
54 | 54 | NMBluetoothCapabilities connection_bt_type; |
55 | 55 | |
56 | guint check_emit_usable_id; | |
57 | ||
56 | 58 | char *adapter_address; |
57 | 59 | char *address; |
58 | 60 | char *name; |
256 | 258 | g_free (uuid); |
257 | 259 | } |
258 | 260 | |
259 | static void | |
261 | static gboolean | |
260 | 262 | check_emit_usable (NMBluezDevice *self) |
261 | 263 | { |
262 | 264 | NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); |
263 | 265 | gboolean new_usable; |
264 | 266 | |
265 | 267 | /* only expect the supported capabilities set. */ |
266 | g_assert ((priv->capabilities & ~(NM_BT_CAPABILITY_NAP | NM_BT_CAPABILITY_DUN)) == NM_BT_CAPABILITY_NONE ); | |
268 | nm_assert ((priv->capabilities & ~(NM_BT_CAPABILITY_NAP | NM_BT_CAPABILITY_DUN)) == NM_BT_CAPABILITY_NONE ); | |
267 | 269 | |
268 | 270 | new_usable = (priv->initialized && priv->capabilities && priv->name && |
269 | 271 | ((priv->bluez_version == 4) || |
290 | 292 | priv->usable = new_usable; |
291 | 293 | g_object_notify (G_OBJECT (self), NM_BLUEZ_DEVICE_USABLE); |
292 | 294 | } |
295 | ||
296 | return G_SOURCE_REMOVE; | |
297 | } | |
298 | ||
299 | static void | |
300 | check_emit_usable_schedule (NMBluezDevice *self) | |
301 | { | |
302 | NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); | |
303 | ||
304 | if (priv->check_emit_usable_id == 0) | |
305 | priv->check_emit_usable_id = g_idle_add ((GSourceFunc) check_emit_usable, self); | |
293 | 306 | } |
294 | 307 | |
295 | 308 | /********************************************************************/ |
330 | 343 | return TRUE; |
331 | 344 | } |
332 | 345 | |
333 | static void | |
334 | _internal_add_connection (NMBluezDevice *self, NMConnection *connection) | |
335 | { | |
336 | NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); | |
337 | ||
338 | if (!g_slist_find (priv->connections, connection)) { | |
346 | static gboolean | |
347 | _internal_track_connection (NMBluezDevice *self, NMConnection *connection, gboolean tracked) | |
348 | { | |
349 | NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); | |
350 | gboolean was_tracked; | |
351 | ||
352 | was_tracked = !!g_slist_find (priv->connections, connection); | |
353 | if (was_tracked == !!tracked) | |
354 | return FALSE; | |
355 | ||
356 | if (tracked) | |
339 | 357 | priv->connections = g_slist_prepend (priv->connections, g_object_ref (connection)); |
340 | check_emit_usable (self); | |
341 | } | |
342 | } | |
343 | ||
344 | static void | |
345 | cp_connection_added (NMConnectionProvider *provider, | |
346 | NMConnection *connection, | |
347 | NMBluezDevice *self) | |
348 | { | |
349 | if (connection_compatible (self, connection)) | |
350 | _internal_add_connection (self, connection); | |
351 | } | |
352 | ||
353 | static void | |
354 | cp_connection_removed (NMConnectionProvider *provider, | |
355 | NMConnection *connection, | |
356 | NMBluezDevice *self) | |
357 | { | |
358 | NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); | |
359 | ||
360 | if (g_slist_find (priv->connections, connection)) { | |
358 | else { | |
361 | 359 | priv->connections = g_slist_remove (priv->connections, connection); |
362 | 360 | if (priv->pan_connection == connection) |
363 | 361 | priv->pan_connection = NULL; |
364 | 362 | g_object_unref (connection); |
363 | } | |
364 | ||
365 | return TRUE; | |
366 | } | |
367 | ||
368 | static void | |
369 | cp_connection_added (NMConnectionProvider *provider, | |
370 | NMConnection *connection, | |
371 | NMBluezDevice *self) | |
372 | { | |
373 | if (connection_compatible (self, connection)) { | |
374 | if (_internal_track_connection (self, connection, TRUE)) | |
375 | check_emit_usable (self); | |
376 | } | |
377 | } | |
378 | ||
379 | static void | |
380 | cp_connection_removed (NMConnectionProvider *provider, | |
381 | NMConnection *connection, | |
382 | NMBluezDevice *self) | |
383 | { | |
384 | if (_internal_track_connection (self, connection, FALSE)) | |
365 | 385 | check_emit_usable (self); |
366 | } | |
367 | 386 | } |
368 | 387 | |
369 | 388 | static void |
371 | 390 | NMConnection *connection, |
372 | 391 | NMBluezDevice *self) |
373 | 392 | { |
374 | if (connection_compatible (self, connection)) | |
375 | _internal_add_connection (self, connection); | |
376 | else | |
377 | cp_connection_removed (provider, connection, self); | |
393 | if (_internal_track_connection (self, connection, | |
394 | connection_compatible (self, connection))) | |
395 | check_emit_usable_schedule (self); | |
378 | 396 | } |
379 | 397 | |
380 | 398 | static void |
382 | 400 | { |
383 | 401 | NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); |
384 | 402 | const GSList *connections, *iter; |
403 | gboolean changed = FALSE; | |
385 | 404 | |
386 | 405 | connections = nm_connection_provider_get_connections (priv->provider); |
387 | for (iter = connections; iter; iter = g_slist_next (iter)) | |
388 | cp_connection_added (priv->provider, NM_CONNECTION (iter->data), self); | |
406 | for (iter = connections; iter; iter = g_slist_next (iter)) { | |
407 | NMConnection *connection = iter->data; | |
408 | ||
409 | if (connection_compatible (self, connection)) | |
410 | changed |= _internal_track_connection (self, connection, TRUE); | |
411 | } | |
412 | if (changed) | |
413 | check_emit_usable (self); | |
389 | 414 | } |
390 | 415 | |
391 | 416 | /***********************************************************/ |
1030 | 1055 | if (adapter_address) |
1031 | 1056 | set_adapter_address (self, adapter_address); |
1032 | 1057 | |
1033 | g_signal_connect (priv->provider, | |
1034 | NM_CP_SIGNAL_CONNECTION_ADDED, | |
1035 | G_CALLBACK (cp_connection_added), | |
1036 | self); | |
1037 | ||
1038 | g_signal_connect (priv->provider, | |
1039 | NM_CP_SIGNAL_CONNECTION_REMOVED, | |
1040 | G_CALLBACK (cp_connection_removed), | |
1041 | self); | |
1042 | ||
1043 | g_signal_connect (priv->provider, | |
1044 | NM_CP_SIGNAL_CONNECTION_UPDATED, | |
1045 | G_CALLBACK (cp_connection_updated), | |
1046 | self); | |
1058 | g_signal_connect (priv->provider, NM_CP_SIGNAL_CONNECTION_ADDED, G_CALLBACK (cp_connection_added), self); | |
1059 | g_signal_connect (priv->provider, NM_CP_SIGNAL_CONNECTION_REMOVED, G_CALLBACK (cp_connection_removed), self); | |
1060 | g_signal_connect (priv->provider, NM_CP_SIGNAL_CONNECTION_UPDATED, G_CALLBACK (cp_connection_updated), self); | |
1047 | 1061 | |
1048 | 1062 | g_bus_get (G_BUS_TYPE_SYSTEM, |
1049 | 1063 | NULL, |
1082 | 1096 | NMBluezDevice *self = NM_BLUEZ_DEVICE (object); |
1083 | 1097 | NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); |
1084 | 1098 | NMConnection *to_delete = NULL; |
1099 | ||
1100 | nm_clear_g_source (&priv->check_emit_usable_id); | |
1085 | 1101 | |
1086 | 1102 | if (priv->pan_connection) { |
1087 | 1103 | /* Check whether we want to remove the created connection. If so, we take a reference |
315 | 315 | if (NM_IN_STRSET (mode, "active-backup", "balance-alb", "balance-tlb")) { |
316 | 316 | value = nm_setting_bond_get_option_by_name (s_bond, NM_SETTING_BOND_OPTION_PRIMARY); |
317 | 317 | set_bond_attr (device, "primary", value ? value : ""); |
318 | set_simple_option (device, "lp_internal", s_bond, NM_SETTING_BOND_OPTION_LP_INTERVAL); | |
318 | set_simple_option (device, "lp_interval", s_bond, NM_SETTING_BOND_OPTION_LP_INTERVAL); | |
319 | 319 | } |
320 | 320 | |
321 | 321 | /* Clear ARP targets */ |
103 | 103 | g_object_thaw_notify (object); |
104 | 104 | } |
105 | 105 | |
106 | static NMDeviceCapabilities | |
107 | get_generic_capabilities (NMDevice *dev) | |
108 | { | |
109 | return NM_DEVICE_CAP_IS_SOFTWARE; | |
110 | } | |
111 | ||
106 | 112 | static void |
107 | 113 | link_changed (NMDevice *device, NMPlatformLink *info) |
108 | 114 | { |
429 | 435 | device_class->complete_connection = complete_connection; |
430 | 436 | device_class->check_connection_compatible = check_connection_compatible; |
431 | 437 | device_class->create_and_realize = create_and_realize; |
438 | device_class->get_generic_capabilities = get_generic_capabilities; | |
432 | 439 | device_class->realize_start_notify = realize_start_notify; |
433 | 440 | device_class->unrealize_notify = unrealize_notify; |
434 | 441 | device_class->update_connection = update_connection; |
135 | 135 | g_object_thaw_notify (object); |
136 | 136 | } |
137 | 137 | |
138 | static NMDeviceCapabilities | |
139 | get_generic_capabilities (NMDevice *dev) | |
140 | { | |
141 | return NM_DEVICE_CAP_IS_SOFTWARE; | |
142 | } | |
143 | ||
138 | 144 | static void |
139 | 145 | link_changed (NMDevice *device, NMPlatformLink *info) |
140 | 146 | { |
646 | 652 | device_class->create_and_realize = create_and_realize; |
647 | 653 | device_class->check_connection_compatible = check_connection_compatible; |
648 | 654 | device_class->complete_connection = complete_connection; |
655 | device_class->get_generic_capabilities = get_generic_capabilities; | |
649 | 656 | device_class->update_connection = update_connection; |
650 | 657 | device_class->act_stage1_prepare = act_stage1_prepare; |
651 | 658 | device_class->ip4_config_pre_commit = ip4_config_pre_commit; |
33 | 33 | #include <netlink/route/addr.h> |
34 | 34 | #include <linux/if_addr.h> |
35 | 35 | |
36 | #include "nm-device.h" | |
36 | #include "nm-common-macros.h" | |
37 | 37 | #include "nm-device-private.h" |
38 | 38 | #include "NetworkManagerUtils.h" |
39 | 39 | #include "nm-manager.h" |
386 | 386 | gboolean commit, |
387 | 387 | gboolean routes_full_sync, |
388 | 388 | NMDeviceStateReason *reason); |
389 | static gboolean ip6_config_merge_and_apply (NMDevice *self, | |
390 | gboolean commit, | |
391 | NMDeviceStateReason *out_reason); | |
389 | 392 | |
390 | 393 | static void nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure); |
391 | 394 | static void nm_device_slave_notify_enslave (NMDevice *self, gboolean success); |
412 | 415 | static gboolean dhcp6_start (NMDevice *self, gboolean wait_for_ll, NMDeviceStateReason *reason); |
413 | 416 | static void nm_device_start_ip_check (NMDevice *self); |
414 | 417 | static void realize_start_setup (NMDevice *self, const NMPlatformLink *plink); |
418 | static void nm_device_set_mtu (NMDevice *self, guint32 mtu); | |
415 | 419 | |
416 | 420 | /***********************************************************/ |
417 | 421 | |
519 | 523 | |
520 | 524 | /***********************************************************/ |
521 | 525 | |
526 | static void | |
527 | init_ip4_config_dns_priority (NMDevice *self, NMIP4Config *config) | |
528 | { | |
529 | gs_free char *value = NULL; | |
530 | gint priority; | |
531 | ||
532 | value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA, | |
533 | "ipv4.dns-priority", | |
534 | self); | |
535 | priority = _nm_utils_ascii_str_to_int64 (value, 10, G_MININT, G_MAXINT, 0); | |
536 | nm_ip4_config_set_dns_priority (config, priority ?: NM_DNS_PRIORITY_DEFAULT_NORMAL); | |
537 | } | |
538 | ||
539 | static void | |
540 | init_ip6_config_dns_priority (NMDevice *self, NMIP6Config *config) | |
541 | { | |
542 | gs_free char *value = NULL; | |
543 | gint priority; | |
544 | ||
545 | value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA, | |
546 | "ipv6.dns-priority", | |
547 | self); | |
548 | priority = _nm_utils_ascii_str_to_int64 (value, 10, G_MININT, G_MAXINT, 0); | |
549 | nm_ip6_config_set_dns_priority (config, priority ?: NM_DNS_PRIORITY_DEFAULT_NORMAL); | |
550 | } | |
551 | ||
552 | /***********************************************************/ | |
553 | ||
522 | 554 | gboolean |
523 | 555 | nm_device_ipv6_sysctl_set (NMDevice *self, const char *property, const char *value) |
524 | 556 | { |
1090 | 1122 | return NULL; |
1091 | 1123 | } |
1092 | 1124 | |
1125 | static void | |
1126 | apply_mtu_from_config (NMDevice *self) | |
1127 | { | |
1128 | const char *method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED; | |
1129 | NMSettingIPConfig *s_ip4; | |
1130 | NMSettingWired *s_wired; | |
1131 | guint32 mtu; | |
1132 | ||
1133 | /* Devices having an IPv4 configuration will set MTU during the commit | |
1134 | * stage, so it is an error to call this function if the IPv4 method is not | |
1135 | * 'disabled'. | |
1136 | */ | |
1137 | s_ip4 = (NMSettingIPConfig *) | |
1138 | nm_device_get_applied_setting (self, NM_TYPE_SETTING_IP4_CONFIG); | |
1139 | if (s_ip4) | |
1140 | method = nm_setting_ip_config_get_method (s_ip4); | |
1141 | g_return_if_fail (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED)); | |
1142 | ||
1143 | s_wired = (NMSettingWired *) | |
1144 | nm_device_get_applied_setting (self, NM_TYPE_SETTING_WIRED); | |
1145 | ||
1146 | if (s_wired) { | |
1147 | mtu = nm_setting_wired_get_mtu (s_wired); | |
1148 | if (mtu) { | |
1149 | _LOGD (LOGD_DEVICE | LOGD_IP, | |
1150 | "setting MTU of device without IP4 config to %u", | |
1151 | mtu); | |
1152 | nm_device_set_mtu (self, mtu); | |
1153 | } | |
1154 | } | |
1155 | } | |
1156 | ||
1093 | 1157 | /** |
1094 | 1158 | * nm_device_master_enslave_slave: |
1095 | 1159 | * @self: the master device |
1146 | 1210 | if (NM_DEVICE_GET_PRIVATE (self)->ip6_state == IP_WAIT) |
1147 | 1211 | nm_device_activate_stage3_ip6_start (self); |
1148 | 1212 | } |
1213 | ||
1214 | /* Since slave devices don't have their own IP configuration, | |
1215 | * set the MTU here. | |
1216 | */ | |
1217 | apply_mtu_from_config (slave); | |
1149 | 1218 | |
1150 | 1219 | return success; |
1151 | 1220 | } |
1499 | 1568 | NMPlatformLink info; |
1500 | 1569 | const NMPlatformLink *pllink; |
1501 | 1570 | int ifindex; |
1571 | gboolean was_up; | |
1502 | 1572 | |
1503 | 1573 | priv->device_link_changed_id = 0; |
1504 | 1574 | |
1571 | 1641 | if (ip_ifname_changed) |
1572 | 1642 | nm_device_update_dynamic_ip_setup (self); |
1573 | 1643 | |
1644 | was_up = priv->up; | |
1574 | 1645 | priv->up = NM_FLAGS_HAS (info.n_ifi_flags, IFF_UP); |
1575 | 1646 | |
1576 | 1647 | if ( info.initialized |
1598 | 1669 | set_unmanaged_external_down (self, FALSE); |
1599 | 1670 | |
1600 | 1671 | device_recheck_slave_status (self, &info); |
1672 | ||
1673 | if (priv->up && !was_up) { | |
1674 | /* the link was down and just came up. That happens for example, while changing MTU. | |
1675 | * We must restore IP configuration. */ | |
1676 | if (priv->ip4_state == IP_DONE) { | |
1677 | if (!ip4_config_merge_and_apply (self, NULL, TRUE, NULL)) | |
1678 | _LOGW (LOGD_IP4, "failed applying IP4 config after link comes up again"); | |
1679 | } | |
1680 | if (priv->ip6_state == IP_DONE) { | |
1681 | if (!ip6_config_merge_and_apply (self, TRUE, NULL)) | |
1682 | _LOGW (LOGD_IP6, "failed applying IP6 config after link comes up again"); | |
1683 | } | |
1684 | } | |
1685 | ||
1601 | 1686 | return G_SOURCE_REMOVE; |
1602 | 1687 | } |
1603 | 1688 | |
4286 | 4371 | gboolean routes_full_sync; |
4287 | 4372 | gboolean ignore_auto_routes = FALSE; |
4288 | 4373 | gboolean ignore_auto_dns = FALSE; |
4374 | gboolean auto_method = FALSE; | |
4289 | 4375 | |
4290 | 4376 | /* Merge all the configs into the composite config */ |
4291 | 4377 | if (config) { |
4301 | 4387 | if (s_ip4) { |
4302 | 4388 | ignore_auto_routes = nm_setting_ip_config_get_ignore_auto_routes (s_ip4); |
4303 | 4389 | ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns (s_ip4); |
4390 | ||
4391 | if (nm_streq0 (nm_setting_ip_config_get_method (s_ip4), | |
4392 | NM_SETTING_IP4_CONFIG_METHOD_AUTO)) | |
4393 | auto_method = TRUE; | |
4304 | 4394 | } |
4305 | 4395 | } |
4306 | 4396 | |
4307 | 4397 | composite = nm_ip4_config_new (nm_device_get_ip_ifindex (self)); |
4398 | init_ip4_config_dns_priority (self, composite); | |
4308 | 4399 | |
4309 | 4400 | if (commit) |
4310 | 4401 | ensure_con_ip4_config (self); |
4356 | 4447 | goto END_ADD_DEFAULT_ROUTE; |
4357 | 4448 | } |
4358 | 4449 | |
4359 | if (nm_device_uses_generated_assumed_connection (self)) { | |
4360 | /* a generate-assumed-connection always detects the default route from platform */ | |
4450 | /* a generated-assumed connection detects the default route from the platform, | |
4451 | * but if the IP method is automatic we need to update the default route to | |
4452 | * maintain connectivity. | |
4453 | */ | |
4454 | if (nm_device_uses_generated_assumed_connection (self) && !auto_method) | |
4361 | 4455 | goto END_ADD_DEFAULT_ROUTE; |
4362 | } | |
4363 | 4456 | |
4364 | 4457 | /* At this point, we treat assumed and non-assumed connections alike. |
4365 | 4458 | * For assumed connections we do that because we still manage RA and DHCP |
4945 | 5038 | } else |
4946 | 5039 | ret = NM_ACT_STAGE_RETURN_FAILURE; |
4947 | 5040 | } else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) { |
4948 | /* Nothing to do... */ | |
5041 | apply_mtu_from_config (self); | |
5042 | /* Nothing else to do... */ | |
4949 | 5043 | ret = NM_ACT_STAGE_RETURN_STOP; |
4950 | 5044 | } else |
4951 | 5045 | _LOGW (LOGD_IP4, "unhandled IPv4 config method '%s'; will fail", method); |
5008 | 5102 | gboolean routes_full_sync; |
5009 | 5103 | gboolean ignore_auto_routes = FALSE; |
5010 | 5104 | gboolean ignore_auto_dns = FALSE; |
5105 | gboolean auto_method = FALSE; | |
5011 | 5106 | |
5012 | 5107 | /* Apply ignore-auto-routes and ignore-auto-dns settings */ |
5013 | 5108 | connection = nm_device_get_applied_connection (self); |
5017 | 5112 | if (s_ip6) { |
5018 | 5113 | ignore_auto_routes = nm_setting_ip_config_get_ignore_auto_routes (s_ip6); |
5019 | 5114 | ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns (s_ip6); |
5115 | ||
5116 | if (NM_IN_STRSET (nm_setting_ip_config_get_method (s_ip6), | |
5117 | NM_SETTING_IP6_CONFIG_METHOD_AUTO, | |
5118 | NM_SETTING_IP6_CONFIG_METHOD_DHCP)) | |
5119 | auto_method = TRUE; | |
5020 | 5120 | } |
5021 | 5121 | } |
5022 | 5122 | |
5023 | 5123 | /* If no config was passed in, create a new one */ |
5024 | 5124 | composite = nm_ip6_config_new (nm_device_get_ip_ifindex (self)); |
5125 | init_ip6_config_dns_priority (self, composite); | |
5025 | 5126 | |
5026 | 5127 | if (commit) |
5027 | 5128 | ensure_con_ip6_config (self); |
5129 | ||
5028 | 5130 | g_assert (composite); |
5029 | 5131 | |
5030 | 5132 | /* Merge all the IP configs into the composite config */ |
5080 | 5182 | goto END_ADD_DEFAULT_ROUTE; |
5081 | 5183 | } |
5082 | 5184 | |
5083 | if (nm_device_uses_generated_assumed_connection (self)) { | |
5084 | /* a generate-assumed-connection always detects the default route from platform */ | |
5185 | /* a generated-assumed connection detects the default route from the platform, | |
5186 | * but if the IP method is automatic we need to update the default route to | |
5187 | * maintain connectivity. | |
5188 | */ | |
5189 | if (nm_device_uses_generated_assumed_connection (self) && !auto_method) | |
5085 | 5190 | goto END_ADD_DEFAULT_ROUTE; |
5086 | } | |
5087 | 5191 | |
5088 | 5192 | /* At this point, we treat assumed and non-assumed connections alike. |
5089 | 5193 | * For assumed connections we do that because we still manage RA and DHCP |
7894 | 7998 | |
7895 | 7999 | g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); |
7896 | 8000 | |
8001 | _LOGD (LOGD_IP4, "ip4-config: update (commit=%d, routes-full-sync=%d, new-config=%p)", | |
8002 | commit, routes_full_sync, new_config); | |
8003 | ||
7897 | 8004 | priv = NM_DEVICE_GET_PRIVATE (self); |
7898 | 8005 | ip_ifindex = nm_device_get_ip_ifindex (self); |
7899 | 8006 | |
7927 | 8034 | * this causes a re-read and reset. This should only happen for relevant changes */ |
7928 | 8035 | nm_ip4_config_replace (old_config, new_config, &has_changes); |
7929 | 8036 | if (has_changes) { |
7930 | _LOGD (LOGD_IP4, "update IP4Config instance (%s)", | |
8037 | _LOGD (LOGD_IP4, "ip4-config: update IP4Config instance (%s)", | |
7931 | 8038 | nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config))); |
7932 | 8039 | } |
7933 | 8040 | } else { |
7937 | 8044 | if (success && !nm_exported_object_is_exported (NM_EXPORTED_OBJECT (new_config))) |
7938 | 8045 | nm_exported_object_export (NM_EXPORTED_OBJECT (new_config)); |
7939 | 8046 | |
7940 | _LOGD (LOGD_IP4, "set IP4Config instance (%s)", | |
8047 | _LOGD (LOGD_IP4, "ip4-config: set IP4Config instance (%s)", | |
7941 | 8048 | nm_exported_object_get_path (NM_EXPORTED_OBJECT (new_config))); |
7942 | 8049 | } |
7943 | 8050 | } else if (old_config) { |
7944 | 8051 | has_changes = TRUE; |
7945 | 8052 | priv->ip4_config = NULL; |
7946 | _LOGD (LOGD_IP4, "clear IP4Config instance (%s)", | |
8053 | _LOGD (LOGD_IP4, "ip4-config: clear IP4Config instance (%s)", | |
7947 | 8054 | nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config))); |
7948 | 8055 | /* Device config is invalid if combined config is invalid */ |
7949 | 8056 | g_clear_object (&priv->dev_ip4_config); |
7962 | 8069 | nm_exported_object_clear_and_unexport (&old_config); |
7963 | 8070 | |
7964 | 8071 | if (nm_device_uses_generated_assumed_connection (self)) { |
7965 | NMConnection *connection = nm_device_get_applied_connection (self); | |
7966 | 8072 | NMConnection *settings_connection = NM_CONNECTION (nm_device_get_settings_connection (self)); |
7967 | 8073 | NMSetting *s_ip4; |
7968 | 8074 | |
7969 | g_object_freeze_notify (G_OBJECT (connection)); | |
7970 | 8075 | g_object_freeze_notify (G_OBJECT (settings_connection)); |
7971 | 8076 | |
7972 | 8077 | nm_connection_remove_setting (settings_connection, NM_TYPE_SETTING_IP4_CONFIG); |
7973 | 8078 | s_ip4 = nm_ip4_config_create_setting (priv->ip4_config); |
7974 | 8079 | nm_connection_add_setting (settings_connection, s_ip4); |
7975 | 8080 | |
7976 | nm_connection_remove_setting (connection, NM_TYPE_SETTING_IP4_CONFIG); | |
7977 | s_ip4 = nm_ip4_config_create_setting (priv->ip4_config); | |
7978 | nm_connection_add_setting (connection, s_ip4); | |
7979 | ||
7980 | 8081 | g_object_thaw_notify (G_OBJECT (settings_connection)); |
7981 | g_object_thaw_notify (G_OBJECT (connection)); | |
7982 | 8082 | } |
7983 | 8083 | |
7984 | 8084 | nm_device_queue_recheck_assume (self); |
8069 | 8169 | |
8070 | 8170 | g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); |
8071 | 8171 | |
8172 | _LOGD (LOGD_IP6, "ip6-config: update (commit=%d, routes-full-sync=%d, new-config=%p)", | |
8173 | commit, routes_full_sync, new_config); | |
8174 | ||
8072 | 8175 | priv = NM_DEVICE_GET_PRIVATE (self); |
8073 | 8176 | ip_ifindex = nm_device_get_ip_ifindex (self); |
8074 | 8177 | |
8096 | 8199 | * this causes a re-read and reset. This should only happen for relevant changes */ |
8097 | 8200 | nm_ip6_config_replace (old_config, new_config, &has_changes); |
8098 | 8201 | if (has_changes) { |
8099 | _LOGD (LOGD_IP6, "update IP6Config instance (%s)", | |
8202 | _LOGD (LOGD_IP6, "ip6-config: update IP6Config instance (%s)", | |
8100 | 8203 | nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config))); |
8101 | 8204 | } |
8102 | 8205 | } else { |
8106 | 8209 | if (success && !nm_exported_object_is_exported (NM_EXPORTED_OBJECT (new_config))) |
8107 | 8210 | nm_exported_object_export (NM_EXPORTED_OBJECT (new_config)); |
8108 | 8211 | |
8109 | _LOGD (LOGD_IP6, "set IP6Config instance (%s)", | |
8212 | _LOGD (LOGD_IP6, "ip6-config: set IP6Config instance (%s)", | |
8110 | 8213 | nm_exported_object_get_path (NM_EXPORTED_OBJECT (new_config))); |
8111 | 8214 | } |
8112 | 8215 | } else if (old_config) { |
8113 | 8216 | has_changes = TRUE; |
8114 | 8217 | priv->ip6_config = NULL; |
8115 | _LOGD (LOGD_IP6, "clear IP6Config instance (%s)", | |
8218 | _LOGD (LOGD_IP6, "ip6-config: clear IP6Config instance (%s)", | |
8116 | 8219 | nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config))); |
8117 | 8220 | } |
8118 | 8221 | |
8127 | 8230 | nm_exported_object_clear_and_unexport (&old_config); |
8128 | 8231 | |
8129 | 8232 | if (nm_device_uses_generated_assumed_connection (self)) { |
8130 | NMConnection *connection = nm_device_get_applied_connection (self); | |
8131 | 8233 | NMConnection *settings_connection = NM_CONNECTION (nm_device_get_settings_connection (self)); |
8132 | 8234 | NMSetting *s_ip6; |
8133 | 8235 | |
8134 | g_object_freeze_notify (G_OBJECT (connection)); | |
8135 | 8236 | g_object_freeze_notify (G_OBJECT (settings_connection)); |
8136 | 8237 | |
8137 | 8238 | nm_connection_remove_setting (settings_connection, NM_TYPE_SETTING_IP6_CONFIG); |
8138 | 8239 | s_ip6 = nm_ip6_config_create_setting (priv->ip6_config); |
8139 | 8240 | nm_connection_add_setting (settings_connection, s_ip6); |
8140 | 8241 | |
8141 | nm_connection_remove_setting (connection, NM_TYPE_SETTING_IP6_CONFIG); | |
8142 | s_ip6 = nm_ip6_config_create_setting (priv->ip6_config); | |
8143 | nm_connection_add_setting (connection, s_ip6); | |
8144 | ||
8145 | 8242 | g_object_thaw_notify (G_OBJECT (settings_connection)); |
8146 | g_object_thaw_notify (G_OBJECT (connection)); | |
8147 | 8243 | } |
8148 | 8244 | |
8149 | 8245 | nm_device_queue_recheck_assume (self); |
8544 | 8640 | nm_device_update_hw_address (self); |
8545 | 8641 | |
8546 | 8642 | _update_ip4_address (self); |
8643 | ||
8644 | /* when the link comes up, we must restore IP configuration if necessary. */ | |
8645 | if (priv->ip4_state == IP_DONE) { | |
8646 | if (!ip4_config_merge_and_apply (self, NULL, TRUE, NULL)) | |
8647 | _LOGW (LOGD_IP4, "failed applying IP4 config after bringing link up"); | |
8648 | } | |
8649 | if (priv->ip6_state == IP_DONE) { | |
8650 | if (!ip6_config_merge_and_apply (self, TRUE, NULL)) | |
8651 | _LOGW (LOGD_IP6, "failed applying IP6 config after bringing link up"); | |
8652 | } | |
8653 | ||
8547 | 8654 | return TRUE; |
8548 | 8655 | } |
8549 | 8656 | |
8781 | 8888 | NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); |
8782 | 8889 | int ifindex; |
8783 | 8890 | gboolean capture_resolv_conf; |
8784 | NMDnsManagerResolvConfMode resolv_conf_mode; | |
8785 | 8891 | |
8786 | 8892 | /* If a commit is scheduled, this function would potentially interfere with |
8787 | 8893 | * it changing IP configurations before they are applied. Postpone the |
8800 | 8906 | if (!ifindex) |
8801 | 8907 | return; |
8802 | 8908 | |
8803 | resolv_conf_mode = nm_dns_manager_get_resolv_conf_mode (nm_dns_manager_get ()); | |
8804 | capture_resolv_conf = initial && (resolv_conf_mode == NM_DNS_MANAGER_RESOLV_CONF_EXPLICIT); | |
8909 | capture_resolv_conf = initial | |
8910 | && nm_dns_manager_get_resolv_conf_explicit (nm_dns_manager_get ()); | |
8805 | 8911 | |
8806 | 8912 | /* IPv4 */ |
8807 | 8913 | g_clear_object (&priv->ext_ip4_config); |
8872 | 8978 | NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); |
8873 | 8979 | int ifindex; |
8874 | 8980 | gboolean capture_resolv_conf; |
8875 | NMDnsManagerResolvConfMode resolv_conf_mode; | |
8876 | 8981 | |
8877 | 8982 | /* If a commit is scheduled, this function would potentially interfere with |
8878 | 8983 | * it changing IP configurations before they are applied. Postpone the |
8891 | 8996 | if (!ifindex) |
8892 | 8997 | return; |
8893 | 8998 | |
8894 | resolv_conf_mode = nm_dns_manager_get_resolv_conf_mode (nm_dns_manager_get ()); | |
8895 | capture_resolv_conf = initial && (resolv_conf_mode == NM_DNS_MANAGER_RESOLV_CONF_EXPLICIT); | |
8999 | capture_resolv_conf = initial | |
9000 | && nm_dns_manager_get_resolv_conf_explicit (nm_dns_manager_get ()); | |
8896 | 9001 | |
8897 | 9002 | /* IPv6 */ |
8898 | 9003 | g_clear_object (&priv->ext_ip6_config); |
8993 | 9098 | g_object_ref (self); |
8994 | 9099 | update_ip6_config (self, FALSE); |
8995 | 9100 | |
8996 | if ( nm_platform_link_get (NM_PLATFORM_GET, priv->ifindex) | |
8997 | && priv->state < NM_DEVICE_STATE_DEACTIVATING) { | |
8998 | /* Handle DAD falures */ | |
9101 | if ( priv->state < NM_DEVICE_STATE_DEACTIVATING | |
9102 | && nm_platform_link_get (NM_PLATFORM_GET, priv->ifindex)) { | |
9103 | /* Handle DAD failures */ | |
8999 | 9104 | for (iter = priv->dad6_failed_addrs; iter; iter = g_slist_next (iter)) { |
9000 | 9105 | NMPlatformIP6Address *addr = iter->data; |
9001 | 9106 | |
9276 | 9381 | * @allow_state_transition: if %FALSE, setting flags never triggers a device |
9277 | 9382 | * state change. If %TRUE, the device can change state, if it is real and |
9278 | 9383 | * switches from managed to unmanaged (or vice versa). |
9384 | * @now: whether the state change should be immediate or delayed | |
9279 | 9385 | * @reason: the device state reason passed to nm_device_state_changed() if |
9280 | 9386 | * the device becomes managed/unmanaged. This is only relevant if the |
9281 | 9387 | * device switches state and if @allow_state_transition is %TRUE. |
9287 | 9393 | NMUnmanagedFlags flags, |
9288 | 9394 | NMUnmanFlagOp set_op, |
9289 | 9395 | gboolean allow_state_transition, |
9396 | gboolean now, | |
9290 | 9397 | NMDeviceStateReason reason) |
9291 | 9398 | { |
9292 | 9399 | NMDevicePrivate *priv; |
9293 | 9400 | gboolean was_managed, transition_state; |
9294 | 9401 | NMUnmanagedFlags old_flags, old_mask; |
9402 | NMDeviceState new_state; | |
9295 | 9403 | const char *operation = NULL; |
9296 | 9404 | char str1[512]; |
9297 | 9405 | char str2[512]; |
9363 | 9471 | #undef _FMT |
9364 | 9472 | |
9365 | 9473 | if (transition_state) { |
9366 | if (was_managed) | |
9367 | nm_device_state_changed (self, NM_DEVICE_STATE_UNMANAGED, reason); | |
9474 | new_state = was_managed ? NM_DEVICE_STATE_UNMANAGED : NM_DEVICE_STATE_UNAVAILABLE; | |
9475 | if (now) | |
9476 | nm_device_state_changed (self, new_state, reason); | |
9368 | 9477 | else |
9369 | nm_device_state_changed (self, NM_DEVICE_STATE_UNAVAILABLE, reason); | |
9478 | nm_device_queue_state (self, new_state, reason); | |
9370 | 9479 | } |
9371 | 9480 | } |
9372 | 9481 | |
9384 | 9493 | NMUnmanagedFlags flags, |
9385 | 9494 | NMUnmanFlagOp set_op) |
9386 | 9495 | { |
9387 | _set_unmanaged_flags (self, flags, set_op, FALSE, NM_DEVICE_STATE_REASON_NONE); | |
9496 | _set_unmanaged_flags (self, flags, set_op, FALSE, FALSE, NM_DEVICE_STATE_REASON_NONE); | |
9388 | 9497 | } |
9389 | 9498 | |
9390 | 9499 | /** |
9405 | 9514 | NMUnmanFlagOp set_op, |
9406 | 9515 | NMDeviceStateReason reason) |
9407 | 9516 | { |
9408 | _set_unmanaged_flags (self, flags, set_op, TRUE, reason); | |
9517 | _set_unmanaged_flags (self, flags, set_op, TRUE, TRUE, reason); | |
9518 | } | |
9519 | ||
9520 | void | |
9521 | nm_device_set_unmanaged_by_flags_queue (NMDevice *self, | |
9522 | NMUnmanagedFlags flags, | |
9523 | NMUnmanFlagOp set_op, | |
9524 | NMDeviceStateReason reason) | |
9525 | { | |
9526 | _set_unmanaged_flags (self, flags, set_op, TRUE, FALSE, reason); | |
9409 | 9527 | } |
9410 | 9528 | |
9411 | 9529 | void |
9709 | 9827 | return available; |
9710 | 9828 | } |
9711 | 9829 | |
9712 | static void | |
9713 | available_connections_notify (NMDevice *self) | |
9714 | { | |
9715 | _notify (self, PROP_AVAILABLE_CONNECTIONS); | |
9716 | } | |
9717 | ||
9718 | 9830 | static gboolean |
9719 | 9831 | available_connections_del_all (NMDevice *self) |
9720 | 9832 | { |
9814 | 9926 | } |
9815 | 9927 | |
9816 | 9928 | if (changed) |
9817 | available_connections_notify (self); | |
9929 | _notify (self, PROP_AVAILABLE_CONNECTIONS); | |
9818 | 9930 | available_connections_check_delete_unrealized (self); |
9819 | 9931 | } |
9820 | 9932 | |
9888 | 10000 | changed = available_connections_del (self, connection); |
9889 | 10001 | |
9890 | 10002 | if (changed) { |
9891 | available_connections_notify (self); | |
10003 | _notify (self, PROP_AVAILABLE_CONNECTIONS); | |
9892 | 10004 | available_connections_check_delete_unrealized (self); |
9893 | 10005 | } |
9894 | 10006 | } |
9901 | 10013 | g_return_if_fail (NM_IS_DEVICE (self)); |
9902 | 10014 | |
9903 | 10015 | if (available_connections_del (self, connection)) { |
9904 | available_connections_notify (self); | |
10016 | _notify (self, PROP_AVAILABLE_CONNECTIONS); | |
9905 | 10017 | available_connections_check_delete_unrealized (self); |
9906 | 10018 | } |
9907 | 10019 | } |
10523 | 10635 | |
10524 | 10636 | if (state <= NM_DEVICE_STATE_UNAVAILABLE) { |
10525 | 10637 | if (available_connections_del_all (self)) |
10526 | available_connections_notify (self); | |
10638 | _notify (self, PROP_AVAILABLE_CONNECTIONS); | |
10527 | 10639 | if (old_state > NM_DEVICE_STATE_UNAVAILABLE) |
10528 | 10640 | _clear_queued_act_request (priv); |
10529 | 10641 | } |
488 | 488 | NMUnmanagedFlags flags, |
489 | 489 | NMUnmanFlagOp set_op, |
490 | 490 | NMDeviceStateReason reason); |
491 | void nm_device_set_unmanaged_by_flags_queue (NMDevice *self, | |
492 | NMUnmanagedFlags flags, | |
493 | NMUnmanFlagOp set_op, | |
494 | NMDeviceStateReason reason); | |
491 | 495 | void nm_device_set_unmanaged_by_user_config (NMDevice *self, const GSList *unmanaged_specs); |
492 | 496 | void nm_device_set_unmanaged_by_user_udev (NMDevice *self); |
493 | 497 | void nm_device_set_unmanaged_by_quitting (NMDevice *device); |
530 | 530 | neigh->valid = TRUE; |
531 | 531 | |
532 | 532 | out: |
533 | return nm_unauto (&neigh); | |
533 | return g_steal_pointer (&neigh); | |
534 | 534 | } |
535 | 535 | |
536 | 536 | static GVariant * |
693 | 693 | LOG_NEIGH_ARG (neigh)); |
694 | 694 | |
695 | 695 | changed = TRUE; |
696 | g_hash_table_add (priv->lldp_neighbors, nm_unauto (&neigh)); | |
696 | g_hash_table_add (priv->lldp_neighbors, g_steal_pointer (&neigh)); | |
697 | 697 | |
698 | 698 | done: |
699 | 699 | if (changed) |
354 | 354 | NM = @NM@ |
355 | 355 | NMEDIT = @NMEDIT@ |
356 | 356 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
357 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
357 | 358 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
358 | 359 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
359 | 360 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
317 | 317 | 2000, |
318 | 318 | NULL, |
319 | 319 | NULL); |
320 | g_variant_get (ret, "(u)", &pid); | |
321 | ||
322 | if (pid != priv->teamd_pid) | |
323 | teamd_cleanup (device, FALSE); | |
320 | ||
321 | if (ret) { | |
322 | g_variant_get (ret, "(u)", &pid); | |
323 | if (pid != priv->teamd_pid) | |
324 | teamd_cleanup (device, FALSE); | |
325 | } else { | |
326 | _LOGW (LOGD_TEAM, "failed to determine D-Bus name owner"); | |
327 | /* If we can't determine the bus name owner, don't kill our | |
328 | * teamd instance. Hopefully another existing teamd just died and | |
329 | * our instance will be able to grab the bus name. | |
330 | */ | |
331 | } | |
324 | 332 | } |
325 | 333 | |
326 | 334 | /* Grab a teamd control handle even if we aren't going to use it |
526 | 526 | NM = @NM@ |
527 | 527 | NMEDIT = @NMEDIT@ |
528 | 528 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
529 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
529 | 530 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
530 | 531 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
531 | 532 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
393 | 393 | NM = @NM@ |
394 | 394 | NMEDIT = @NMEDIT@ |
395 | 395 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
396 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
396 | 397 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
397 | 398 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
398 | 399 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
25 | 25 | #include <unistd.h> |
26 | 26 | #include <errno.h> |
27 | 27 | |
28 | #include "nm-common-macros.h" | |
28 | 29 | #include "nm-device.h" |
29 | 30 | #include "nm-device-wifi.h" |
30 | 31 | #include "nm-device-private.h" |
695 | 696 | "WLAN", |
696 | 697 | "ALICE-WLAN", |
697 | 698 | "Speedport W 501V", |
699 | "TURBONETT", | |
698 | 700 | }; |
699 | 701 | |
700 | 702 | #define ARRAY_SIZE(a) (sizeof (a) / sizeof (a[0])) |
521 | 521 | NM = @NM@ |
522 | 522 | NMEDIT = @NMEDIT@ |
523 | 523 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
524 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
524 | 525 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
525 | 526 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
526 | 527 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
362 | 362 | NM = @NM@ |
363 | 363 | NMEDIT = @NMEDIT@ |
364 | 364 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
365 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
365 | 366 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
366 | 367 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
367 | 368 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
316 | 316 | NM = @NM@ |
317 | 317 | NMEDIT = @NMEDIT@ |
318 | 318 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
319 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
319 | 320 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
320 | 321 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
321 | 322 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
883 | 883 | |
884 | 884 | g_clear_pointer (&priv->iface, g_free); |
885 | 885 | g_clear_pointer (&priv->hostname, g_free); |
886 | g_clear_pointer (&priv->fqdn, g_free); | |
886 | 887 | g_clear_pointer (&priv->uuid, g_free); |
888 | g_clear_pointer (&priv->client_id, g_bytes_unref); | |
887 | 889 | |
888 | 890 | if (priv->hwaddr) { |
889 | 891 | g_byte_array_free (priv->hwaddr, TRUE); |
35 | 35 | #define HOSTNAME4_TAG "send host-name" |
36 | 36 | #define HOSTNAME4_FORMAT HOSTNAME4_TAG " \"%s\"; # added by NetworkManager" |
37 | 37 | |
38 | #define FQDN_TAG "send fqdn.fqdn" | |
39 | #define FQDN_FORMAT FQDN_TAG " \"%s\"; # added by NetworkManager" | |
38 | #define FQDN_TAG_PREFIX "send fqdn." | |
39 | #define FQDN_TAG FQDN_TAG_PREFIX "fqdn" | |
40 | #define FQDN_FORMAT FQDN_TAG " \"%s\"; # added by NetworkManager" | |
40 | 41 | |
41 | 42 | #define ALSOREQ_TAG "also request " |
42 | 43 | |
204 | 205 | GBytes **out_new_client_id) |
205 | 206 | { |
206 | 207 | GString *new_contents; |
207 | GPtrArray *alsoreq; | |
208 | GPtrArray *alsoreq, *fqdn_opts; | |
208 | 209 | int i; |
209 | 210 | |
210 | 211 | g_return_val_if_fail (!anycast_addr || nm_utils_hwaddr_valid (anycast_addr, ETH_ALEN), NULL); |
211 | 212 | |
212 | 213 | new_contents = g_string_new (_("# Created by NetworkManager\n")); |
213 | 214 | alsoreq = g_ptr_array_sized_new (5); |
215 | fqdn_opts = g_ptr_array_sized_new (5); | |
214 | 216 | |
215 | 217 | if (orig_contents) { |
216 | 218 | char **lines, **line; |
241 | 243 | continue; |
242 | 244 | if (strncmp (p, FQDN_TAG, strlen (FQDN_TAG)) == 0) |
243 | 245 | continue; |
246 | } | |
247 | ||
248 | /* To let user's FQDN options (except "fqdn.fqdn") override the | |
249 | * default ones set by NM, add them later | |
250 | */ | |
251 | if (!strncmp (p, FQDN_TAG_PREFIX, NM_STRLEN (FQDN_TAG_PREFIX))) { | |
252 | g_ptr_array_add (fqdn_opts, g_strdup (p + NM_STRLEN (FQDN_TAG_PREFIX))); | |
253 | continue; | |
244 | 254 | } |
245 | 255 | |
246 | 256 | /* Ignore 'script' since we pass our own */ |
318 | 328 | g_free (t); |
319 | 329 | } |
320 | 330 | g_ptr_array_free (alsoreq, TRUE); |
331 | ||
332 | for (i = 0; i < fqdn_opts->len; i++) { | |
333 | char *t = g_ptr_array_index (fqdn_opts, i); | |
334 | ||
335 | if (i == 0) | |
336 | g_string_append_printf (new_contents, "\n# FQDN options from %s\n", orig_path); | |
337 | g_string_append_printf (new_contents, FQDN_TAG_PREFIX "%s\n", t); | |
338 | g_free (t); | |
339 | } | |
340 | g_ptr_array_free (fqdn_opts, TRUE); | |
321 | 341 | |
322 | 342 | g_string_append_c (new_contents, '\n'); |
323 | 343 |
51 | 51 | const char *def_leasefile; |
52 | 52 | char *lease_file; |
53 | 53 | char *pid_file; |
54 | NMDhcpListener *dhcp_listener; | |
54 | 55 | } NMDhcpDhclientPrivate; |
55 | 56 | |
56 | 57 | static const char * |
621 | 622 | if (!priv->def_leasefile) |
622 | 623 | priv->def_leasefile = SYSCONFDIR "/dhclient6.leases"; |
623 | 624 | |
624 | g_signal_connect (nm_dhcp_listener_get (), | |
625 | priv->dhcp_listener = g_object_ref (nm_dhcp_listener_get ()); | |
626 | g_signal_connect (priv->dhcp_listener, | |
625 | 627 | NM_DHCP_LISTENER_EVENT, |
626 | 628 | G_CALLBACK (nm_dhcp_client_handle_event), |
627 | 629 | self); |
632 | 634 | { |
633 | 635 | NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (object); |
634 | 636 | |
635 | g_signal_handlers_disconnect_by_func (nm_dhcp_listener_get (), | |
636 | G_CALLBACK (nm_dhcp_client_handle_event), | |
637 | NM_DHCP_DHCLIENT (object)); | |
637 | if (priv->dhcp_listener) { | |
638 | g_signal_handlers_disconnect_by_func (priv->dhcp_listener, | |
639 | G_CALLBACK (nm_dhcp_client_handle_event), | |
640 | NM_DHCP_DHCLIENT (object)); | |
641 | g_clear_object (&priv->dhcp_listener); | |
642 | } | |
638 | 643 | |
639 | 644 | g_free (priv->pid_file); |
640 | 645 | g_free (priv->conf_file); |
43 | 43 | |
44 | 44 | typedef struct { |
45 | 45 | char *pid_file; |
46 | NMDhcpListener *dhcp_listener; | |
46 | 47 | } NMDhcpDhcpcdPrivate; |
47 | 48 | |
48 | 49 | static const char * |
190 | 191 | static void |
191 | 192 | nm_dhcp_dhcpcd_init (NMDhcpDhcpcd *self) |
192 | 193 | { |
193 | g_signal_connect (nm_dhcp_listener_get (), | |
194 | NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (self); | |
195 | ||
196 | priv->dhcp_listener = g_object_ref (nm_dhcp_listener_get ()); | |
197 | g_signal_connect (priv->dhcp_listener, | |
194 | 198 | NM_DHCP_LISTENER_EVENT, |
195 | 199 | G_CALLBACK (nm_dhcp_client_handle_event), |
196 | 200 | self); |
201 | 205 | { |
202 | 206 | NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (object); |
203 | 207 | |
204 | g_signal_handlers_disconnect_by_func (nm_dhcp_listener_get (), | |
205 | G_CALLBACK (nm_dhcp_client_handle_event), | |
206 | NM_DHCP_DHCPCD (object)); | |
208 | if (priv->dhcp_listener) { | |
209 | g_signal_handlers_disconnect_by_func (priv->dhcp_listener, | |
210 | G_CALLBACK (nm_dhcp_client_handle_event), | |
211 | NM_DHCP_DHCPCD (object)); | |
212 | g_clear_object (&priv->dhcp_listener); | |
213 | } | |
207 | 214 | |
208 | 215 | g_free (priv->pid_file); |
209 | 216 |
526 | 526 | NM = @NM@ |
527 | 527 | NMEDIT = @NMEDIT@ |
528 | 528 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
529 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
529 | 530 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
530 | 531 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
531 | 532 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
333 | 333 | NULL); |
334 | 334 | } |
335 | 335 | |
336 | static const char *fqdn_options_override_orig = \ | |
337 | "\n" | |
338 | "send fqdn.fqdn \"foobar.com\"\n" /* NM must ignore this ... */ | |
339 | "send fqdn.encoded off;\n" /* ... and honor these */ | |
340 | "send fqdn.server-update off;\n"; | |
341 | ||
342 | static const char *fqdn_options_override_expected = \ | |
343 | "# Created by NetworkManager\n" | |
344 | "# Merged from /path/to/dhclient.conf\n" | |
345 | "\n" | |
346 | "send fqdn.fqdn \"example2.com\"; # added by NetworkManager\n" | |
347 | "send fqdn.encoded on;\n" | |
348 | "send fqdn.server-update on;\n" | |
349 | "\n" | |
350 | "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n" | |
351 | "option ms-classless-static-routes code 249 = array of unsigned integer 8;\n" | |
352 | "option wpad code 252 = string;\n" | |
353 | "\n" | |
354 | "also request rfc3442-classless-static-routes;\n" | |
355 | "also request ms-classless-static-routes;\n" | |
356 | "also request static-routes;\n" | |
357 | "also request wpad;\n" | |
358 | "also request ntp-servers;\n" | |
359 | "\n" | |
360 | "# FQDN options from /path/to/dhclient.conf\n" | |
361 | "send fqdn.encoded off;\n" | |
362 | "send fqdn.server-update off;\n\n"; | |
363 | ||
364 | static void | |
365 | test_fqdn_options_override (void) | |
366 | { | |
367 | test_config (fqdn_options_override_orig, | |
368 | fqdn_options_override_expected, | |
369 | FALSE, NULL, | |
370 | "example2.com", NULL, | |
371 | NULL, | |
372 | "eth0", | |
373 | NULL); | |
374 | } | |
375 | ||
336 | 376 | /*******************************************/ |
337 | 377 | |
338 | 378 | static const char *override_hostname_orig = \ |
803 | 843 | g_test_add_func ("/dhcp/dhclient/existing-hex-client-id", test_existing_hex_client_id); |
804 | 844 | g_test_add_func ("/dhcp/dhclient/existing-ascii-client-id", test_existing_ascii_client_id); |
805 | 845 | g_test_add_func ("/dhcp/dhclient/fqdn", test_fqdn); |
846 | g_test_add_func ("/dhcp/dhclient/fqdn_options_override", test_fqdn_options_override); | |
806 | 847 | g_test_add_func ("/dhcp/dhclient/override_hostname", test_override_hostname); |
807 | 848 | g_test_add_func ("/dhcp/dhclient/override_hostname6", test_override_hostname6); |
808 | 849 | g_test_add_func ("/dhcp/dhclient/nonfqdn_hostname6", test_nonfqdn_hostname6); |
25 | 25 | #include <sys/wait.h> |
26 | 26 | #include <arpa/inet.h> |
27 | 27 | #include <sys/stat.h> |
28 | #include <linux/if.h> | |
28 | 29 | |
29 | 30 | #include "nm-dns-dnsmasq.h" |
31 | #include "nm-core-internal.h" | |
32 | #include "nm-platform.h" | |
30 | 33 | #include "nm-utils.h" |
31 | 34 | #include "nm-ip4-config.h" |
32 | 35 | #include "nm-ip6-config.h" |
33 | #include "nm-dns-utils.h" | |
34 | 36 | #include "nm-bus-manager.h" |
35 | 37 | #include "NetworkManagerUtils.h" |
36 | 38 | |
47 | 49 | typedef struct { |
48 | 50 | GDBusProxy *dnsmasq; |
49 | 51 | GCancellable *dnsmasq_cancellable; |
52 | GCancellable *update_cancellable; | |
50 | 53 | gboolean running; |
51 | 54 | |
52 | 55 | GVariant *set_server_ex_args; |
67 | 70 | |
68 | 71 | /*****************************************************************************/ |
69 | 72 | |
73 | static char ** | |
74 | get_ip4_rdns_domains (NMIP4Config *ip4) | |
75 | { | |
76 | char **strv; | |
77 | GPtrArray *domains = NULL; | |
78 | int i; | |
79 | ||
80 | g_return_val_if_fail (ip4 != NULL, NULL); | |
81 | ||
82 | domains = g_ptr_array_sized_new (5); | |
83 | ||
84 | for (i = 0; i < nm_ip4_config_get_num_addresses (ip4); i++) { | |
85 | const NMPlatformIP4Address *address = nm_ip4_config_get_address (ip4, i); | |
86 | ||
87 | nm_utils_get_reverse_dns_domains_ip4 (address->address, address->plen, domains); | |
88 | } | |
89 | ||
90 | for (i = 0; i < nm_ip4_config_get_num_routes (ip4); i++) { | |
91 | const NMPlatformIP4Route *route = nm_ip4_config_get_route (ip4, i); | |
92 | ||
93 | nm_utils_get_reverse_dns_domains_ip4 (route->network, route->plen, domains); | |
94 | } | |
95 | ||
96 | /* Terminating NULL so we can use g_strfreev() to free it */ | |
97 | g_ptr_array_add (domains, NULL); | |
98 | ||
99 | /* Free the array and return NULL if the only element was the ending NULL */ | |
100 | strv = (char **) g_ptr_array_free (domains, (domains->len == 1)); | |
101 | ||
102 | return _nm_utils_strv_cleanup (strv, FALSE, FALSE, TRUE); | |
103 | } | |
104 | ||
105 | static char ** | |
106 | get_ip6_rdns_domains (NMIP6Config *ip6) | |
107 | { | |
108 | char **strv; | |
109 | GPtrArray *domains = NULL; | |
110 | int i; | |
111 | ||
112 | g_return_val_if_fail (ip6 != NULL, NULL); | |
113 | ||
114 | domains = g_ptr_array_sized_new (5); | |
115 | ||
116 | for (i = 0; i < nm_ip6_config_get_num_addresses (ip6); i++) { | |
117 | const NMPlatformIP6Address *address = nm_ip6_config_get_address (ip6, i); | |
118 | ||
119 | nm_utils_get_reverse_dns_domains_ip6 (&address->address, address->plen, domains); | |
120 | } | |
121 | ||
122 | for (i = 0; i < nm_ip6_config_get_num_routes (ip6); i++) { | |
123 | const NMPlatformIP6Route *route = nm_ip6_config_get_route (ip6, i); | |
124 | ||
125 | nm_utils_get_reverse_dns_domains_ip6 (&route->network, route->plen, domains); | |
126 | } | |
127 | ||
128 | /* Terminating NULL so we can use g_strfreev() to free it */ | |
129 | g_ptr_array_add (domains, NULL); | |
130 | ||
131 | /* Free the array and return NULL if the only element was the ending NULL */ | |
132 | strv = (char **) g_ptr_array_free (domains, (domains->len == 1)); | |
133 | ||
134 | return _nm_utils_strv_cleanup (strv, FALSE, FALSE, TRUE); | |
135 | } | |
136 | ||
70 | 137 | static void |
71 | 138 | add_dnsmasq_nameserver (NMDnsDnsmasq *self, |
72 | 139 | GVariantBuilder *servers, |
88 | 155 | } |
89 | 156 | |
90 | 157 | static gboolean |
91 | add_ip4_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP4Config *ip4, gboolean split) | |
92 | { | |
93 | char buf[INET_ADDRSTRLEN]; | |
158 | add_ip4_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP4Config *ip4, | |
159 | const char *iface, gboolean split) | |
160 | { | |
161 | char buf[INET_ADDRSTRLEN + 1 + IFNAMSIZ]; | |
162 | char buf2[INET_ADDRSTRLEN]; | |
94 | 163 | in_addr_t addr; |
95 | 164 | int nnameservers, i_nameserver, n, i; |
96 | 165 | gboolean added = FALSE; |
97 | 166 | |
167 | g_return_val_if_fail (iface, FALSE); | |
98 | 168 | nnameservers = nm_ip4_config_get_num_nameservers (ip4); |
99 | 169 | |
100 | 170 | if (split) { |
105 | 175 | |
106 | 176 | for (i_nameserver = 0; i_nameserver < nnameservers; i_nameserver++) { |
107 | 177 | addr = nm_ip4_config_get_nameserver (ip4, i_nameserver); |
108 | nm_utils_inet4_ntop (addr, buf); | |
178 | g_snprintf (buf, sizeof (buf), "%s@%s", | |
179 | nm_utils_inet4_ntop (addr, buf2), iface); | |
109 | 180 | |
110 | 181 | /* searches are preferred over domains */ |
111 | 182 | n = nm_ip4_config_get_num_searches (ip4); |
132 | 203 | /* Ensure reverse-DNS works by directing queries for in-addr.arpa |
133 | 204 | * domains to the split domain's nameserver. |
134 | 205 | */ |
135 | domains = nm_dns_utils_get_ip4_rdns_domains (ip4); | |
206 | domains = get_ip4_rdns_domains (ip4); | |
136 | 207 | if (domains) { |
137 | 208 | for (iter = domains; iter && *iter; iter++) |
138 | 209 | add_dnsmasq_nameserver (self, servers, buf, *iter); |
139 | 210 | g_strfreev (domains); |
140 | added = TRUE; | |
141 | 211 | } |
142 | 212 | } |
143 | 213 | } |
144 | 214 | |
145 | /* If no searches or domains, just add the namservers */ | |
215 | /* If no searches or domains, just add the nameservers */ | |
146 | 216 | if (!added) { |
147 | 217 | for (i = 0; i < nnameservers; i++) { |
148 | 218 | addr = nm_ip4_config_get_nameserver (ip4, i); |
149 | add_dnsmasq_nameserver (self, servers, | |
150 | nm_utils_inet4_ntop (addr, NULL), NULL); | |
219 | g_snprintf (buf, sizeof (buf), "%s@%s", | |
220 | nm_utils_inet4_ntop (addr, buf2), iface); | |
221 | add_dnsmasq_nameserver (self, servers, buf, NULL); | |
151 | 222 | } |
152 | 223 | } |
153 | 224 | |
157 | 228 | static char * |
158 | 229 | ip6_addr_to_string (const struct in6_addr *addr, const char *iface) |
159 | 230 | { |
160 | char *buf; | |
161 | ||
162 | if (IN6_IS_ADDR_V4MAPPED (addr)) { | |
163 | buf = g_malloc (INET_ADDRSTRLEN); | |
231 | char buf[NM_UTILS_INET_ADDRSTRLEN]; | |
232 | ||
233 | if (IN6_IS_ADDR_V4MAPPED (addr)) | |
164 | 234 | nm_utils_inet4_ntop (addr->s6_addr32[3], buf); |
165 | } else if (!iface || !iface[0] || !IN6_IS_ADDR_LINKLOCAL (addr)) { | |
166 | buf = g_malloc (INET6_ADDRSTRLEN); | |
235 | else | |
167 | 236 | nm_utils_inet6_ntop (addr, buf); |
168 | } else { | |
169 | /* Need to scope the address with %<zone-id>. Before dnsmasq 2.58, | |
170 | * only '@' was supported as delimiter. Since 2.58, '@' and '%' | |
171 | * are supported. Due to a bug, since 2.73 only '%' works properly | |
172 | * as "server" address. | |
173 | */ | |
174 | buf = g_strconcat (nm_utils_inet6_ntop (addr, NULL), "%", iface, NULL); | |
175 | } | |
176 | return buf; | |
237 | ||
238 | /* Need to scope link-local addresses with %<zone-id>. Before dnsmasq 2.58, | |
239 | * only '@' was supported as delimiter. Since 2.58, '@' and '%' are | |
240 | * supported. Due to a bug, since 2.73 only '%' works properly as "server" | |
241 | * address. | |
242 | */ | |
243 | return g_strdup_printf ("%s%c%s", | |
244 | buf, | |
245 | IN6_IS_ADDR_LINKLOCAL (addr) ? '%' : '@', | |
246 | iface); | |
177 | 247 | } |
178 | 248 | |
179 | 249 | static void |
201 | 271 | } |
202 | 272 | |
203 | 273 | static gboolean |
204 | add_ip6_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP6Config *ip6, gboolean split) | |
274 | add_ip6_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP6Config *ip6, | |
275 | const char *iface, gboolean split) | |
205 | 276 | { |
206 | 277 | const struct in6_addr *addr; |
207 | 278 | char *buf = NULL; |
208 | 279 | int nnameservers, i_nameserver, n, i; |
209 | 280 | gboolean added = FALSE; |
210 | const char *iface; | |
211 | ||
281 | ||
282 | g_return_val_if_fail (iface, FALSE); | |
212 | 283 | nnameservers = nm_ip6_config_get_num_nameservers (ip6); |
213 | 284 | |
214 | iface = g_object_get_data (G_OBJECT (ip6), IP_CONFIG_IFACE_TAG); | |
215 | g_assert (iface); | |
216 | ||
217 | 285 | if (split) { |
286 | char **domains, **iter; | |
287 | ||
218 | 288 | if (nnameservers == 0) |
219 | 289 | return FALSE; |
220 | 290 | |
244 | 314 | } |
245 | 315 | } |
246 | 316 | |
317 | /* Ensure reverse-DNS works by directing queries for ip6.arpa | |
318 | * domains to the split domain's nameserver. | |
319 | */ | |
320 | domains = get_ip6_rdns_domains (ip6); | |
321 | if (domains) { | |
322 | for (iter = domains; iter && *iter; iter++) | |
323 | add_dnsmasq_nameserver (self, servers, buf, *iter); | |
324 | g_strfreev (domains); | |
325 | } | |
326 | ||
247 | 327 | g_free (buf); |
248 | 328 | } |
249 | 329 | } |
250 | 330 | |
251 | /* If no searches or domains, just add the namservers */ | |
331 | /* If no searches or domains, just add the nameservers */ | |
252 | 332 | if (!added) { |
253 | 333 | for (i = 0; i < nnameservers; i++) { |
254 | 334 | addr = nm_ip6_config_get_nameserver (ip6, i); |
263 | 343 | return TRUE; |
264 | 344 | } |
265 | 345 | |
266 | static void | |
267 | dnsmasq_update_done (GObject *source, GAsyncResult *res, gpointer user_data) | |
268 | { | |
269 | NMDnsDnsmasq *self = NM_DNS_DNSMASQ (user_data); | |
270 | NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (self); | |
346 | static gboolean | |
347 | add_ip_config_data (NMDnsDnsmasq *self, GVariantBuilder *servers, const NMDnsIPConfigData *data) | |
348 | { | |
349 | if (NM_IS_IP4_CONFIG (data->config)) { | |
350 | return add_ip4_config (self, | |
351 | servers, | |
352 | (NMIP4Config *) data->config, | |
353 | data->iface, | |
354 | data->type == NM_DNS_IP_CONFIG_TYPE_VPN); | |
355 | } else if (NM_IS_IP6_CONFIG (data->config)) { | |
356 | return add_ip6_config (self, | |
357 | servers, | |
358 | (NMIP6Config *) data->config, | |
359 | data->iface, | |
360 | data->type == NM_DNS_IP_CONFIG_TYPE_VPN); | |
361 | } else | |
362 | g_return_val_if_reached (FALSE); | |
363 | } | |
364 | ||
365 | static void | |
366 | dnsmasq_clear_cache_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) | |
367 | { | |
368 | NMDnsDnsmasq *self; | |
271 | 369 | gs_free_error GError *error = NULL; |
272 | 370 | gs_unref_variant GVariant *response = NULL; |
273 | 371 | |
274 | response = g_dbus_proxy_call_finish (priv->dnsmasq, res, &error); | |
372 | response = g_dbus_proxy_call_finish (proxy, res, &error); | |
373 | if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) | |
374 | return; | |
375 | ||
376 | self = NM_DNS_DNSMASQ (user_data); | |
377 | ||
378 | if (!response) | |
379 | _LOGW ("dnsmasq cache clear failed: %s", error->message); | |
380 | else | |
381 | _LOGD ("dnsmasq update successful, cache cleared"); | |
382 | } | |
383 | ||
384 | static void | |
385 | dnsmasq_update_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) | |
386 | { | |
387 | NMDnsDnsmasq *self; | |
388 | NMDnsDnsmasqPrivate *priv; | |
389 | gs_free_error GError *error = NULL; | |
390 | gs_unref_variant GVariant *response = NULL; | |
391 | ||
392 | response = g_dbus_proxy_call_finish (proxy, res, &error); | |
393 | if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) | |
394 | return; | |
395 | ||
396 | self = NM_DNS_DNSMASQ (user_data); | |
397 | priv = NM_DNS_DNSMASQ_GET_PRIVATE (self); | |
398 | ||
275 | 399 | if (!response) |
276 | 400 | _LOGW ("dnsmasq update failed: %s", error->message); |
277 | else | |
278 | _LOGD ("dnsmasq update successful"); | |
401 | else { | |
402 | g_dbus_proxy_call (priv->dnsmasq, | |
403 | "ClearCache", | |
404 | NULL, | |
405 | G_DBUS_CALL_FLAGS_NONE, | |
406 | -1, | |
407 | priv->update_cancellable, | |
408 | (GAsyncReadyCallback) dnsmasq_clear_cache_done, | |
409 | self); | |
410 | } | |
279 | 411 | } |
280 | 412 | |
281 | 413 | static void |
288 | 420 | |
289 | 421 | if (priv->running) { |
290 | 422 | _LOGD ("trying to update dnsmasq nameservers"); |
423 | ||
424 | nm_clear_g_cancellable (&priv->update_cancellable); | |
425 | priv->update_cancellable = g_cancellable_new (); | |
291 | 426 | |
292 | 427 | g_dbus_proxy_call (priv->dnsmasq, |
293 | 428 | "SetServersEx", |
294 | 429 | priv->set_server_ex_args, |
295 | 430 | G_DBUS_CALL_FLAGS_NONE, |
296 | 431 | -1, |
297 | NULL, | |
432 | priv->update_cancellable, | |
298 | 433 | (GAsyncReadyCallback) dnsmasq_update_done, |
299 | 434 | self); |
300 | 435 | g_clear_pointer (&priv->set_server_ex_args, g_variant_unref); |
372 | 507 | NMBusManager *dbus_mgr; |
373 | 508 | GDBusConnection *connection; |
374 | 509 | |
375 | ||
376 | if ( priv->running | |
377 | || priv->dnsmasq | |
378 | || priv->dnsmasq_cancellable) | |
379 | return; | |
510 | if (priv->running) { | |
511 | /* the dnsmasq process is running. Nothing to do. */ | |
512 | return; | |
513 | } | |
514 | ||
515 | if (nm_dns_plugin_child_pid ((NMDnsPlugin *) self) > 0) { | |
516 | /* if we already have a child process spawned, don't do | |
517 | * it again. */ | |
518 | return; | |
519 | } | |
380 | 520 | |
381 | 521 | dm_binary = nm_utils_find_helper ("dnsmasq", DNSMASQ_PATH, NULL); |
382 | 522 | if (!dm_binary) { |
408 | 548 | if (!pid) |
409 | 549 | return; |
410 | 550 | |
551 | if ( priv->dnsmasq | |
552 | || priv->dnsmasq_cancellable) { | |
553 | /* we already have a proxy or are about to create it. | |
554 | * We are done. */ | |
555 | return; | |
556 | } | |
557 | ||
411 | 558 | dbus_mgr = nm_bus_manager_get (); |
412 | 559 | g_return_if_fail (dbus_mgr); |
413 | 560 | |
428 | 575 | |
429 | 576 | static gboolean |
430 | 577 | update (NMDnsPlugin *plugin, |
431 | const GSList *vpn_configs, | |
432 | const GSList *dev_configs, | |
433 | const GSList *other_configs, | |
578 | const NMDnsIPConfigData **configs, | |
434 | 579 | const NMGlobalDnsConfig *global_config, |
435 | 580 | const char *hostname) |
436 | 581 | { |
437 | 582 | NMDnsDnsmasq *self = NM_DNS_DNSMASQ (plugin); |
438 | 583 | NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (self); |
439 | const GSList *iter; | |
440 | 584 | GVariantBuilder servers; |
441 | 585 | |
442 | 586 | start_dnsmasq (self); |
446 | 590 | if (global_config) |
447 | 591 | add_global_config (self, &servers, global_config); |
448 | 592 | else { |
449 | /* Use split DNS for VPN configs */ | |
450 | for (iter = vpn_configs; iter; iter = g_slist_next (iter)) { | |
451 | if (NM_IS_IP4_CONFIG (iter->data)) | |
452 | add_ip4_config (self, &servers, iter->data, TRUE); | |
453 | else if (NM_IS_IP6_CONFIG (iter->data)) | |
454 | add_ip6_config (self, &servers, iter->data, TRUE); | |
455 | } | |
456 | ||
457 | /* Now add interface configs without split DNS */ | |
458 | for (iter = dev_configs; iter; iter = g_slist_next (iter)) { | |
459 | if (NM_IS_IP4_CONFIG (iter->data)) | |
460 | add_ip4_config (self, &servers, iter->data, FALSE); | |
461 | else if (NM_IS_IP6_CONFIG (iter->data)) | |
462 | add_ip6_config (self, &servers, iter->data, FALSE); | |
463 | } | |
464 | ||
465 | /* And any other random configs */ | |
466 | for (iter = other_configs; iter; iter = g_slist_next (iter)) { | |
467 | if (NM_IS_IP4_CONFIG (iter->data)) | |
468 | add_ip4_config (self, &servers, iter->data, FALSE); | |
469 | else if (NM_IS_IP6_CONFIG (iter->data)) | |
470 | add_ip6_config (self, &servers, iter->data, FALSE); | |
593 | while (*configs) { | |
594 | add_ip_config_data (self, &servers, *configs); | |
595 | configs++; | |
471 | 596 | } |
472 | 597 | } |
473 | 598 | |
481 | 606 | |
482 | 607 | /****************************************************************/ |
483 | 608 | |
484 | static const char * | |
485 | dm_exit_code_to_msg (int status) | |
486 | { | |
487 | if (status == 1) | |
488 | return "Configuration problem"; | |
489 | else if (status == 2) | |
490 | return "Network access problem (address in use; permissions; etc)"; | |
491 | else if (status == 3) | |
492 | return "Filesystem problem (missing file/directory; permissions; etc)"; | |
493 | else if (status == 4) | |
494 | return "Memory allocation failure"; | |
495 | else if (status == 5) | |
496 | return "Other problem"; | |
497 | else if (status >= 11) | |
498 | return "Lease-script 'init' process failure"; | |
499 | return "Unknown error"; | |
500 | } | |
501 | ||
502 | 609 | static void |
503 | 610 | child_quit (NMDnsPlugin *plugin, gint status) |
504 | 611 | { |
505 | 612 | NMDnsDnsmasq *self = NM_DNS_DNSMASQ (plugin); |
613 | NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (self); | |
506 | 614 | gboolean failed = TRUE; |
507 | 615 | int err; |
508 | 616 | |
509 | 617 | if (WIFEXITED (status)) { |
510 | 618 | err = WEXITSTATUS (status); |
511 | 619 | if (err) { |
512 | _LOGW ("dnsmasq exited with error: %s (%d)", | |
513 | dm_exit_code_to_msg (err), | |
514 | err); | |
515 | } else | |
620 | _LOGW ("dnsmasq exited with error: %s", | |
621 | nm_utils_dnsmasq_status_to_string (err, NULL, 0)); | |
622 | } else { | |
623 | _LOGD ("dnsmasq exited normally"); | |
516 | 624 | failed = FALSE; |
625 | } | |
517 | 626 | } else if (WIFSTOPPED (status)) |
518 | 627 | _LOGW ("dnsmasq stopped unexpectedly with signal %d", WSTOPSIG (status)); |
519 | 628 | else if (WIFSIGNALED (status)) |
521 | 630 | else |
522 | 631 | _LOGW ("dnsmasq died from an unknown cause"); |
523 | 632 | |
633 | priv->running = FALSE; | |
634 | ||
524 | 635 | if (failed) |
525 | 636 | g_signal_emit_by_name (self, NM_DNS_PLUGIN_FAILED); |
526 | 637 | } |
558 | 669 | NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (object); |
559 | 670 | |
560 | 671 | nm_clear_g_cancellable (&priv->dnsmasq_cancellable); |
672 | nm_clear_g_cancellable (&priv->update_cancellable); | |
561 | 673 | |
562 | 674 | g_clear_object (&priv->dnsmasq); |
563 | 675 |
60 | 60 | #define DOMAIN_IS_VALID(domain) (*(domain)) |
61 | 61 | #endif |
62 | 62 | |
63 | G_DEFINE_TYPE (NMDnsManager, nm_dns_manager, G_TYPE_OBJECT) | |
64 | ||
65 | #define NM_DNS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ | |
66 | NM_TYPE_DNS_MANAGER, \ | |
67 | NMDnsManagerPrivate)) | |
68 | ||
69 | 63 | #define HASH_LEN 20 |
70 | 64 | |
71 | #ifdef RESOLVCONF_PATH | |
72 | #define RESOLVCONF_SELECTED | |
73 | #else | |
65 | #ifndef RESOLVCONF_PATH | |
74 | 66 | #define RESOLVCONF_PATH "/sbin/resolvconf" |
75 | 67 | #endif |
76 | 68 | |
77 | #ifdef NETCONFIG_PATH | |
78 | #define NETCONFIG_SELECTED | |
79 | #else | |
69 | #ifndef NETCONFIG_PATH | |
80 | 70 | #define NETCONFIG_PATH "/sbin/netconfig" |
81 | 71 | #endif |
82 | 72 | |
84 | 74 | #define PLUGIN_RATELIMIT_BURST 5 |
85 | 75 | #define PLUGIN_RATELIMIT_DELAY 300 |
86 | 76 | |
87 | NM_DEFINE_SINGLETON_INSTANCE (NMDnsManager); | |
77 | enum { | |
78 | CONFIG_CHANGED, | |
79 | ||
80 | LAST_SIGNAL | |
81 | }; | |
82 | ||
83 | static guint signals[LAST_SIGNAL] = { 0 }; | |
84 | ||
85 | typedef enum { | |
86 | SR_SUCCESS, | |
87 | SR_NOTFOUND, | |
88 | SR_ERROR | |
89 | } SpawnResult; | |
88 | 90 | |
89 | 91 | /*********************************************************************************************/ |
90 | 92 | |
111 | 113 | /*********************************************************************************************/ |
112 | 114 | |
113 | 115 | typedef struct { |
114 | NMIP4Config *ip4_vpn_config; | |
115 | NMIP4Config *ip4_device_config; | |
116 | NMIP6Config *ip6_vpn_config; | |
117 | NMIP6Config *ip6_device_config; | |
118 | GSList *configs; | |
116 | GPtrArray *configs; | |
117 | NMDnsIPConfigData *best_conf4, *best_conf6; | |
118 | gboolean need_sort; | |
119 | ||
119 | 120 | char *hostname; |
120 | 121 | guint updates_queue; |
121 | 122 | |
122 | 123 | guint8 hash[HASH_LEN]; /* SHA1 hash of current DNS config */ |
123 | 124 | guint8 prev_hash[HASH_LEN]; /* Hash when begin_updates() was called */ |
124 | 125 | |
125 | NMDnsManagerResolvConfMode resolv_conf_mode; | |
126 | 126 | NMDnsManagerResolvConfManager rc_manager; |
127 | char *last_mode; | |
128 | bool last_immutable:1; | |
129 | bool mode_initialized:1; | |
130 | 127 | NMDnsPlugin *plugin; |
131 | 128 | |
132 | 129 | NMConfig *config; |
140 | 137 | } plugin_ratelimit; |
141 | 138 | } NMDnsManagerPrivate; |
142 | 139 | |
143 | enum { | |
144 | CONFIG_CHANGED, | |
145 | ||
146 | LAST_SIGNAL | |
140 | struct _NMDnsManager { | |
141 | GObject parent; | |
142 | NMDnsManagerPrivate _priv; | |
147 | 143 | }; |
148 | 144 | |
149 | typedef enum { | |
150 | SR_SUCCESS, | |
151 | SR_NOTFOUND, | |
152 | SR_ERROR | |
153 | } SpawnResult; | |
154 | ||
155 | static guint signals[LAST_SIGNAL] = { 0 }; | |
156 | ||
145 | struct _NMDnsManagerClass { | |
146 | GObjectClass parent; | |
147 | }; | |
148 | ||
149 | G_DEFINE_TYPE (NMDnsManager, nm_dns_manager, G_TYPE_OBJECT) | |
150 | ||
151 | NM_DEFINE_SINGLETON_INSTANCE (NMDnsManager); | |
152 | ||
153 | #define NM_DNS_MANAGER_GET_PRIVATE(self) \ | |
154 | ({ \ | |
155 | /* preserve the const-ness of self. Unfortunately, that | |
156 | * way, @self cannot be a void pointer */ \ | |
157 | typeof (self) _self = (self); \ | |
158 | \ | |
159 | /* Get compiler error if variable is of wrong type */ \ | |
160 | _nm_unused const NMDnsManager *_self2 = (_self); \ | |
161 | \ | |
162 | nm_assert (NM_IS_DNS_MANAGER (_self)); \ | |
163 | &_self->_priv; \ | |
164 | }) | |
165 | ||
166 | /*****************************************************************************/ | |
157 | 167 | |
158 | 168 | typedef struct { |
159 | 169 | GPtrArray *nameservers; |
165 | 175 | |
166 | 176 | NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_rc_manager_to_string, NMDnsManagerResolvConfManager, |
167 | 177 | NM_UTILS_LOOKUP_DEFAULT_WARN (NULL), |
168 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE, "none"), | |
169 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE, "file"), | |
170 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF, "resolvconf"), | |
171 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG, "netconfig"), | |
172 | NM_UTILS_LOOKUP_ITEM_IGNORE (_NM_DNS_MANAGER_RESOLV_CONF_MAN_INTERNAL_ONLY), | |
178 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN, "unknown"), | |
179 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED, "unmanaged"), | |
180 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE, "immutable"), | |
181 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK, "symlink"), | |
182 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE, "file"), | |
183 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF, "resolvconf"), | |
184 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG, "netconfig"), | |
173 | 185 | ); |
186 | ||
187 | NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_config_type_to_string, NMDnsIPConfigType, | |
188 | NM_UTILS_LOOKUP_DEFAULT_WARN ("<unknown>"), | |
189 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_IP_CONFIG_TYPE_DEFAULT, "default"), | |
190 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_IP_CONFIG_TYPE_BEST_DEVICE, "best"), | |
191 | NM_UTILS_LOOKUP_STR_ITEM (NM_DNS_IP_CONFIG_TYPE_VPN, "vpn"), | |
192 | ); | |
193 | ||
194 | static NMDnsIPConfigData * | |
195 | ip_config_data_new (gpointer config, NMDnsIPConfigType type, const char *iface) | |
196 | { | |
197 | NMDnsIPConfigData *data; | |
198 | ||
199 | data = g_slice_new0 (NMDnsIPConfigData); | |
200 | data->config = g_object_ref (config); | |
201 | data->iface = g_strdup (iface); | |
202 | data->type = type; | |
203 | ||
204 | return data; | |
205 | } | |
206 | ||
207 | static void | |
208 | ip_config_data_destroy (gpointer ptr) | |
209 | { | |
210 | NMDnsIPConfigData *data = ptr; | |
211 | ||
212 | if (!data) | |
213 | return; | |
214 | ||
215 | g_object_unref (data->config); | |
216 | g_free (data->iface); | |
217 | g_slice_free (NMDnsIPConfigData, data); | |
218 | } | |
219 | ||
220 | static gint | |
221 | ip_config_data_compare (const NMDnsIPConfigData *a, const NMDnsIPConfigData *b) | |
222 | { | |
223 | gboolean a_v4, b_v4; | |
224 | gint a_prio, b_prio; | |
225 | ||
226 | a_v4 = NM_IS_IP4_CONFIG (a->config); | |
227 | b_v4 = NM_IS_IP4_CONFIG (b->config); | |
228 | ||
229 | a_prio = a_v4 ? | |
230 | nm_ip4_config_get_dns_priority ((NMIP4Config *) a->config) : | |
231 | nm_ip6_config_get_dns_priority ((NMIP6Config *) a->config); | |
232 | ||
233 | b_prio = b_v4 ? | |
234 | nm_ip4_config_get_dns_priority ((NMIP4Config *) b->config) : | |
235 | nm_ip6_config_get_dns_priority ((NMIP6Config *) b->config); | |
236 | ||
237 | /* Configurations with lower priority value first */ | |
238 | if (a_prio < b_prio) | |
239 | return -1; | |
240 | else if (a_prio > b_prio) | |
241 | return 1; | |
242 | ||
243 | /* Sort also according to type */ | |
244 | if (a->type > b->type) | |
245 | return -1; | |
246 | else if (a->type < b->type) | |
247 | return 1; | |
248 | ||
249 | return 0; | |
250 | } | |
251 | ||
252 | static gint | |
253 | ip_config_data_ptr_compare (gconstpointer a, gconstpointer b) | |
254 | { | |
255 | const NMDnsIPConfigData *const *ptr_a = a, *const *ptr_b = b; | |
256 | ||
257 | return ip_config_data_compare (*ptr_a, *ptr_b); | |
258 | } | |
174 | 259 | |
175 | 260 | static void |
176 | 261 | add_string_item (GPtrArray *array, const char *str) |
256 | 341 | } |
257 | 342 | |
258 | 343 | static void |
259 | merge_one_ip6_config (NMResolvConfData *rc, NMIP6Config *src) | |
344 | merge_one_ip6_config (NMResolvConfData *rc, NMIP6Config *src, const char *iface) | |
260 | 345 | { |
261 | 346 | guint32 num, num_domains, num_searches, i; |
262 | const char *iface; | |
263 | ||
264 | iface = g_object_get_data (G_OBJECT (src), IP_CONFIG_IFACE_TAG); | |
265 | 347 | |
266 | 348 | num = nm_ip6_config_get_num_nameservers (src); |
267 | 349 | for (i = 0; i < num; i++) { |
275 | 357 | nm_utils_inet4_ntop (addr->s6_addr32[3], buf); |
276 | 358 | else { |
277 | 359 | nm_utils_inet6_ntop (addr, buf); |
278 | if (iface && IN6_IS_ADDR_LINKLOCAL (addr)) { | |
360 | if (IN6_IS_ADDR_LINKLOCAL (addr)) { | |
279 | 361 | g_strlcat (buf, "%", sizeof (buf)); |
280 | 362 | g_strlcat (buf, iface, sizeof (buf)); |
281 | 363 | } |
313 | 395 | option = nm_ip6_config_get_dns_option (src, i); |
314 | 396 | add_dns_option_item (rc->options, option, TRUE); |
315 | 397 | } |
398 | } | |
399 | ||
400 | static void | |
401 | merge_one_ip_config_data (NMDnsManager *self, | |
402 | NMResolvConfData *rc, | |
403 | NMDnsIPConfigData *data) | |
404 | { | |
405 | if (NM_IS_IP4_CONFIG (data->config)) | |
406 | merge_one_ip4_config (rc, (NMIP4Config *) data->config); | |
407 | else if (NM_IS_IP6_CONFIG (data->config)) | |
408 | merge_one_ip6_config (rc, (NMIP6Config *) data->config, data->iface); | |
409 | else | |
410 | g_return_if_reached (); | |
316 | 411 | } |
317 | 412 | |
318 | 413 | static GPid |
469 | 564 | const char *content, |
470 | 565 | GError **error) |
471 | 566 | { |
567 | int errsv; | |
568 | ||
472 | 569 | if (fprintf (f, "%s", content) < 0) { |
570 | errsv = errno; | |
473 | 571 | g_set_error (error, |
474 | 572 | NM_MANAGER_ERROR, |
475 | 573 | NM_MANAGER_ERROR_FAILED, |
476 | 574 | "Could not write " _PATH_RESCONF ": %s", |
477 | g_strerror (errno)); | |
575 | g_strerror (errsv)); | |
576 | errno = errsv; | |
478 | 577 | return FALSE; |
479 | 578 | } |
480 | 579 | |
573 | 672 | gboolean success; |
574 | 673 | gs_free char *content = NULL; |
575 | 674 | SpawnResult write_file_result = SR_SUCCESS; |
675 | int errsv; | |
676 | const char *rc_path = _PATH_RESCONF; | |
677 | nm_auto_free char *rc_path_real = NULL; | |
576 | 678 | |
577 | 679 | /* If we are not managing /etc/resolv.conf and it points to |
578 | 680 | * MY_RESOLV_CONF, don't write the private DNS configuration to |
581 | 683 | * |
582 | 684 | * This is the only situation, where we don't try to update our |
583 | 685 | * internal resolv.conf file. */ |
584 | if (rc_manager == _NM_DNS_MANAGER_RESOLV_CONF_MAN_INTERNAL_ONLY) { | |
686 | if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED) { | |
585 | 687 | gs_free char *path = g_file_read_link (_PATH_RESCONF, NULL); |
586 | 688 | |
587 | 689 | if (g_strcmp0 (path, MY_RESOLV_CONF) == 0) { |
588 | _LOGD ("not updating " MY_RESOLV_CONF | |
589 | " since it points to " _PATH_RESCONF); | |
690 | _LOGD ("update-resolv-conf: not updating " _PATH_RESCONF | |
691 | " since it points to " MY_RESOLV_CONF); | |
590 | 692 | return SR_SUCCESS; |
591 | 693 | } |
592 | 694 | } |
594 | 696 | content = create_resolv_conf (searches, nameservers, options); |
595 | 697 | |
596 | 698 | if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE) { |
699 | GError *local = NULL; | |
700 | ||
701 | rc_path_real = realpath (rc_path, NULL); | |
702 | if (rc_path_real) | |
703 | rc_path = rc_path_real; | |
704 | ||
597 | 705 | /* we first write to /etc/resolv.conf directly. If that fails, |
598 | 706 | * we still continue to write to runstatedir but remember the |
599 | 707 | * error. */ |
600 | if (!g_file_set_contents (_PATH_RESCONF, content, -1, error)) { | |
708 | if (!g_file_set_contents (rc_path, content, -1, &local)) { | |
709 | _LOGT ("update-resolv-conf: write to %s failed (rc-manager=%s, %s)", | |
710 | rc_path, _rc_manager_to_string (rc_manager), local->message); | |
601 | 711 | write_file_result = SR_ERROR; |
712 | g_propagate_error (error, local); | |
602 | 713 | error = NULL; |
714 | } else { | |
715 | _LOGT ("update-resolv-conf: write to %s succeeded (rc-manager=%s)", | |
716 | rc_path, _rc_manager_to_string (rc_manager)); | |
603 | 717 | } |
604 | 718 | } |
605 | 719 | |
606 | 720 | if ((f = fopen (MY_RESOLV_CONF_TMP, "w")) == NULL) { |
721 | errsv = errno; | |
607 | 722 | g_set_error (error, |
608 | 723 | NM_MANAGER_ERROR, |
609 | 724 | NM_MANAGER_ERROR_FAILED, |
610 | 725 | "Could not open %s: %s", |
611 | 726 | MY_RESOLV_CONF_TMP, |
612 | g_strerror (errno)); | |
727 | g_strerror (errsv)); | |
728 | _LOGT ("update-resolv-conf: open temporary file %s failed (%s)", | |
729 | MY_RESOLV_CONF_TMP, g_strerror (errsv)); | |
613 | 730 | return SR_ERROR; |
614 | 731 | } |
615 | 732 | |
616 | 733 | success = write_resolv_conf_contents (f, content, error); |
734 | if (!success) { | |
735 | errsv = errno; | |
736 | _LOGT ("update-resolv-conf: write temporary file %s failed (%s)", | |
737 | MY_RESOLV_CONF_TMP, g_strerror (errsv)); | |
738 | } | |
617 | 739 | |
618 | 740 | if (fclose (f) < 0) { |
619 | 741 | if (success) { |
742 | errsv = errno; | |
620 | 743 | /* only set an error here if write_resolv_conf() was successful, |
621 | 744 | * since its error is more important. |
622 | 745 | */ |
625 | 748 | NM_MANAGER_ERROR_FAILED, |
626 | 749 | "Could not close %s: %s", |
627 | 750 | MY_RESOLV_CONF_TMP, |
628 | g_strerror (errno)); | |
751 | g_strerror (errsv)); | |
752 | _LOGT ("update-resolv-conf: close temporary file %s failed (%s)", | |
753 | MY_RESOLV_CONF_TMP, g_strerror (errsv)); | |
629 | 754 | } |
630 | 755 | return SR_ERROR; |
631 | 756 | } else if (!success) |
632 | 757 | return SR_ERROR; |
633 | 758 | |
634 | 759 | if (rename (MY_RESOLV_CONF_TMP, MY_RESOLV_CONF) < 0) { |
760 | errsv = errno; | |
635 | 761 | g_set_error (error, |
636 | 762 | NM_MANAGER_ERROR, |
637 | 763 | NM_MANAGER_ERROR_FAILED, |
638 | 764 | "Could not replace %s: %s", |
639 | 765 | MY_RESOLV_CONF, |
640 | 766 | g_strerror (errno)); |
767 | _LOGT ("update-resolv-conf: failed to rename temporary file %s to %s (%s)", | |
768 | MY_RESOLV_CONF_TMP, MY_RESOLV_CONF, g_strerror (errsv)); | |
641 | 769 | return SR_ERROR; |
642 | 770 | } |
643 | 771 | |
644 | if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE) | |
772 | if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE) { | |
773 | _LOGT ("update-resolv-conf: write internal file %s succeeded (rc-manager=%s)", | |
774 | rc_path, _rc_manager_to_string (rc_manager)); | |
645 | 775 | return write_file_result; |
646 | ||
647 | if (rc_manager != NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE) | |
776 | } | |
777 | ||
778 | if (rc_manager != NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK) { | |
779 | _LOGT ("update-resolv-conf: write internal file %s succeeded", MY_RESOLV_CONF); | |
648 | 780 | return SR_SUCCESS; |
781 | } | |
649 | 782 | |
650 | 783 | /* A symlink pointing to NM's own resolv.conf (MY_RESOLV_CONF) is always |
651 | 784 | * overwritten to ensure that changes are indicated with inotify. Symlinks |
652 | 785 | * pointing to any other file are never overwritten. |
653 | 786 | */ |
654 | if (lstat (_PATH_RESCONF, &st) != -1) { | |
787 | if (lstat (_PATH_RESCONF, &st) != 0) { | |
788 | errsv = errno; | |
789 | if (errsv != ENOENT) { | |
790 | /* NM cannot read /etc/resolv.conf */ | |
791 | _LOGT ("update-resolv-conf: write internal file %s succeeded but lstat(%s) failed (%s)", | |
792 | MY_RESOLV_CONF, _PATH_RESCONF, g_strerror (errsv)); | |
793 | g_set_error (error, | |
794 | NM_MANAGER_ERROR, | |
795 | NM_MANAGER_ERROR_FAILED, | |
796 | "Could not lstat %s: %s", | |
797 | _PATH_RESCONF, | |
798 | g_strerror (errsv)); | |
799 | return SR_ERROR; | |
800 | } | |
801 | } else { | |
655 | 802 | if (S_ISLNK (st.st_mode)) { |
656 | 803 | if (stat (_PATH_RESCONF, &st) != -1) { |
657 | 804 | gs_free char *path = g_file_read_link (_PATH_RESCONF, NULL); |
658 | 805 | |
659 | if (g_strcmp0 (path, MY_RESOLV_CONF) != 0) { | |
806 | if (!path || !nm_streq (path, MY_RESOLV_CONF)) { | |
660 | 807 | /* It's not NM's symlink; do nothing */ |
808 | _LOGT ("update-resolv-conf: write internal file %s succeeded " | |
809 | "but don't update %s as it points to %s", | |
810 | MY_RESOLV_CONF, _PATH_RESCONF, path ?: ""); | |
661 | 811 | return SR_SUCCESS; |
662 | 812 | } |
663 | 813 | |
668 | 818 | * some other program is probably managing resolv.conf and |
669 | 819 | * NM should not touch it. |
670 | 820 | */ |
821 | _LOGT ("update-resolv-conf: write internal file %s succeeded " | |
822 | "but don't update %s as the symlinks points somewhere else", | |
823 | MY_RESOLV_CONF, _PATH_RESCONF); | |
671 | 824 | return SR_SUCCESS; |
672 | 825 | } |
673 | 826 | } |
674 | } else if (errno != ENOENT) { | |
675 | /* NM cannot read /etc/resolv.conf */ | |
676 | g_set_error (error, | |
677 | NM_MANAGER_ERROR, | |
678 | NM_MANAGER_ERROR_FAILED, | |
679 | "Could not lstat %s: %s", | |
680 | _PATH_RESCONF, | |
681 | g_strerror (errno)); | |
682 | return SR_ERROR; | |
683 | 827 | } |
684 | 828 | |
685 | 829 | /* By this point, either /etc/resolv.conf does not exist, is a regular |
686 | 830 | * file, or is a symlink already owned by NM. In all cases /etc/resolv.conf |
687 | 831 | * is replaced with a symlink pointing to NM's resolv.conf in /var/run/. |
688 | 832 | */ |
689 | if (unlink (RESOLV_CONF_TMP) == -1 && errno != ENOENT) { | |
833 | if ( unlink (RESOLV_CONF_TMP) != 0 | |
834 | && ((errsv = errno) != ENOENT)) { | |
690 | 835 | g_set_error (error, |
691 | 836 | NM_MANAGER_ERROR, |
692 | 837 | NM_MANAGER_ERROR_FAILED, |
693 | 838 | "Could not unlink %s: %s", |
694 | 839 | RESOLV_CONF_TMP, |
695 | g_strerror (errno)); | |
840 | g_strerror (errsv)); | |
841 | _LOGT ("update-resolv-conf: write internal file %s succeeded " | |
842 | "but canot delete temporary file %s: %s", | |
843 | MY_RESOLV_CONF, RESOLV_CONF_TMP, g_strerror (errsv)); | |
696 | 844 | return SR_ERROR; |
697 | 845 | } |
698 | 846 | |
699 | 847 | if (symlink (MY_RESOLV_CONF, RESOLV_CONF_TMP) == -1) { |
848 | errsv = errno; | |
700 | 849 | g_set_error (error, |
701 | 850 | NM_MANAGER_ERROR, |
702 | 851 | NM_MANAGER_ERROR_FAILED, |
703 | 852 | "Could not create symlink %s pointing to %s: %s", |
704 | 853 | RESOLV_CONF_TMP, |
705 | 854 | MY_RESOLV_CONF, |
706 | g_strerror (errno)); | |
855 | g_strerror (errsv)); | |
856 | _LOGT ("update-resolv-conf: write internal file %s succeeded " | |
857 | "but failed to symlink %s: %s", | |
858 | MY_RESOLV_CONF, RESOLV_CONF_TMP, g_strerror (errsv)); | |
707 | 859 | return SR_ERROR; |
708 | 860 | } |
709 | 861 | |
710 | 862 | if (rename (RESOLV_CONF_TMP, _PATH_RESCONF) == -1) { |
863 | errsv = errno; | |
711 | 864 | g_set_error (error, |
712 | 865 | NM_MANAGER_ERROR, |
713 | 866 | NM_MANAGER_ERROR_FAILED, |
714 | 867 | "Could not rename %s to %s: %s", |
715 | 868 | RESOLV_CONF_TMP, |
716 | 869 | _PATH_RESCONF, |
717 | g_strerror (errno)); | |
870 | g_strerror (errsv)); | |
871 | _LOGT ("update-resolv-conf: write internal file %s succeeded " | |
872 | "but failed to rename temporary symlink %s to %s: %s", | |
873 | MY_RESOLV_CONF, RESOLV_CONF_TMP, _PATH_RESCONF, g_strerror (errsv)); | |
718 | 874 | return SR_ERROR; |
719 | 875 | } |
720 | 876 | |
877 | _LOGT ("update-resolv-conf: write internal file %s succeeded and update symlink %s", | |
878 | MY_RESOLV_CONF, _PATH_RESCONF); | |
721 | 879 | return SR_SUCCESS; |
722 | 880 | } |
723 | 881 | |
726 | 884 | { |
727 | 885 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); |
728 | 886 | GChecksum *sum; |
729 | GSList *iter; | |
730 | 887 | gsize len = HASH_LEN; |
888 | guint i; | |
731 | 889 | |
732 | 890 | sum = g_checksum_new (G_CHECKSUM_SHA1); |
733 | 891 | g_assert (len == g_checksum_type_get_length (G_CHECKSUM_SHA1)); |
734 | 892 | |
735 | 893 | if (global) |
736 | 894 | nm_global_dns_config_update_checksum (global, sum); |
737 | ||
738 | if (priv->ip4_vpn_config) | |
739 | nm_ip4_config_hash (priv->ip4_vpn_config, sum, TRUE); | |
740 | if (priv->ip4_device_config) | |
741 | nm_ip4_config_hash (priv->ip4_device_config, sum, TRUE); | |
742 | ||
743 | if (priv->ip6_vpn_config) | |
744 | nm_ip6_config_hash (priv->ip6_vpn_config, sum, TRUE); | |
745 | if (priv->ip6_device_config) | |
746 | nm_ip6_config_hash (priv->ip6_device_config, sum, TRUE); | |
747 | ||
748 | /* add any other configs we know about */ | |
749 | for (iter = priv->configs; iter; iter = g_slist_next (iter)) { | |
750 | if (NM_IN_SET (iter->data, priv->ip4_vpn_config, | |
751 | priv->ip4_device_config, | |
752 | priv->ip6_vpn_config, | |
753 | priv->ip6_device_config)) | |
754 | continue; | |
755 | ||
756 | if (NM_IS_IP4_CONFIG (iter->data)) | |
757 | nm_ip4_config_hash (NM_IP4_CONFIG (iter->data), sum, TRUE); | |
758 | else if (NM_IS_IP6_CONFIG (iter->data)) | |
759 | nm_ip6_config_hash (NM_IP6_CONFIG (iter->data), sum, TRUE); | |
895 | else { | |
896 | for (i = 0; i < priv->configs->len; i++) { | |
897 | NMDnsIPConfigData *data = priv->configs->pdata[i]; | |
898 | ||
899 | if (NM_IS_IP4_CONFIG (data->config)) | |
900 | nm_ip4_config_hash ((NMIP4Config *) data->config, sum, TRUE); | |
901 | else if (NM_IS_IP6_CONFIG (data->config)) | |
902 | nm_ip6_config_hash ((NMIP6Config *) data->config, sum, TRUE); | |
903 | } | |
760 | 904 | } |
761 | 905 | |
762 | 906 | g_checksum_get_digest (sum, buffer, &len); |
763 | 907 | g_checksum_free (sum); |
764 | } | |
765 | ||
766 | static void | |
767 | build_plugin_config_lists (NMDnsManager *self, | |
768 | GSList **out_vpn_configs, | |
769 | GSList **out_dev_configs, | |
770 | GSList **out_other_configs) | |
771 | { | |
772 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
773 | GSList *iter; | |
774 | ||
775 | g_return_if_fail (out_vpn_configs && !*out_vpn_configs); | |
776 | g_return_if_fail (out_dev_configs && !*out_dev_configs); | |
777 | g_return_if_fail (out_other_configs && !*out_other_configs); | |
778 | ||
779 | /* Build up config lists for plugins; we use the raw configs here, not the | |
780 | * merged information that we write to resolv.conf so that the plugins can | |
781 | * still use the domain information in each config to provide split DNS if | |
782 | * they want to. | |
783 | */ | |
784 | if (priv->ip4_vpn_config) | |
785 | *out_vpn_configs = g_slist_append (*out_vpn_configs, priv->ip4_vpn_config); | |
786 | if (priv->ip6_vpn_config) | |
787 | *out_vpn_configs = g_slist_append (*out_vpn_configs, priv->ip6_vpn_config); | |
788 | if (priv->ip4_device_config) | |
789 | *out_dev_configs = g_slist_append (*out_dev_configs, priv->ip4_device_config); | |
790 | if (priv->ip6_device_config) | |
791 | *out_dev_configs = g_slist_append (*out_dev_configs, priv->ip6_device_config); | |
792 | ||
793 | for (iter = priv->configs; iter; iter = g_slist_next (iter)) { | |
794 | if (!NM_IN_SET (iter->data, priv->ip4_vpn_config, | |
795 | priv->ip4_device_config, | |
796 | priv->ip6_vpn_config, | |
797 | priv->ip6_device_config)) | |
798 | *out_other_configs = g_slist_append (*out_other_configs, iter->data); | |
799 | } | |
800 | 908 | } |
801 | 909 | |
802 | 910 | static gboolean |
831 | 939 | return TRUE; |
832 | 940 | } |
833 | 941 | |
942 | static const char * | |
943 | get_nameserver_list (void *config, GString **str) | |
944 | { | |
945 | NMIP4Config *ip4; | |
946 | NMIP6Config *ip6; | |
947 | guint num, i; | |
948 | ||
949 | nm_assert (str); | |
950 | ||
951 | if (*str) | |
952 | g_string_truncate (*str, 0); | |
953 | else | |
954 | *str = g_string_sized_new (64); | |
955 | ||
956 | if (NM_IS_IP4_CONFIG (config)) { | |
957 | ip4 = (NMIP4Config *) config; | |
958 | num = nm_ip4_config_get_num_nameservers (ip4); | |
959 | for (i = 0; i < num; i++) { | |
960 | g_string_append (*str, | |
961 | nm_utils_inet4_ntop (nm_ip4_config_get_nameserver (ip4, i), | |
962 | NULL)); | |
963 | g_string_append_c (*str, ' '); | |
964 | } | |
965 | } else if (NM_IS_IP6_CONFIG (config)) { | |
966 | ip6 = (NMIP6Config *) config; | |
967 | num = nm_ip6_config_get_num_nameservers (ip6); | |
968 | for (i = 0; i < num; i++) { | |
969 | g_string_append (*str, | |
970 | nm_utils_inet6_ntop (nm_ip6_config_get_nameserver (ip6, i), | |
971 | NULL)); | |
972 | g_string_append_c (*str, ' '); | |
973 | } | |
974 | } else | |
975 | g_return_val_if_reached (NULL); | |
976 | ||
977 | return (*str)->str; | |
978 | } | |
979 | ||
834 | 980 | static gboolean |
835 | 981 | update_dns (NMDnsManager *self, |
836 | 982 | gboolean no_caching, |
838 | 984 | { |
839 | 985 | NMDnsManagerPrivate *priv; |
840 | 986 | NMResolvConfData rc; |
841 | GSList *iter; | |
842 | 987 | const char *nis_domain = NULL; |
843 | 988 | char **searches = NULL; |
844 | 989 | char **options = NULL; |
850 | 995 | SpawnResult result = SR_ERROR; |
851 | 996 | NMConfigData *data; |
852 | 997 | NMGlobalDnsConfig *global_config; |
998 | gs_free NMDnsIPConfigData **plugin_confs = NULL; | |
999 | nm_auto_free_gstring GString *tmp_gstring = NULL; | |
853 | 1000 | |
854 | 1001 | g_return_val_if_fail (!error || !*error, FALSE); |
855 | 1002 | |
856 | 1003 | priv = NM_DNS_MANAGER_GET_PRIVATE (self); |
857 | 1004 | nm_clear_g_source (&priv->plugin_ratelimit.timer); |
858 | 1005 | |
859 | if (priv->resolv_conf_mode == NM_DNS_MANAGER_RESOLV_CONF_UNMANAGED) { | |
1006 | if (NM_IN_SET (priv->rc_manager, NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED, | |
1007 | NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE)) { | |
860 | 1008 | update = FALSE; |
861 | 1009 | _LOGD ("update-dns: not updating resolv.conf"); |
862 | 1010 | } else { |
867 | 1015 | data = nm_config_get_data (priv->config); |
868 | 1016 | global_config = nm_config_data_get_global_dns_config (data); |
869 | 1017 | |
1018 | if (priv->need_sort) { | |
1019 | g_ptr_array_sort (priv->configs, ip_config_data_ptr_compare); | |
1020 | priv->need_sort = FALSE; | |
1021 | } | |
1022 | ||
870 | 1023 | /* Update hash with config we're applying */ |
871 | 1024 | compute_hash (self, global_config, priv->hash); |
872 | 1025 | |
879 | 1032 | if (global_config) |
880 | 1033 | merge_global_dns_config (&rc, global_config); |
881 | 1034 | else { |
882 | if (priv->ip4_vpn_config) | |
883 | merge_one_ip4_config (&rc, priv->ip4_vpn_config); | |
884 | if (priv->ip4_device_config) | |
885 | merge_one_ip4_config (&rc, priv->ip4_device_config); | |
886 | ||
887 | if (priv->ip6_vpn_config) | |
888 | merge_one_ip6_config (&rc, priv->ip6_vpn_config); | |
889 | if (priv->ip6_device_config) | |
890 | merge_one_ip6_config (&rc, priv->ip6_device_config); | |
891 | ||
892 | for (iter = priv->configs; iter; iter = g_slist_next (iter)) { | |
893 | if (NM_IN_SET (iter->data, priv->ip4_vpn_config, | |
894 | priv->ip4_device_config, | |
895 | priv->ip6_vpn_config, | |
896 | priv->ip6_device_config)) | |
897 | continue; | |
898 | ||
899 | if (NM_IS_IP4_CONFIG (iter->data)) { | |
900 | NMIP4Config *config = NM_IP4_CONFIG (iter->data); | |
901 | ||
902 | merge_one_ip4_config (&rc, config); | |
903 | } else if (NM_IS_IP6_CONFIG (iter->data)) { | |
904 | NMIP6Config *config = NM_IP6_CONFIG (iter->data); | |
905 | ||
906 | merge_one_ip6_config (&rc, config); | |
907 | } else | |
908 | g_assert_not_reached (); | |
909 | } | |
1035 | int prio, prev_prio = 0; | |
1036 | NMDnsIPConfigData *current; | |
1037 | gboolean skip = FALSE, v4; | |
1038 | ||
1039 | plugin_confs = g_new (NMDnsIPConfigData *, priv->configs->len + 1); | |
1040 | ||
1041 | for (i = 0; i < priv->configs->len; i++) { | |
1042 | current = priv->configs->pdata[i]; | |
1043 | v4 = NM_IS_IP4_CONFIG (current->config); | |
1044 | ||
1045 | prio = v4 ? | |
1046 | nm_ip4_config_get_dns_priority ((NMIP4Config *) current->config) : | |
1047 | nm_ip6_config_get_dns_priority ((NMIP6Config *) current->config); | |
1048 | ||
1049 | if (prev_prio < 0 && prio != prev_prio) { | |
1050 | skip = TRUE; | |
1051 | plugin_confs[i] = NULL; | |
1052 | } | |
1053 | ||
1054 | prev_prio = prio; | |
1055 | ||
1056 | _LOGT ("config: %8d %-7s v%c %-16s %s: %s", | |
1057 | prio, | |
1058 | _config_type_to_string (current->type), | |
1059 | v4 ? '4' : '6', | |
1060 | current->iface, | |
1061 | skip ? "<SKIP>" : "", | |
1062 | get_nameserver_list (current->config, &tmp_gstring)); | |
1063 | ||
1064 | if (!skip) { | |
1065 | merge_one_ip_config_data (self, &rc, current); | |
1066 | plugin_confs[i] = current; | |
1067 | } | |
1068 | } | |
1069 | plugin_confs[i] = NULL; | |
910 | 1070 | } |
911 | 1071 | |
912 | 1072 | /* If the hostname is a FQDN ("dcbw.example.com"), then add the domain part of it |
969 | 1129 | if (priv->plugin) { |
970 | 1130 | NMDnsPlugin *plugin = priv->plugin; |
971 | 1131 | const char *plugin_name = nm_dns_plugin_get_name (plugin); |
972 | GSList *vpn_configs = NULL, *dev_configs = NULL, *other_configs = NULL; | |
973 | 1132 | |
974 | 1133 | if (nm_dns_plugin_is_caching (plugin)) { |
975 | 1134 | if (no_caching) { |
980 | 1139 | caching = TRUE; |
981 | 1140 | } |
982 | 1141 | |
983 | if (!global_config) | |
984 | build_plugin_config_lists (self, &vpn_configs, &dev_configs, &other_configs); | |
985 | ||
986 | 1142 | _LOGD ("update-dns: updating plugin %s", plugin_name); |
987 | 1143 | if (!nm_dns_plugin_update (plugin, |
988 | vpn_configs, | |
989 | dev_configs, | |
990 | other_configs, | |
1144 | (const NMDnsIPConfigData **) plugin_confs, | |
991 | 1145 | global_config, |
992 | 1146 | priv->hostname)) { |
993 | 1147 | _LOGW ("update-dns: plugin %s update failed", plugin_name); |
997 | 1151 | */ |
998 | 1152 | caching = FALSE; |
999 | 1153 | } |
1000 | g_slist_free (vpn_configs); | |
1001 | g_slist_free (dev_configs); | |
1002 | g_slist_free (other_configs); | |
1003 | 1154 | |
1004 | 1155 | skip: |
1005 | 1156 | ; |
1018 | 1169 | |
1019 | 1170 | if (update) { |
1020 | 1171 | switch (priv->rc_manager) { |
1021 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE: | |
1172 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK: | |
1022 | 1173 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE: |
1023 | 1174 | result = update_resolv_conf (self, searches, nameservers, options, error, priv->rc_manager); |
1024 | 1175 | resolv_conf_updated = TRUE; |
1037 | 1188 | if (result == SR_NOTFOUND) { |
1038 | 1189 | _LOGD ("update-dns: program not available, writing to resolv.conf"); |
1039 | 1190 | g_clear_error (error); |
1040 | result = update_resolv_conf (self, searches, nameservers, options, error, NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE); | |
1191 | result = update_resolv_conf (self, searches, nameservers, options, error, NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK); | |
1041 | 1192 | resolv_conf_updated = TRUE; |
1042 | 1193 | } |
1043 | 1194 | } |
1045 | 1196 | /* Unless we've already done it, update private resolv.conf in NMRUNDIR |
1046 | 1197 | ignoring any errors */ |
1047 | 1198 | if (!resolv_conf_updated) |
1048 | update_resolv_conf (self, searches, nameservers, options, NULL, _NM_DNS_MANAGER_RESOLV_CONF_MAN_INTERNAL_ONLY); | |
1199 | update_resolv_conf (self, searches, nameservers, options, NULL, NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED); | |
1049 | 1200 | |
1050 | 1201 | /* signal that resolv.conf was changed */ |
1051 | 1202 | if (update && result == SR_SUCCESS) |
1123 | 1274 | plugin_child_quit_update_dns (self); |
1124 | 1275 | } |
1125 | 1276 | |
1277 | static void | |
1278 | ip_config_dns_priority_changed (gpointer config, | |
1279 | GParamSpec *pspec, | |
1280 | NMDnsManager *self) | |
1281 | { | |
1282 | NM_DNS_MANAGER_GET_PRIVATE (self)->need_sort = TRUE; | |
1283 | } | |
1284 | ||
1285 | static void | |
1286 | forget_data (NMDnsManager *self, NMDnsIPConfigData *data) | |
1287 | { | |
1288 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1289 | ||
1290 | if (data == priv->best_conf4) | |
1291 | priv->best_conf4 = NULL; | |
1292 | else if (data == priv->best_conf6) | |
1293 | priv->best_conf6 = NULL; | |
1294 | ||
1295 | g_signal_handlers_disconnect_by_func (data->config, ip_config_dns_priority_changed, self); | |
1296 | } | |
1297 | ||
1298 | static gboolean | |
1299 | nm_dns_manager_add_ip_config (NMDnsManager *self, | |
1300 | const char *iface, | |
1301 | gpointer config, | |
1302 | NMDnsIPConfigType cfg_type) | |
1303 | { | |
1304 | NMDnsManagerPrivate *priv; | |
1305 | GError *error = NULL; | |
1306 | NMDnsIPConfigData *data; | |
1307 | gboolean v4 = NM_IS_IP4_CONFIG (config); | |
1308 | guint i; | |
1309 | ||
1310 | g_return_val_if_fail (NM_IS_DNS_MANAGER (self), FALSE); | |
1311 | g_return_val_if_fail (config, FALSE); | |
1312 | g_return_val_if_fail (iface && iface[0], FALSE); | |
1313 | ||
1314 | priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1315 | ||
1316 | for (i = 0; i < priv->configs->len; i++) { | |
1317 | data = priv->configs->pdata[i]; | |
1318 | if (data->config == config) { | |
1319 | if ( nm_streq (data->iface, iface) | |
1320 | && data->type == cfg_type) | |
1321 | return FALSE; | |
1322 | else { | |
1323 | forget_data (self, data); | |
1324 | g_ptr_array_remove_index_fast (priv->configs, i); | |
1325 | break; | |
1326 | } | |
1327 | } | |
1328 | } | |
1329 | ||
1330 | data = ip_config_data_new (config, cfg_type, iface); | |
1331 | g_ptr_array_add (priv->configs, data); | |
1332 | g_signal_connect (config, | |
1333 | v4 ? | |
1334 | "notify::" NM_IP4_CONFIG_DNS_PRIORITY : | |
1335 | "notify::" NM_IP6_CONFIG_DNS_PRIORITY, | |
1336 | (GCallback) ip_config_dns_priority_changed, self); | |
1337 | priv->need_sort = TRUE; | |
1338 | ||
1339 | if (cfg_type == NM_DNS_IP_CONFIG_TYPE_BEST_DEVICE) { | |
1340 | /* Only one best-device per IP version is allowed */ | |
1341 | if (v4) { | |
1342 | if (priv->best_conf4) | |
1343 | priv->best_conf4->type = NM_DNS_IP_CONFIG_TYPE_DEFAULT; | |
1344 | priv->best_conf4 = data; | |
1345 | } else { | |
1346 | if (priv->best_conf6) | |
1347 | priv->best_conf6->type = NM_DNS_IP_CONFIG_TYPE_DEFAULT; | |
1348 | priv->best_conf6 = data; | |
1349 | } | |
1350 | } | |
1351 | ||
1352 | if (!priv->updates_queue && !update_dns (self, FALSE, &error)) { | |
1353 | _LOGW ("could not commit DNS changes: %s", error->message); | |
1354 | g_clear_error (&error); | |
1355 | } | |
1356 | ||
1357 | return TRUE; | |
1358 | } | |
1359 | ||
1126 | 1360 | gboolean |
1127 | 1361 | nm_dns_manager_add_ip4_config (NMDnsManager *self, |
1128 | 1362 | const char *iface, |
1129 | 1363 | NMIP4Config *config, |
1130 | 1364 | NMDnsIPConfigType cfg_type) |
1131 | 1365 | { |
1132 | NMDnsManagerPrivate *priv; | |
1133 | GError *error = NULL; | |
1134 | ||
1135 | g_return_val_if_fail (self != NULL, FALSE); | |
1136 | g_return_val_if_fail (config != NULL, FALSE); | |
1137 | ||
1138 | priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1139 | ||
1140 | g_object_set_data_full (G_OBJECT (config), IP_CONFIG_IFACE_TAG, g_strdup (iface), g_free); | |
1141 | ||
1142 | switch (cfg_type) { | |
1143 | case NM_DNS_IP_CONFIG_TYPE_VPN: | |
1144 | priv->ip4_vpn_config = config; | |
1145 | break; | |
1146 | case NM_DNS_IP_CONFIG_TYPE_BEST_DEVICE: | |
1147 | priv->ip4_device_config = config; | |
1148 | break; | |
1149 | default: | |
1150 | break; | |
1151 | } | |
1152 | ||
1153 | /* Don't allow the same zone added twice */ | |
1154 | if (!g_slist_find (priv->configs, config)) | |
1155 | priv->configs = g_slist_append (priv->configs, g_object_ref (config)); | |
1156 | ||
1157 | if (!priv->updates_queue && !update_dns (self, FALSE, &error)) { | |
1158 | _LOGW ("could not commit DNS changes: %s", error->message); | |
1159 | g_clear_error (&error); | |
1160 | } | |
1161 | ||
1162 | return TRUE; | |
1163 | } | |
1164 | ||
1165 | gboolean | |
1166 | nm_dns_manager_remove_ip4_config (NMDnsManager *self, NMIP4Config *config) | |
1167 | { | |
1168 | NMDnsManagerPrivate *priv; | |
1169 | GError *error = NULL; | |
1170 | ||
1171 | g_return_val_if_fail (self != NULL, FALSE); | |
1172 | g_return_val_if_fail (config != NULL, FALSE); | |
1173 | ||
1174 | priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1175 | ||
1176 | /* Can't remove it if it wasn't in the list to begin with */ | |
1177 | if (!g_slist_find (priv->configs, config)) | |
1178 | return FALSE; | |
1179 | ||
1180 | priv->configs = g_slist_remove (priv->configs, config); | |
1181 | ||
1182 | if (config == priv->ip4_vpn_config) | |
1183 | priv->ip4_vpn_config = NULL; | |
1184 | if (config == priv->ip4_device_config) | |
1185 | priv->ip4_device_config = NULL; | |
1186 | ||
1187 | g_object_unref (config); | |
1188 | ||
1189 | if (!priv->updates_queue && !update_dns (self, FALSE, &error)) { | |
1190 | _LOGW ("could not commit DNS changes: %s", error->message); | |
1191 | g_clear_error (&error); | |
1192 | } | |
1193 | ||
1194 | g_object_set_data (G_OBJECT (config), IP_CONFIG_IFACE_TAG, NULL); | |
1195 | ||
1196 | return TRUE; | |
1366 | return nm_dns_manager_add_ip_config (self, iface, config, cfg_type); | |
1197 | 1367 | } |
1198 | 1368 | |
1199 | 1369 | gboolean |
1202 | 1372 | NMIP6Config *config, |
1203 | 1373 | NMDnsIPConfigType cfg_type) |
1204 | 1374 | { |
1375 | return nm_dns_manager_add_ip_config (self, iface, config, cfg_type); | |
1376 | } | |
1377 | ||
1378 | static gboolean | |
1379 | nm_dns_manager_remove_ip_config (NMDnsManager *self, gpointer config) | |
1380 | { | |
1205 | 1381 | NMDnsManagerPrivate *priv; |
1206 | 1382 | GError *error = NULL; |
1207 | ||
1208 | g_return_val_if_fail (self != NULL, FALSE); | |
1209 | g_return_val_if_fail (config != NULL, FALSE); | |
1383 | NMDnsIPConfigData *data; | |
1384 | guint i; | |
1385 | ||
1386 | g_return_val_if_fail (NM_IS_DNS_MANAGER (self), FALSE); | |
1387 | g_return_val_if_fail (config, FALSE); | |
1210 | 1388 | |
1211 | 1389 | priv = NM_DNS_MANAGER_GET_PRIVATE (self); |
1212 | 1390 | |
1213 | g_object_set_data_full (G_OBJECT (config), IP_CONFIG_IFACE_TAG, g_strdup (iface), g_free); | |
1214 | ||
1215 | switch (cfg_type) { | |
1216 | case NM_DNS_IP_CONFIG_TYPE_VPN: | |
1217 | priv->ip6_vpn_config = config; | |
1218 | break; | |
1219 | case NM_DNS_IP_CONFIG_TYPE_BEST_DEVICE: | |
1220 | priv->ip6_device_config = config; | |
1221 | break; | |
1222 | default: | |
1223 | break; | |
1224 | } | |
1225 | ||
1226 | /* Don't allow the same zone added twice */ | |
1227 | if (!g_slist_find (priv->configs, config)) | |
1228 | priv->configs = g_slist_append (priv->configs, g_object_ref (config)); | |
1229 | ||
1230 | if (!priv->updates_queue && !update_dns (self, FALSE, &error)) { | |
1231 | _LOGW ("could not commit DNS changes: %s", error->message); | |
1232 | g_clear_error (&error); | |
1233 | } | |
1234 | ||
1235 | return TRUE; | |
1391 | for (i = 0; i < priv->configs->len; i++) { | |
1392 | data = priv->configs->pdata[i]; | |
1393 | ||
1394 | if (data->config == config) { | |
1395 | forget_data (self, data); | |
1396 | g_ptr_array_remove_index (priv->configs, i); | |
1397 | ||
1398 | if (!priv->updates_queue && !update_dns (self, FALSE, &error)) { | |
1399 | _LOGW ("could not commit DNS changes: %s", error->message); | |
1400 | g_clear_error (&error); | |
1401 | } | |
1402 | ||
1403 | return TRUE; | |
1404 | } | |
1405 | } | |
1406 | return FALSE; | |
1407 | } | |
1408 | ||
1409 | gboolean | |
1410 | nm_dns_manager_remove_ip4_config (NMDnsManager *self, NMIP4Config *config) | |
1411 | { | |
1412 | return nm_dns_manager_remove_ip_config (self, config); | |
1236 | 1413 | } |
1237 | 1414 | |
1238 | 1415 | gboolean |
1239 | 1416 | nm_dns_manager_remove_ip6_config (NMDnsManager *self, NMIP6Config *config) |
1240 | 1417 | { |
1241 | NMDnsManagerPrivate *priv; | |
1242 | GError *error = NULL; | |
1243 | ||
1244 | g_return_val_if_fail (self != NULL, FALSE); | |
1245 | g_return_val_if_fail (config != NULL, FALSE); | |
1246 | ||
1247 | priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1248 | ||
1249 | /* Can't remove it if it wasn't in the list to begin with */ | |
1250 | if (!g_slist_find (priv->configs, config)) | |
1251 | return FALSE; | |
1252 | ||
1253 | priv->configs = g_slist_remove (priv->configs, config); | |
1254 | ||
1255 | if (config == priv->ip6_vpn_config) | |
1256 | priv->ip6_vpn_config = NULL; | |
1257 | if (config == priv->ip6_device_config) | |
1258 | priv->ip6_device_config = NULL; | |
1259 | ||
1260 | g_object_unref (config); | |
1261 | ||
1262 | if (!priv->updates_queue && !update_dns (self, FALSE, &error)) { | |
1263 | _LOGW ("could not commit DNS changes: %s", error->message); | |
1264 | g_clear_error (&error); | |
1265 | } | |
1266 | ||
1267 | g_object_set_data (G_OBJECT (config), IP_CONFIG_IFACE_TAG, NULL); | |
1268 | ||
1269 | return TRUE; | |
1418 | return nm_dns_manager_remove_ip_config (self, config); | |
1270 | 1419 | } |
1271 | 1420 | |
1272 | 1421 | void |
1307 | 1456 | } |
1308 | 1457 | } |
1309 | 1458 | |
1310 | NMDnsManagerResolvConfMode | |
1311 | nm_dns_manager_get_resolv_conf_mode (NMDnsManager *self) | |
1312 | { | |
1313 | return NM_DNS_MANAGER_GET_PRIVATE (self)->resolv_conf_mode; | |
1459 | gboolean | |
1460 | nm_dns_manager_get_resolv_conf_explicit (NMDnsManager *self) | |
1461 | { | |
1462 | NMDnsManagerPrivate *priv; | |
1463 | ||
1464 | g_return_val_if_fail (NM_IS_DNS_MANAGER (self), FALSE); | |
1465 | ||
1466 | priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1467 | ||
1468 | if ( NM_IN_SET (priv->rc_manager, NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED, | |
1469 | NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE) | |
1470 | || priv->plugin) | |
1471 | return FALSE; | |
1472 | ||
1473 | return TRUE; | |
1314 | 1474 | } |
1315 | 1475 | |
1316 | 1476 | void |
1342 | 1502 | |
1343 | 1503 | priv = NM_DNS_MANAGER_GET_PRIVATE (self); |
1344 | 1504 | g_return_if_fail (priv->updates_queue > 0); |
1505 | ||
1506 | if (priv->need_sort) { | |
1507 | g_ptr_array_sort (priv->configs, ip_config_data_ptr_compare); | |
1508 | priv->need_sort = FALSE; | |
1509 | } | |
1345 | 1510 | |
1346 | 1511 | compute_hash (self, nm_config_data_get_global_dns_config (nm_config_get_data (priv->config)), new); |
1347 | 1512 | changed = (memcmp (new, priv->prev_hash, sizeof (new)) != 0) ? TRUE : FALSE; |
1365 | 1530 | |
1366 | 1531 | /******************************************************************/ |
1367 | 1532 | |
1368 | static bool | |
1369 | _get_resconf_immutable (int *immutable_cached) | |
1370 | { | |
1533 | static gboolean | |
1534 | _clear_plugin (NMDnsManager *self) | |
1535 | { | |
1536 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1537 | ||
1538 | if (priv->plugin) { | |
1539 | g_signal_handlers_disconnect_by_func (priv->plugin, plugin_failed, self); | |
1540 | g_signal_handlers_disconnect_by_func (priv->plugin, plugin_child_quit, self); | |
1541 | nm_dns_plugin_stop (priv->plugin); | |
1542 | g_clear_object (&priv->plugin); | |
1543 | return TRUE; | |
1544 | } | |
1545 | priv->plugin_ratelimit.ts = 0; | |
1546 | nm_clear_g_source (&priv->plugin_ratelimit.timer); | |
1547 | return FALSE; | |
1548 | } | |
1549 | ||
1550 | static NMDnsManagerResolvConfManager | |
1551 | _check_resconf_immutable (NMDnsManagerResolvConfManager rc_manager) | |
1552 | { | |
1553 | struct stat st; | |
1371 | 1554 | int fd, flags; |
1372 | int immutable; | |
1373 | ||
1374 | immutable = *immutable_cached; | |
1375 | if (!NM_IN_SET (immutable, FALSE, TRUE)) { | |
1376 | immutable = FALSE; | |
1555 | bool immutable = FALSE; | |
1556 | ||
1557 | switch (rc_manager) { | |
1558 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN: | |
1559 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE: | |
1560 | nm_assert_not_reached (); | |
1561 | /* fall-through */ | |
1562 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED: | |
1563 | return NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED; | |
1564 | default: | |
1565 | ||
1566 | if (lstat (_PATH_RESCONF, &st) != 0) | |
1567 | return rc_manager; | |
1568 | ||
1569 | if (S_ISLNK (st.st_mode)) { | |
1570 | /* only regular files and directories can have extended file attributes. */ | |
1571 | switch (rc_manager) { | |
1572 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK: | |
1573 | /* we don't care whether the link-target is immutable. | |
1574 | * If the symlink points to another file, rc-manager=symlink anyway backs off. | |
1575 | * Otherwise, we would only check whether our internal resolv.conf is immutable. */ | |
1576 | return NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK; | |
1577 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN: | |
1578 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED: | |
1579 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE: | |
1580 | nm_assert_not_reached (); | |
1581 | /* fall-through */ | |
1582 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE: | |
1583 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF: | |
1584 | case NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG: | |
1585 | break; | |
1586 | } | |
1587 | } | |
1588 | ||
1377 | 1589 | fd = open (_PATH_RESCONF, O_RDONLY); |
1378 | 1590 | if (fd != -1) { |
1379 | 1591 | if (ioctl (fd, FS_IOC_GETFLAGS, &flags) != -1) |
1380 | 1592 | immutable = NM_FLAGS_HAS (flags, FS_IMMUTABLE_FL); |
1381 | 1593 | close (fd); |
1382 | 1594 | } |
1383 | *immutable_cached = immutable; | |
1384 | } | |
1385 | return immutable; | |
1595 | return immutable ? NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE : rc_manager; | |
1596 | } | |
1386 | 1597 | } |
1387 | 1598 | |
1388 | 1599 | NM_DEFINE_SINGLETON_GETTER (NMDnsManager, nm_dns_manager_get, NM_TYPE_DNS_MANAGER); |
1389 | 1600 | |
1390 | 1601 | static void |
1391 | init_resolv_conf_mode (NMDnsManager *self) | |
1602 | init_resolv_conf_mode (NMDnsManager *self, gboolean force_reload_plugin) | |
1392 | 1603 | { |
1393 | 1604 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); |
1394 | const char *mode, *mode_unknown; | |
1395 | int immutable = -1; | |
1605 | NMDnsManagerResolvConfManager rc_manager; | |
1606 | const char *mode; | |
1607 | gboolean plugin_changed = FALSE; | |
1396 | 1608 | |
1397 | 1609 | mode = nm_config_data_get_dns_mode (nm_config_get_data (priv->config)); |
1398 | 1610 | |
1399 | if ( priv->mode_initialized | |
1400 | && nm_streq0 (mode, priv->last_mode) | |
1401 | && ( nm_streq0 (mode, "none") | |
1402 | || priv->last_immutable == _get_resconf_immutable (&immutable))) { | |
1403 | /* we call init_resolv_conf_mode() on every SIGHUP to possibly reload | |
1404 | * when either "mode" or "immutable" changed. However, we don't want to | |
1405 | * re-create the plugin, when the paramters didn't actually change. So | |
1406 | * detect that we would recreate the same plugin and return early. */ | |
1407 | return; | |
1408 | } | |
1409 | ||
1410 | priv->mode_initialized = TRUE; | |
1411 | g_free (priv->last_mode); | |
1412 | priv->last_mode = g_strdup (mode); | |
1413 | priv->last_immutable = FALSE; | |
1414 | g_clear_object (&priv->plugin); | |
1415 | priv->resolv_conf_mode = NM_DNS_MANAGER_RESOLV_CONF_UNMANAGED; | |
1416 | ||
1417 | if (nm_streq0 (mode, "none")) { | |
1418 | _LOGI ("%s%s", "set resolv-conf-mode: ", "none"); | |
1419 | return; | |
1420 | } | |
1421 | ||
1422 | priv->last_immutable = _get_resconf_immutable (&immutable); | |
1423 | ||
1424 | if (NM_IN_STRSET (mode, "dnsmasq", "unbound")) { | |
1425 | if (!immutable) | |
1426 | priv->resolv_conf_mode = NM_DNS_MANAGER_RESOLV_CONF_PROXY; | |
1427 | if (nm_streq (mode, "dnsmasq")) | |
1611 | if (nm_streq0 (mode, "none")) | |
1612 | rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED; | |
1613 | else { | |
1614 | const char *man; | |
1615 | ||
1616 | rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN; | |
1617 | man = nm_config_data_get_rc_manager (nm_config_get_data (priv->config)); | |
1618 | ||
1619 | again: | |
1620 | if (!man) { | |
1621 | /* nop */ | |
1622 | } else if (NM_IN_STRSET (man, "symlink", "none")) | |
1623 | rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK; | |
1624 | else if (nm_streq (man, "file")) | |
1625 | rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE; | |
1626 | else if (nm_streq (man, "resolvconf")) | |
1627 | rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF; | |
1628 | else if (nm_streq (man, "netconfig")) | |
1629 | rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG; | |
1630 | else if (nm_streq (man, "unmanaged")) | |
1631 | rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED; | |
1632 | ||
1633 | if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN) { | |
1634 | if (man) { | |
1635 | _LOGW ("init: unknown resolv.conf manager \"%s\", fallback to \"%s\"", | |
1636 | man, ""NM_CONFIG_DEFAULT_DNS_RC_MANAGER); | |
1637 | } | |
1638 | man = ""NM_CONFIG_DEFAULT_DNS_RC_MANAGER; | |
1639 | rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK; | |
1640 | goto again; | |
1641 | } | |
1642 | } | |
1643 | ||
1644 | rc_manager = _check_resconf_immutable (rc_manager); | |
1645 | ||
1646 | if (nm_streq0 (mode, "dnsmasq")) { | |
1647 | if (force_reload_plugin || !NM_IS_DNS_DNSMASQ (priv->plugin)) { | |
1648 | _clear_plugin (self); | |
1428 | 1649 | priv->plugin = nm_dns_dnsmasq_new (); |
1429 | else | |
1650 | plugin_changed = TRUE; | |
1651 | } | |
1652 | } else if (nm_streq0 (mode, "unbound")) { | |
1653 | if (force_reload_plugin || !NM_IS_DNS_UNBOUND (priv->plugin)) { | |
1654 | _clear_plugin (self); | |
1430 | 1655 | priv->plugin = nm_dns_unbound_new (); |
1431 | ||
1656 | plugin_changed = TRUE; | |
1657 | } | |
1658 | } else { | |
1659 | if (!NM_IN_STRSET (mode, "none", "default")) { | |
1660 | if (mode) | |
1661 | _LOGW ("init: unknown dns mode '%s'", mode); | |
1662 | mode = "default"; | |
1663 | } | |
1664 | if (_clear_plugin (self)) | |
1665 | plugin_changed = TRUE; | |
1666 | } | |
1667 | ||
1668 | if (plugin_changed && priv->plugin) { | |
1432 | 1669 | g_signal_connect (priv->plugin, NM_DNS_PLUGIN_FAILED, G_CALLBACK (plugin_failed), self); |
1433 | 1670 | g_signal_connect (priv->plugin, NM_DNS_PLUGIN_CHILD_QUIT, G_CALLBACK (plugin_child_quit), self); |
1434 | ||
1435 | _NMLOG (immutable ? LOGL_WARN : LOGL_INFO, | |
1436 | "%s%s%s%s%s%s", | |
1437 | "set resolv-conf-mode: ", | |
1438 | immutable ? "none" : mode, | |
1439 | ", plugin=\"", nm_dns_plugin_get_name (priv->plugin), "\"", | |
1440 | immutable ? ", resolv.conf immutable" : ""); | |
1441 | return; | |
1442 | } | |
1443 | ||
1444 | if (!immutable) | |
1445 | priv->resolv_conf_mode = NM_DNS_MANAGER_RESOLV_CONF_EXPLICIT; | |
1446 | ||
1447 | mode_unknown = mode && !nm_streq (mode, "default") ? mode : NULL; | |
1448 | _NMLOG (mode_unknown ? LOGL_WARN : LOGL_INFO, | |
1449 | "%s%s%s%s%s%s", | |
1450 | "set resolv-conf-mode: ", | |
1451 | immutable ? "none" : "default", | |
1452 | NM_PRINT_FMT_QUOTED (mode_unknown, " -- unknown configuration '", mode_unknown, "'", ""), | |
1453 | immutable ? ", resolv.conf immutable" : ""); | |
1454 | } | |
1455 | ||
1456 | static void | |
1457 | init_resolv_conf_manager (NMDnsManager *self) | |
1458 | { | |
1459 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1460 | const char *man; | |
1461 | ||
1462 | man = nm_config_data_get_rc_manager (nm_config_get_data (priv->config)); | |
1463 | if (!g_strcmp0 (man, "none")) | |
1464 | priv->rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE; | |
1465 | else if (nm_streq0 (man, "file")) | |
1466 | priv->rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE; | |
1467 | else if (!g_strcmp0 (man, "resolvconf")) | |
1468 | priv->rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF; | |
1469 | else if (!g_strcmp0 (man, "netconfig")) | |
1470 | priv->rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG; | |
1471 | else { | |
1472 | #if defined(RESOLVCONF_SELECTED) | |
1473 | priv->rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF; | |
1474 | #elif defined(NETCONFIG_SELECTED) | |
1475 | priv->rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG; | |
1476 | #else | |
1477 | priv->rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE; | |
1478 | #endif | |
1479 | if (man) | |
1480 | _LOGW ("unknown resolv.conf manager '%s'", man); | |
1481 | } | |
1482 | ||
1483 | _LOGI ("using resolv.conf manager '%s'", _rc_manager_to_string (priv->rc_manager)); | |
1671 | } | |
1672 | ||
1673 | if ( plugin_changed | |
1674 | || priv->rc_manager != rc_manager) { | |
1675 | priv->rc_manager = rc_manager; | |
1676 | _LOGI ("init: dns=%s, rc-manager=%s%s%s%s", | |
1677 | mode, _rc_manager_to_string (rc_manager), | |
1678 | NM_PRINT_FMT_QUOTED (priv->plugin, ", plugin=", nm_dns_plugin_get_name (priv->plugin), "", "")); | |
1679 | } | |
1484 | 1680 | } |
1485 | 1681 | |
1486 | 1682 | static void |
1493 | 1689 | GError *error = NULL; |
1494 | 1690 | |
1495 | 1691 | if (NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_DNS_MODE | |
1496 | NM_CONFIG_CHANGE_SIGHUP)) { | |
1692 | NM_CONFIG_CHANGE_RC_MANAGER | | |
1693 | NM_CONFIG_CHANGE_CAUSE_SIGHUP | | |
1694 | NM_CONFIG_CHANGE_CAUSE_DNS_FULL)) { | |
1497 | 1695 | /* reload the resolv-conf mode also on SIGHUP (when DNS_MODE didn't change). |
1498 | 1696 | * The reason is, that the configuration also depends on whether resolv.conf |
1499 | 1697 | * is immutable, thus, without the configuration changing, we always want to |
1500 | 1698 | * re-configure the mode. */ |
1501 | init_resolv_conf_mode (self); | |
1502 | } | |
1503 | ||
1504 | if (NM_FLAGS_HAS (changes, NM_CONFIG_CHANGE_RC_MANAGER)) | |
1505 | init_resolv_conf_manager (self); | |
1506 | ||
1507 | if (NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_SIGHUP | | |
1508 | NM_CONFIG_CHANGE_SIGUSR1 | | |
1699 | init_resolv_conf_mode (self, | |
1700 | NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_CAUSE_SIGHUP | |
1701 | | NM_CONFIG_CHANGE_CAUSE_DNS_FULL)); | |
1702 | } | |
1703 | ||
1704 | if (NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_CAUSE_SIGHUP | | |
1705 | NM_CONFIG_CHANGE_CAUSE_SIGUSR1 | | |
1706 | NM_CONFIG_CHANGE_CAUSE_DNS_RC | | |
1707 | NM_CONFIG_CHANGE_CAUSE_DNS_FULL | | |
1509 | 1708 | NM_CONFIG_CHANGE_DNS_MODE | |
1510 | 1709 | NM_CONFIG_CHANGE_RC_MANAGER | |
1511 | 1710 | NM_CONFIG_CHANGE_GLOBAL_DNS_CONFIG)) { |
1512 | if (!update_dns (self, TRUE, &error)) { | |
1711 | if (!update_dns (self, FALSE, &error)) { | |
1513 | 1712 | _LOGW ("could not commit DNS changes: %s", error->message); |
1514 | 1713 | g_clear_error (&error); |
1515 | 1714 | } |
1524 | 1723 | _LOGT ("creating..."); |
1525 | 1724 | |
1526 | 1725 | priv->config = g_object_ref (nm_config_get ()); |
1726 | priv->configs = g_ptr_array_new_full (8, ip_config_data_destroy); | |
1727 | ||
1527 | 1728 | /* Set the initial hash */ |
1528 | compute_hash (self, nm_config_data_get_global_dns_config (nm_config_get_data (priv->config)), | |
1529 | NM_DNS_MANAGER_GET_PRIVATE (self)->hash); | |
1729 | compute_hash (self, NULL, NM_DNS_MANAGER_GET_PRIVATE (self)->hash); | |
1530 | 1730 | |
1531 | 1731 | g_signal_connect (G_OBJECT (priv->config), |
1532 | 1732 | NM_CONFIG_SIGNAL_CONFIG_CHANGED, |
1533 | 1733 | G_CALLBACK (config_changed_cb), |
1534 | 1734 | self); |
1535 | init_resolv_conf_mode (self); | |
1536 | init_resolv_conf_manager (self); | |
1735 | init_resolv_conf_mode (self, TRUE); | |
1537 | 1736 | } |
1538 | 1737 | |
1539 | 1738 | static void |
1541 | 1740 | { |
1542 | 1741 | NMDnsManager *self = NM_DNS_MANAGER (object); |
1543 | 1742 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); |
1743 | NMDnsIPConfigData *data; | |
1544 | 1744 | GError *error = NULL; |
1745 | guint i; | |
1545 | 1746 | |
1546 | 1747 | _LOGT ("disposing"); |
1547 | 1748 | |
1548 | if (priv->plugin) { | |
1549 | g_signal_handlers_disconnect_by_func (priv->plugin, plugin_failed, self); | |
1550 | g_signal_handlers_disconnect_by_func (priv->plugin, plugin_child_quit, self); | |
1551 | g_clear_object (&priv->plugin); | |
1552 | } | |
1553 | ||
1554 | g_clear_pointer (&priv->last_mode, g_free); | |
1749 | _clear_plugin (self); | |
1555 | 1750 | |
1556 | 1751 | /* If we're quitting, leave a valid resolv.conf in place, not one |
1557 | 1752 | * pointing to 127.0.0.1 if any plugins were active. Thus update |
1569 | 1764 | g_clear_object (&priv->config); |
1570 | 1765 | } |
1571 | 1766 | |
1572 | g_slist_free_full (priv->configs, g_object_unref); | |
1573 | priv->configs = NULL; | |
1767 | if (priv->configs) { | |
1768 | for (i = 0; i < priv->configs->len; i++) { | |
1769 | data = priv->configs->pdata[i]; | |
1770 | forget_data (self, data); | |
1771 | } | |
1772 | g_ptr_array_free (priv->configs, TRUE); | |
1773 | priv->configs = NULL; | |
1774 | } | |
1775 | ||
1776 | nm_clear_g_source (&priv->plugin_ratelimit.timer); | |
1574 | 1777 | |
1575 | 1778 | G_OBJECT_CLASS (nm_dns_manager_parent_class)->dispose (object); |
1576 | 1779 | } |
1578 | 1781 | static void |
1579 | 1782 | finalize (GObject *object) |
1580 | 1783 | { |
1581 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (object); | |
1784 | NMDnsManager *self = NM_DNS_MANAGER (object); | |
1785 | NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); | |
1582 | 1786 | |
1583 | 1787 | g_free (priv->hostname); |
1584 | 1788 | |
1589 | 1793 | nm_dns_manager_class_init (NMDnsManagerClass *klass) |
1590 | 1794 | { |
1591 | 1795 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
1592 | ||
1593 | g_type_class_add_private (object_class, sizeof (NMDnsManagerPrivate)); | |
1594 | 1796 | |
1595 | 1797 | /* virtual methods */ |
1596 | 1798 | object_class->dispose = dispose; |
1601 | 1803 | g_signal_new (NM_DNS_MANAGER_CONFIG_CHANGED, |
1602 | 1804 | G_OBJECT_CLASS_TYPE (object_class), |
1603 | 1805 | G_SIGNAL_RUN_FIRST, |
1604 | G_STRUCT_OFFSET (NMDnsManagerClass, config_changed), | |
1605 | NULL, NULL, | |
1806 | 0, NULL, NULL, | |
1606 | 1807 | g_cclosure_marshal_VOID__VOID, |
1607 | 1808 | G_TYPE_NONE, 0); |
1608 | 1809 | } |
27 | 27 | #include "nm-ip4-config.h" |
28 | 28 | #include "nm-ip6-config.h" |
29 | 29 | |
30 | G_BEGIN_DECLS | |
31 | ||
30 | 32 | typedef enum { |
31 | 33 | NM_DNS_IP_CONFIG_TYPE_DEFAULT = 0, |
32 | 34 | NM_DNS_IP_CONFIG_TYPE_BEST_DEVICE, |
33 | 35 | NM_DNS_IP_CONFIG_TYPE_VPN |
34 | 36 | } NMDnsIPConfigType; |
35 | 37 | |
36 | G_BEGIN_DECLS | |
38 | enum { | |
39 | NM_DNS_PRIORITY_DEFAULT_NORMAL = 100, | |
40 | NM_DNS_PRIORITY_DEFAULT_VPN = 50, | |
41 | }; | |
42 | ||
43 | typedef struct { | |
44 | gpointer config; | |
45 | NMDnsIPConfigType type; | |
46 | char *iface; | |
47 | } NMDnsIPConfigData; | |
37 | 48 | |
38 | 49 | #define NM_TYPE_DNS_MANAGER (nm_dns_manager_get_type ()) |
39 | 50 | #define NM_DNS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_DNS_MANAGER, NMDnsManager)) |
44 | 55 | |
45 | 56 | #define NM_DNS_MANAGER_CONFIG_CHANGED "config-changed" |
46 | 57 | |
47 | typedef struct { | |
48 | GObject parent; | |
49 | } NMDnsManager; | |
50 | ||
51 | typedef struct { | |
52 | GObjectClass parent; | |
53 | ||
54 | /* Signals */ | |
55 | void (*config_changed) (NMDnsManager *mgr); | |
56 | } NMDnsManagerClass; | |
58 | typedef struct _NMDnsManager NMDnsManager; | |
59 | typedef struct _NMDnsManagerClass NMDnsManagerClass; | |
57 | 60 | |
58 | 61 | GType nm_dns_manager_get_type (void); |
59 | 62 | |
83 | 86 | const char *hostname); |
84 | 87 | |
85 | 88 | /** |
86 | * NMDnsManagerResolvConfMode: | |
87 | * @NM_DNS_MANAGER_RESOLV_CONF_UNMANAGED: NM is not managing resolv.conf | |
88 | * @NM_DNS_MANAGER_RESOLV_CONF_EXPLICIT: NM is managing resolv.conf by | |
89 | * adding and removing "nameserver" lines corresponding to the currently | |
90 | * active connections | |
91 | * @NM_DNS_MANAGER_RESOLV_CONF_PROXY: NM is managing resolv.conf by | |
92 | * pointing it to some other service (eg, dnsmasq) that knows the | |
93 | * nameservers corresponding to the currently active connections. | |
94 | * | |
95 | * NMDnsManager's behavior toward /etc/resolv.conf. | |
96 | */ | |
97 | typedef enum { | |
98 | NM_DNS_MANAGER_RESOLV_CONF_UNMANAGED, | |
99 | NM_DNS_MANAGER_RESOLV_CONF_EXPLICIT, | |
100 | NM_DNS_MANAGER_RESOLV_CONF_PROXY | |
101 | } NMDnsManagerResolvConfMode; | |
102 | ||
103 | /** | |
104 | 89 | * NMDnsManagerResolvConfManager |
105 | * @_NM_DNS_MANAGER_RESOLV_CONF_MAN_INTERNAL_ONLY: dummy-manager | |
106 | * to not write resolv.conf at all, only the internal file in | |
107 | * NM's run state directory. | |
108 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE: NM writes resolv.conf | |
90 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN: unspecified rc-manager. | |
91 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED: do not touch /etc/resolv.conf | |
92 | * (but still write the internal copy -- unless it is symlinked by | |
93 | * /etc/resolv.conf) | |
94 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE: similar to "unmanaged", | |
95 | * but indicates that resolv.conf cannot be modified. | |
96 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK: NM writes resolv.conf | |
109 | 97 | * by symlinking it to the run state directory. |
110 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE: Like NONE, but instead of symlinking | |
111 | * resolv.conf, write it as a file. | |
98 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE: Like SYMLINK, but instead of | |
99 | * symlinking /etc/resolv.conf, write it as a file. | |
112 | 100 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF: NM is managing resolv.conf |
113 | 101 | through resolvconf |
114 | 102 | * @NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG: NM is managing resolv.conf |
117 | 105 | * NMDnsManager's management of resolv.conf |
118 | 106 | */ |
119 | 107 | typedef enum { |
120 | _NM_DNS_MANAGER_RESOLV_CONF_MAN_INTERNAL_ONLY, | |
121 | NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE, | |
108 | NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN, | |
109 | NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED, | |
110 | NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE, | |
111 | NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK, | |
122 | 112 | NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE, |
123 | 113 | NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF, |
124 | 114 | NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG, |
125 | 115 | } NMDnsManagerResolvConfManager; |
126 | 116 | |
127 | NMDnsManagerResolvConfMode nm_dns_manager_get_resolv_conf_mode (NMDnsManager *self); | |
117 | gboolean nm_dns_manager_get_resolv_conf_explicit (NMDnsManager *self); | |
128 | 118 | |
129 | 119 | G_END_DECLS |
130 | 120 |
73 | 73 | |
74 | 74 | gboolean |
75 | 75 | nm_dns_plugin_update (NMDnsPlugin *self, |
76 | const GSList *vpn_configs, | |
77 | const GSList *dev_configs, | |
78 | const GSList *other_configs, | |
76 | const NMDnsIPConfigData **configs, | |
79 | 77 | const NMGlobalDnsConfig *global_config, |
80 | 78 | const char *hostname) |
81 | 79 | { |
82 | 80 | g_return_val_if_fail (NM_DNS_PLUGIN_GET_CLASS (self)->update != NULL, FALSE); |
83 | 81 | |
84 | 82 | return NM_DNS_PLUGIN_GET_CLASS (self)->update (self, |
85 | vpn_configs, | |
86 | dev_configs, | |
87 | other_configs, | |
83 | configs, | |
88 | 84 | global_config, |
89 | 85 | hostname); |
90 | 86 | } |
178 | 174 | _clear_pidfile (self); |
179 | 175 | |
180 | 176 | g_signal_emit (self, signals[CHILD_QUIT], 0, status); |
177 | } | |
178 | ||
179 | GPid | |
180 | nm_dns_plugin_child_pid (NMDnsPlugin *self) | |
181 | { | |
182 | NMDnsPluginPrivate *priv; | |
183 | ||
184 | g_return_val_if_fail (NM_IS_DNS_PLUGIN (self), 0); | |
185 | ||
186 | priv = NM_DNS_PLUGIN_GET_PRIVATE (self); | |
187 | return priv->pid; | |
181 | 188 | } |
182 | 189 | |
183 | 190 | GPid |
223 | 230 | _LOGD ("%s started with pid %d", progname, pid); |
224 | 231 | priv->watch_id = g_child_watch_add (pid, (GChildWatchFunc) watch_cb, self); |
225 | 232 | priv->pid = pid; |
226 | priv->progname = nm_unauto (&progname); | |
233 | priv->progname = g_steal_pointer (&progname); | |
227 | 234 | priv->pidfile = g_strdup (pidfile); |
228 | 235 | |
229 | 236 | return pid; |
246 | 253 | return TRUE; |
247 | 254 | } |
248 | 255 | |
256 | void | |
257 | nm_dns_plugin_stop (NMDnsPlugin *self) | |
258 | { | |
259 | nm_dns_plugin_child_kill (self); | |
260 | } | |
261 | ||
249 | 262 | /********************************************/ |
250 | 263 | |
251 | 264 | static void |
258 | 271 | { |
259 | 272 | NMDnsPlugin *self = NM_DNS_PLUGIN (object); |
260 | 273 | |
261 | nm_dns_plugin_child_kill (self); | |
274 | nm_dns_plugin_stop (self); | |
262 | 275 | |
263 | 276 | G_OBJECT_CLASS (nm_dns_plugin_parent_class)->dispose (object); |
264 | 277 | } |
19 | 19 | #define __NETWORKMANAGER_DNS_PLUGIN_H__ |
20 | 20 | |
21 | 21 | #include "nm-default.h" |
22 | #include "nm-dns-manager.h" | |
22 | 23 | |
23 | 24 | #include "nm-config-data.h" |
24 | 25 | |
32 | 33 | #define NM_DNS_PLUGIN_FAILED "failed" |
33 | 34 | #define NM_DNS_PLUGIN_CHILD_QUIT "child-quit" |
34 | 35 | |
35 | #define IP_CONFIG_IFACE_TAG "dns-manager-iface" | |
36 | ||
37 | 36 | typedef struct { |
38 | 37 | GObject parent; |
39 | 38 | } NMDnsPlugin; |
43 | 42 | |
44 | 43 | /* Methods */ |
45 | 44 | |
46 | /* Called when DNS information is changed. 'vpn_configs' is a list of | |
47 | * NMIP4Config or NMIP6Config objects from VPN connections, while | |
48 | * 'dev_configs' is a list of NMPI4Config or NMIP6Config objects from | |
49 | * active devices. 'other_configs' represent other IP configuration that | |
50 | * may be in-use. 'global_config' is the optional global DNS | |
51 | * configuration. Configs of the same IP version are sorted in priority | |
52 | * order. | |
45 | /* Called when DNS information is changed. 'configs' is an array | |
46 | * of pointers to NMDnsIPConfigData sorted by priority. | |
47 | * 'global_config' is the optional global DNS | |
48 | * configuration. | |
53 | 49 | */ |
54 | 50 | gboolean (*update) (NMDnsPlugin *self, |
55 | const GSList *vpn_configs, | |
56 | const GSList *dev_configs, | |
57 | const GSList *other_configs, | |
51 | const NMDnsIPConfigData **configs, | |
58 | 52 | const NMGlobalDnsConfig *global_config, |
59 | 53 | const char *hostname); |
60 | 54 | |
91 | 85 | const char *nm_dns_plugin_get_name (NMDnsPlugin *self); |
92 | 86 | |
93 | 87 | gboolean nm_dns_plugin_update (NMDnsPlugin *self, |
94 | const GSList *vpn_configs, | |
95 | const GSList *dev_configs, | |
96 | const GSList *other_configs, | |
88 | const NMDnsIPConfigData **configs, | |
97 | 89 | const NMGlobalDnsConfig *global_config, |
98 | 90 | const char *hostname); |
91 | ||
92 | void nm_dns_plugin_stop (NMDnsPlugin *self); | |
99 | 93 | |
100 | 94 | /* For subclasses/plugins */ |
101 | 95 | |
110 | 104 | const char *pidfile, |
111 | 105 | const char *kill_match); |
112 | 106 | |
107 | GPid nm_dns_plugin_child_pid (NMDnsPlugin *self); | |
108 | ||
113 | 109 | gboolean nm_dns_plugin_child_kill (NMDnsPlugin *self); |
114 | 110 | |
115 | 111 | #endif /* __NETWORKMANAGER_DNS_PLUGIN_H__ */ |
27 | 27 | |
28 | 28 | static gboolean |
29 | 29 | update (NMDnsPlugin *plugin, |
30 | const GSList *vpn_configs, | |
31 | const GSList *dev_configs, | |
32 | const GSList *other_configs, | |
30 | const NMDnsIPConfigData **configs, | |
33 | 31 | const NMGlobalDnsConfig *global_config, |
34 | 32 | const char *hostname) |
35 | 33 | { |
0 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | |
1 | /* This program is free software; you can redistribute it and/or modify | |
2 | * it under the terms of the GNU General Public License as published by | |
3 | * the Free Software Foundation; either version 2, or (at your option) | |
4 | * any later version. | |
5 | * | |
6 | * This program is distributed in the hope that it will be useful, | |
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | * GNU General Public License for more details. | |
10 | * | |
11 | * You should have received a copy of the GNU General Public License along | |
12 | * with this program; if not, write to the Free Software Foundation, Inc., | |
13 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
14 | * | |
15 | * Copyright (C) 2010 Red Hat, Inc. | |
16 | * | |
17 | */ | |
18 | ||
19 | #include "nm-default.h" | |
20 | ||
21 | #include <arpa/inet.h> | |
22 | #include <string.h> | |
23 | ||
24 | #include "nm-dns-utils.h" | |
25 | #include "nm-platform.h" | |
26 | #include "nm-utils.h" | |
27 | ||
28 | static void | |
29 | add_ip4_to_rdns_array (guint32 ip, GPtrArray *domains) /* network byte order */ | |
30 | { | |
31 | guint32 defprefix; | |
32 | guchar *p; | |
33 | char *str = NULL; | |
34 | int i; | |
35 | ||
36 | defprefix = nm_utils_ip4_get_default_prefix (ip); | |
37 | ||
38 | /* Convert to host byte order, mask the host bits, and convert back */ | |
39 | ip = ntohl (ip); | |
40 | ip &= 0xFFFFFFFF << (32 - defprefix); | |
41 | ip = htonl (ip); | |
42 | p = (guchar *) &ip; | |
43 | ||
44 | if (defprefix == 8) | |
45 | str = g_strdup_printf ("%u.in-addr.arpa", p[0] & 0xFF); | |
46 | else if (defprefix == 16) | |
47 | str = g_strdup_printf ("%u.%u.in-addr.arpa", p[1] & 0xFF, p[0] & 0xFF); | |
48 | else if (defprefix == 24) | |
49 | str = g_strdup_printf ("%u.%u.%u.in-addr.arpa", p[2] & 0xFF, p[1] & 0xFF, p[0] & 0xFF); | |
50 | ||
51 | if (!str) { | |
52 | g_return_if_fail (str != NULL); | |
53 | return; | |
54 | } | |
55 | ||
56 | /* Suppress duplicates */ | |
57 | for (i = 0; i < domains->len; i++) { | |
58 | if (strcmp (str, g_ptr_array_index (domains, i)) == 0) | |
59 | break; | |
60 | } | |
61 | ||
62 | if (i == domains->len) | |
63 | g_ptr_array_add (domains, str); | |
64 | else | |
65 | g_free (str); | |
66 | } | |
67 | ||
68 | char ** | |
69 | nm_dns_utils_get_ip4_rdns_domains (NMIP4Config *ip4) | |
70 | { | |
71 | GPtrArray *domains = NULL; | |
72 | int i; | |
73 | ||
74 | g_return_val_if_fail (ip4 != NULL, NULL); | |
75 | ||
76 | domains = g_ptr_array_sized_new (5); | |
77 | ||
78 | /* To calculate the reverse DNS domains for this IP4 config, we take | |
79 | * all the IP addresses and routes in the config, calculate the network | |
80 | * portion, and convert that to classful, and use the network bits for | |
81 | * the final domain. FIXME: better handle classless routing, which might | |
82 | * require us to add multiple domains for each actual network prefix to | |
83 | * cover all the separate networks in that block. | |
84 | */ | |
85 | ||
86 | for (i = 0; i < nm_ip4_config_get_num_addresses (ip4); i++) { | |
87 | const NMPlatformIP4Address *address = nm_ip4_config_get_address (ip4, i); | |
88 | ||
89 | add_ip4_to_rdns_array (address->address, domains); | |
90 | } | |
91 | ||
92 | for (i = 0; i < nm_ip4_config_get_num_routes (ip4); i++) { | |
93 | const NMPlatformIP4Route *route = nm_ip4_config_get_route (ip4, i); | |
94 | ||
95 | add_ip4_to_rdns_array (route->network, domains); | |
96 | } | |
97 | ||
98 | /* Terminating NULL so we can use g_strfreev() to free it */ | |
99 | g_ptr_array_add (domains, NULL); | |
100 | ||
101 | /* Free the array and return NULL if the only element was the ending NULL */ | |
102 | return (char **) g_ptr_array_free (domains, (domains->len == 1)); | |
103 | } | |
104 |
0 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | |
1 | /* This program is free software; you can redistribute it and/or modify | |
2 | * it under the terms of the GNU General Public License as published by | |
3 | * the Free Software Foundation; either version 2, or (at your option) | |
4 | * any later version. | |
5 | * | |
6 | * This program is distributed in the hope that it will be useful, | |
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | * GNU General Public License for more details. | |
10 | * | |
11 | * You should have received a copy of the GNU General Public License along | |
12 | * with this program; if not, write to the Free Software Foundation, Inc., | |
13 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
14 | * | |
15 | * Copyright (C) 2010 Red Hat, Inc. | |
16 | * | |
17 | */ | |
18 | ||
19 | #ifndef __NETWORKMANAGER_DNS_UTILS_H__ | |
20 | #define __NETWORKMANAGER_DNS_UTILS_H__ | |
21 | ||
22 | #include "nm-ip4-config.h" | |
23 | ||
24 | char **nm_dns_utils_get_ip4_rdns_domains (NMIP4Config *ip4); | |
25 | ||
26 | #endif /* NM_DNS_UTILS_H */ | |
27 |
164 | 164 | /*******************************************/ |
165 | 165 | |
166 | 166 | static void |
167 | dm_exit_code (guint dm_exit_status) | |
168 | { | |
169 | char *msg = "Unknown error"; | |
170 | ||
171 | switch (dm_exit_status) { | |
172 | case 1: | |
173 | msg = "Configuration problem"; | |
174 | break; | |
175 | case 2: | |
176 | msg = "Network access problem (address in use; permissions; etc)"; | |
177 | break; | |
178 | case 3: | |
179 | msg = "Filesystem problem (missing file/directory; permissions; etc)"; | |
180 | break; | |
181 | case 4: | |
182 | msg = "Memory allocation failure"; | |
183 | break; | |
184 | case 5: | |
185 | msg = "Other problem"; | |
186 | break; | |
187 | default: | |
188 | if (dm_exit_status >= 11) | |
189 | msg = "Lease-script 'init' process failure"; | |
190 | break; | |
191 | } | |
192 | ||
193 | _LOGW ("dnsmasq exited with error: %s (%d)", msg, dm_exit_status); | |
194 | } | |
195 | ||
196 | static void | |
197 | 167 | dm_watch_cb (GPid pid, gint status, gpointer user_data) |
198 | 168 | { |
199 | 169 | NMDnsMasqManager *manager = NM_DNSMASQ_MANAGER (user_data); |
202 | 172 | |
203 | 173 | if (WIFEXITED (status)) { |
204 | 174 | err = WEXITSTATUS (status); |
205 | if (err != 0) | |
206 | dm_exit_code (err); | |
175 | if (err != 0) { | |
176 | _LOGW ("dnsmasq exited with error: %s", | |
177 | nm_utils_dnsmasq_status_to_string (err, NULL, 0)); | |
178 | } | |
207 | 179 | } else if (WIFSTOPPED (status)) { |
208 | 180 | _LOGW ("dnsmasq stopped unexpectedly with signal %d", WSTOPSIG (status)); |
209 | 181 | } else if (WIFSIGNALED (status)) { |
520 | 520 | NM = @NM@ |
521 | 521 | NMEDIT = @NMEDIT@ |
522 | 522 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
523 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
523 | 524 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
524 | 525 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
525 | 526 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
187 | 187 | void |
188 | 188 | nm_main_config_reload (int signal) |
189 | 189 | { |
190 | NMConfigChangeFlags reload_flags; | |
191 | ||
192 | switch (signal) { | |
193 | case SIGHUP: | |
194 | reload_flags = NM_CONFIG_CHANGE_CAUSE_SIGHUP; | |
195 | break; | |
196 | case SIGUSR1: | |
197 | reload_flags = NM_CONFIG_CHANGE_CAUSE_SIGUSR1; | |
198 | break; | |
199 | case SIGUSR2: | |
200 | reload_flags = NM_CONFIG_CHANGE_CAUSE_SIGUSR2; | |
201 | break; | |
202 | default: | |
203 | g_return_if_reached (); | |
204 | } | |
205 | ||
190 | 206 | nm_log_info (LOGD_CORE, "reload configuration (signal %s)...", strsignal (signal)); |
207 | ||
191 | 208 | /* The signal handler thread is only installed after |
192 | 209 | * creating NMConfig instance, and on shut down we |
193 | 210 | * no longer run the mainloop (to reach this point). |
194 | 211 | * |
195 | 212 | * Hence, a NMConfig singleton instance must always be |
196 | 213 | * available. */ |
197 | nm_config_reload (nm_config_get (), signal); | |
214 | nm_config_reload (nm_config_get (), reload_flags); | |
198 | 215 | } |
199 | 216 | |
200 | 217 | static void |
20 | 20 | #include "nm-default.h" |
21 | 21 | |
22 | 22 | #include "nm-active-connection.h" |
23 | ||
24 | #include "nm-common-macros.h" | |
23 | 25 | #include "nm-dbus-interface.h" |
24 | 26 | #include "nm-device.h" |
25 | 27 | #include "nm-settings-connection.h" |
69 | 71 | gpointer user_data2; |
70 | 72 | } NMActiveConnectionPrivate; |
71 | 73 | |
72 | enum { | |
73 | PROP_0, | |
74 | NM_GOBJECT_PROPERTIES_DEFINE (NMActiveConnection, | |
74 | 75 | PROP_CONNECTION, |
75 | 76 | PROP_ID, |
76 | 77 | PROP_UUID, |
92 | 93 | PROP_INT_SUBJECT, |
93 | 94 | PROP_INT_MASTER, |
94 | 95 | PROP_INT_MASTER_READY, |
95 | ||
96 | LAST_PROP | |
97 | }; | |
96 | ); | |
98 | 97 | |
99 | 98 | enum { |
100 | 99 | DEVICE_CHANGED, |
136 | 135 | |
137 | 136 | /****************************************************************/ |
138 | 137 | |
138 | static void | |
139 | _settings_connection_updated (NMSettingsConnection *connection, | |
140 | gboolean by_user, | |
141 | gpointer user_data) | |
142 | { | |
143 | NMActiveConnection *self = user_data; | |
144 | ||
145 | /* we don't know which properties actually changed. Just to be sure, | |
146 | * notify about all possible properties. After all, an update of a | |
147 | * connection is a rare event. */ | |
148 | ||
149 | _notify (self, PROP_ID); | |
150 | ||
151 | /* it's a bit odd to update the TYPE of an active connection. But the alternative | |
152 | * is unexpected too. */ | |
153 | _notify (self, PROP_TYPE); | |
154 | ||
155 | /* currently, the UUID and the exported CONNECTION path cannot change. Later, we might | |
156 | * want to support a re-link operation, which associates an active-connection with a different | |
157 | * settings-connection. */ | |
158 | } | |
159 | ||
160 | static void | |
161 | _set_settings_connection (NMActiveConnection *self, NMSettingsConnection *connection) | |
162 | { | |
163 | NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); | |
164 | ||
165 | if (priv->settings_connection == connection) | |
166 | return; | |
167 | if (priv->settings_connection) { | |
168 | g_signal_handlers_disconnect_by_func (priv->settings_connection, _settings_connection_updated, self); | |
169 | g_clear_object (&priv->settings_connection); | |
170 | } | |
171 | if (connection) { | |
172 | priv->settings_connection = g_object_ref (connection); | |
173 | g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, (GCallback) _settings_connection_updated, self); | |
174 | } | |
175 | } | |
176 | ||
139 | 177 | NMActiveConnectionState |
140 | 178 | nm_active_connection_get_state (NMActiveConnection *self) |
141 | 179 | { |
163 | 201 | old_state = priv->state; |
164 | 202 | priv->state = new_state; |
165 | 203 | priv->state_set = TRUE; |
166 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE); | |
204 | _notify (self, PROP_STATE); | |
167 | 205 | |
168 | 206 | check_master_ready (self); |
169 | 207 | |
185 | 223 | |
186 | 224 | if ( new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED |
187 | 225 | || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { |
188 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG); | |
189 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP4_CONFIG); | |
190 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG); | |
191 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP6_CONFIG); | |
226 | _notify (self, PROP_IP4_CONFIG); | |
227 | _notify (self, PROP_DHCP4_CONFIG); | |
228 | _notify (self, PROP_IP6_CONFIG); | |
229 | _notify (self, PROP_DHCP6_CONFIG); | |
192 | 230 | } |
193 | 231 | |
194 | 232 | if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) { |
197 | 235 | * which will be NULL due to conditions in get_property(). |
198 | 236 | */ |
199 | 237 | _device_cleanup (self); |
200 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES); | |
238 | _notify (self, PROP_DEVICES); | |
201 | 239 | } |
202 | 240 | } |
203 | 241 | |
275 | 313 | * For example, we'd have to cancel all pending seret requests. */ |
276 | 314 | g_return_if_fail (!nm_exported_object_is_exported (NM_EXPORTED_OBJECT (self))); |
277 | 315 | |
278 | priv->settings_connection = g_object_ref (connection); | |
316 | _set_settings_connection (self, connection); | |
279 | 317 | priv->applied_connection = nm_simple_connection_new_clone (NM_CONNECTION (priv->settings_connection)); |
280 | 318 | nm_connection_clear_secrets (priv->applied_connection); |
281 | 319 | } |
338 | 376 | |
339 | 377 | g_free (priv->specific_object); |
340 | 378 | priv->specific_object = g_strdup (specific_object); |
341 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT); | |
379 | _notify (self, PROP_SPECIFIC_OBJECT); | |
342 | 380 | } |
343 | 381 | |
344 | 382 | void |
355 | 393 | return; |
356 | 394 | |
357 | 395 | priv->is_default = is_default; |
358 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT); | |
396 | _notify (self, PROP_DEFAULT); | |
359 | 397 | } |
360 | 398 | |
361 | 399 | gboolean |
380 | 418 | return; |
381 | 419 | |
382 | 420 | priv->is_default6 = is_default6; |
383 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT6); | |
421 | _notify (self, PROP_DEFAULT6); | |
384 | 422 | } |
385 | 423 | |
386 | 424 | gboolean |
523 | 561 | g_warn_if_fail (priv->state > NM_ACTIVE_CONNECTION_STATE_UNKNOWN); |
524 | 562 | priv->device = NULL; |
525 | 563 | } |
526 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_INT_DEVICE); | |
564 | _notify (self, PROP_INT_DEVICE); | |
527 | 565 | |
528 | 566 | g_signal_emit (self, signals[DEVICE_CHANGED], 0, priv->device, old_device); |
529 | 567 | |
530 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES); | |
568 | _notify (self, PROP_DEVICES); | |
531 | 569 | |
532 | 570 | return TRUE; |
533 | 571 | } |
588 | 626 | |
589 | 627 | if (signalling) { |
590 | 628 | priv->master_ready = TRUE; |
591 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_INT_MASTER_READY); | |
629 | _notify (self, PROP_INT_MASTER_READY); | |
592 | 630 | |
593 | 631 | /* Also notify clients to recheck the exported 'master' property to |
594 | 632 | * ensure that if the master connection was created without a device |
595 | 633 | * that we notify clients when the master device is known. |
596 | 634 | */ |
597 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_MASTER); | |
635 | _notify (self, PROP_MASTER); | |
598 | 636 | } |
599 | 637 | } |
600 | 638 | |
920 | 958 | set_property (GObject *object, guint prop_id, |
921 | 959 | const GValue *value, GParamSpec *pspec) |
922 | 960 | { |
923 | NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object); | |
961 | NMActiveConnection *self = (NMActiveConnection *) object; | |
962 | NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); | |
924 | 963 | const char *tmp; |
925 | 964 | NMSettingsConnection *con; |
926 | 965 | |
929 | 968 | /* construct-only */ |
930 | 969 | con = g_value_get_object (value); |
931 | 970 | if (con) { |
932 | priv->settings_connection = g_object_ref (con); | |
933 | priv->applied_connection = nm_simple_connection_new_clone (NM_CONNECTION (con)); | |
971 | _set_settings_connection (self, con); | |
972 | priv->applied_connection = nm_simple_connection_new_clone ((NMConnection *) priv->settings_connection); | |
934 | 973 | nm_connection_clear_secrets (priv->applied_connection); |
935 | 974 | } |
936 | 975 | break; |
937 | 976 | case PROP_INT_DEVICE: |
938 | 977 | /* construct-only */ |
939 | nm_active_connection_set_device (NM_ACTIVE_CONNECTION (object), g_value_get_object (value)); | |
978 | nm_active_connection_set_device (self, g_value_get_object (value)); | |
940 | 979 | break; |
941 | 980 | case PROP_INT_SUBJECT: |
942 | 981 | priv->subject = g_value_dup_object (value); |
943 | 982 | break; |
944 | 983 | case PROP_INT_MASTER: |
945 | nm_active_connection_set_master (NM_ACTIVE_CONNECTION (object), g_value_get_object (value)); | |
984 | nm_active_connection_set_master (self, g_value_get_object (value)); | |
946 | 985 | break; |
947 | 986 | case PROP_SPECIFIC_OBJECT: |
948 | 987 | tmp = g_value_get_string (value); |
1082 | 1121 | g_free (priv->specific_object); |
1083 | 1122 | priv->specific_object = NULL; |
1084 | 1123 | |
1085 | g_clear_object (&priv->settings_connection); | |
1124 | _set_settings_connection (self, NULL); | |
1086 | 1125 | g_clear_object (&priv->applied_connection); |
1087 | 1126 | |
1088 | 1127 | _device_cleanup (self); |
1119 | 1158 | object_class->dispose = dispose; |
1120 | 1159 | |
1121 | 1160 | /* D-Bus exported properties */ |
1122 | g_object_class_install_property | |
1123 | (object_class, PROP_CONNECTION, | |
1124 | g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, "", "", | |
1125 | NULL, | |
1126 | G_PARAM_READABLE | | |
1127 | G_PARAM_STATIC_STRINGS)); | |
1128 | ||
1129 | g_object_class_install_property | |
1130 | (object_class, PROP_ID, | |
1131 | g_param_spec_string (NM_ACTIVE_CONNECTION_ID, "", "", | |
1132 | NULL, | |
1133 | G_PARAM_READABLE | | |
1134 | G_PARAM_STATIC_STRINGS)); | |
1135 | ||
1136 | g_object_class_install_property | |
1137 | (object_class, PROP_UUID, | |
1138 | g_param_spec_string (NM_ACTIVE_CONNECTION_UUID, "", "", | |
1139 | NULL, | |
1140 | G_PARAM_READABLE | | |
1141 | G_PARAM_STATIC_STRINGS)); | |
1142 | ||
1143 | g_object_class_install_property | |
1144 | (object_class, PROP_TYPE, | |
1145 | g_param_spec_string (NM_ACTIVE_CONNECTION_TYPE, "", "", | |
1146 | NULL, | |
1147 | G_PARAM_READABLE | | |
1148 | G_PARAM_STATIC_STRINGS)); | |
1149 | ||
1150 | g_object_class_install_property | |
1151 | (object_class, PROP_SPECIFIC_OBJECT, | |
1152 | g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, "", "", | |
1153 | NULL, | |
1154 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | |
1155 | G_PARAM_STATIC_STRINGS)); | |
1156 | ||
1157 | g_object_class_install_property | |
1158 | (object_class, PROP_DEVICES, | |
1159 | g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES, "", "", | |
1160 | G_TYPE_STRV, | |
1161 | G_PARAM_READABLE | | |
1162 | G_PARAM_STATIC_STRINGS)); | |
1163 | ||
1164 | g_object_class_install_property | |
1165 | (object_class, PROP_STATE, | |
1166 | g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE, "", "", | |
1167 | NM_ACTIVE_CONNECTION_STATE_UNKNOWN, | |
1168 | NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, | |
1169 | NM_ACTIVE_CONNECTION_STATE_UNKNOWN, | |
1170 | G_PARAM_READABLE | | |
1171 | G_PARAM_STATIC_STRINGS)); | |
1172 | ||
1173 | g_object_class_install_property | |
1174 | (object_class, PROP_DEFAULT, | |
1175 | g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, "", "", | |
1176 | FALSE, | |
1177 | G_PARAM_READWRITE | | |
1178 | G_PARAM_STATIC_STRINGS)); | |
1179 | ||
1180 | g_object_class_install_property | |
1181 | (object_class, PROP_IP4_CONFIG, | |
1182 | g_param_spec_string (NM_ACTIVE_CONNECTION_IP4_CONFIG, "", "", | |
1183 | NULL, | |
1184 | G_PARAM_READABLE | | |
1185 | G_PARAM_STATIC_STRINGS)); | |
1186 | ||
1187 | g_object_class_install_property | |
1188 | (object_class, PROP_DHCP4_CONFIG, | |
1189 | g_param_spec_string (NM_ACTIVE_CONNECTION_DHCP4_CONFIG, "", "", | |
1190 | NULL, | |
1191 | G_PARAM_READABLE | | |
1192 | G_PARAM_STATIC_STRINGS)); | |
1193 | ||
1194 | g_object_class_install_property | |
1195 | (object_class, PROP_DEFAULT6, | |
1196 | g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6, "", "", | |
1197 | FALSE, | |
1198 | G_PARAM_READWRITE | | |
1199 | G_PARAM_STATIC_STRINGS)); | |
1200 | ||
1201 | g_object_class_install_property | |
1202 | (object_class, PROP_IP6_CONFIG, | |
1203 | g_param_spec_string (NM_ACTIVE_CONNECTION_IP6_CONFIG, "", "", | |
1204 | NULL, | |
1205 | G_PARAM_READABLE | | |
1206 | G_PARAM_STATIC_STRINGS)); | |
1207 | ||
1208 | g_object_class_install_property | |
1209 | (object_class, PROP_DHCP6_CONFIG, | |
1210 | g_param_spec_string (NM_ACTIVE_CONNECTION_DHCP6_CONFIG, "", "", | |
1211 | NULL, | |
1212 | G_PARAM_READABLE | | |
1213 | G_PARAM_STATIC_STRINGS)); | |
1214 | ||
1215 | g_object_class_install_property | |
1216 | (object_class, PROP_VPN, | |
1217 | g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN, "", "", | |
1218 | FALSE, | |
1219 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | |
1220 | G_PARAM_STATIC_STRINGS)); | |
1221 | ||
1222 | g_object_class_install_property | |
1223 | (object_class, PROP_MASTER, | |
1224 | g_param_spec_string (NM_ACTIVE_CONNECTION_MASTER, "", "", | |
1225 | NULL, | |
1226 | G_PARAM_READABLE | | |
1227 | G_PARAM_STATIC_STRINGS)); | |
1161 | obj_properties[PROP_CONNECTION] = | |
1162 | g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, "", "", | |
1163 | NULL, | |
1164 | G_PARAM_READABLE | | |
1165 | G_PARAM_STATIC_STRINGS); | |
1166 | ||
1167 | obj_properties[PROP_ID] = | |
1168 | g_param_spec_string (NM_ACTIVE_CONNECTION_ID, "", "", | |
1169 | NULL, | |
1170 | G_PARAM_READABLE | | |
1171 | G_PARAM_STATIC_STRINGS); | |
1172 | ||
1173 | obj_properties[PROP_UUID] = | |
1174 | g_param_spec_string (NM_ACTIVE_CONNECTION_UUID, "", "", | |
1175 | NULL, | |
1176 | G_PARAM_READABLE | | |
1177 | G_PARAM_STATIC_STRINGS); | |
1178 | ||
1179 | obj_properties[PROP_TYPE] = | |
1180 | g_param_spec_string (NM_ACTIVE_CONNECTION_TYPE, "", "", | |
1181 | NULL, | |
1182 | G_PARAM_READABLE | | |
1183 | G_PARAM_STATIC_STRINGS); | |
1184 | ||
1185 | obj_properties[PROP_SPECIFIC_OBJECT] = | |
1186 | g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, "", "", | |
1187 | NULL, | |
1188 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | |
1189 | G_PARAM_STATIC_STRINGS); | |
1190 | ||
1191 | obj_properties[PROP_DEVICES] = | |
1192 | g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES, "", "", | |
1193 | G_TYPE_STRV, | |
1194 | G_PARAM_READABLE | | |
1195 | G_PARAM_STATIC_STRINGS); | |
1196 | ||
1197 | obj_properties[PROP_STATE] = | |
1198 | g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE, "", "", | |
1199 | NM_ACTIVE_CONNECTION_STATE_UNKNOWN, | |
1200 | NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, | |
1201 | NM_ACTIVE_CONNECTION_STATE_UNKNOWN, | |
1202 | G_PARAM_READABLE | | |
1203 | G_PARAM_STATIC_STRINGS); | |
1204 | ||
1205 | obj_properties[PROP_DEFAULT] = | |
1206 | g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, "", "", | |
1207 | FALSE, | |
1208 | G_PARAM_READWRITE | | |
1209 | G_PARAM_STATIC_STRINGS); | |
1210 | ||
1211 | obj_properties[PROP_IP4_CONFIG] = | |
1212 | g_param_spec_string (NM_ACTIVE_CONNECTION_IP4_CONFIG, "", "", | |
1213 | NULL, | |
1214 | G_PARAM_READABLE | | |
1215 | G_PARAM_STATIC_STRINGS); | |
1216 | ||
1217 | obj_properties[PROP_DHCP4_CONFIG] = | |
1218 | g_param_spec_string (NM_ACTIVE_CONNECTION_DHCP4_CONFIG, "", "", | |
1219 | NULL, | |
1220 | G_PARAM_READABLE | | |
1221 | G_PARAM_STATIC_STRINGS); | |
1222 | ||
1223 | obj_properties[PROP_DEFAULT6] = | |
1224 | g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6, "", "", | |
1225 | FALSE, | |
1226 | G_PARAM_READWRITE | | |
1227 | G_PARAM_STATIC_STRINGS); | |
1228 | ||
1229 | obj_properties[PROP_IP6_CONFIG] = | |
1230 | g_param_spec_string (NM_ACTIVE_CONNECTION_IP6_CONFIG, "", "", | |
1231 | NULL, | |
1232 | G_PARAM_READABLE | | |
1233 | G_PARAM_STATIC_STRINGS); | |
1234 | ||
1235 | obj_properties[PROP_DHCP6_CONFIG] = | |
1236 | g_param_spec_string (NM_ACTIVE_CONNECTION_DHCP6_CONFIG, "", "", | |
1237 | NULL, | |
1238 | G_PARAM_READABLE | | |
1239 | G_PARAM_STATIC_STRINGS); | |
1240 | ||
1241 | obj_properties[PROP_VPN] = | |
1242 | g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN, "", "", | |
1243 | FALSE, | |
1244 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | |
1245 | G_PARAM_STATIC_STRINGS); | |
1246 | ||
1247 | obj_properties[PROP_MASTER] = | |
1248 | g_param_spec_string (NM_ACTIVE_CONNECTION_MASTER, "", "", | |
1249 | NULL, | |
1250 | G_PARAM_READABLE | | |
1251 | G_PARAM_STATIC_STRINGS); | |
1228 | 1252 | |
1229 | 1253 | /* Internal properties */ |
1230 | g_object_class_install_property | |
1231 | (object_class, PROP_INT_SETTINGS_CONNECTION, | |
1232 | g_param_spec_object (NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION, "", "", | |
1233 | NM_TYPE_SETTINGS_CONNECTION, | |
1234 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | | |
1235 | G_PARAM_STATIC_STRINGS)); | |
1236 | ||
1237 | g_object_class_install_property | |
1238 | (object_class, PROP_INT_DEVICE, | |
1239 | g_param_spec_object (NM_ACTIVE_CONNECTION_INT_DEVICE, "", "", | |
1240 | NM_TYPE_DEVICE, | |
1241 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | |
1242 | G_PARAM_STATIC_STRINGS)); | |
1243 | ||
1244 | g_object_class_install_property | |
1245 | (object_class, PROP_INT_SUBJECT, | |
1246 | g_param_spec_object (NM_ACTIVE_CONNECTION_INT_SUBJECT, "", "", | |
1247 | NM_TYPE_AUTH_SUBJECT, | |
1248 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | |
1249 | G_PARAM_STATIC_STRINGS)); | |
1250 | ||
1251 | g_object_class_install_property | |
1252 | (object_class, PROP_INT_MASTER, | |
1253 | g_param_spec_object (NM_ACTIVE_CONNECTION_INT_MASTER, "", "", | |
1254 | NM_TYPE_ACTIVE_CONNECTION, | |
1255 | G_PARAM_READWRITE | | |
1256 | G_PARAM_STATIC_STRINGS)); | |
1257 | ||
1258 | g_object_class_install_property | |
1259 | (object_class, PROP_INT_MASTER_READY, | |
1260 | g_param_spec_boolean (NM_ACTIVE_CONNECTION_INT_MASTER_READY, "", "", | |
1261 | FALSE, G_PARAM_READABLE | | |
1262 | G_PARAM_STATIC_STRINGS)); | |
1254 | obj_properties[PROP_INT_SETTINGS_CONNECTION] = | |
1255 | g_param_spec_object (NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION, "", "", | |
1256 | NM_TYPE_SETTINGS_CONNECTION, | |
1257 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | | |
1258 | G_PARAM_STATIC_STRINGS); | |
1259 | ||
1260 | obj_properties[PROP_INT_DEVICE] = | |
1261 | g_param_spec_object (NM_ACTIVE_CONNECTION_INT_DEVICE, "", "", | |
1262 | NM_TYPE_DEVICE, | |
1263 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | |
1264 | G_PARAM_STATIC_STRINGS); | |
1265 | ||
1266 | obj_properties[PROP_INT_SUBJECT] = | |
1267 | g_param_spec_object (NM_ACTIVE_CONNECTION_INT_SUBJECT, "", "", | |
1268 | NM_TYPE_AUTH_SUBJECT, | |
1269 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | |
1270 | G_PARAM_STATIC_STRINGS); | |
1271 | ||
1272 | obj_properties[PROP_INT_MASTER] = | |
1273 | g_param_spec_object (NM_ACTIVE_CONNECTION_INT_MASTER, "", "", | |
1274 | NM_TYPE_ACTIVE_CONNECTION, | |
1275 | G_PARAM_READWRITE | | |
1276 | G_PARAM_STATIC_STRINGS); | |
1277 | ||
1278 | obj_properties[PROP_INT_MASTER_READY] = | |
1279 | g_param_spec_boolean (NM_ACTIVE_CONNECTION_INT_MASTER_READY, "", "", | |
1280 | FALSE, G_PARAM_READABLE | | |
1281 | G_PARAM_STATIC_STRINGS); | |
1282 | ||
1283 | g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); | |
1263 | 1284 | |
1264 | 1285 | signals[DEVICE_CHANGED] = |
1265 | g_signal_new (NM_ACTIVE_CONNECTION_DEVICE_CHANGED, | |
1266 | G_OBJECT_CLASS_TYPE (object_class), | |
1267 | G_SIGNAL_RUN_FIRST, | |
1268 | G_STRUCT_OFFSET (NMActiveConnectionClass, device_changed), | |
1269 | NULL, NULL, NULL, | |
1270 | G_TYPE_NONE, 2, NM_TYPE_DEVICE, NM_TYPE_DEVICE); | |
1286 | g_signal_new (NM_ACTIVE_CONNECTION_DEVICE_CHANGED, | |
1287 | G_OBJECT_CLASS_TYPE (object_class), | |
1288 | G_SIGNAL_RUN_FIRST, | |
1289 | G_STRUCT_OFFSET (NMActiveConnectionClass, device_changed), | |
1290 | NULL, NULL, NULL, | |
1291 | G_TYPE_NONE, 2, NM_TYPE_DEVICE, NM_TYPE_DEVICE); | |
1271 | 1292 | |
1272 | 1293 | signals[DEVICE_METERED_CHANGED] = |
1273 | g_signal_new (NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED, | |
1274 | G_OBJECT_CLASS_TYPE (object_class), | |
1275 | G_SIGNAL_RUN_FIRST, | |
1276 | G_STRUCT_OFFSET (NMActiveConnectionClass, device_metered_changed), | |
1277 | NULL, NULL, NULL, | |
1278 | G_TYPE_NONE, 1, G_TYPE_UINT); | |
1294 | g_signal_new (NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED, | |
1295 | G_OBJECT_CLASS_TYPE (object_class), | |
1296 | G_SIGNAL_RUN_FIRST, | |
1297 | G_STRUCT_OFFSET (NMActiveConnectionClass, device_metered_changed), | |
1298 | NULL, NULL, NULL, | |
1299 | G_TYPE_NONE, 1, G_TYPE_UINT); | |
1279 | 1300 | |
1280 | 1301 | signals[PARENT_ACTIVE] = |
1281 | g_signal_new (NM_ACTIVE_CONNECTION_PARENT_ACTIVE, | |
1282 | G_OBJECT_CLASS_TYPE (object_class), | |
1283 | G_SIGNAL_RUN_FIRST, | |
1284 | G_STRUCT_OFFSET (NMActiveConnectionClass, parent_active), | |
1285 | NULL, NULL, NULL, | |
1286 | G_TYPE_NONE, 1, NM_TYPE_ACTIVE_CONNECTION); | |
1302 | g_signal_new (NM_ACTIVE_CONNECTION_PARENT_ACTIVE, | |
1303 | G_OBJECT_CLASS_TYPE (object_class), | |
1304 | G_SIGNAL_RUN_FIRST, | |
1305 | G_STRUCT_OFFSET (NMActiveConnectionClass, parent_active), | |
1306 | NULL, NULL, NULL, | |
1307 | G_TYPE_NONE, 1, NM_TYPE_ACTIVE_CONNECTION); | |
1287 | 1308 | |
1288 | 1309 | nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (ac_class), |
1289 | 1310 | NMDBUS_TYPE_ACTIVE_CONNECTION_SKELETON, |
52 | 52 | #define NM_AUDIT_OP_CONN_DEACTIVATE "connection-deactivate" |
53 | 53 | #define NM_AUDIT_OP_CONN_CLEAR_SECRETS "connection-clear-secrets" |
54 | 54 | |
55 | #define NM_AUDIT_OP_RELOAD "reload" | |
55 | 56 | #define NM_AUDIT_OP_SLEEP_CONTROL "sleep-control" |
56 | 57 | #define NM_AUDIT_OP_NET_CONTROL "networking-control" |
57 | 58 | #define NM_AUDIT_OP_RADIO_CONTROL "radio-control" |
19 | 19 | |
20 | 20 | #include "nm-default.h" |
21 | 21 | |
22 | #include "nm-auth-utils.h" | |
23 | ||
22 | 24 | #include <string.h> |
23 | 25 | |
24 | 26 | #include "nm-setting-connection.h" |
25 | #include "nm-auth-utils.h" | |
26 | 27 | #include "nm-auth-subject.h" |
27 | 28 | #include "nm-auth-manager.h" |
28 | 29 | #include "nm-session-monitor.h" |
20 | 20 | #ifndef __NETWORKMANAGER_MANAGER_AUTH_H__ |
21 | 21 | #define __NETWORKMANAGER_MANAGER_AUTH_H__ |
22 | 22 | |
23 | #include <nm-connection.h> | |
24 | #include "nm-default.h" | |
25 | ||
26 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK "org.freedesktop.NetworkManager.enable-disable-network" | |
27 | #define NM_AUTH_PERMISSION_SLEEP_WAKE "org.freedesktop.NetworkManager.sleep-wake" | |
28 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI "org.freedesktop.NetworkManager.enable-disable-wifi" | |
29 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN "org.freedesktop.NetworkManager.enable-disable-wwan" | |
30 | #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX "org.freedesktop.NetworkManager.enable-disable-wimax" | |
31 | #define NM_AUTH_PERMISSION_NETWORK_CONTROL "org.freedesktop.NetworkManager.network-control" | |
32 | #define NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED "org.freedesktop.NetworkManager.wifi.share.protected" | |
33 | #define NM_AUTH_PERMISSION_WIFI_SHARE_OPEN "org.freedesktop.NetworkManager.wifi.share.open" | |
34 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM "org.freedesktop.NetworkManager.settings.modify.system" | |
35 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN "org.freedesktop.NetworkManager.settings.modify.own" | |
36 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME "org.freedesktop.NetworkManager.settings.modify.hostname" | |
37 | #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS "org.freedesktop.NetworkManager.settings.modify.global-dns" | |
38 | ||
23 | #include "nm-connection.h" | |
39 | 24 | |
40 | 25 | typedef struct NMAuthChain NMAuthChain; |
41 | 26 |
1199 | 1199 | |
1200 | 1200 | if (!global_dns_equal (priv_old->global_dns, priv_new->global_dns)) |
1201 | 1201 | changes |= NM_CONFIG_CHANGE_GLOBAL_DNS_CONFIG; |
1202 | ||
1203 | nm_assert (!NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_CAUSES)); | |
1202 | 1204 | |
1203 | 1205 | return changes; |
1204 | 1206 | } |
19 | 19 | |
20 | 20 | #ifndef NM_CONFIG_DATA_H |
21 | 21 | #define NM_CONFIG_DATA_H |
22 | ||
23 | ||
24 | #include "nm-default.h" | |
25 | ||
26 | G_BEGIN_DECLS | |
27 | 22 | |
28 | 23 | #define NM_TYPE_CONFIG_DATA (nm_config_data_get_type ()) |
29 | 24 | #define NM_CONFIG_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONFIG_DATA, NMConfigData)) |
43 | 38 | #define NM_CONFIG_DATA_NO_AUTO_DEFAULT "no-auto-default" |
44 | 39 | #define NM_CONFIG_DATA_DNS_MODE "dns" |
45 | 40 | |
46 | typedef enum { /*<flags >*/ | |
41 | /* The flags for Reload. Currently these are internal defines, | |
42 | * only their numeric value matters and must be stable as | |
43 | * they are public API! Also, the enum must fit in uint32. */ | |
44 | enum { /*< skip >*/ | |
45 | NM_MANAGER_RELOAD_FLAGS_NONE = 0, | |
46 | ||
47 | /* reload the configuration from disk */ | |
48 | NM_MANAGER_RELOAD_FLAGS_CONF = (1LL << 0), | |
49 | ||
50 | /* write DNS configuration to resolv.conf */ | |
51 | NM_MANAGER_RELOAD_FLAGS_DNS_RC = (1LL << 1), | |
52 | ||
53 | /* restart the DNS plugin (includes DNS_RC) */ | |
54 | NM_MANAGER_RELOAD_FLAGS_DNS_FULL = (1LL << 2), | |
55 | ||
56 | _NM_MANAGER_RELOAD_FLAGS_ALL, | |
57 | NM_MANAGER_RELOAD_FLAGS_ALL = ((_NM_MANAGER_RELOAD_FLAGS_ALL - 1) << 1) - 1, | |
58 | }; | |
59 | ||
60 | typedef enum { /*< flags >*/ | |
47 | 61 | NM_CONFIG_GET_VALUE_NONE = 0, |
48 | 62 | |
49 | 63 | /* use g_key_file_get_value() instead of g_key_file_get_string(). */ |
63 | 77 | typedef enum { /*< flags >*/ |
64 | 78 | NM_CONFIG_CHANGE_NONE = 0, |
65 | 79 | |
66 | NM_CONFIG_CHANGE_SIGHUP = (1L << 0), | |
67 | NM_CONFIG_CHANGE_SIGUSR1 = (1L << 1), | |
68 | NM_CONFIG_CHANGE_SIGUSR2 = (1L << 2), | |
69 | ||
70 | NM_CONFIG_CHANGE_CONFIG_FILES = (1L << 3), | |
71 | NM_CONFIG_CHANGE_VALUES = (1L << 4), | |
72 | NM_CONFIG_CHANGE_VALUES_USER = (1L << 5), | |
73 | NM_CONFIG_CHANGE_VALUES_INTERN = (1L << 6), | |
74 | NM_CONFIG_CHANGE_CONNECTIVITY = (1L << 7), | |
75 | NM_CONFIG_CHANGE_NO_AUTO_DEFAULT = (1L << 8), | |
76 | NM_CONFIG_CHANGE_DNS_MODE = (1L << 9), | |
77 | NM_CONFIG_CHANGE_RC_MANAGER = (1L << 10), | |
78 | NM_CONFIG_CHANGE_GLOBAL_DNS_CONFIG = (1L << 11), | |
79 | ||
80 | _NM_CONFIG_CHANGE_LAST, | |
81 | NM_CONFIG_CHANGE_ALL = ((_NM_CONFIG_CHANGE_LAST - 1) << 1) - 1, | |
80 | /************************************************************************** | |
81 | * The external cause which triggered the reload/configuration-change | |
82 | *************************************************************************/ | |
83 | ||
84 | NM_CONFIG_CHANGE_CAUSE_SIGHUP = (1L << 0), | |
85 | NM_CONFIG_CHANGE_CAUSE_SIGUSR1 = (1L << 1), | |
86 | NM_CONFIG_CHANGE_CAUSE_SIGUSR2 = (1L << 2), | |
87 | NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT = (1L << 3), | |
88 | NM_CONFIG_CHANGE_CAUSE_SET_VALUES = (1L << 4), | |
89 | NM_CONFIG_CHANGE_CAUSE_CONF = (1L << 5), | |
90 | NM_CONFIG_CHANGE_CAUSE_DNS_RC = (1L << 6), | |
91 | NM_CONFIG_CHANGE_CAUSE_DNS_FULL = (1L << 7), | |
92 | ||
93 | NM_CONFIG_CHANGE_CAUSES = ((1L << 8) - 1), | |
94 | ||
95 | /************************************************************************** | |
96 | * Following flags describe which property of the configuration changed: | |
97 | *************************************************************************/ | |
98 | ||
99 | /* main-file or config-description changed */ | |
100 | NM_CONFIG_CHANGE_CONFIG_FILES = (1L << 10), | |
101 | ||
102 | ||
103 | /* any configuration on disk changed */ | |
104 | NM_CONFIG_CHANGE_VALUES = (1L << 11), | |
105 | ||
106 | /* any user configuration on disk changed (NetworkManager.conf) */ | |
107 | NM_CONFIG_CHANGE_VALUES_USER = (1L << 12), | |
108 | ||
109 | /* any internal configuration on disk changed (NetworkManager-intern.conf) */ | |
110 | NM_CONFIG_CHANGE_VALUES_INTERN = (1L << 13), | |
111 | ||
112 | ||
113 | /* configuration regarding connectivity changed */ | |
114 | NM_CONFIG_CHANGE_CONNECTIVITY = (1L << 14), | |
115 | ||
116 | /* configuration regarding no-auto-default changed */ | |
117 | NM_CONFIG_CHANGE_NO_AUTO_DEFAULT = (1L << 15), | |
118 | ||
119 | /* configuration regarding dns-mode changed */ | |
120 | NM_CONFIG_CHANGE_DNS_MODE = (1L << 16), | |
121 | ||
122 | /* configuration regarding rc-manager changed */ | |
123 | NM_CONFIG_CHANGE_RC_MANAGER = (1L << 17), | |
124 | ||
125 | /* configuration regarding global dns-config changed */ | |
126 | NM_CONFIG_CHANGE_GLOBAL_DNS_CONFIG = (1L << 18), | |
127 | ||
82 | 128 | } NMConfigChangeFlags; |
83 | 129 | |
84 | 130 | struct _NMConfigData { |
163 | 209 | GKeyFile *_nm_config_data_get_keyfile_user (const NMConfigData *self); |
164 | 210 | GKeyFile *_nm_config_data_get_keyfile_intern (const NMConfigData *self); |
165 | 211 | |
166 | G_END_DECLS | |
167 | ||
168 | 212 | #endif /* NM_CONFIG_DATA_H */ |
169 | 213 |
20 | 20 | |
21 | 21 | #include "nm-default.h" |
22 | 22 | |
23 | #include "nm-config.h" | |
24 | ||
23 | 25 | #include <string.h> |
24 | 26 | #include <stdio.h> |
25 | 27 | |
26 | #include "nm-config.h" | |
27 | 28 | #include "nm-utils.h" |
28 | 29 | #include "nm-device.h" |
29 | 30 | #include "NetworkManagerUtils.h" |
108 | 109 | |
109 | 110 | /************************************************************************/ |
110 | 111 | |
111 | static void _set_config_data (NMConfig *self, NMConfigData *new_data, int signal); | |
112 | static void _set_config_data (NMConfig *self, NMConfigData *new_data, NMConfigChangeFlags reload_flags); | |
112 | 113 | |
113 | 114 | /************************************************************************/ |
114 | 115 | |
392 | 393 | /* unref no_auto_default_set here. Note that _set_config_data() probably invalidates the content of the array. */ |
393 | 394 | g_ptr_array_unref (no_auto_default_new); |
394 | 395 | |
395 | _set_config_data (self, new_data, 0); | |
396 | _set_config_data (self, new_data, NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT); | |
396 | 397 | } |
397 | 398 | |
398 | 399 | /************************************************************************/ |
633 | 634 | |
634 | 635 | kf = nm_config_create_keyfile (); |
635 | 636 | if (!g_key_file_load_from_file (kf, path, G_KEY_FILE_NONE, error)) { |
637 | g_prefix_error (error, "%s: ", path); | |
636 | 638 | g_key_file_free (kf); |
637 | 639 | return FALSE; |
638 | 640 | } |
645 | 647 | /* the config-group is internal to every configuration snippets. It doesn't make sense |
646 | 648 | * to merge the into the global configuration, and it doesn't make sense to preserve the |
647 | 649 | * group beyond this point. */ |
648 | g_key_file_remove_group (keyfile, NM_CONFIG_KEYFILE_GROUP_CONFIG, NULL); | |
650 | g_key_file_remove_group (kf, NM_CONFIG_KEYFILE_GROUP_CONFIG, NULL); | |
649 | 651 | |
650 | 652 | /* Override the current settings with the new ones */ |
651 | 653 | groups = g_key_file_get_groups (kf, &ngroups); |
814 | 816 | } |
815 | 817 | |
816 | 818 | if (!g_error_matches (my_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) { |
817 | nm_log_warn (LOGD_CORE, "Old default config file %s invalid: %s\n", | |
818 | DEFAULT_CONFIG_MAIN_FILE_OLD, | |
819 | nm_log_warn (LOGD_CORE, "Old default config file invalid: %s\n", | |
819 | 820 | my_error->message); |
820 | 821 | } |
821 | 822 | g_clear_error (&my_error); |
827 | 828 | } |
828 | 829 | |
829 | 830 | if (!g_error_matches (my_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) { |
830 | nm_log_warn (LOGD_CORE, "Default config file %s invalid: %s\n", | |
831 | DEFAULT_CONFIG_MAIN_FILE, | |
831 | nm_log_warn (LOGD_CORE, "Default config file invalid: %s\n", | |
832 | 832 | my_error->message); |
833 | 833 | g_propagate_error (error, my_error); |
834 | 834 | return FALSE; |
1639 | 1639 | nm_log_dbg (LOGD_CORE, "don't persistate internal configuration (no file set, use --intern-config?)"); |
1640 | 1640 | } |
1641 | 1641 | if (new_data) |
1642 | _set_config_data (self, new_data, 0); | |
1642 | _set_config_data (self, new_data, NM_CONFIG_CHANGE_CAUSE_SET_VALUES); | |
1643 | 1643 | |
1644 | 1644 | g_key_file_unref (keyfile_new); |
1645 | 1645 | } |
1647 | 1647 | /************************************************************************/ |
1648 | 1648 | |
1649 | 1649 | void |
1650 | nm_config_reload (NMConfig *self, int signal) | |
1650 | nm_config_reload (NMConfig *self, NMConfigChangeFlags reload_flags) | |
1651 | 1651 | { |
1652 | 1652 | NMConfigPrivate *priv; |
1653 | 1653 | GError *error = NULL; |
1659 | 1659 | gboolean intern_config_needs_rewrite; |
1660 | 1660 | |
1661 | 1661 | g_return_if_fail (NM_IS_CONFIG (self)); |
1662 | g_return_if_fail ( reload_flags | |
1663 | && !NM_FLAGS_ANY (reload_flags, ~NM_CONFIG_CHANGE_CAUSES) | |
1664 | && !NM_FLAGS_ANY (reload_flags, NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT | |
1665 | | NM_CONFIG_CHANGE_CAUSE_SET_VALUES)); | |
1662 | 1666 | |
1663 | 1667 | priv = NM_CONFIG_GET_PRIVATE (self); |
1664 | 1668 | |
1665 | if (signal != SIGHUP) { | |
1666 | _set_config_data (self, NULL, signal); | |
1669 | if (!NM_FLAGS_ANY (reload_flags, NM_CONFIG_CHANGE_CAUSE_SIGHUP | NM_CONFIG_CHANGE_CAUSE_CONF)) { | |
1670 | /* unless SIGHUP is specified, we don't reload the configuration from disc. */ | |
1671 | _set_config_data (self, NULL, reload_flags); | |
1667 | 1672 | return; |
1668 | 1673 | } |
1669 | 1674 | |
1680 | 1685 | if (!keyfile) { |
1681 | 1686 | nm_log_err (LOGD_CORE, "Failed to reload the configuration: %s", error->message); |
1682 | 1687 | g_clear_error (&error); |
1683 | _set_config_data (self, NULL, signal); | |
1688 | _set_config_data (self, NULL, reload_flags); | |
1684 | 1689 | return; |
1685 | 1690 | } |
1686 | 1691 | |
1702 | 1707 | if (keyfile_intern) |
1703 | 1708 | g_key_file_unref (keyfile_intern); |
1704 | 1709 | |
1705 | _set_config_data (self, new_data, signal); | |
1710 | _set_config_data (self, new_data, reload_flags); | |
1706 | 1711 | } |
1707 | 1712 | |
1708 | 1713 | NM_UTILS_FLAGS2STR_DEFINE (nm_config_change_flags_to_string, NMConfigChangeFlags, |
1709 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_SIGHUP, "SIGHUP"), | |
1710 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_SIGUSR1, "SIGUSR1"), | |
1711 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_SIGUSR2, "SIGUSR2"), | |
1714 | ||
1715 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CAUSE_CONF, "CONF"), | |
1716 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CAUSE_DNS_RC, "DNS_RC"), | |
1717 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CAUSE_DNS_FULL, "DNS_FULL"), | |
1718 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CAUSE_SIGHUP, "SIGHUP"), | |
1719 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CAUSE_SIGUSR1, "SIGUSR1"), | |
1720 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CAUSE_SIGUSR2, "SIGUSR2"), | |
1721 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT, "NO_AUTO_DEFAULT"), | |
1722 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CAUSE_SET_VALUES, "SET_VALUES"), | |
1723 | ||
1712 | 1724 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_CONFIG_FILES, "config-files"), |
1713 | 1725 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_VALUES, "values"), |
1714 | 1726 | NM_UTILS_FLAGS2STR (NM_CONFIG_CHANGE_VALUES_USER, "values-user"), |
1721 | 1733 | ); |
1722 | 1734 | |
1723 | 1735 | static void |
1724 | _set_config_data (NMConfig *self, NMConfigData *new_data, int signal) | |
1736 | _set_config_data (NMConfig *self, NMConfigData *new_data, NMConfigChangeFlags reload_flags) | |
1725 | 1737 | { |
1726 | 1738 | NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (self); |
1727 | 1739 | NMConfigData *old_data = priv->config_data; |
1728 | 1740 | NMConfigChangeFlags changes, changes_diff; |
1729 | 1741 | gboolean had_new_data = !!new_data; |
1730 | 1742 | |
1731 | switch (signal) { | |
1732 | case SIGHUP: | |
1733 | changes = NM_CONFIG_CHANGE_SIGHUP; | |
1734 | break; | |
1735 | case SIGUSR1: | |
1736 | changes = NM_CONFIG_CHANGE_SIGUSR1; | |
1737 | break; | |
1738 | case SIGUSR2: | |
1739 | changes = NM_CONFIG_CHANGE_SIGUSR2; | |
1740 | break; | |
1741 | default: | |
1742 | changes = NM_CONFIG_CHANGE_NONE; | |
1743 | break; | |
1744 | } | |
1743 | nm_assert (reload_flags); | |
1744 | nm_assert (!NM_FLAGS_ANY (reload_flags, ~NM_CONFIG_CHANGE_CAUSES)); | |
1745 | nm_assert ( NM_IN_SET (reload_flags, NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT, NM_CONFIG_CHANGE_CAUSE_SET_VALUES) | |
1746 | || !NM_FLAGS_ANY (reload_flags, NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT | NM_CONFIG_CHANGE_CAUSE_SET_VALUES)); | |
1747 | ||
1748 | changes = reload_flags; | |
1745 | 1749 | |
1746 | 1750 | if (new_data) { |
1747 | 1751 | changes_diff = nm_config_data_diff (old_data, new_data); |
1751 | 1755 | changes |= changes_diff; |
1752 | 1756 | } |
1753 | 1757 | |
1754 | if (changes == NM_CONFIG_CHANGE_NONE) | |
1758 | if ( NM_IN_SET (reload_flags, | |
1759 | NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT, | |
1760 | NM_CONFIG_CHANGE_CAUSE_SET_VALUES, | |
1761 | NM_CONFIG_CHANGE_CAUSE_CONF) | |
1762 | && !new_data) { | |
1763 | /* no relevant changes that should be propagated. Return silently. */ | |
1755 | 1764 | return; |
1765 | } | |
1756 | 1766 | |
1757 | 1767 | if (new_data) { |
1758 | nm_log_info (LOGD_CORE, "config: update %s (%s)", nm_config_data_get_config_description (new_data), | |
1759 | nm_config_change_flags_to_string (changes, NULL, 0)); | |
1768 | nm_log_info (LOGD_CORE, "config: signal %s (%s)", | |
1769 | nm_config_change_flags_to_string (changes, NULL, 0), | |
1770 | nm_config_data_get_config_description (new_data)); | |
1760 | 1771 | nm_config_data_log (new_data, "CONFIG: ", " ", NULL); |
1761 | 1772 | priv->config_data = new_data; |
1762 | 1773 | } else if (had_new_data) |
21 | 21 | #ifndef __NETWORKMANAGER_CONFIG_H__ |
22 | 22 | #define __NETWORKMANAGER_CONFIG_H__ |
23 | 23 | |
24 | ||
25 | #include "nm-default.h" | |
26 | 24 | #include "nm-config-data.h" |
27 | ||
28 | G_BEGIN_DECLS | |
29 | 25 | |
30 | 26 | #define NM_TYPE_CONFIG (nm_config_get_type ()) |
31 | 27 | #define NM_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONFIG, NMConfig)) |
128 | 124 | |
129 | 125 | NMConfig *nm_config_new (const NMConfigCmdLineOptions *cli, char **atomic_section_prefixes, GError **error); |
130 | 126 | NMConfig *nm_config_setup (const NMConfigCmdLineOptions *cli, char **atomic_section_prefixes, GError **error); |
131 | void nm_config_reload (NMConfig *config, int signal); | |
127 | void nm_config_reload (NMConfig *config, NMConfigChangeFlags reload_flags); | |
132 | 128 | |
133 | 129 | gint nm_config_parse_boolean (const char *str, gint default_value); |
134 | 130 | |
158 | 154 | extern guint _nm_config_match_nm_version; |
159 | 155 | extern char *_nm_config_match_env; |
160 | 156 | |
161 | G_END_DECLS | |
162 | ||
163 | 157 | #endif /* __NETWORKMANAGER_CONFIG_H__ */ |
164 | 158 |
105 | 105 | g_signal_new (NM_CP_SIGNAL_CONNECTION_ADDED, |
106 | 106 | iface_type, |
107 | 107 | G_SIGNAL_RUN_FIRST, |
108 | G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_added), | |
109 | NULL, NULL, | |
108 | 0, NULL, NULL, | |
110 | 109 | g_cclosure_marshal_VOID__OBJECT, |
111 | 110 | G_TYPE_NONE, 1, G_TYPE_OBJECT); |
112 | 111 | |
113 | 112 | g_signal_new (NM_CP_SIGNAL_CONNECTION_UPDATED, |
114 | 113 | iface_type, |
115 | 114 | G_SIGNAL_RUN_FIRST, |
116 | G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_updated), | |
117 | NULL, NULL, | |
115 | 0, NULL, NULL, | |
118 | 116 | g_cclosure_marshal_VOID__OBJECT, |
119 | 117 | G_TYPE_NONE, 1, G_TYPE_OBJECT); |
120 | 118 | |
121 | 119 | g_signal_new (NM_CP_SIGNAL_CONNECTION_REMOVED, |
122 | 120 | iface_type, |
123 | 121 | G_SIGNAL_RUN_FIRST, |
124 | G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_removed), | |
125 | NULL, NULL, | |
122 | 0, NULL, NULL, | |
126 | 123 | g_cclosure_marshal_VOID__OBJECT, |
127 | 124 | G_TYPE_NONE, 1, G_TYPE_OBJECT); |
128 | 125 | } |
62 | 62 | |
63 | 63 | NMConnection * (*get_connection_by_uuid) (NMConnectionProvider *self, |
64 | 64 | const char *uuid); |
65 | ||
66 | /* Signals */ | |
67 | void (*connection_added) (NMConnectionProvider *self, NMConnection *connection); | |
68 | ||
69 | void (*connection_updated) (NMConnectionProvider *self, NMConnection *connection); | |
70 | ||
71 | void (*connection_removed) (NMConnectionProvider *self, NMConnection *connection); | |
72 | ||
73 | 65 | } NMConnectionProviderInterface; |
74 | 66 | |
75 | 67 | GType nm_connection_provider_get_type (void); |
1140 | 1140 | nm_utils_find_helper(const char *progname, const char *try_first, GError **error) |
1141 | 1141 | { |
1142 | 1142 | return nm_utils_file_search_in_paths (progname, try_first, NM_PATHS_DEFAULT, G_FILE_TEST_IS_EXECUTABLE, NULL, NULL, error); |
1143 | } | |
1144 | ||
1145 | /******************************************************************************************/ | |
1146 | ||
1147 | /** | |
1148 | * nm_utils_read_link_absolute: | |
1149 | * @link_file: file name of the symbolic link | |
1150 | * @error: error reason in case of failure | |
1151 | * | |
1152 | * Uses to g_file_read_link()/readlink() to read the symlink | |
1153 | * and returns the result as absolute path. | |
1154 | **/ | |
1155 | char * | |
1156 | nm_utils_read_link_absolute (const char *link_file, GError **error) | |
1157 | { | |
1158 | char *ln, *dirname, *ln_abs; | |
1159 | ||
1160 | ln = g_file_read_link (link_file, error); | |
1161 | if (!ln) | |
1162 | return NULL; | |
1163 | if (g_path_is_absolute (ln)) | |
1164 | return ln; | |
1165 | ||
1166 | dirname = g_path_get_dirname (link_file); | |
1167 | if (!g_path_is_absolute (link_file)) { | |
1168 | gs_free char *dirname_rel = dirname; | |
1169 | gs_free char *current_dir = g_get_current_dir (); | |
1170 | ||
1171 | dirname = g_build_filename (current_dir, dirname_rel, NULL); | |
1172 | } | |
1173 | ln_abs = g_build_filename (dirname, ln, NULL); | |
1174 | g_free (dirname); | |
1175 | g_free (ln); | |
1176 | return ln_abs; | |
1143 | 1177 | } |
1144 | 1178 | |
1145 | 1179 | /******************************************************************************************/ |
2611 | 2645 | if (contents[i] != '\0') |
2612 | 2646 | return FALSE; |
2613 | 2647 | |
2614 | return nm_unauto (&contents); | |
2648 | return g_steal_pointer (&contents); | |
2615 | 2649 | } |
2616 | 2650 | |
2617 | 2651 | /*****************************************************************************/ |
3084 | 3118 | return TRUE; |
3085 | 3119 | } |
3086 | 3120 | |
3121 | const char * | |
3122 | nm_utils_dnsmasq_status_to_string (int status, char *dest, guint size) | |
3123 | { | |
3124 | static char buffer[128]; | |
3125 | char *msg, *ret; | |
3126 | gs_free char *msg_free = NULL; | |
3127 | int len; | |
3128 | ||
3129 | if (status == 0) | |
3130 | msg = "Success"; | |
3131 | else if (status == 1) | |
3132 | msg = "Configuration problem"; | |
3133 | else if (status == 2) | |
3134 | msg = "Network access problem (address in use, permissions)"; | |
3135 | else if (status == 3) | |
3136 | msg = "Filesystem problem (missing file/directory, permissions)"; | |
3137 | else if (status == 4) | |
3138 | msg = "Memory allocation failure"; | |
3139 | else if (status == 5) | |
3140 | msg = "Other problem"; | |
3141 | else if (status >= 11) | |
3142 | msg = msg_free = g_strdup_printf ("Lease script failed with error %d", status - 10); | |
3143 | else | |
3144 | msg = "Unknown problem"; | |
3145 | ||
3146 | if (dest) { | |
3147 | ret = dest; | |
3148 | len = size; | |
3149 | } else { | |
3150 | ret = buffer; | |
3151 | len = sizeof (buffer); | |
3152 | } | |
3153 | ||
3154 | g_snprintf (ret, len, "%s (%d)", msg, status); | |
3155 | ||
3156 | return ret; | |
3157 | } | |
3158 | ||
3159 | /** | |
3160 | * nm_utils_get_reverse_dns_domains_ip4: | |
3161 | * @addr: IP address in network order | |
3162 | * @plen: prefix length | |
3163 | * @domains: array for results | |
3164 | * | |
3165 | * Creates reverse DNS domains for the given address and prefix length, and | |
3166 | * append them to @domains. | |
3167 | */ | |
3168 | void | |
3169 | nm_utils_get_reverse_dns_domains_ip4 (guint32 addr, guint8 plen, GPtrArray *domains) | |
3170 | { | |
3171 | guint32 ip, ip2, mask; | |
3172 | guchar *p; | |
3173 | guint octets; | |
3174 | guint i; | |
3175 | gsize len0, len; | |
3176 | char *str, *s; | |
3177 | ||
3178 | g_return_if_fail (domains); | |
3179 | g_return_if_fail (plen <= 32); | |
3180 | ||
3181 | if (!plen) | |
3182 | return; | |
3183 | ||
3184 | octets = (plen - 1) / 8 + 1; | |
3185 | ip = ntohl (addr); | |
3186 | mask = 0xFFFFFFFF << (32 - plen); | |
3187 | ip &= mask; | |
3188 | ip2 = ip; | |
3189 | ||
3190 | len0 = NM_STRLEN ("in-addr.arpa") + (4 * octets) + 1; | |
3191 | while ((ip2 & mask) == ip) { | |
3192 | addr = htonl (ip2); | |
3193 | p = (guchar *) &addr; | |
3194 | ||
3195 | len = len0; | |
3196 | str = s = g_malloc (len); | |
3197 | for (i = octets; i > 0; i--) | |
3198 | nm_utils_strbuf_append (&s, &len, "%u.", p[i - 1] & 0xff); | |
3199 | nm_utils_strbuf_append_str (&s, &len, "in-addr.arpa"); | |
3200 | ||
3201 | g_ptr_array_add (domains, str); | |
3202 | ||
3203 | ip2 += 1 << ((32 - plen) & ~7); | |
3204 | } | |
3205 | } | |
3206 | ||
3207 | /** | |
3208 | * nm_utils_get_reverse_dns_domains_ip6: | |
3209 | * @addr: IPv6 address | |
3210 | * @plen: prefix length | |
3211 | * @domains: array for results | |
3212 | * | |
3213 | * Creates reverse DNS domains for the given address and prefix length, and | |
3214 | * append them to @domains. | |
3215 | */ | |
3216 | void | |
3217 | nm_utils_get_reverse_dns_domains_ip6 (const struct in6_addr *ip, guint8 plen, GPtrArray *domains) | |
3218 | { | |
3219 | struct in6_addr addr; | |
3220 | guint nibbles, bits, entries; | |
3221 | int i, j; | |
3222 | gsize len0, len; | |
3223 | char *str, *s; | |
3224 | ||
3225 | g_return_if_fail (domains); | |
3226 | g_return_if_fail (plen <= 128); | |
3227 | ||
3228 | if (!plen) | |
3229 | return; | |
3230 | ||
3231 | memcpy (&addr, ip, sizeof (struct in6_addr)); | |
3232 | nm_utils_ip6_address_clear_host_address (&addr, &addr, plen); | |
3233 | ||
3234 | /* Number of nibbles to include in domains */ | |
3235 | nibbles = (plen - 1) / 4 + 1; | |
3236 | /* Prefix length in nibble */ | |
3237 | bits = plen - ((plen - 1) / 4 * 4); | |
3238 | /* Number of domains */ | |
3239 | entries = 1 << (4 - bits); | |
3240 | ||
3241 | len0 = NM_STRLEN ("ip6.arpa") + (2 * nibbles) + 1; | |
3242 | ||
3243 | #define N_SHIFT(x) ((x) % 2 ? 0 : 4) | |
3244 | ||
3245 | for (i = 0; i < entries; i++) { | |
3246 | len = len0; | |
3247 | str = s = g_malloc (len); | |
3248 | ||
3249 | for (j = nibbles - 1; j >= 0; j--) | |
3250 | nm_utils_strbuf_append (&s, | |
3251 | &len, | |
3252 | "%x.", | |
3253 | (addr.s6_addr[j / 2] >> N_SHIFT (j)) & 0xf); | |
3254 | nm_utils_strbuf_append_str (&s, &len, "ip6.arpa"); | |
3255 | ||
3256 | g_ptr_array_add (domains, str); | |
3257 | ||
3258 | addr.s6_addr[(nibbles - 1) / 2] += 1 << N_SHIFT (nibbles - 1); | |
3259 | } | |
3260 | ||
3261 | #undef N_SHIFT | |
3262 | } |
132 | 132 | const char *nm_utils_find_helper (const char *progname, |
133 | 133 | const char *try_first, |
134 | 134 | GError **error); |
135 | ||
136 | char *nm_utils_read_link_absolute (const char *link_file, GError **error); | |
135 | 137 | |
136 | 138 | typedef enum { |
137 | 139 | NM_MATCH_SPEC_NO_MATCH = 0, |
393 | 395 | |
394 | 396 | gboolean nm_utils_ip4_address_is_link_local (in_addr_t addr); |
395 | 397 | |
398 | const char *nm_utils_dnsmasq_status_to_string (int status, char *dest, guint size); | |
399 | ||
400 | void nm_utils_get_reverse_dns_domains_ip4 (guint32 ip, guint8 plen, GPtrArray *domains); | |
401 | void nm_utils_get_reverse_dns_domains_ip6 (const struct in6_addr *ip, guint8 plen, GPtrArray *domains); | |
402 | ||
396 | 403 | #endif /* __NM_CORE_UTILS_H__ */ |
726 | 726 | |
727 | 727 | if (device) |
728 | 728 | ip_ifindex = nm_device_get_ip_ifindex (device); |
729 | else { | |
730 | ip_ifindex = nm_vpn_connection_get_ip_ifindex (vpn); | |
731 | ||
732 | if (ip_ifindex <= 0) { | |
733 | NMDevice *parent = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (vpn)); | |
734 | ||
735 | if (parent) | |
736 | ip_ifindex = nm_device_get_ip_ifindex (parent); | |
737 | } | |
738 | } | |
729 | else | |
730 | ip_ifindex = nm_vpn_connection_get_ip_ifindex (vpn, TRUE); | |
739 | 731 | |
740 | 732 | entries = vtable->get_entries (priv); |
741 | 733 | entry = _entry_find_by_source (entries, source, &entry_idx); |
817 | 809 | } |
818 | 810 | } |
819 | 811 | } |
820 | if (nm_vpn_connection_get_ip_ifindex (vpn) > 0) | |
812 | if (nm_vpn_connection_get_ip_ifindex (vpn, FALSE) > 0) | |
821 | 813 | synced = TRUE; |
822 | 814 | else { |
823 | 815 | /* a VPN connection without tunnel device cannot have a non-synced, missing default route. |
1148 | 1140 | if (out_ac) |
1149 | 1141 | *out_ac = NM_ACTIVE_CONNECTION (vpn); |
1150 | 1142 | if (out_ip_iface) |
1151 | *out_ip_iface = nm_vpn_connection_get_ip_iface (vpn); | |
1143 | *out_ip_iface = nm_vpn_connection_get_ip_iface (vpn, TRUE); | |
1152 | 1144 | } else { |
1153 | 1145 | NMDevice *device = entry->source.device; |
1154 | 1146 | NMActRequest *req; |
34 | 34 | #include "nm-dns-unbound.h" |
35 | 35 | #include "nm-dns-manager.h" |
36 | 36 | #include "nm-dns-plugin.h" |
37 | #include "nm-dns-utils.h" | |
38 | 37 | #include "nm-dnsmasq-manager.h" |
39 | 38 | #include "nm-dnsmasq-utils.h" |
40 | 39 | #include "nmp-netns.h" |
187 | 186 | return g_define_type_id__volatile; |
188 | 187 | } |
189 | 188 | GType |
190 | nm_dns_manager_resolv_conf_mode_get_type (void) | |
191 | { | |
192 | static volatile gsize g_define_type_id__volatile = 0; | |
193 | ||
194 | if (g_once_init_enter (&g_define_type_id__volatile)) | |
195 | { | |
196 | static const GEnumValue values[] = { | |
197 | { NM_DNS_MANAGER_RESOLV_CONF_UNMANAGED, "NM_DNS_MANAGER_RESOLV_CONF_UNMANAGED", "unmanaged" }, | |
198 | { NM_DNS_MANAGER_RESOLV_CONF_EXPLICIT, "NM_DNS_MANAGER_RESOLV_CONF_EXPLICIT", "explicit" }, | |
199 | { NM_DNS_MANAGER_RESOLV_CONF_PROXY, "NM_DNS_MANAGER_RESOLV_CONF_PROXY", "proxy" }, | |
200 | { 0, NULL, NULL } | |
201 | }; | |
202 | GType g_define_type_id = | |
203 | g_enum_register_static (g_intern_static_string ("NMDnsManagerResolvConfMode"), values); | |
204 | g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); | |
205 | } | |
206 | ||
207 | return g_define_type_id__volatile; | |
208 | } | |
209 | GType | |
210 | 189 | nm_dns_manager_resolv_conf_manager_get_type (void) |
211 | 190 | { |
212 | 191 | static volatile gsize g_define_type_id__volatile = 0; |
214 | 193 | if (g_once_init_enter (&g_define_type_id__volatile)) |
215 | 194 | { |
216 | 195 | static const GEnumValue values[] = { |
217 | { _NM_DNS_MANAGER_RESOLV_CONF_MAN_INTERNAL_ONLY, "_NM_DNS_MANAGER_RESOLV_CONF_MAN_INTERNAL_ONLY", "-nm-dns-manager-resolv-conf-man-internal-only" }, | |
218 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE, "NM_DNS_MANAGER_RESOLV_CONF_MAN_NONE", "nm-dns-manager-resolv-conf-man-none" }, | |
219 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE, "NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE", "nm-dns-manager-resolv-conf-man-file" }, | |
220 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF, "NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF", "nm-dns-manager-resolv-conf-man-resolvconf" }, | |
221 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG, "NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG", "nm-dns-manager-resolv-conf-man-netconfig" }, | |
196 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN, "NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN", "unknown" }, | |
197 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED, "NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED", "unmanaged" }, | |
198 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE, "NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE", "immutable" }, | |
199 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK, "NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK", "symlink" }, | |
200 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE, "NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE", "file" }, | |
201 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF, "NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF", "resolvconf" }, | |
202 | { NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG, "NM_DNS_MANAGER_RESOLV_CONF_MAN_NETCONFIG", "netconfig" }, | |
222 | 203 | { 0, NULL, NULL } |
223 | 204 | }; |
224 | 205 | GType g_define_type_id = |
522 | 503 | if (g_once_init_enter (&g_define_type_id__volatile)) |
523 | 504 | { |
524 | 505 | static const GFlagsValue values[] = { |
525 | { NM_CONFIG_CHANGE_NONE, "NM_CONFIG_CHANGE_NONE", "nm-config-change-none" }, | |
526 | { NM_CONFIG_CHANGE_SIGHUP, "NM_CONFIG_CHANGE_SIGHUP", "nm-config-change-sighup" }, | |
527 | { NM_CONFIG_CHANGE_SIGUSR1, "NM_CONFIG_CHANGE_SIGUSR1", "nm-config-change-sigusr1" }, | |
528 | { NM_CONFIG_CHANGE_SIGUSR2, "NM_CONFIG_CHANGE_SIGUSR2", "nm-config-change-sigusr2" }, | |
529 | { NM_CONFIG_CHANGE_CONFIG_FILES, "NM_CONFIG_CHANGE_CONFIG_FILES", "nm-config-change-config-files" }, | |
530 | { NM_CONFIG_CHANGE_VALUES, "NM_CONFIG_CHANGE_VALUES", "nm-config-change-values" }, | |
531 | { NM_CONFIG_CHANGE_VALUES_USER, "NM_CONFIG_CHANGE_VALUES_USER", "nm-config-change-values-user" }, | |
532 | { NM_CONFIG_CHANGE_VALUES_INTERN, "NM_CONFIG_CHANGE_VALUES_INTERN", "nm-config-change-values-intern" }, | |
533 | { NM_CONFIG_CHANGE_CONNECTIVITY, "NM_CONFIG_CHANGE_CONNECTIVITY", "nm-config-change-connectivity" }, | |
534 | { NM_CONFIG_CHANGE_NO_AUTO_DEFAULT, "NM_CONFIG_CHANGE_NO_AUTO_DEFAULT", "nm-config-change-no-auto-default" }, | |
535 | { NM_CONFIG_CHANGE_DNS_MODE, "NM_CONFIG_CHANGE_DNS_MODE", "nm-config-change-dns-mode" }, | |
536 | { NM_CONFIG_CHANGE_RC_MANAGER, "NM_CONFIG_CHANGE_RC_MANAGER", "nm-config-change-rc-manager" }, | |
537 | { NM_CONFIG_CHANGE_GLOBAL_DNS_CONFIG, "NM_CONFIG_CHANGE_GLOBAL_DNS_CONFIG", "nm-config-change-global-dns-config" }, | |
538 | { _NM_CONFIG_CHANGE_LAST, "_NM_CONFIG_CHANGE_LAST", "-nm-config-change-last" }, | |
539 | { NM_CONFIG_CHANGE_ALL, "NM_CONFIG_CHANGE_ALL", "nm-config-change-all" }, | |
506 | { NM_CONFIG_CHANGE_NONE, "NM_CONFIG_CHANGE_NONE", "none" }, | |
507 | { NM_CONFIG_CHANGE_CAUSE_SIGHUP, "NM_CONFIG_CHANGE_CAUSE_SIGHUP", "cause-sighup" }, | |
508 | { NM_CONFIG_CHANGE_CAUSE_SIGUSR1, "NM_CONFIG_CHANGE_CAUSE_SIGUSR1", "cause-sigusr1" }, | |
509 | { NM_CONFIG_CHANGE_CAUSE_SIGUSR2, "NM_CONFIG_CHANGE_CAUSE_SIGUSR2", "cause-sigusr2" }, | |
510 | { NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT, "NM_CONFIG_CHANGE_CAUSE_NO_AUTO_DEFAULT", "cause-no-auto-default" }, | |
511 | { NM_CONFIG_CHANGE_CAUSE_SET_VALUES, "NM_CONFIG_CHANGE_CAUSE_SET_VALUES", "cause-set-values" }, | |
512 | { NM_CONFIG_CHANGE_CAUSE_CONF, "NM_CONFIG_CHANGE_CAUSE_CONF", "cause-conf" }, | |
513 | { NM_CONFIG_CHANGE_CAUSE_DNS_RC, "NM_CONFIG_CHANGE_CAUSE_DNS_RC", "cause-dns-rc" }, | |
514 | { NM_CONFIG_CHANGE_CAUSE_DNS_FULL, "NM_CONFIG_CHANGE_CAUSE_DNS_FULL", "cause-dns-full" }, | |
515 | { NM_CONFIG_CHANGE_CAUSES, "NM_CONFIG_CHANGE_CAUSES", "causes" }, | |
516 | { NM_CONFIG_CHANGE_CONFIG_FILES, "NM_CONFIG_CHANGE_CONFIG_FILES", "config-files" }, | |
517 | { NM_CONFIG_CHANGE_VALUES, "NM_CONFIG_CHANGE_VALUES", "values" }, | |
518 | { NM_CONFIG_CHANGE_VALUES_USER, "NM_CONFIG_CHANGE_VALUES_USER", "values-user" }, | |
519 | { NM_CONFIG_CHANGE_VALUES_INTERN, "NM_CONFIG_CHANGE_VALUES_INTERN", "values-intern" }, | |
520 | { NM_CONFIG_CHANGE_CONNECTIVITY, "NM_CONFIG_CHANGE_CONNECTIVITY", "connectivity" }, | |
521 | { NM_CONFIG_CHANGE_NO_AUTO_DEFAULT, "NM_CONFIG_CHANGE_NO_AUTO_DEFAULT", "no-auto-default" }, | |
522 | { NM_CONFIG_CHANGE_DNS_MODE, "NM_CONFIG_CHANGE_DNS_MODE", "dns-mode" }, | |
523 | { NM_CONFIG_CHANGE_RC_MANAGER, "NM_CONFIG_CHANGE_RC_MANAGER", "rc-manager" }, | |
524 | { NM_CONFIG_CHANGE_GLOBAL_DNS_CONFIG, "NM_CONFIG_CHANGE_GLOBAL_DNS_CONFIG", "global-dns-config" }, | |
540 | 525 | { 0, NULL, NULL } |
541 | 526 | }; |
542 | 527 | GType g_define_type_id = |
17 | 17 | #define NM_TYPE_DHCP_STATE (nm_dhcp_state_get_type ()) |
18 | 18 | GType nm_dns_ip_config_type_get_type (void) G_GNUC_CONST; |
19 | 19 | #define NM_TYPE_DNS_IP_CONFIG_TYPE (nm_dns_ip_config_type_get_type ()) |
20 | GType nm_dns_manager_resolv_conf_mode_get_type (void) G_GNUC_CONST; | |
21 | #define NM_TYPE_DNS_MANAGER_RESOLV_CONF_MODE (nm_dns_manager_resolv_conf_mode_get_type ()) | |
22 | 20 | GType nm_dns_manager_resolv_conf_manager_get_type (void) G_GNUC_CONST; |
23 | 21 | #define NM_TYPE_DNS_MANAGER_RESOLV_CONF_MANAGER (nm_dns_manager_resolv_conf_manager_get_type ()) |
24 | 22 | GType nm_dns_masq_status_get_type (void) G_GNUC_CONST; |
57 | 57 | int ifindex; |
58 | 58 | gint64 route_metric; |
59 | 59 | gboolean metered; |
60 | gint dns_priority; | |
60 | 61 | } NMIP4ConfigPrivate; |
61 | 62 | |
62 | 63 | /* internal guint32 are assigned to gobject properties of type uint. Ensure, that uint is large enough */ |
75 | 76 | PROP_SEARCHES, |
76 | 77 | PROP_DNS_OPTIONS, |
77 | 78 | PROP_WINS_SERVERS, |
79 | PROP_DNS_PRIORITY, | |
78 | 80 | ); |
79 | 81 | |
80 | 82 | NMIP4Config * |
426 | 428 | { |
427 | 429 | NMIP4ConfigPrivate *priv; |
428 | 430 | guint naddresses, nroutes, nnameservers, nsearches; |
429 | int i; | |
431 | int i, priority; | |
430 | 432 | |
431 | 433 | if (!setting) |
432 | 434 | return; |
525 | 527 | i++; |
526 | 528 | } |
527 | 529 | |
530 | priority = nm_setting_ip_config_get_dns_priority (setting); | |
531 | if (priority) | |
532 | nm_ip4_config_set_dns_priority (config, priority); | |
533 | ||
528 | 534 | g_object_thaw_notify (G_OBJECT (config)); |
529 | 535 | } |
530 | 536 | |
634 | 640 | nm_setting_ip_config_add_dns_option (s_ip4, option); |
635 | 641 | } |
636 | 642 | |
643 | g_object_set (s_ip4, | |
644 | NM_SETTING_IP_CONFIG_DNS_PRIORITY, | |
645 | nm_ip4_config_get_dns_priority (config), | |
646 | NULL); | |
647 | ||
637 | 648 | return NM_SETTING (s_ip4); |
638 | 649 | } |
639 | 650 | |
723 | 734 | /* metered flag */ |
724 | 735 | nm_ip4_config_set_metered (dst, nm_ip4_config_get_metered (dst) || |
725 | 736 | nm_ip4_config_get_metered (src)); |
737 | ||
738 | /* DNS priority */ | |
739 | if (nm_ip4_config_get_dns_priority (src)) | |
740 | nm_ip4_config_set_dns_priority (dst, nm_ip4_config_get_dns_priority (src)); | |
726 | 741 | |
727 | 742 | g_object_thaw_notify (G_OBJECT (dst)); |
728 | 743 | } |
946 | 961 | if (idx >= 0) |
947 | 962 | nm_ip4_config_del_wins (dst, idx); |
948 | 963 | } |
964 | ||
965 | /* DNS priority */ | |
966 | if (nm_ip4_config_get_dns_priority (src) == nm_ip4_config_get_dns_priority (dst)) | |
967 | nm_ip4_config_set_dns_priority (dst, 0); | |
949 | 968 | |
950 | 969 | g_object_thaw_notify (G_OBJECT (dst)); |
951 | 970 | } |
1187 | 1206 | has_relevant_changes = TRUE; |
1188 | 1207 | } |
1189 | 1208 | |
1209 | /* DNS priority */ | |
1210 | if (src_priv->dns_priority != dst_priv->dns_priority) { | |
1211 | nm_ip4_config_set_dns_priority (dst, src_priv->dns_priority); | |
1212 | has_minor_changes = TRUE; | |
1213 | } | |
1214 | ||
1190 | 1215 | /* mss */ |
1191 | 1216 | if (src_priv->mss != dst_priv->mss) { |
1192 | 1217 | nm_ip4_config_set_mss (dst, src_priv->mss); |
1310 | 1335 | for (i = 0; i < nm_ip4_config_get_num_dns_options (config); i++) |
1311 | 1336 | g_message (" dnsopt: %s", nm_ip4_config_get_dns_option (config, i)); |
1312 | 1337 | |
1338 | g_message (" dnspri: %d", nm_ip4_config_get_dns_priority (config)); | |
1313 | 1339 | |
1314 | 1340 | g_message (" mss: %"G_GUINT32_FORMAT, nm_ip4_config_get_mss (config)); |
1315 | 1341 | g_message (" mtu: %"G_GUINT32_FORMAT, nm_ip4_config_get_mtu (config)); |
1900 | 1926 | /******************************************************************/ |
1901 | 1927 | |
1902 | 1928 | void |
1929 | nm_ip4_config_set_dns_priority (NMIP4Config *config, gint priority) | |
1930 | { | |
1931 | NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); | |
1932 | ||
1933 | if (priority != priv->dns_priority) { | |
1934 | priv->dns_priority = priority; | |
1935 | _notify (config, PROP_DNS_PRIORITY); | |
1936 | } | |
1937 | } | |
1938 | ||
1939 | gint | |
1940 | nm_ip4_config_get_dns_priority (const NMIP4Config *config) | |
1941 | { | |
1942 | const NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); | |
1943 | ||
1944 | return priv->dns_priority; | |
1945 | } | |
1946 | ||
1947 | /******************************************************************/ | |
1948 | ||
1949 | void | |
1903 | 1950 | nm_ip4_config_set_mss (NMIP4Config *config, guint32 mss) |
1904 | 1951 | { |
1905 | 1952 | NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); |
2150 | 2197 | s = nm_ip4_config_get_dns_option (config, i); |
2151 | 2198 | g_checksum_update (sum, (const guint8 *) s, strlen (s)); |
2152 | 2199 | } |
2153 | ||
2154 | 2200 | } |
2155 | 2201 | |
2156 | 2202 | /** |
2384 | 2430 | break; |
2385 | 2431 | case PROP_DNS_OPTIONS: |
2386 | 2432 | nm_utils_g_value_set_strv (value, priv->dns_options); |
2433 | break; | |
2434 | case PROP_DNS_PRIORITY: | |
2435 | g_value_set_int (value, priv->dns_priority); | |
2387 | 2436 | break; |
2388 | 2437 | case PROP_WINS_SERVERS: |
2389 | 2438 | g_value_take_variant (value, |
2487 | 2536 | G_TYPE_STRV, |
2488 | 2537 | G_PARAM_READABLE | |
2489 | 2538 | G_PARAM_STATIC_STRINGS); |
2490 | ||
2539 | obj_properties[PROP_DNS_PRIORITY] = | |
2540 | g_param_spec_int (NM_IP4_CONFIG_DNS_PRIORITY, "", "", | |
2541 | G_MININT32, G_MAXINT32, 0, | |
2542 | G_PARAM_READABLE | | |
2543 | G_PARAM_STATIC_STRINGS); | |
2491 | 2544 | obj_properties[PROP_WINS_SERVERS] = |
2492 | 2545 | g_param_spec_variant (NM_IP4_CONFIG_WINS_SERVERS, "", "", |
2493 | 2546 | G_VARIANT_TYPE ("au"), |
54 | 54 | #define NM_IP4_CONFIG_DOMAINS "domains" |
55 | 55 | #define NM_IP4_CONFIG_SEARCHES "searches" |
56 | 56 | #define NM_IP4_CONFIG_DNS_OPTIONS "dns-options" |
57 | #define NM_IP4_CONFIG_DNS_PRIORITY "dns-priority" | |
57 | 58 | #define NM_IP4_CONFIG_WINS_SERVERS "wins-servers" |
58 | 59 | |
59 | 60 | /* deprecated */ |
136 | 137 | guint32 nm_ip4_config_get_num_dns_options (const NMIP4Config *config); |
137 | 138 | const char * nm_ip4_config_get_dns_option (const NMIP4Config *config, guint i); |
138 | 139 | |
140 | /* DNS priority */ | |
141 | void nm_ip4_config_set_dns_priority (NMIP4Config *config, gint priority); | |
142 | gint nm_ip4_config_get_dns_priority (const NMIP4Config *config); | |
143 | ||
139 | 144 | /* MSS */ |
140 | 145 | void nm_ip4_config_set_mss (NMIP4Config *config, guint32 mss); |
141 | 146 | guint32 nm_ip4_config_get_mss (const NMIP4Config *config); |
49 | 49 | guint32 mss; |
50 | 50 | int ifindex; |
51 | 51 | gint64 route_metric; |
52 | gint dns_priority; | |
52 | 53 | } NMIP6ConfigPrivate; |
53 | 54 | |
54 | 55 | |
63 | 64 | PROP_DOMAINS, |
64 | 65 | PROP_SEARCHES, |
65 | 66 | PROP_DNS_OPTIONS, |
67 | PROP_DNS_PRIORITY, | |
66 | 68 | ); |
67 | 69 | |
68 | 70 | NMIP6Config * |
413 | 415 | NMIP6ConfigPrivate *priv; |
414 | 416 | guint naddresses, nroutes, nnameservers, nsearches; |
415 | 417 | const char *gateway_str; |
416 | int i; | |
418 | int i, priority; | |
417 | 419 | |
418 | 420 | if (!setting) |
419 | 421 | return; |
507 | 509 | i++; |
508 | 510 | } |
509 | 511 | |
512 | priority = nm_setting_ip_config_get_dns_priority (setting); | |
513 | if (priority) | |
514 | nm_ip6_config_set_dns_priority (config, priority); | |
515 | ||
510 | 516 | g_object_thaw_notify (G_OBJECT (config)); |
511 | 517 | } |
512 | 518 | |
623 | 629 | nm_setting_ip_config_add_dns_option (s_ip6, option); |
624 | 630 | } |
625 | 631 | |
632 | g_object_set (s_ip6, | |
633 | NM_SETTING_IP_CONFIG_DNS_PRIORITY, | |
634 | nm_ip6_config_get_dns_priority (config), | |
635 | NULL); | |
626 | 636 | |
627 | 637 | return NM_SETTING (s_ip6); |
628 | 638 | } |
688 | 698 | |
689 | 699 | if (nm_ip6_config_get_mss (src)) |
690 | 700 | nm_ip6_config_set_mss (dst, nm_ip6_config_get_mss (src)); |
701 | ||
702 | /* DNS priority */ | |
703 | if (nm_ip6_config_get_dns_priority (src)) | |
704 | nm_ip6_config_set_dns_priority (dst, nm_ip6_config_get_dns_priority (src)); | |
691 | 705 | |
692 | 706 | g_object_thaw_notify (G_OBJECT (dst)); |
693 | 707 | } |
881 | 895 | |
882 | 896 | if (nm_ip6_config_get_mss (src) == nm_ip6_config_get_mss (dst)) |
883 | 897 | nm_ip6_config_set_mss (dst, 0); |
898 | ||
899 | /* DNS priority */ | |
900 | if (nm_ip6_config_get_dns_priority (src) == nm_ip6_config_get_dns_priority (dst)) | |
901 | nm_ip6_config_set_dns_priority (dst, 0); | |
884 | 902 | |
885 | 903 | g_object_thaw_notify (G_OBJECT (dst)); |
886 | 904 | } |
1128 | 1146 | has_minor_changes = TRUE; |
1129 | 1147 | } |
1130 | 1148 | |
1149 | /* DNS priority */ | |
1150 | if (src_priv->dns_priority != dst_priv->dns_priority) { | |
1151 | nm_ip6_config_set_dns_priority (dst, src_priv->dns_priority); | |
1152 | has_minor_changes = TRUE; | |
1153 | } | |
1154 | ||
1131 | 1155 | #if NM_MORE_ASSERTS |
1132 | 1156 | /* config_equal does not compare *all* the fields, therefore, we might have has_minor_changes |
1133 | 1157 | * regardless of config_equal. But config_equal must correspond to has_relevant_changes. */ |
1187 | 1211 | /* dns options */ |
1188 | 1212 | for (i = 0; i < nm_ip6_config_get_num_dns_options (config); i++) |
1189 | 1213 | g_message (" dnsopt: %s", nm_ip6_config_get_dns_option (config, i)); |
1214 | ||
1215 | g_message (" dnspri: %d", nm_ip6_config_get_dns_priority (config)); | |
1190 | 1216 | |
1191 | 1217 | g_message (" mss: %"G_GUINT32_FORMAT, nm_ip6_config_get_mss (config)); |
1192 | 1218 | g_message (" n-dflt: %d", nm_ip6_config_get_never_default (config)); |
1760 | 1786 | /******************************************************************/ |
1761 | 1787 | |
1762 | 1788 | void |
1789 | nm_ip6_config_set_dns_priority (NMIP6Config *config, gint priority) | |
1790 | { | |
1791 | NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config); | |
1792 | ||
1793 | if (priority != priv->dns_priority) { | |
1794 | priv->dns_priority = priority; | |
1795 | _notify (config, PROP_DNS_PRIORITY); | |
1796 | } | |
1797 | } | |
1798 | ||
1799 | gint | |
1800 | nm_ip6_config_get_dns_priority (const NMIP6Config *config) | |
1801 | { | |
1802 | const NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config); | |
1803 | ||
1804 | return priv->dns_priority; | |
1805 | } | |
1806 | ||
1807 | /******************************************************************/ | |
1808 | ||
1809 | void | |
1763 | 1810 | nm_ip6_config_set_mss (NMIP6Config *config, guint32 mss) |
1764 | 1811 | { |
1765 | 1812 | NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config); |
1838 | 1885 | s = nm_ip6_config_get_dns_option (config, i); |
1839 | 1886 | g_checksum_update (sum, (const guint8 *) s, strlen (s)); |
1840 | 1887 | } |
1841 | ||
1842 | 1888 | } |
1843 | 1889 | |
1844 | 1890 | /** |
2077 | 2123 | break; |
2078 | 2124 | case PROP_DNS_OPTIONS: |
2079 | 2125 | nm_utils_g_value_set_strv (value, priv->dns_options); |
2126 | break; | |
2127 | case PROP_DNS_PRIORITY: | |
2128 | g_value_set_int (value, priv->dns_priority); | |
2080 | 2129 | break; |
2081 | 2130 | default: |
2082 | 2131 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
2175 | 2224 | G_TYPE_STRV, |
2176 | 2225 | G_PARAM_READABLE | |
2177 | 2226 | G_PARAM_STATIC_STRINGS); |
2227 | obj_properties[PROP_DNS_PRIORITY] = | |
2228 | g_param_spec_int (NM_IP6_CONFIG_DNS_PRIORITY, "", "", | |
2229 | G_MININT32, G_MAXINT32, 0, | |
2230 | G_PARAM_READABLE | | |
2231 | G_PARAM_STATIC_STRINGS); | |
2178 | 2232 | |
2179 | 2233 | g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); |
2180 | 2234 |
56 | 56 | #define NM_IP6_CONFIG_DOMAINS "domains" |
57 | 57 | #define NM_IP6_CONFIG_SEARCHES "searches" |
58 | 58 | #define NM_IP6_CONFIG_DNS_OPTIONS "dns-options" |
59 | #define NM_IP6_CONFIG_DNS_PRIORITY "dns-priority" | |
59 | 60 | |
60 | 61 | /* deprecated */ |
61 | 62 | #define NM_IP6_CONFIG_ADDRESSES "addresses" |
138 | 139 | guint32 nm_ip6_config_get_num_dns_options (const NMIP6Config *config); |
139 | 140 | const char * nm_ip6_config_get_dns_option (const NMIP6Config *config, guint i); |
140 | 141 | |
142 | /* DNS priority */ | |
143 | void nm_ip6_config_set_dns_priority (NMIP6Config *config, gint priority); | |
144 | gint nm_ip6_config_get_dns_priority (const NMIP6Config *config); | |
145 | ||
141 | 146 | /* MSS */ |
142 | 147 | void nm_ip6_config_set_mss (NMIP6Config *config, guint32 mss); |
143 | 148 | guint32 nm_ip6_config_get_mss (const NMIP6Config *config); |
27 | 27 | #include <unistd.h> |
28 | 28 | |
29 | 29 | #include "nm-manager.h" |
30 | #include "nm-common-macros.h" | |
30 | 31 | #include "nm-bus-manager.h" |
31 | 32 | #include "nm-vpn-manager.h" |
32 | 33 | #include "nm-device.h" |
67 | 68 | |
68 | 69 | static void policy_activating_device_changed (GObject *object, GParamSpec *pspec, gpointer user_data); |
69 | 70 | |
70 | static void rfkill_change (const char *desc, RfKillType rtype, gboolean enabled); | |
71 | ||
72 | 71 | static gboolean find_master (NMManager *self, |
73 | 72 | NMConnection *connection, |
74 | 73 | NMDevice *device, |
79 | 78 | |
80 | 79 | static void nm_manager_update_state (NMManager *manager); |
81 | 80 | |
82 | static void connection_changed (NMSettings *settings, NMConnection *connection, | |
83 | NMManager *manager); | |
81 | static void connection_changed (NMManager *self, NMConnection *connection); | |
82 | static void device_sleep_cb (NMDevice *device, | |
83 | GParamSpec *pspec, | |
84 | NMManager *self); | |
84 | 85 | |
85 | 86 | #define TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE "act-con-add-and-activate" |
86 | 87 | |
131 | 132 | NMSleepMonitor *sleep_monitor; |
132 | 133 | |
133 | 134 | GSList *auth_chains; |
135 | GHashTable *sleep_devices; | |
134 | 136 | |
135 | 137 | /* Firmware dir monitor */ |
136 | 138 | GFileMonitor *fw_monitor; |
456 | 458 | _notify (self, PROP_GLOBAL_DNS_CONFIGURATION); |
457 | 459 | } |
458 | 460 | |
461 | static void | |
462 | _reload_auth_cb (NMAuthChain *chain, | |
463 | GError *error, | |
464 | GDBusMethodInvocation *context, | |
465 | gpointer user_data) | |
466 | { | |
467 | NMManager *self = NM_MANAGER (user_data); | |
468 | NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
469 | GError *ret_error = NULL; | |
470 | NMAuthCallResult result; | |
471 | guint32 flags; | |
472 | NMAuthSubject *subject; | |
473 | char s_buf[60]; | |
474 | NMConfigChangeFlags reload_type = NM_CONFIG_CHANGE_NONE; | |
475 | ||
476 | g_assert (context); | |
477 | ||
478 | priv->auth_chains = g_slist_remove (priv->auth_chains, chain); | |
479 | flags = GPOINTER_TO_UINT (nm_auth_chain_get_data (chain, "flags")); | |
480 | ||
481 | subject = nm_auth_chain_get_subject (chain); | |
482 | ||
483 | result = nm_auth_chain_get_result (chain, NM_AUTH_PERMISSION_RELOAD); | |
484 | if (error) { | |
485 | _LOGD (LOGD_CORE, "Reload request failed: %s", error->message); | |
486 | ret_error = g_error_new (NM_MANAGER_ERROR, | |
487 | NM_MANAGER_ERROR_PERMISSION_DENIED, | |
488 | "Reload request failed: %s", | |
489 | error->message); | |
490 | } else if (result != NM_AUTH_CALL_RESULT_YES) { | |
491 | ret_error = g_error_new_literal (NM_MANAGER_ERROR, | |
492 | NM_MANAGER_ERROR_PERMISSION_DENIED, | |
493 | "Not authorized to reload configuration"); | |
494 | } else { | |
495 | if (NM_FLAGS_ANY (flags, ~NM_MANAGER_RELOAD_FLAGS_ALL)) { | |
496 | /* invalid flags */ | |
497 | } else if (flags == 0) | |
498 | reload_type = NM_CONFIG_CHANGE_CAUSE_SIGHUP; | |
499 | else { | |
500 | if (NM_FLAGS_HAS (flags, NM_MANAGER_RELOAD_FLAGS_CONF)) | |
501 | reload_type |= NM_CONFIG_CHANGE_CAUSE_CONF; | |
502 | if (NM_FLAGS_HAS (flags, NM_MANAGER_RELOAD_FLAGS_DNS_RC)) | |
503 | reload_type |= NM_CONFIG_CHANGE_CAUSE_DNS_RC; | |
504 | if (NM_FLAGS_HAS (flags, NM_MANAGER_RELOAD_FLAGS_DNS_FULL)) | |
505 | reload_type |= NM_CONFIG_CHANGE_CAUSE_DNS_FULL; | |
506 | } | |
507 | ||
508 | if (reload_type == NM_CONFIG_CHANGE_NONE) { | |
509 | ret_error = g_error_new_literal (NM_MANAGER_ERROR, | |
510 | NM_MANAGER_ERROR_INVALID_ARGUMENTS, | |
511 | "Invalid flags for reload"); | |
512 | } | |
513 | } | |
514 | ||
515 | nm_audit_log_control_op (NM_AUDIT_OP_RELOAD, | |
516 | nm_sprintf_buf (s_buf, "%u", flags), | |
517 | ret_error == NULL, subject, | |
518 | ret_error ? ret_error->message : NULL); | |
519 | ||
520 | if (ret_error) { | |
521 | g_dbus_method_invocation_take_error (context, ret_error); | |
522 | goto out; | |
523 | } | |
524 | ||
525 | nm_config_reload (priv->config, reload_type); | |
526 | g_dbus_method_invocation_return_value (context, NULL); | |
527 | ||
528 | out: | |
529 | nm_auth_chain_unref (chain); | |
530 | } | |
531 | ||
532 | static void | |
533 | impl_manager_reload (NMManager *self, | |
534 | GDBusMethodInvocation *context, | |
535 | guint32 flags) | |
536 | { | |
537 | NMManagerPrivate *priv; | |
538 | NMAuthChain *chain; | |
539 | GError *error = NULL; | |
540 | ||
541 | g_return_if_fail (NM_IS_MANAGER (self)); | |
542 | ||
543 | priv = NM_MANAGER_GET_PRIVATE (self); | |
544 | ||
545 | chain = nm_auth_chain_new_context (context, _reload_auth_cb, self); | |
546 | if (!chain) { | |
547 | error = g_error_new_literal (NM_MANAGER_ERROR, | |
548 | NM_MANAGER_ERROR_PERMISSION_DENIED, | |
549 | "Unable to authenticate request"); | |
550 | g_dbus_method_invocation_take_error (context, error); | |
551 | return; | |
552 | } | |
553 | ||
554 | priv->auth_chains = g_slist_append (priv->auth_chains, chain); | |
555 | nm_auth_chain_set_data (chain, "flags", GUINT_TO_POINTER (flags), NULL); | |
556 | nm_auth_chain_add_call (chain, NM_AUTH_PERMISSION_RELOAD, TRUE); | |
557 | } | |
558 | ||
459 | 559 | /************************************************************************/ |
460 | 560 | |
461 | 561 | static NMDevice * |
838 | 938 | nm_device_get_iface (device), allow_unmanage, nm_device_get_managed (device, FALSE)); |
839 | 939 | |
840 | 940 | if (allow_unmanage && nm_device_get_managed (device, FALSE)) { |
841 | NMActRequest *req = nm_device_get_act_request (device); | |
842 | ||
843 | /* Leave activated interfaces up when quitting so their configuration | |
844 | * can be taken over when NM restarts. This ensures connectivity while | |
845 | * NM is stopped. Devices which do not support connection assumption | |
846 | * cannot be left up. | |
847 | */ | |
848 | if (!quitting) /* Forced removal; device already gone */ | |
849 | unmanage = TRUE; | |
850 | else if (!nm_device_can_assume_active_connection (device)) | |
851 | unmanage = TRUE; | |
852 | else if (!req) | |
853 | unmanage = TRUE; | |
941 | unmanage = TRUE; | |
942 | ||
943 | if (!quitting) { | |
944 | /* the device is already gone. Unmanage it. */ | |
945 | } else { | |
946 | /* Leave certain devices alone when quitting so their configuration | |
947 | * can be taken over when NM restarts. This ensures connectivity while | |
948 | * NM is stopped. | |
949 | */ | |
950 | if (nm_device_uses_assumed_connection (device)) { | |
951 | /* An assume connection must be left alone */ | |
952 | unmanage = FALSE; | |
953 | } else if (!nm_device_get_act_request (device)) { | |
954 | /* a device without any active connection is either UNAVAILABLE or DISCONNECTED | |
955 | * state. Since we don't know whether the device was upped by NetworkManager, | |
956 | * we must leave it up on exit. */ | |
957 | unmanage = FALSE; | |
958 | } else if (!nm_platform_link_can_assume (NM_PLATFORM_GET, nm_device_get_ifindex (device))) { | |
959 | /* The device has no layer 3 configuration. Leave it up. */ | |
960 | unmanage = FALSE; | |
961 | } else if (nm_device_can_assume_active_connection (device)) | |
962 | unmanage = FALSE; | |
963 | } | |
854 | 964 | |
855 | 965 | if (unmanage) { |
856 | 966 | if (quitting) |
1161 | 1271 | ifname = nm_manager_get_connection_iface (self, candidate, &parent, &error); |
1162 | 1272 | if (ifname) { |
1163 | 1273 | if (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, ifname)) |
1164 | connection_changed (priv->settings, candidate, self); | |
1274 | connection_changed (self, candidate); | |
1165 | 1275 | } |
1166 | 1276 | } |
1167 | 1277 | } |
1170 | 1280 | } |
1171 | 1281 | |
1172 | 1282 | static void |
1173 | connection_changed (NMSettings *settings, | |
1174 | NMConnection *connection, | |
1175 | NMManager *manager) | |
1283 | connection_changed (NMManager *self, | |
1284 | NMConnection *connection) | |
1176 | 1285 | { |
1177 | 1286 | NMDevice *device; |
1178 | 1287 | |
1179 | 1288 | if (!nm_connection_is_virtual (connection)) |
1180 | 1289 | return; |
1181 | 1290 | |
1182 | device = system_create_virtual_device (manager, connection); | |
1291 | device = system_create_virtual_device (self, connection); | |
1183 | 1292 | if (!device) |
1184 | 1293 | return; |
1185 | 1294 | |
1186 | 1295 | /* Maybe the device that was created was needed by some other |
1187 | 1296 | * connection's device (parent of a VLAN). Let the connections |
1188 | 1297 | * can use the newly created device as a parent know. */ |
1189 | retry_connections_for_parent_device (manager, device); | |
1190 | } | |
1191 | ||
1192 | static void | |
1193 | connection_removed (NMSettings *settings, | |
1194 | NMSettingsConnection *connection, | |
1195 | NMManager *manager) | |
1196 | { | |
1197 | /* | |
1198 | * Do not delete existing virtual devices to keep connectivity up. | |
1199 | * Virtual devices are reused when NetworkManager is restarted. | |
1200 | */ | |
1298 | retry_connections_for_parent_device (self, device); | |
1299 | } | |
1300 | ||
1301 | static void | |
1302 | connection_added_cb (NMSettings *settings, | |
1303 | NMConnection *connection, | |
1304 | NMManager *self) | |
1305 | { | |
1306 | connection_changed (self, connection); | |
1307 | } | |
1308 | ||
1309 | static void | |
1310 | connection_updated_cb (NMSettings *settings, | |
1311 | NMConnection *connection, | |
1312 | gboolean by_user, | |
1313 | NMManager *self) | |
1314 | { | |
1315 | if (by_user) | |
1316 | connection_changed (self, connection); | |
1201 | 1317 | } |
1202 | 1318 | |
1203 | 1319 | static void |
2776 | 2892 | /* We can now proceed to disconnected state so that activation proceeds. */ |
2777 | 2893 | unmanaged_to_disconnected (device); |
2778 | 2894 | } else { |
2779 | nm_log_warn (LOGD_CORE, "Could not realize device '%s': %s", | |
2780 | nm_device_get_iface (device), error->message); | |
2895 | _LOGW (LOGD_CORE, "Could not realize device '%s': %s", | |
2896 | nm_device_get_iface (device), error->message); | |
2781 | 2897 | nm_active_connection_set_state (active, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED); |
2782 | 2898 | } |
2783 | 2899 | } else { |
2784 | nm_log_warn (LOGD_CORE, "The parent connection device '%s' depended on disappeared.", | |
2785 | nm_device_get_iface (device)); | |
2900 | _LOGW (LOGD_CORE, "The parent connection device '%s' depended on disappeared.", | |
2901 | nm_device_get_iface (device)); | |
2786 | 2902 | nm_active_connection_set_state (active, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED); |
2787 | 2903 | } |
2788 | 2904 | } |
3267 | 3383 | NM_MANAGER_ERROR, |
3268 | 3384 | NM_MANAGER_ERROR_CONNECTION_NOT_AVAILABLE, |
3269 | 3385 | "Sharing IPv6 connections is not supported yet."); |
3270 | return NULL; | |
3386 | goto error; | |
3271 | 3387 | } |
3272 | 3388 | |
3273 | 3389 | /* Check whether it's a VPN or not */ |
3848 | 3964 | return nm_platform_link_get_wake_on_lan (NM_PLATFORM_GET, nm_device_get_ip_ifindex (device)); |
3849 | 3965 | } |
3850 | 3966 | |
3967 | static gboolean | |
3968 | sleep_devices_add (NMManager *self, NMDevice *device, gboolean suspending) | |
3969 | { | |
3970 | NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
3971 | NMSleepMonitorInhibitorHandle *handle = NULL; | |
3972 | ||
3973 | if (g_hash_table_lookup_extended (priv->sleep_devices, device, NULL, (gpointer *) &handle)) { | |
3974 | if (suspending) { | |
3975 | /* if we are suspending, always insert a new handle in sleep_devices. | |
3976 | * Even if we had an old handle, it might be stale by now. */ | |
3977 | g_hash_table_insert (priv->sleep_devices, device, | |
3978 | nm_sleep_monitor_inhibit_take (priv->sleep_monitor)); | |
3979 | if (handle) | |
3980 | nm_sleep_monitor_inhibit_release (priv->sleep_monitor, handle); | |
3981 | } | |
3982 | return FALSE; | |
3983 | } | |
3984 | ||
3985 | g_hash_table_insert (priv->sleep_devices, | |
3986 | g_object_ref (device), | |
3987 | suspending | |
3988 | ? nm_sleep_monitor_inhibit_take (priv->sleep_monitor) | |
3989 | : NULL); | |
3990 | g_signal_connect (device, "notify::" NM_DEVICE_STATE, (GCallback) device_sleep_cb, self); | |
3991 | return TRUE; | |
3992 | } | |
3993 | ||
3994 | static gboolean | |
3995 | sleep_devices_remove (NMManager *self, NMDevice *device) | |
3996 | { | |
3997 | NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
3998 | NMSleepMonitorInhibitorHandle *handle; | |
3999 | ||
4000 | if (!g_hash_table_lookup_extended (priv->sleep_devices, device, NULL, (gpointer *) &handle)) | |
4001 | return FALSE; | |
4002 | ||
4003 | if (handle) | |
4004 | nm_sleep_monitor_inhibit_release (priv->sleep_monitor, handle); | |
4005 | ||
4006 | /* Remove device from hash */ | |
4007 | g_signal_handlers_disconnect_by_func (device, device_sleep_cb, self); | |
4008 | g_hash_table_remove (priv->sleep_devices, device); | |
4009 | g_object_unref (device); | |
4010 | return TRUE; | |
4011 | } | |
4012 | ||
4013 | static void | |
4014 | sleep_devices_clear (NMManager *self) | |
4015 | { | |
4016 | NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
4017 | NMDevice *device; | |
4018 | NMSleepMonitorInhibitorHandle *handle; | |
4019 | GHashTableIter iter; | |
4020 | ||
4021 | if (!priv->sleep_devices) | |
4022 | return; | |
4023 | ||
4024 | g_hash_table_iter_init (&iter, priv->sleep_devices); | |
4025 | while (g_hash_table_iter_next (&iter, (gpointer *) &device, (gpointer *) &handle)) { | |
4026 | g_signal_handlers_disconnect_by_func (device, device_sleep_cb, self); | |
4027 | if (handle) | |
4028 | nm_sleep_monitor_inhibit_release (priv->sleep_monitor, handle); | |
4029 | g_object_unref (device); | |
4030 | g_hash_table_iter_remove (&iter); | |
4031 | } | |
4032 | } | |
4033 | ||
4034 | static void | |
4035 | device_sleep_cb (NMDevice *device, | |
4036 | GParamSpec *pspec, | |
4037 | NMManager *self) | |
4038 | { | |
4039 | switch (nm_device_get_state (device)) { | |
4040 | case NM_DEVICE_STATE_DISCONNECTED: | |
4041 | _LOGD (LOGD_SUSPEND, "sleep: unmanaging device %s", nm_device_get_ip_iface (device)); | |
4042 | nm_device_set_unmanaged_by_flags_queue (device, | |
4043 | NM_UNMANAGED_SLEEPING, | |
4044 | TRUE, | |
4045 | NM_DEVICE_STATE_REASON_SLEEPING); | |
4046 | break; | |
4047 | case NM_DEVICE_STATE_UNMANAGED: | |
4048 | _LOGD (LOGD_SUSPEND, "sleep: device %s is ready", nm_device_get_ip_iface (device)); | |
4049 | ||
4050 | if (!sleep_devices_remove (self, device)) | |
4051 | g_return_if_reached (); | |
4052 | ||
4053 | break; | |
4054 | default: | |
4055 | return; | |
4056 | } | |
4057 | } | |
4058 | ||
3851 | 4059 | static void |
3852 | 4060 | do_sleep_wake (NMManager *self, gboolean sleeping_changed) |
3853 | 4061 | { |
3871 | 4079 | if (nm_device_is_software (device)) |
3872 | 4080 | continue; |
3873 | 4081 | /* Wake-on-LAN devices will be taken down post-suspend rather than pre- */ |
3874 | if (suspending && device_is_wake_on_lan (device)) | |
4082 | if (suspending && device_is_wake_on_lan (device)) { | |
4083 | _LOGD (LOGD_SUSPEND, "sleep: device %s has wake-on-lan, skipping", | |
4084 | nm_device_get_ip_iface (device)); | |
3875 | 4085 | continue; |
3876 | ||
3877 | nm_device_set_unmanaged_by_flags (device, NM_UNMANAGED_SLEEPING, TRUE, NM_DEVICE_STATE_REASON_SLEEPING); | |
4086 | } | |
4087 | ||
4088 | if (nm_device_is_activating (device) || | |
4089 | nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED) { | |
4090 | _LOGD (LOGD_SUSPEND, "sleep: wait disconnection of device %s", | |
4091 | nm_device_get_ip_iface (device)); | |
4092 | ||
4093 | if (sleep_devices_add (self, device, suspending)) | |
4094 | nm_device_queue_state (device, NM_DEVICE_STATE_DEACTIVATING, NM_DEVICE_STATE_REASON_SLEEPING); | |
4095 | } else { | |
4096 | nm_device_set_unmanaged_by_flags (device, NM_UNMANAGED_SLEEPING, TRUE, NM_DEVICE_STATE_REASON_SLEEPING); | |
4097 | } | |
3878 | 4098 | } |
3879 | 4099 | } else { |
3880 | 4100 | _LOGI (LOGD_SUSPEND, "%s...", waking_from_suspend ? "waking up" : "re-enabling"); |
3881 | 4101 | |
3882 | 4102 | if (waking_from_suspend) { |
4103 | sleep_devices_clear (self); | |
3883 | 4104 | /* Belatedly take down Wake-on-LAN devices; ideally we wouldn't have to do this |
3884 | 4105 | * but for now it's the only way to make sure we re-check their connectivity. |
3885 | 4106 | */ |
3940 | 4161 | static void |
3941 | 4162 | _internal_sleep (NMManager *self, gboolean do_sleep) |
3942 | 4163 | { |
3943 | NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); | |
4164 | NMManagerPrivate *priv; | |
4165 | ||
4166 | g_return_if_fail (NM_IS_MANAGER (self)); | |
4167 | ||
4168 | priv = NM_MANAGER_GET_PRIVATE (self); | |
3944 | 4169 | |
3945 | 4170 | if (priv->sleeping == do_sleep) |
3946 | 4171 | return; |
4053 | 4278 | } |
4054 | 4279 | |
4055 | 4280 | static void |
4056 | sleeping_cb (NMSleepMonitor *monitor, gpointer user_data) | |
4057 | { | |
4058 | nm_log_dbg (LOGD_SUSPEND, "Received sleeping signal"); | |
4059 | _internal_sleep (NM_MANAGER (user_data), TRUE); | |
4060 | } | |
4061 | ||
4062 | static void | |
4063 | resuming_cb (NMSleepMonitor *monitor, gpointer user_data) | |
4064 | { | |
4065 | nm_log_dbg (LOGD_SUSPEND, "Received resuming signal"); | |
4066 | _internal_sleep (NM_MANAGER (user_data), FALSE); | |
4281 | sleeping_cb (NMSleepMonitor *monitor, gboolean is_about_to_suspend, gpointer user_data) | |
4282 | { | |
4283 | NMManager *self = user_data; | |
4284 | ||
4285 | _LOGD (LOGD_SUSPEND, "Received %s signal", is_about_to_suspend ? "sleeping" : "resuming"); | |
4286 | _internal_sleep (self, is_about_to_suspend); | |
4067 | 4287 | } |
4068 | 4288 | |
4069 | 4289 | static void |
4185 | 4405 | /* Permissions */ |
4186 | 4406 | |
4187 | 4407 | static void |
4188 | get_perm_add_result (NMAuthChain *chain, GVariantBuilder *results, const char *permission) | |
4408 | get_perm_add_result (NMManager *self, NMAuthChain *chain, GVariantBuilder *results, const char *permission) | |
4189 | 4409 | { |
4190 | 4410 | NMAuthCallResult result; |
4191 | 4411 | |
4197 | 4417 | else if (result == NM_AUTH_CALL_RESULT_AUTH) |
4198 | 4418 | g_variant_builder_add (results, "{ss}", permission, "auth"); |
4199 | 4419 | else { |
4200 | nm_log_dbg (LOGD_CORE, "unknown auth chain result %d", result); | |
4420 | _LOGD (LOGD_CORE, "unknown auth chain result %d", result); | |
4201 | 4421 | } |
4202 | 4422 | } |
4203 | 4423 | |
4225 | 4445 | } else { |
4226 | 4446 | g_variant_builder_init (&results, G_VARIANT_TYPE ("a{ss}")); |
4227 | 4447 | |
4228 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK); | |
4229 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_SLEEP_WAKE); | |
4230 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI); | |
4231 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN); | |
4232 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX); | |
4233 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_NETWORK_CONTROL); | |
4234 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED); | |
4235 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_WIFI_SHARE_OPEN); | |
4236 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM); | |
4237 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN); | |
4238 | get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME); | |
4448 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK); | |
4449 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_SLEEP_WAKE); | |
4450 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI); | |
4451 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN); | |
4452 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX); | |
4453 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_NETWORK_CONTROL); | |
4454 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED); | |
4455 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_WIFI_SHARE_OPEN); | |
4456 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM); | |
4457 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN); | |
4458 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME); | |
4459 | get_perm_add_result (self, chain, &results, NM_AUTH_PERMISSION_RELOAD); | |
4239 | 4460 | |
4240 | 4461 | g_dbus_method_invocation_return_value (context, |
4241 | 4462 | g_variant_new ("(a{ss})", &results)); |
4273 | 4494 | nm_auth_chain_add_call (chain, NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM, FALSE); |
4274 | 4495 | nm_auth_chain_add_call (chain, NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN, FALSE); |
4275 | 4496 | nm_auth_chain_add_call (chain, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME, FALSE); |
4497 | nm_auth_chain_add_call (chain, NM_AUTH_PERMISSION_RELOAD, FALSE); | |
4276 | 4498 | } |
4277 | 4499 | |
4278 | 4500 | static void |
4472 | 4694 | _LOGD (LOGD_CORE, "creating virtual devices..."); |
4473 | 4695 | connections = nm_settings_get_connections (priv->settings); |
4474 | 4696 | for (iter = connections; iter; iter = iter->next) |
4475 | connection_changed (priv->settings, NM_CONNECTION (iter->data), self); | |
4697 | connection_changed (self, NM_CONNECTION (iter->data)); | |
4476 | 4698 | g_slist_free (connections); |
4477 | 4699 | |
4478 | 4700 | priv->devices_inited = TRUE; |
4964 | 5186 | } __attribute__((packed)); |
4965 | 5187 | |
4966 | 5188 | static void |
4967 | rfkill_change (const char *desc, RfKillType rtype, gboolean enabled) | |
5189 | rfkill_change (NMManager *self, const char *desc, RfKillType rtype, gboolean enabled) | |
4968 | 5190 | { |
4969 | 5191 | int fd; |
4970 | 5192 | struct rfkill_event event; |
4976 | 5198 | fd = open ("/dev/rfkill", O_RDWR); |
4977 | 5199 | if (fd < 0) { |
4978 | 5200 | if (errno == EACCES) |
4979 | nm_log_warn (LOGD_RFKILL, "(%s): failed to open killswitch device", desc); | |
5201 | _LOGW (LOGD_RFKILL, "(%s): failed to open killswitch device", desc); | |
4980 | 5202 | return; |
4981 | 5203 | } |
4982 | 5204 | |
4983 | 5205 | if (fcntl (fd, F_SETFL, O_NONBLOCK) < 0) { |
4984 | nm_log_warn (LOGD_RFKILL, "(%s): failed to set killswitch device for " | |
4985 | "non-blocking operation", desc); | |
5206 | _LOGW (LOGD_RFKILL, "(%s): failed to set killswitch device for " | |
5207 | "non-blocking operation", desc); | |
4986 | 5208 | close (fd); |
4987 | 5209 | return; |
4988 | 5210 | } |
5003 | 5225 | |
5004 | 5226 | len = write (fd, &event, sizeof (event)); |
5005 | 5227 | if (len < 0) { |
5006 | nm_log_warn (LOGD_RFKILL, "(%s): failed to change WiFi killswitch state: (%d) %s", | |
5007 | desc, errno, g_strerror (errno)); | |
5228 | _LOGW (LOGD_RFKILL, "(%s): failed to change WiFi killswitch state: (%d) %s", | |
5229 | desc, errno, g_strerror (errno)); | |
5008 | 5230 | } else if (len == sizeof (event)) { |
5009 | nm_log_info (LOGD_RFKILL, "%s hardware radio set %s", | |
5010 | desc, enabled ? "enabled" : "disabled"); | |
5231 | _LOGI (LOGD_RFKILL, "%s hardware radio set %s", | |
5232 | desc, enabled ? "enabled" : "disabled"); | |
5011 | 5233 | } else { |
5012 | 5234 | /* Failed to write full structure */ |
5013 | nm_log_warn (LOGD_RFKILL, "(%s): failed to change WiFi killswitch state", desc); | |
5235 | _LOGW (LOGD_RFKILL, "(%s): failed to change WiFi killswitch state", desc); | |
5014 | 5236 | } |
5015 | 5237 | |
5016 | 5238 | close (fd); |
5063 | 5285 | if (new_enabled != old_enabled) { |
5064 | 5286 | /* Try to change the kernel rfkill state */ |
5065 | 5287 | if (rstate->rtype == RFKILL_TYPE_WLAN || rstate->rtype == RFKILL_TYPE_WWAN) |
5066 | rfkill_change (rstate->desc, rstate->rtype, new_enabled); | |
5288 | rfkill_change (self, rstate->desc, rstate->rtype, new_enabled); | |
5067 | 5289 | |
5068 | 5290 | manager_update_radio_enabled (self, rstate, new_enabled); |
5069 | 5291 | } |
5166 | 5388 | g_signal_connect (priv->settings, "notify::" NM_SETTINGS_HOSTNAME, |
5167 | 5389 | G_CALLBACK (system_hostname_changed_cb), self); |
5168 | 5390 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, |
5169 | G_CALLBACK (connection_changed), self); | |
5170 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER, | |
5171 | G_CALLBACK (connection_changed), self); | |
5172 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, | |
5173 | G_CALLBACK (connection_removed), self); | |
5391 | G_CALLBACK (connection_added_cb), self); | |
5392 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, | |
5393 | G_CALLBACK (connection_updated_cb), self); | |
5394 | /* | |
5395 | * Do not delete existing virtual devices to keep connectivity up. | |
5396 | * Virtual devices are reused when NetworkManager is restarted. | |
5397 | * Hence, don't react on NM_SETTINGS_SIGNAL_CONNECTION_REMOVED. | |
5398 | */ | |
5174 | 5399 | |
5175 | 5400 | priv->policy = nm_policy_new (self, priv->settings); |
5176 | 5401 | g_signal_connect (priv->policy, "notify::" NM_POLICY_DEFAULT_IP4_DEVICE, |
5206 | 5431 | * changes to the WirelessEnabled/WWANEnabled properties which toggle kernel |
5207 | 5432 | * rfkill. |
5208 | 5433 | */ |
5209 | rfkill_change (priv->radio_states[RFKILL_TYPE_WLAN].desc, RFKILL_TYPE_WLAN, priv->radio_states[RFKILL_TYPE_WLAN].user_enabled); | |
5210 | rfkill_change (priv->radio_states[RFKILL_TYPE_WWAN].desc, RFKILL_TYPE_WWAN, priv->radio_states[RFKILL_TYPE_WWAN].user_enabled); | |
5434 | rfkill_change (self, priv->radio_states[RFKILL_TYPE_WLAN].desc, RFKILL_TYPE_WLAN, priv->radio_states[RFKILL_TYPE_WLAN].user_enabled); | |
5435 | rfkill_change (self, priv->radio_states[RFKILL_TYPE_WWAN].desc, RFKILL_TYPE_WWAN, priv->radio_states[RFKILL_TYPE_WWAN].user_enabled); | |
5211 | 5436 | } |
5212 | 5437 | |
5213 | 5438 | static void |
5248 | 5473 | self); |
5249 | 5474 | |
5250 | 5475 | /* sleep/wake handling */ |
5251 | priv->sleep_monitor = g_object_ref (nm_sleep_monitor_get ()); | |
5476 | priv->sleep_monitor = nm_sleep_monitor_new (); | |
5252 | 5477 | g_signal_connect (priv->sleep_monitor, NM_SLEEP_MONITOR_SLEEPING, |
5253 | 5478 | G_CALLBACK (sleeping_cb), self); |
5254 | g_signal_connect (priv->sleep_monitor, NM_SLEEP_MONITOR_RESUMING, | |
5255 | G_CALLBACK (resuming_cb), self); | |
5256 | 5479 | |
5257 | 5480 | /* Listen for authorization changes */ |
5258 | 5481 | g_signal_connect (nm_auth_manager_get (), |
5283 | 5506 | priv->timestamp_update_id = g_timeout_add_seconds (300, (GSourceFunc) periodic_update_active_connection_timestamps, self); |
5284 | 5507 | |
5285 | 5508 | priv->metered = NM_METERED_UNKNOWN; |
5509 | priv->sleep_devices = g_hash_table_new (g_direct_hash, g_direct_equal); | |
5286 | 5510 | } |
5287 | 5511 | |
5288 | 5512 | static gboolean |
5491 | 5715 | g_signal_handlers_disconnect_by_func (priv->settings, settings_startup_complete_changed, manager); |
5492 | 5716 | g_signal_handlers_disconnect_by_func (priv->settings, system_unmanaged_devices_changed_cb, manager); |
5493 | 5717 | g_signal_handlers_disconnect_by_func (priv->settings, system_hostname_changed_cb, manager); |
5494 | g_signal_handlers_disconnect_by_func (priv->settings, connection_changed, manager); | |
5495 | g_signal_handlers_disconnect_by_func (priv->settings, connection_removed, manager); | |
5718 | g_signal_handlers_disconnect_by_func (priv->settings, connection_added_cb, manager); | |
5719 | g_signal_handlers_disconnect_by_func (priv->settings, connection_updated_cb, manager); | |
5496 | 5720 | g_clear_object (&priv->settings); |
5497 | 5721 | } |
5498 | 5722 | |
5506 | 5730 | } |
5507 | 5731 | _set_prop_filter (manager, NULL); |
5508 | 5732 | |
5733 | sleep_devices_clear (manager); | |
5734 | g_clear_pointer (&priv->sleep_devices, g_hash_table_unref); | |
5735 | ||
5509 | 5736 | if (priv->sleep_monitor) { |
5510 | 5737 | g_signal_handlers_disconnect_by_func (priv->sleep_monitor, sleeping_cb, manager); |
5511 | g_signal_handlers_disconnect_by_func (priv->sleep_monitor, resuming_cb, manager); | |
5512 | 5738 | g_clear_object (&priv->sleep_monitor); |
5513 | 5739 | } |
5514 | 5740 | |
5785 | 6011 | |
5786 | 6012 | nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (manager_class), |
5787 | 6013 | NMDBUS_TYPE_MANAGER_SKELETON, |
6014 | "Reload", impl_manager_reload, | |
5788 | 6015 | "GetDevices", impl_manager_get_devices, |
5789 | 6016 | "GetAllDevices", impl_manager_get_all_devices, |
5790 | 6017 | "GetDeviceByIpIface", impl_manager_get_device_by_ip_iface, |
82 | 82 | |
83 | 83 | guint reset_retries_id; /* idle handler for resetting the retries count */ |
84 | 84 | |
85 | guint schedule_activate_all_id; /* idle handler for schedule_activate_all(). */ | |
86 | ||
85 | 87 | char *orig_hostname; /* hostname at NM start time */ |
86 | 88 | char *cur_hostname; /* hostname we want to assign */ |
87 | 89 | gboolean hostname_changed; /* TRUE if NM ever set the hostname */ |
912 | 914 | NM_DEVICE_STATE_REASON_USER_REQUESTED); |
913 | 915 | } |
914 | 916 | } |
917 | g_slist_free (connections); | |
915 | 918 | } |
916 | 919 | |
917 | 920 | static void |
1013 | 1016 | |
1014 | 1017 | return FALSE; |
1015 | 1018 | } |
1016 | ||
1017 | static void schedule_activate_all (NMPolicy *self); | |
1018 | 1019 | |
1019 | 1020 | static void |
1020 | 1021 | activate_slave_connections (NMPolicy *self, NMDevice *device) |
1440 | 1441 | |
1441 | 1442 | nm_dns_manager_begin_updates (priv->dns_manager, __func__); |
1442 | 1443 | |
1443 | ip_iface = nm_vpn_connection_get_ip_iface (vpn); | |
1444 | ip_iface = nm_vpn_connection_get_ip_iface (vpn, TRUE); | |
1444 | 1445 | |
1445 | 1446 | /* Add the VPN connection's IP configs from DNS */ |
1446 | 1447 | |
1578 | 1579 | |
1579 | 1580 | /**************************************************************************/ |
1580 | 1581 | |
1582 | static gboolean | |
1583 | schedule_activate_all_cb (gpointer user_data) | |
1584 | { | |
1585 | NMPolicy *self = user_data; | |
1586 | NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self); | |
1587 | const GSList *iter; | |
1588 | ||
1589 | priv->schedule_activate_all_id = 0; | |
1590 | ||
1591 | for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter)) | |
1592 | schedule_activate_check (self, iter->data); | |
1593 | ||
1594 | return G_SOURCE_REMOVE; | |
1595 | } | |
1596 | ||
1581 | 1597 | static void |
1582 | 1598 | schedule_activate_all (NMPolicy *self) |
1583 | 1599 | { |
1584 | 1600 | NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self); |
1585 | const GSList *iter; | |
1586 | ||
1587 | for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter)) | |
1588 | schedule_activate_check (self, NM_DEVICE (iter->data)); | |
1601 | ||
1602 | /* always restart the idle handler. That way, we settle | |
1603 | * all other events before restarting to activate them. */ | |
1604 | nm_clear_g_source (&priv->schedule_activate_all_id); | |
1605 | priv->schedule_activate_all_id = g_idle_add (schedule_activate_all_cb, self); | |
1589 | 1606 | } |
1590 | 1607 | |
1591 | 1608 | static void |
1647 | 1664 | |
1648 | 1665 | static void |
1649 | 1666 | connection_updated (NMSettings *settings, |
1650 | NMConnection *connection, | |
1667 | NMSettingsConnection *connection, | |
1668 | gboolean by_user, | |
1651 | 1669 | gpointer user_data) |
1652 | 1670 | { |
1653 | 1671 | NMPolicyPrivate *priv = user_data; |
1654 | 1672 | NMPolicy *self = priv->self; |
1655 | ||
1656 | schedule_activate_all (self); | |
1657 | } | |
1658 | ||
1659 | static void | |
1660 | connection_updated_by_user (NMSettings *settings, | |
1661 | NMSettingsConnection *connection, | |
1662 | gpointer user_data) | |
1663 | { | |
1664 | NMPolicyPrivate *priv = user_data; | |
1665 | 1673 | const GSList *iter; |
1666 | 1674 | NMDevice *device = NULL; |
1667 | 1675 | |
1668 | /* find device with given connection */ | |
1669 | for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter)) { | |
1670 | NMDevice *dev = NM_DEVICE (iter->data); | |
1671 | ||
1672 | if (nm_device_get_settings_connection (dev) == connection) { | |
1673 | device = dev; | |
1674 | break; | |
1675 | } | |
1676 | } | |
1677 | ||
1678 | if (device) | |
1679 | nm_device_reapply_settings_immediately (device); | |
1680 | ||
1681 | /* Reset auto retries back to default since connection was updated */ | |
1682 | nm_settings_connection_reset_autoconnect_retries (connection); | |
1676 | if (by_user) { | |
1677 | /* find device with given connection */ | |
1678 | for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter)) { | |
1679 | NMDevice *dev = NM_DEVICE (iter->data); | |
1680 | ||
1681 | if (nm_device_get_settings_connection (dev) == connection) { | |
1682 | device = dev; | |
1683 | break; | |
1684 | } | |
1685 | } | |
1686 | ||
1687 | if (device) | |
1688 | nm_device_reapply_settings_immediately (device); | |
1689 | ||
1690 | /* Reset auto retries back to default since connection was updated */ | |
1691 | nm_settings_connection_reset_autoconnect_retries (connection); | |
1692 | } | |
1693 | ||
1694 | schedule_activate_all (self); | |
1683 | 1695 | } |
1684 | 1696 | |
1685 | 1697 | static void |
1875 | 1887 | |
1876 | 1888 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, (GCallback) connection_added, priv); |
1877 | 1889 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, (GCallback) connection_updated, priv); |
1878 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER, (GCallback) connection_updated_by_user, priv); | |
1879 | 1890 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, (GCallback) connection_removed, priv); |
1880 | 1891 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED, (GCallback) connection_visibility_changed, priv); |
1881 | 1892 | g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_AGENT_REGISTERED, (GCallback) secret_agent_registered, priv); |
1940 | 1951 | g_assert (connections == NULL); |
1941 | 1952 | |
1942 | 1953 | nm_clear_g_source (&priv->reset_retries_id); |
1954 | nm_clear_g_source (&priv->schedule_activate_all_id); | |
1943 | 1955 | |
1944 | 1956 | g_clear_pointer (&priv->orig_hostname, g_free); |
1945 | 1957 | g_clear_pointer (&priv->cur_hostname, g_free); |
0 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | |
1 | /* This program is free software; you can redistribute it and/or modify | |
2 | * it under the terms of the GNU General Public License as published by | |
3 | * the Free Software Foundation; either version 2 of the License, or | |
4 | * (at your option) any later version. | |
5 | * | |
6 | * This program is distributed in the hope that it will be useful, | |
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | * GNU General Public License for more details. | |
10 | * | |
11 | * You should have received a copy of the GNU General Public License along | |
12 | * with this program; if not, write to the Free Software Foundation, Inc., | |
13 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
14 | * | |
15 | * (C) Copyright 2012 Red Hat, Inc. | |
16 | * Author: Matthias Clasen <mclasen@redhat.com> | |
17 | */ | |
18 | ||
19 | #include "nm-default.h" | |
20 | ||
21 | #include <errno.h> | |
22 | #include <string.h> | |
23 | #include <sys/stat.h> | |
24 | #include <gio/gunixfdlist.h> | |
25 | ||
26 | #include "nm-core-internal.h" | |
27 | #include "NetworkManagerUtils.h" | |
28 | ||
29 | #include "nm-sleep-monitor.h" | |
30 | ||
31 | #if defined (SUSPEND_RESUME_SYSTEMD) == defined (SUSPEND_RESUME_CONSOLEKIT) | |
32 | #error either define SUSPEND_RESUME_SYSTEMD or SUSPEND_RESUME_CONSOLEKIT | |
33 | #endif | |
34 | ||
35 | #ifdef SUSPEND_RESUME_SYSTEMD | |
36 | ||
37 | #define SUSPEND_DBUS_NAME "org.freedesktop.login1" | |
38 | #define SUSPEND_DBUS_PATH "/org/freedesktop/login1" | |
39 | #define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager" | |
40 | ||
41 | #else | |
42 | ||
43 | /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd | |
44 | * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit | |
45 | */ | |
46 | ||
47 | #define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit" | |
48 | #define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager" | |
49 | #define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager" | |
50 | ||
51 | #endif | |
52 | ||
53 | struct _NMSleepMonitor { | |
54 | GObject parent_instance; | |
55 | ||
56 | GDBusProxy *sd_proxy; | |
57 | gint inhibit_fd; | |
58 | }; | |
59 | ||
60 | struct _NMSleepMonitorClass { | |
61 | GObjectClass parent_class; | |
62 | ||
63 | void (*sleeping) (NMSleepMonitor *monitor); | |
64 | void (*resuming) (NMSleepMonitor *monitor); | |
65 | }; | |
66 | ||
67 | ||
68 | enum { | |
69 | SLEEPING, | |
70 | RESUMING, | |
71 | LAST_SIGNAL, | |
72 | }; | |
73 | static guint signals[LAST_SIGNAL] = {0}; | |
74 | ||
75 | G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT); | |
76 | ||
77 | /********************************************************************/ | |
78 | ||
79 | static gboolean | |
80 | drop_inhibitor (NMSleepMonitor *self) | |
81 | { | |
82 | if (self->inhibit_fd >= 0) { | |
83 | nm_log_dbg (LOGD_SUSPEND, "Dropping systemd sleep inhibitor"); | |
84 | close (self->inhibit_fd); | |
85 | self->inhibit_fd = -1; | |
86 | return TRUE; | |
87 | } | |
88 | return FALSE; | |
89 | } | |
90 | ||
91 | static void | |
92 | inhibit_done (GObject *source, | |
93 | GAsyncResult *result, | |
94 | gpointer user_data) | |
95 | { | |
96 | GDBusProxy *sd_proxy = G_DBUS_PROXY (source); | |
97 | NMSleepMonitor *self = user_data; | |
98 | GError *error = NULL; | |
99 | GVariant *res; | |
100 | GUnixFDList *fd_list; | |
101 | ||
102 | res = g_dbus_proxy_call_with_unix_fd_list_finish (sd_proxy, &fd_list, result, &error); | |
103 | if (!res) { | |
104 | g_dbus_error_strip_remote_error (error); | |
105 | nm_log_warn (LOGD_SUSPEND, "Inhibit failed: %s", error->message); | |
106 | g_error_free (error); | |
107 | } else { | |
108 | if (!fd_list || g_unix_fd_list_get_length (fd_list) != 1) | |
109 | nm_log_warn (LOGD_SUSPEND, "Didn't get a single fd back"); | |
110 | ||
111 | self->inhibit_fd = g_unix_fd_list_get (fd_list, 0, NULL); | |
112 | ||
113 | nm_log_dbg (LOGD_SUSPEND, "Inhibitor fd is %d", self->inhibit_fd); | |
114 | g_object_unref (fd_list); | |
115 | g_variant_unref (res); | |
116 | } | |
117 | } | |
118 | ||
119 | static void | |
120 | take_inhibitor (NMSleepMonitor *self) | |
121 | { | |
122 | g_assert (self->inhibit_fd == -1); | |
123 | ||
124 | nm_log_dbg (LOGD_SUSPEND, "Taking systemd sleep inhibitor"); | |
125 | g_dbus_proxy_call_with_unix_fd_list (self->sd_proxy, | |
126 | "Inhibit", | |
127 | g_variant_new ("(ssss)", | |
128 | "sleep", | |
129 | "NetworkManager", | |
130 | _("NetworkManager needs to turn off networks"), | |
131 | "delay"), | |
132 | 0, | |
133 | G_MAXINT, | |
134 | NULL, | |
135 | NULL, | |
136 | inhibit_done, | |
137 | self); | |
138 | } | |
139 | ||
140 | static void | |
141 | prepare_for_sleep_cb (GDBusProxy *proxy, | |
142 | gboolean is_about_to_suspend, | |
143 | gpointer data) | |
144 | { | |
145 | NMSleepMonitor *self = data; | |
146 | ||
147 | nm_log_dbg (LOGD_SUSPEND, "Received PrepareForSleep signal: %d", is_about_to_suspend); | |
148 | ||
149 | if (is_about_to_suspend) { | |
150 | g_signal_emit (self, signals[SLEEPING], 0); | |
151 | drop_inhibitor (self); | |
152 | } else { | |
153 | take_inhibitor (self); | |
154 | g_signal_emit (self, signals[RESUMING], 0); | |
155 | } | |
156 | } | |
157 | ||
158 | static void | |
159 | name_owner_cb (GObject *object, | |
160 | GParamSpec *pspec, | |
161 | gpointer user_data) | |
162 | { | |
163 | GDBusProxy *proxy = G_DBUS_PROXY (object); | |
164 | NMSleepMonitor *self = NM_SLEEP_MONITOR (user_data); | |
165 | char *owner; | |
166 | ||
167 | g_assert (proxy == self->sd_proxy); | |
168 | ||
169 | owner = g_dbus_proxy_get_name_owner (proxy); | |
170 | if (owner) | |
171 | take_inhibitor (self); | |
172 | else | |
173 | drop_inhibitor (self); | |
174 | g_free (owner); | |
175 | } | |
176 | ||
177 | static void | |
178 | on_proxy_acquired (GObject *object, | |
179 | GAsyncResult *res, | |
180 | NMSleepMonitor *self) | |
181 | { | |
182 | GError *error = NULL; | |
183 | char *owner; | |
184 | ||
185 | self->sd_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); | |
186 | if (!self->sd_proxy) { | |
187 | nm_log_warn (LOGD_SUSPEND, "Failed to acquire logind proxy: %s", error->message); | |
188 | g_clear_error (&error); | |
189 | return; | |
190 | } | |
191 | ||
192 | g_signal_connect (self->sd_proxy, "notify::g-name-owner", G_CALLBACK (name_owner_cb), self); | |
193 | _nm_dbus_signal_connect (self->sd_proxy, "PrepareForSleep", G_VARIANT_TYPE ("(b)"), | |
194 | G_CALLBACK (prepare_for_sleep_cb), self); | |
195 | ||
196 | owner = g_dbus_proxy_get_name_owner (self->sd_proxy); | |
197 | if (owner) | |
198 | take_inhibitor (self); | |
199 | g_free (owner); | |
200 | } | |
201 | ||
202 | static void | |
203 | nm_sleep_monitor_init (NMSleepMonitor *self) | |
204 | { | |
205 | self->inhibit_fd = -1; | |
206 | g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, | |
207 | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | | |
208 | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, | |
209 | NULL, | |
210 | SUSPEND_DBUS_NAME, SUSPEND_DBUS_PATH, SUSPEND_DBUS_INTERFACE, | |
211 | NULL, | |
212 | (GAsyncReadyCallback) on_proxy_acquired, self); | |
213 | } | |
214 | ||
215 | static void | |
216 | finalize (GObject *object) | |
217 | { | |
218 | NMSleepMonitor *self = NM_SLEEP_MONITOR (object); | |
219 | ||
220 | drop_inhibitor (self); | |
221 | if (self->sd_proxy) | |
222 | g_object_unref (self->sd_proxy); | |
223 | ||
224 | if (G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize != NULL) | |
225 | G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize (object); | |
226 | } | |
227 | ||
228 | static void | |
229 | nm_sleep_monitor_class_init (NMSleepMonitorClass *klass) | |
230 | { | |
231 | GObjectClass *gobject_class; | |
232 | ||
233 | gobject_class = G_OBJECT_CLASS (klass); | |
234 | ||
235 | gobject_class->finalize = finalize; | |
236 | ||
237 | signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING, | |
238 | NM_TYPE_SLEEP_MONITOR, | |
239 | G_SIGNAL_RUN_LAST, | |
240 | G_STRUCT_OFFSET (NMSleepMonitorClass, sleeping), | |
241 | NULL, /* accumulator */ | |
242 | NULL, /* accumulator data */ | |
243 | g_cclosure_marshal_VOID__VOID, | |
244 | G_TYPE_NONE, 0); | |
245 | signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING, | |
246 | NM_TYPE_SLEEP_MONITOR, | |
247 | G_SIGNAL_RUN_LAST, | |
248 | G_STRUCT_OFFSET (NMSleepMonitorClass, resuming), | |
249 | NULL, /* accumulator */ | |
250 | NULL, /* accumulator data */ | |
251 | g_cclosure_marshal_VOID__VOID, | |
252 | G_TYPE_NONE, 0); | |
253 | } | |
254 | ||
255 | NM_DEFINE_SINGLETON_GETTER (NMSleepMonitor, nm_sleep_monitor_get, NM_TYPE_SLEEP_MONITOR); | |
256 | ||
257 | /* ---------------------------------------------------------------------------------------------------- */ |
0 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | |
1 | /* This program is free software; you can redistribute it and/or modify | |
2 | * it under the terms of the GNU General Public License as published by | |
3 | * the Free Software Foundation; either version 2 of the License, or | |
4 | * (at your option) any later version. | |
5 | * | |
6 | * This program is distributed in the hope that it will be useful, | |
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | * GNU General Public License for more details. | |
10 | * | |
11 | * You should have received a copy of the GNU General Public License along | |
12 | * with this program; if not, write to the Free Software Foundation, Inc., | |
13 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
14 | * | |
15 | * (C) Copyright 2012 Red Hat, Inc. | |
16 | * Author: Matthias Clasen <mclasen@redhat.com> | |
17 | */ | |
18 | ||
19 | #include "nm-default.h" | |
20 | ||
21 | #include <errno.h> | |
22 | #include <string.h> | |
23 | #include <sys/stat.h> | |
24 | ||
25 | #include "nm-core-internal.h" | |
26 | ||
27 | #include "nm-sleep-monitor.h" | |
28 | ||
29 | #define UPOWER_DBUS_SERVICE "org.freedesktop.UPower" | |
30 | ||
31 | struct _NMSleepMonitor { | |
32 | GObject parent_instance; | |
33 | ||
34 | GDBusProxy *upower_proxy; | |
35 | }; | |
36 | ||
37 | struct _NMSleepMonitorClass { | |
38 | GObjectClass parent_class; | |
39 | ||
40 | void (*sleeping) (NMSleepMonitor *monitor); | |
41 | void (*resuming) (NMSleepMonitor *monitor); | |
42 | }; | |
43 | ||
44 | ||
45 | enum { | |
46 | SLEEPING, | |
47 | RESUMING, | |
48 | LAST_SIGNAL, | |
49 | }; | |
50 | static guint signals[LAST_SIGNAL] = {0}; | |
51 | ||
52 | G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT); | |
53 | ||
54 | /********************************************************************/ | |
55 | ||
56 | static void | |
57 | upower_sleeping_cb (GDBusProxy *proxy, gpointer user_data) | |
58 | { | |
59 | nm_log_dbg (LOGD_SUSPEND, "Received UPower sleeping signal"); | |
60 | g_signal_emit (user_data, signals[SLEEPING], 0); | |
61 | } | |
62 | ||
63 | static void | |
64 | upower_resuming_cb (GDBusProxy *proxy, gpointer user_data) | |
65 | { | |
66 | nm_log_dbg (LOGD_SUSPEND, "Received UPower resuming signal"); | |
67 | g_signal_emit (user_data, signals[RESUMING], 0); | |
68 | } | |
69 | ||
70 | static void | |
71 | nm_sleep_monitor_init (NMSleepMonitor *self) | |
72 | { | |
73 | GError *error = NULL; | |
74 | ||
75 | self->upower_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, | |
76 | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | | |
77 | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, | |
78 | NULL, | |
79 | UPOWER_DBUS_SERVICE, | |
80 | "/org/freedesktop/UPower", | |
81 | "org.freedesktop.UPower", | |
82 | NULL, &error); | |
83 | if (self->upower_proxy) { | |
84 | _nm_dbus_signal_connect (self->upower_proxy, "Sleeping", NULL, | |
85 | G_CALLBACK (upower_sleeping_cb), self); | |
86 | _nm_dbus_signal_connect (self->upower_proxy, "Resuming", NULL, | |
87 | G_CALLBACK (upower_resuming_cb), self); | |
88 | } else { | |
89 | nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus proxy: %s", error->message); | |
90 | g_error_free (error); | |
91 | } | |
92 | } | |
93 | ||
94 | static void | |
95 | finalize (GObject *object) | |
96 | { | |
97 | NMSleepMonitor *self = NM_SLEEP_MONITOR (object); | |
98 | ||
99 | g_clear_object (&self->upower_proxy); | |
100 | ||
101 | G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize (object); | |
102 | } | |
103 | ||
104 | static void | |
105 | nm_sleep_monitor_class_init (NMSleepMonitorClass *klass) | |
106 | { | |
107 | GObjectClass *gobject_class; | |
108 | ||
109 | gobject_class = G_OBJECT_CLASS (klass); | |
110 | ||
111 | gobject_class->finalize = finalize; | |
112 | ||
113 | signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING, | |
114 | NM_TYPE_SLEEP_MONITOR, | |
115 | G_SIGNAL_RUN_LAST, | |
116 | G_STRUCT_OFFSET (NMSleepMonitorClass, sleeping), | |
117 | NULL, /* accumulator */ | |
118 | NULL, /* accumulator data */ | |
119 | g_cclosure_marshal_VOID__VOID, | |
120 | G_TYPE_NONE, 0); | |
121 | signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING, | |
122 | NM_TYPE_SLEEP_MONITOR, | |
123 | G_SIGNAL_RUN_LAST, | |
124 | G_STRUCT_OFFSET (NMSleepMonitorClass, resuming), | |
125 | NULL, /* accumulator */ | |
126 | NULL, /* accumulator data */ | |
127 | g_cclosure_marshal_VOID__VOID, | |
128 | G_TYPE_NONE, 0); | |
129 | } | |
130 | ||
131 | NM_DEFINE_SINGLETON_GETTER (NMSleepMonitor, nm_sleep_monitor_get, NM_TYPE_SLEEP_MONITOR); | |
132 | ||
133 | /* ---------------------------------------------------------------------------------------------------- */ |
0 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | |
1 | /* This program is free software; you can redistribute it and/or modify | |
2 | * it under the terms of the GNU General Public License as published by | |
3 | * the Free Software Foundation; either version 2 of the License, or | |
4 | * (at your option) any later version. | |
5 | * | |
6 | * This program is distributed in the hope that it will be useful, | |
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | * GNU General Public License for more details. | |
10 | * | |
11 | * You should have received a copy of the GNU General Public License along | |
12 | * with this program; if not, write to the Free Software Foundation, Inc., | |
13 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
14 | * | |
15 | * (C) Copyright 2012-2016 Red Hat, Inc. | |
16 | * Author: Matthias Clasen <mclasen@redhat.com> | |
17 | */ | |
18 | ||
19 | #include "nm-default.h" | |
20 | ||
21 | #include "nm-sleep-monitor.h" | |
22 | ||
23 | #include <errno.h> | |
24 | #include <string.h> | |
25 | #include <sys/stat.h> | |
26 | #include <gio/gunixfdlist.h> | |
27 | ||
28 | #include "nm-core-internal.h" | |
29 | #include "NetworkManagerUtils.h" | |
30 | ||
31 | ||
32 | #if defined (SUSPEND_RESUME_UPOWER) | |
33 | ||
34 | #define SUSPEND_DBUS_NAME "org.freedesktop.UPower" | |
35 | #define SUSPEND_DBUS_PATH "/org/freedesktop/UPower" | |
36 | #define SUSPEND_DBUS_INTERFACE "org.freedesktop.UPower" | |
37 | #define USE_UPOWER 1 | |
38 | #define _NMLOG_PREFIX_NAME "sleep-monitor-up" | |
39 | ||
40 | #elif defined (SUSPEND_RESUME_SYSTEMD) | |
41 | ||
42 | #define SUSPEND_DBUS_NAME "org.freedesktop.login1" | |
43 | #define SUSPEND_DBUS_PATH "/org/freedesktop/login1" | |
44 | #define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager" | |
45 | #define USE_UPOWER 0 | |
46 | #define _NMLOG_PREFIX_NAME "sleep-monitor-sd" | |
47 | ||
48 | #elif defined(SUSPEND_RESUME_CONSOLEKIT) | |
49 | ||
50 | /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd | |
51 | * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit | |
52 | */ | |
53 | ||
54 | #define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit" | |
55 | #define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager" | |
56 | #define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager" | |
57 | #define USE_UPOWER 0 | |
58 | #define _NMLOG_PREFIX_NAME "sleep-monitor-ck" | |
59 | ||
60 | #else | |
61 | ||
62 | #error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER | |
63 | ||
64 | #endif | |
65 | ||
66 | struct _NMSleepMonitor { | |
67 | GObject parent_instance; | |
68 | ||
69 | GDBusProxy *proxy; | |
70 | ||
71 | /* used both during construction of proxy and during Inhibit call. */ | |
72 | GCancellable *cancellable; | |
73 | ||
74 | gint inhibit_fd; | |
75 | GSList *handles_active; | |
76 | GSList *handles_stale; | |
77 | ||
78 | gulong sig_id_1; | |
79 | gulong sig_id_2; | |
80 | }; | |
81 | ||
82 | struct _NMSleepMonitorClass { | |
83 | GObjectClass parent_class; | |
84 | }; | |
85 | ||
86 | enum { | |
87 | SLEEPING, | |
88 | LAST_SIGNAL, | |
89 | }; | |
90 | static guint signals[LAST_SIGNAL] = {0}; | |
91 | ||
92 | G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT); | |
93 | ||
94 | static void sleep_signal (NMSleepMonitor *self, gboolean is_about_to_suspend); | |
95 | ||
96 | /*****************************************************************************/ | |
97 | ||
98 | #define _NMLOG_DOMAIN LOGD_SUSPEND | |
99 | #define _NMLOG(level, ...) \ | |
100 | G_STMT_START { \ | |
101 | nm_log ((level), _NMLOG_DOMAIN, \ | |
102 | "%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \ | |
103 | _NMLOG_PREFIX_NAME \ | |
104 | _NM_UTILS_MACRO_REST (__VA_ARGS__)); \ | |
105 | } G_STMT_END | |
106 | ||
107 | /*****************************************************************************/ | |
108 | ||
109 | #if USE_UPOWER | |
110 | ||
111 | static void | |
112 | upower_sleeping_cb (GDBusProxy *proxy, gpointer user_data) | |
113 | { | |
114 | sleep_signal (user_data, TRUE); | |
115 | } | |
116 | ||
117 | static void | |
118 | upower_resuming_cb (GDBusProxy *proxy, gpointer user_data) | |
119 | { | |
120 | sleep_signal (user_data, FALSE); | |
121 | } | |
122 | ||
123 | #else /* USE_UPOWER */ | |
124 | ||
125 | static void | |
126 | drop_inhibitor (NMSleepMonitor *self, gboolean force) | |
127 | { | |
128 | if (!force && self->handles_active) | |
129 | return; | |
130 | ||
131 | if (self->inhibit_fd >= 0) { | |
132 | _LOGD ("inhibit: dropping sleep inhibitor %d", self->inhibit_fd); | |
133 | close (self->inhibit_fd); | |
134 | self->inhibit_fd = -1; | |
135 | } | |
136 | ||
137 | if (self->handles_active) { | |
138 | self->handles_stale = g_slist_concat (self->handles_stale, self->handles_active); | |
139 | self->handles_active = NULL; | |
140 | } | |
141 | ||
142 | nm_clear_g_cancellable (&self->cancellable); | |
143 | } | |
144 | ||
145 | static void | |
146 | inhibit_done (GObject *source, | |
147 | GAsyncResult *result, | |
148 | gpointer user_data) | |
149 | { | |
150 | GDBusProxy *proxy = G_DBUS_PROXY (source); | |
151 | NMSleepMonitor *self = user_data; | |
152 | gs_free_error GError *error = NULL; | |
153 | gs_unref_variant GVariant *res = NULL; | |
154 | gs_unref_object GUnixFDList *fd_list = NULL; | |
155 | ||
156 | res = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, &fd_list, result, &error); | |
157 | if (!res) { | |
158 | if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { | |
159 | g_clear_object (&self->cancellable); | |
160 | _LOGW ("inhibit: failed (%s)", error->message); | |
161 | } | |
162 | return; | |
163 | } | |
164 | ||
165 | g_clear_object (&self->cancellable); | |
166 | ||
167 | if (!fd_list || g_unix_fd_list_get_length (fd_list) != 1) { | |
168 | _LOGW ("inhibit: didn't get a single fd back"); | |
169 | return; | |
170 | } | |
171 | ||
172 | self->inhibit_fd = g_unix_fd_list_get (fd_list, 0, NULL); | |
173 | _LOGD ("inhibit: inhibitor fd is %d", self->inhibit_fd); | |
174 | } | |
175 | ||
176 | static void | |
177 | take_inhibitor (NMSleepMonitor *self) | |
178 | { | |
179 | g_return_if_fail (NM_IS_SLEEP_MONITOR (self)); | |
180 | g_return_if_fail (G_IS_DBUS_PROXY (self->proxy)); | |
181 | ||
182 | drop_inhibitor (self, TRUE); | |
183 | ||
184 | _LOGD ("inhibit: taking sleep inhibitor..."); | |
185 | self->cancellable = g_cancellable_new (); | |
186 | g_dbus_proxy_call_with_unix_fd_list (self->proxy, | |
187 | "Inhibit", | |
188 | g_variant_new ("(ssss)", | |
189 | "sleep", | |
190 | "NetworkManager", | |
191 | "NetworkManager needs to turn off networks", | |
192 | "delay"), | |
193 | 0, | |
194 | G_MAXINT, | |
195 | NULL, | |
196 | self->cancellable, | |
197 | inhibit_done, | |
198 | self); | |
199 | } | |
200 | ||
201 | static void | |
202 | prepare_for_sleep_cb (GDBusProxy *proxy, | |
203 | gboolean is_about_to_suspend, | |
204 | gpointer data) | |
205 | { | |
206 | sleep_signal (data, is_about_to_suspend); | |
207 | } | |
208 | ||
209 | static void | |
210 | name_owner_cb (GObject *object, | |
211 | GParamSpec *pspec, | |
212 | gpointer user_data) | |
213 | { | |
214 | GDBusProxy *proxy = G_DBUS_PROXY (object); | |
215 | NMSleepMonitor *self = NM_SLEEP_MONITOR (user_data); | |
216 | char *owner; | |
217 | ||
218 | g_assert (proxy == self->proxy); | |
219 | ||
220 | owner = g_dbus_proxy_get_name_owner (proxy); | |
221 | if (owner) | |
222 | take_inhibitor (self); | |
223 | else | |
224 | drop_inhibitor (self, TRUE); | |
225 | g_free (owner); | |
226 | } | |
227 | #endif /* USE_UPOWER */ | |
228 | ||
229 | static void | |
230 | sleep_signal (NMSleepMonitor *self, | |
231 | gboolean is_about_to_suspend) | |
232 | { | |
233 | g_return_if_fail (NM_IS_SLEEP_MONITOR (self)); | |
234 | ||
235 | _LOGD ("received %s signal", is_about_to_suspend ? "SLEEP" : "RESUME"); | |
236 | ||
237 | #if !USE_UPOWER | |
238 | if (!is_about_to_suspend) | |
239 | take_inhibitor (self); | |
240 | #endif | |
241 | ||
242 | g_signal_emit (self, signals[SLEEPING], 0, is_about_to_suspend); | |
243 | ||
244 | #if !USE_UPOWER | |
245 | if (is_about_to_suspend) | |
246 | drop_inhibitor (self, FALSE); | |
247 | #endif | |
248 | } | |
249 | ||
250 | /** | |
251 | * nm_sleep_monitor_inhibit_take: | |
252 | * @self: the #NMSleepMonitor instance | |
253 | * | |
254 | * Prevent the release of inhibitor lock | |
255 | * | |
256 | * Returns: an inhibitor handle that must be returned via | |
257 | * nm_sleep_monitor_inhibit_release(). | |
258 | **/ | |
259 | NMSleepMonitorInhibitorHandle * | |
260 | nm_sleep_monitor_inhibit_take (NMSleepMonitor *self) | |
261 | { | |
262 | g_return_val_if_fail (NM_IS_SLEEP_MONITOR (self), NULL); | |
263 | ||
264 | self->handles_active = g_slist_prepend (self->handles_active, NULL); | |
265 | return (NMSleepMonitorInhibitorHandle *) self->handles_active; | |
266 | } | |
267 | ||
268 | /** | |
269 | * nm_sleep_monitor_inhibit_release: | |
270 | * @self: the #NMSleepMonitor instance | |
271 | * @handle: the #NMSleepMonitorInhibitorHandle inhibitor handle. | |
272 | * | |
273 | * Allow again the release of inhibitor lock | |
274 | **/ | |
275 | void | |
276 | nm_sleep_monitor_inhibit_release (NMSleepMonitor *self, | |
277 | NMSleepMonitorInhibitorHandle *handle) | |
278 | { | |
279 | GSList *l; | |
280 | ||
281 | g_return_if_fail (NM_IS_SLEEP_MONITOR (self)); | |
282 | g_return_if_fail (handle); | |
283 | ||
284 | l = (GSList *) handle; | |
285 | ||
286 | if (g_slist_position (self->handles_active, l) < 0) { | |
287 | if (g_slist_position (self->handles_stale, l) < 0) | |
288 | g_return_if_reached (); | |
289 | self->handles_stale = g_slist_delete_link (self->handles_stale, l); | |
290 | return; | |
291 | } | |
292 | ||
293 | self->handles_active = g_slist_delete_link (self->handles_active, l); | |
294 | ||
295 | #if !USE_UPOWER | |
296 | drop_inhibitor (self, FALSE); | |
297 | #endif | |
298 | } | |
299 | ||
300 | static void | |
301 | on_proxy_acquired (GObject *object, | |
302 | GAsyncResult *res, | |
303 | NMSleepMonitor *self) | |
304 | { | |
305 | GError *error = NULL; | |
306 | GDBusProxy *proxy; | |
307 | ||
308 | proxy = g_dbus_proxy_new_for_bus_finish (res, &error); | |
309 | if (!proxy) { | |
310 | if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) | |
311 | _LOGW ("failed to acquire D-Bus proxy: %s", error->message); | |
312 | g_clear_error (&error); | |
313 | return; | |
314 | } | |
315 | self->proxy = proxy; | |
316 | g_clear_object (&self->cancellable); | |
317 | ||
318 | #if USE_UPOWER | |
319 | self->sig_id_1 = _nm_dbus_signal_connect (self->proxy, "Sleeping", NULL, | |
320 | G_CALLBACK (upower_sleeping_cb), self); | |
321 | self->sig_id_2 = _nm_dbus_signal_connect (self->proxy, "Resuming", NULL, | |
322 | G_CALLBACK (upower_resuming_cb), self); | |
323 | #else | |
324 | self->sig_id_1 = g_signal_connect (self->proxy, "notify::g-name-owner", | |
325 | G_CALLBACK (name_owner_cb), self); | |
326 | self->sig_id_2 = _nm_dbus_signal_connect (self->proxy, "PrepareForSleep", | |
327 | G_VARIANT_TYPE ("(b)"), | |
328 | G_CALLBACK (prepare_for_sleep_cb), self); | |
329 | { | |
330 | gs_free char *owner = NULL; | |
331 | ||
332 | owner = g_dbus_proxy_get_name_owner (self->proxy); | |
333 | if (owner) | |
334 | take_inhibitor (self); | |
335 | } | |
336 | #endif | |
337 | } | |
338 | ||
339 | static void | |
340 | nm_sleep_monitor_init (NMSleepMonitor *self) | |
341 | { | |
342 | self->inhibit_fd = -1; | |
343 | self->cancellable = g_cancellable_new (); | |
344 | g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, | |
345 | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | | |
346 | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, | |
347 | NULL, | |
348 | SUSPEND_DBUS_NAME, SUSPEND_DBUS_PATH, SUSPEND_DBUS_INTERFACE, | |
349 | self->cancellable, | |
350 | (GAsyncReadyCallback) on_proxy_acquired, self); | |
351 | } | |
352 | ||
353 | NMSleepMonitor * | |
354 | nm_sleep_monitor_new (void) | |
355 | { | |
356 | return g_object_new (NM_TYPE_SLEEP_MONITOR, NULL); | |
357 | } | |
358 | ||
359 | static void | |
360 | dispose (GObject *object) | |
361 | { | |
362 | NMSleepMonitor *self = NM_SLEEP_MONITOR (object); | |
363 | ||
364 | #if !USE_UPOWER | |
365 | drop_inhibitor (self, TRUE); | |
366 | #endif | |
367 | ||
368 | nm_clear_g_cancellable (&self->cancellable); | |
369 | ||
370 | if (self->proxy) { | |
371 | nm_clear_g_signal_handler (self->proxy, &self->sig_id_1); | |
372 | nm_clear_g_signal_handler (self->proxy, &self->sig_id_2); | |
373 | g_clear_object (&self->proxy); | |
374 | } | |
375 | ||
376 | G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->dispose (object); | |
377 | } | |
378 | ||
379 | static void | |
380 | nm_sleep_monitor_class_init (NMSleepMonitorClass *klass) | |
381 | { | |
382 | GObjectClass *gobject_class; | |
383 | ||
384 | gobject_class = G_OBJECT_CLASS (klass); | |
385 | ||
386 | gobject_class->dispose = dispose; | |
387 | ||
388 | signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING, | |
389 | NM_TYPE_SLEEP_MONITOR, | |
390 | G_SIGNAL_RUN_LAST, | |
391 | 0, NULL, NULL, | |
392 | g_cclosure_marshal_VOID__BOOLEAN, | |
393 | G_TYPE_NONE, 1, G_TYPE_BOOLEAN); | |
394 | } | |
395 |
12 | 12 | * with this program; if not, write to the Free Software Foundation, Inc., |
13 | 13 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
14 | 14 | * |
15 | * (C) Copyright 2012 Red Hat, Inc. | |
15 | * (C) Copyright 2012-2016 Red Hat, Inc. | |
16 | 16 | * Author: Matthias Clasen <mclasen@redhat.com> |
17 | 17 | */ |
18 | 18 | |
19 | 19 | #ifndef __NETWORKMANAGER_SLEEP_MONITOR_H__ |
20 | 20 | #define __NETWORKMANAGER_SLEEP_MONITOR_H__ |
21 | ||
22 | ||
23 | #include "nm-default.h" | |
24 | 21 | |
25 | 22 | G_BEGIN_DECLS |
26 | 23 | |
32 | 29 | #define NM_IS_SLEEP_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_SLEEP_MONITOR)) |
33 | 30 | |
34 | 31 | #define NM_SLEEP_MONITOR_SLEEPING "sleeping" |
35 | #define NM_SLEEP_MONITOR_RESUMING "resuming" | |
36 | 32 | |
37 | 33 | typedef struct _NMSleepMonitorClass NMSleepMonitorClass; |
38 | 34 | |
39 | 35 | GType nm_sleep_monitor_get_type (void) G_GNUC_CONST; |
40 | NMSleepMonitor *nm_sleep_monitor_get (void); | |
36 | NMSleepMonitor *nm_sleep_monitor_new (void); | |
37 | ||
38 | typedef struct _NMSleepMonitorInhibitorHandle NMSleepMonitorInhibitorHandle; | |
39 | ||
40 | NMSleepMonitorInhibitorHandle *nm_sleep_monitor_inhibit_take (NMSleepMonitor *self); | |
41 | void nm_sleep_monitor_inhibit_release (NMSleepMonitor *self, | |
42 | NMSleepMonitorInhibitorHandle *handle); | |
41 | 43 | |
42 | 44 | G_END_DECLS |
43 | 45 |
323 | 323 | NM = @NM@ |
324 | 324 | NMEDIT = @NMEDIT@ |
325 | 325 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
326 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
326 | 327 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
327 | 328 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
328 | 329 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
1438 | 1438 | gboolean *completed_from_cache = cache ? &completed_from_cache_val : NULL; |
1439 | 1439 | const NMPObject *link_cached = NULL; |
1440 | 1440 | NMPObject *lnk_data = NULL; |
1441 | gboolean address_complete_from_cache = TRUE; | |
1442 | gboolean lnk_data_complete_from_cache = TRUE; | |
1441 | 1443 | |
1442 | 1444 | if (!nlmsg_valid_hdr (nlh, sizeof (*ifi))) |
1443 | 1445 | return NULL; |
1502 | 1504 | memcpy (obj->link.addr.data, nla_data (tb[IFLA_ADDRESS]), l); |
1503 | 1505 | obj->link.addr.len = l; |
1504 | 1506 | } |
1507 | address_complete_from_cache = FALSE; | |
1505 | 1508 | } |
1506 | 1509 | |
1507 | 1510 | if (tb[IFLA_AF_SPEC]) { |
1551 | 1554 | lnk_data = _parse_lnk_vxlan (nl_info_kind, nl_info_data); |
1552 | 1555 | break; |
1553 | 1556 | default: |
1554 | goto lnk_data_handled; | |
1555 | } | |
1556 | ||
1557 | /* We always try to look into the cache and reuse the object there. | |
1558 | * We do that, because we consider the lnk object as immutable and don't | |
1559 | * modify it after creating. Hence we can share it and reuse. | |
1560 | * | |
1561 | * Also, sometimes the info-data is missing for updates. In this case | |
1562 | * we want to keep the previously received lnk_data. */ | |
1563 | if (completed_from_cache) { | |
1557 | lnk_data_complete_from_cache = FALSE; | |
1558 | break; | |
1559 | } | |
1560 | ||
1561 | if ( completed_from_cache | |
1562 | && ( lnk_data_complete_from_cache | |
1563 | || address_complete_from_cache)) { | |
1564 | 1564 | _lookup_cached_link (cache, obj->link.ifindex, completed_from_cache, &link_cached); |
1565 | if ( link_cached | |
1566 | && link_cached->link.type == obj->link.type | |
1567 | && link_cached->_link.netlink.lnk | |
1568 | && ( !lnk_data | |
1569 | || nmp_object_equal (lnk_data, link_cached->_link.netlink.lnk))) { | |
1570 | nmp_object_unref (lnk_data); | |
1571 | lnk_data = nmp_object_ref (link_cached->_link.netlink.lnk); | |
1565 | if (link_cached) { | |
1566 | if ( lnk_data_complete_from_cache | |
1567 | && link_cached->link.type == obj->link.type | |
1568 | && link_cached->_link.netlink.lnk | |
1569 | && ( !lnk_data | |
1570 | || nmp_object_equal (lnk_data, link_cached->_link.netlink.lnk))) { | |
1571 | /* We always try to look into the cache and reuse the object there. | |
1572 | * We do that, because we consider the lnk object as immutable and don't | |
1573 | * modify it after creating. Hence we can share it and reuse. | |
1574 | * | |
1575 | * Also, sometimes the info-data is missing for updates. In this case | |
1576 | * we want to keep the previously received lnk_data. */ | |
1577 | nmp_object_unref (lnk_data); | |
1578 | lnk_data = nmp_object_ref (link_cached->_link.netlink.lnk); | |
1579 | } | |
1580 | if (address_complete_from_cache) | |
1581 | obj->link.addr = link_cached->link.addr; | |
1572 | 1582 | } |
1573 | 1583 | } |
1574 | 1584 | |
1575 | lnk_data_handled: | |
1576 | 1585 | obj->_link.netlink.lnk = lnk_data; |
1577 | 1586 | |
1578 | 1587 | obj->_link.netlink.is_in_netlink = TRUE; |
3282 | 3291 | if ( ops_type == NMP_CACHE_OPS_UPDATED |
3283 | 3292 | && old && new /* <-- nonsensical, make coverity happy */ |
3284 | 3293 | && old->_link.netlink.is_in_netlink |
3285 | && NM_FLAGS_HAS (old->link.n_ifi_flags, IFF_LOWER_UP) | |
3286 | 3294 | && new->_link.netlink.is_in_netlink |
3287 | && !NM_FLAGS_HAS (new->link.n_ifi_flags, IFF_LOWER_UP)) { | |
3295 | && ( ( NM_FLAGS_HAS (old->link.n_ifi_flags, IFF_UP) | |
3296 | && !NM_FLAGS_HAS (new->link.n_ifi_flags, IFF_UP)) | |
3297 | || ( NM_FLAGS_HAS (old->link.n_ifi_flags, IFF_LOWER_UP) | |
3298 | && !NM_FLAGS_HAS (new->link.n_ifi_flags, IFF_LOWER_UP)))) { | |
3299 | /* FIXME: I suspect that IFF_LOWER_UP must not be considered, and I | |
3300 | * think kernel does send RTM_DELROUTE events for IPv6 routes, so | |
3301 | * we might not need to refresh IPv6 routes. */ | |
3288 | 3302 | delayed_action_schedule (platform, |
3289 | 3303 | DELAYED_ACTION_TYPE_REFRESH_ALL_IP4_ROUTES | |
3290 | 3304 | DELAYED_ACTION_TYPE_REFRESH_ALL_IP6_ROUTES, |
5139 | 5153 | wifi_get_wifi_data (NMPlatform *platform, int ifindex) |
5140 | 5154 | { |
5141 | 5155 | NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform); |
5156 | const NMPlatformLink *pllink; | |
5142 | 5157 | WifiData *wifi_data; |
5143 | 5158 | |
5144 | 5159 | wifi_data = g_hash_table_lookup (priv->wifi_data, GINT_TO_POINTER (ifindex)); |
5160 | pllink = nm_platform_link_get (platform, ifindex); | |
5161 | ||
5162 | /* @wifi_data contains an interface name which is used for WEXT queries. If | |
5163 | * the interface name changes we should at least replace the name in the | |
5164 | * existing structure; but probably a complete reinitialization is better | |
5165 | * because during the initial creation there can be race conditions while | |
5166 | * the interface is renamed by udev. | |
5167 | */ | |
5168 | if (wifi_data && pllink) { | |
5169 | if (!nm_streq (wifi_utils_get_iface (wifi_data), pllink->name)) { | |
5170 | _LOGD ("wifi: interface %s renamed to %s, dropping old data for ifindex %d", | |
5171 | wifi_utils_get_iface (wifi_data), | |
5172 | pllink->name, | |
5173 | ifindex); | |
5174 | g_hash_table_remove (priv->wifi_data, GINT_TO_POINTER (ifindex)); | |
5175 | wifi_data = NULL; | |
5176 | } | |
5177 | } | |
5178 | ||
5145 | 5179 | if (!wifi_data) { |
5146 | const NMPlatformLink *pllink; | |
5147 | ||
5148 | pllink = nm_platform_link_get (platform, ifindex); | |
5149 | 5180 | if (pllink) { |
5150 | 5181 | if (pllink->type == NM_LINK_TYPE_WIFI) |
5151 | 5182 | wifi_data = wifi_utils_init (pllink->name, ifindex, TRUE); |
5776 | 5807 | g_clear_pointer (&creds, free); |
5777 | 5808 | errno = 0; |
5778 | 5809 | n = nl_recv (sk, &nla, &buf, &creds); |
5810 | ||
5811 | if (n <= 0) { | |
5812 | /* workaround libnl3 <= 3.2.15 returning danling pointers in case nl_recv() | |
5813 | * fails. Fixed by libnl3 69468517d0de1675d80f24661ff57a5dbac7275c. */ | |
5814 | buf = NULL; | |
5815 | creds = NULL; | |
5816 | } | |
5779 | 5817 | |
5780 | 5818 | switch (n) { |
5781 | 5819 | case 0: |
137 | 137 | /* rtnl_link_get_arptype(), ifinfomsg.ifi_type. */ |
138 | 138 | guint32 arptype; |
139 | 139 | |
140 | /* rtnl_link_get_addr() */ | |
140 | /* rtnl_link_get_addr(), IFLA_ADDRESS */ | |
141 | 141 | struct { |
142 | 142 | guint8 data[20]; /* NM_UTILS_HWADDR_LEN_MAX */ |
143 | 143 | guint8 len; |
620 | 620 | NM = @NM@ |
621 | 621 | NMEDIT = @NMEDIT@ |
622 | 622 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
623 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
623 | 624 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
624 | 625 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
625 | 626 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
69 | 69 | return ret; |
70 | 70 | } |
71 | 71 | |
72 | int | |
73 | wifi_utils_get_ifindex (WifiData *data) | |
74 | { | |
75 | g_return_val_if_fail (data != NULL, -1); | |
76 | ||
77 | return data->ifindex; | |
78 | } | |
79 | ||
80 | const char * | |
81 | wifi_utils_get_iface (WifiData *data) | |
82 | { | |
83 | g_return_val_if_fail (data != NULL, NULL); | |
84 | ||
85 | return data->iface; | |
86 | } | |
87 | ||
72 | 88 | NMDeviceWifiCapabilities |
73 | 89 | wifi_utils_get_caps (WifiData *data) |
74 | 90 | { |
31 | 31 | gboolean wifi_utils_is_wifi (const char *iface, const char *sysfs_path); |
32 | 32 | |
33 | 33 | WifiData *wifi_utils_init (const char *iface, int ifindex, gboolean check_scan); |
34 | ||
35 | int wifi_utils_get_ifindex (WifiData *data); | |
36 | ||
37 | const char *wifi_utils_get_iface (WifiData *data); | |
34 | 38 | |
35 | 39 | void wifi_utils_deinit (WifiData *data); |
36 | 40 |
349 | 349 | NM = @NM@ |
350 | 350 | NMEDIT = @NMEDIT@ |
351 | 351 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
352 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
352 | 353 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
353 | 354 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
354 | 355 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
323 | 323 | NM = @NM@ |
324 | 324 | NMEDIT = @NMEDIT@ |
325 | 325 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
326 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
326 | 327 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
327 | 328 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
328 | 329 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
524 | 524 | NM = @NM@ |
525 | 525 | NMEDIT = @NMEDIT@ |
526 | 526 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
527 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
527 | 528 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
528 | 529 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
529 | 530 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
19 | 19 | |
20 | 20 | #include "nm-default.h" |
21 | 21 | |
22 | #include "nm-agent-manager.h" | |
23 | ||
22 | 24 | #include <string.h> |
23 | 25 | #include <pwd.h> |
24 | 26 | |
27 | #include "nm-common-macros.h" | |
25 | 28 | #include "nm-dbus-interface.h" |
26 | #include "nm-agent-manager.h" | |
27 | 29 | #include "nm-secret-agent.h" |
28 | 30 | #include "nm-auth-utils.h" |
29 | 31 | #include "nm-setting-vpn.h" |
20 | 20 | #ifndef __NETWORKMANAGER_AGENT_MANAGER_H__ |
21 | 21 | #define __NETWORKMANAGER_AGENT_MANAGER_H__ |
22 | 22 | |
23 | #include <nm-connection.h> | |
23 | #include "nm-connection.h" | |
24 | 24 | |
25 | 25 | #include "nm-exported-object.h" |
26 | 26 | #include "nm-secret-agent.h" |
361 | 361 | r = request_new (self, "GetSecrets", path, setting_name, callback, callback_data); |
362 | 362 | r->is_get_secrets = TRUE; |
363 | 363 | g_hash_table_add (priv->requests, r); |
364 | ||
365 | /* Increase the timeout only for this call */ | |
366 | g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (priv->proxy), 120000); | |
364 | 367 | nmdbus_secret_agent_call_get_secrets (priv->proxy, |
365 | 368 | dict, |
366 | 369 | path, |
369 | 372 | flags, |
370 | 373 | r->cancellable, |
371 | 374 | get_callback, r); |
375 | g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (priv->proxy), -1); | |
372 | 376 | |
373 | 377 | return r; |
374 | 378 | } |
20 | 20 | |
21 | 21 | #include "nm-default.h" |
22 | 22 | |
23 | #include "nm-settings-connection.h" | |
24 | ||
23 | 25 | #include <string.h> |
24 | 26 | |
27 | #include "nm-common-macros.h" | |
25 | 28 | #include "nm-dbus-interface.h" |
26 | #include "nm-settings-connection.h" | |
27 | 29 | #include "nm-session-monitor.h" |
28 | 30 | #include "nm-auth-utils.h" |
29 | 31 | #include "nm-auth-subject.h" |
69 | 71 | NM_TYPE_SETTINGS_CONNECTION, \ |
70 | 72 | NMSettingsConnectionPrivate)) |
71 | 73 | |
72 | enum { | |
73 | PROP_0 = 0, | |
74 | NM_GOBJECT_PROPERTIES_DEFINE (NMSettingsConnection, | |
74 | 75 | PROP_VISIBLE, |
75 | 76 | PROP_UNSAVED, |
76 | 77 | PROP_READY, |
77 | 78 | PROP_FLAGS, |
78 | 79 | PROP_FILENAME, |
79 | }; | |
80 | ); | |
80 | 81 | |
81 | 82 | enum { |
82 | 83 | UPDATED, |
83 | 84 | REMOVED, |
84 | UPDATED_BY_USER, | |
85 | UPDATED_INTERNAL, | |
85 | 86 | LAST_SIGNAL |
86 | 87 | }; |
87 | 88 | static guint signals[LAST_SIGNAL] = { 0 }; |
95 | 96 | |
96 | 97 | NMSettingsConnectionFlags flags; |
97 | 98 | gboolean ready; |
98 | ||
99 | guint updated_idle_id; | |
100 | 99 | |
101 | 100 | GSList *pending_auths; /* List of pending authentication requests */ |
102 | 101 | gboolean visible; /* Is this connection is visible by some session? */ |
129 | 128 | char *filename; |
130 | 129 | |
131 | 130 | } NMSettingsConnectionPrivate; |
131 | ||
132 | /*******************************************************************/ | |
133 | ||
134 | static void | |
135 | _emit_updated (NMSettingsConnection *self, gboolean by_user) | |
136 | { | |
137 | g_signal_emit (self, signals[UPDATED], 0); | |
138 | g_signal_emit (self, signals[UPDATED_INTERNAL], 0, by_user); | |
139 | } | |
132 | 140 | |
133 | 141 | /*******************************************************************/ |
134 | 142 | |
291 | 299 | if (new_visible == priv->visible) |
292 | 300 | return; |
293 | 301 | priv->visible = new_visible; |
294 | g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_VISIBLE); | |
302 | _notify (self, PROP_VISIBLE); | |
295 | 303 | } |
296 | 304 | |
297 | 305 | gboolean |
464 | 472 | priv->agent_secrets = NULL; |
465 | 473 | } |
466 | 474 | |
467 | static gboolean | |
468 | emit_updated (NMSettingsConnection *self) | |
469 | { | |
470 | NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->updated_idle_id = 0; | |
471 | g_signal_emit (self, signals[UPDATED], 0); | |
472 | return FALSE; | |
473 | } | |
474 | ||
475 | 475 | static void |
476 | 476 | set_unsaved (NMSettingsConnection *self, gboolean now_unsaved) |
477 | 477 | { |
490 | 490 | } |
491 | 491 | |
492 | 492 | static void |
493 | changed_cb (NMSettingsConnection *self, gpointer user_data) | |
494 | { | |
495 | gboolean update_unsaved = !!user_data; | |
496 | ||
497 | NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self); | |
498 | ||
499 | if (update_unsaved) | |
500 | set_unsaved (self, TRUE); | |
501 | if (priv->updated_idle_id == 0) | |
502 | priv->updated_idle_id = g_idle_add ((GSourceFunc) emit_updated, self); | |
493 | connection_changed_cb (NMSettingsConnection *self, gpointer unused) | |
494 | { | |
495 | set_unsaved (self, TRUE); | |
496 | _emit_updated (self, FALSE); | |
503 | 497 | } |
504 | 498 | |
505 | 499 | /* Update the settings of this connection to match that of 'new_connection', |
542 | 536 | /* Disconnect the changed signal to ensure we don't set Unsaved when |
543 | 537 | * it's not required. |
544 | 538 | */ |
545 | g_signal_handlers_block_by_func (self, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); | |
539 | g_signal_handlers_block_by_func (self, G_CALLBACK (connection_changed_cb), NULL); | |
546 | 540 | |
547 | 541 | if (log_diff_name) |
548 | 542 | nm_utils_log_connection_diff (new_connection, NM_CONNECTION (self), LOGL_DEBUG, LOGD_CORE, log_diff_name, "++ "); |
579 | 573 | /* Manually emit changed signal since we disconnected the handler, but |
580 | 574 | * only update Unsaved if the caller wanted us to. |
581 | 575 | */ |
582 | changed_cb (self, GUINT_TO_POINTER (update_unsaved)); | |
583 | ||
584 | g_signal_emit (self, signals[UPDATED_BY_USER], 0); | |
585 | ||
586 | g_signal_handlers_unblock_by_func (self, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); | |
576 | if (update_unsaved) | |
577 | set_unsaved (self, TRUE); | |
578 | ||
579 | g_signal_handlers_unblock_by_func (self, G_CALLBACK (connection_changed_cb), NULL); | |
580 | ||
581 | _emit_updated (self, TRUE); | |
587 | 582 | |
588 | 583 | return success; |
589 | 584 | } |
2098 | 2093 | old_flags = priv->flags; |
2099 | 2094 | if (old_flags != flags) { |
2100 | 2095 | priv->flags = flags; |
2101 | g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_FLAGS); | |
2096 | _notify (self, PROP_FLAGS); | |
2102 | 2097 | if (NM_FLAGS_HAS (old_flags, NM_SETTINGS_CONNECTION_FLAGS_UNSAVED) != NM_FLAGS_HAS (flags, NM_SETTINGS_CONNECTION_FLAGS_UNSAVED)) |
2103 | g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_UNSAVED); | |
2098 | _notify (self, PROP_UNSAVED); | |
2104 | 2099 | } |
2105 | 2100 | return old_flags; |
2106 | 2101 | } |
2505 | 2500 | ready = !!ready; |
2506 | 2501 | if (priv->ready != ready) { |
2507 | 2502 | priv->ready = ready; |
2508 | g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_READY); | |
2503 | _notify (self, PROP_READY); | |
2509 | 2504 | } |
2510 | 2505 | } |
2511 | 2506 | |
2526 | 2521 | if (g_strcmp0 (filename, priv->filename) != 0) { |
2527 | 2522 | g_free (priv->filename); |
2528 | 2523 | priv->filename = g_strdup (filename); |
2529 | g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_FILENAME); | |
2524 | _notify (self, PROP_FILENAME); | |
2530 | 2525 | } |
2531 | 2526 | } |
2532 | 2527 | |
2581 | 2576 | priv->autoconnect_blocked_reason = NM_DEVICE_STATE_REASON_NONE; |
2582 | 2577 | |
2583 | 2578 | g_signal_connect (self, NM_CONNECTION_SECRETS_CLEARED, G_CALLBACK (secrets_cleared_cb), NULL); |
2584 | g_signal_connect (self, NM_CONNECTION_CHANGED, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); | |
2579 | g_signal_connect (self, NM_CONNECTION_CHANGED, G_CALLBACK (connection_changed_cb), NULL); | |
2585 | 2580 | } |
2586 | 2581 | |
2587 | 2582 | static void |
2612 | 2607 | } |
2613 | 2608 | } |
2614 | 2609 | |
2615 | nm_clear_g_source (&priv->updated_idle_id); | |
2616 | ||
2617 | 2610 | /* Disconnect handlers. |
2618 | * changed_cb() has to be disconnected *before* nm_connection_clear_secrets(), | |
2611 | * connection_changed_cb() has to be disconnected *before* nm_connection_clear_secrets(), | |
2619 | 2612 | * because nm_connection_clear_secrets() emits NM_CONNECTION_CHANGED signal. |
2620 | 2613 | */ |
2621 | 2614 | g_signal_handlers_disconnect_by_func (self, G_CALLBACK (secrets_cleared_cb), NULL); |
2622 | g_signal_handlers_disconnect_by_func (self, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); | |
2615 | g_signal_handlers_disconnect_by_func (self, G_CALLBACK (connection_changed_cb), NULL); | |
2623 | 2616 | |
2624 | 2617 | nm_connection_clear_secrets (NM_CONNECTION (self)); |
2625 | 2618 | g_clear_object (&priv->system_secrets); |
2718 | 2711 | class->supports_secrets = supports_secrets; |
2719 | 2712 | |
2720 | 2713 | /* Properties */ |
2721 | g_object_class_install_property | |
2722 | (object_class, PROP_VISIBLE, | |
2723 | g_param_spec_boolean (NM_SETTINGS_CONNECTION_VISIBLE, "", "", | |
2724 | FALSE, | |
2725 | G_PARAM_READABLE | | |
2726 | G_PARAM_STATIC_STRINGS)); | |
2727 | ||
2728 | g_object_class_install_property | |
2729 | (object_class, PROP_UNSAVED, | |
2730 | g_param_spec_boolean (NM_SETTINGS_CONNECTION_UNSAVED, "", "", | |
2731 | FALSE, | |
2732 | G_PARAM_READABLE | | |
2733 | G_PARAM_STATIC_STRINGS)); | |
2734 | ||
2735 | g_object_class_install_property | |
2736 | (object_class, PROP_READY, | |
2737 | g_param_spec_boolean (NM_SETTINGS_CONNECTION_READY, "", "", | |
2738 | TRUE, | |
2739 | G_PARAM_READWRITE | | |
2740 | G_PARAM_STATIC_STRINGS)); | |
2741 | ||
2742 | g_object_class_install_property | |
2743 | (object_class, PROP_FLAGS, | |
2714 | obj_properties[PROP_VISIBLE] = | |
2715 | g_param_spec_boolean (NM_SETTINGS_CONNECTION_VISIBLE, "", "", | |
2716 | FALSE, | |
2717 | G_PARAM_READABLE | | |
2718 | G_PARAM_STATIC_STRINGS); | |
2719 | ||
2720 | obj_properties[PROP_UNSAVED] = | |
2721 | g_param_spec_boolean (NM_SETTINGS_CONNECTION_UNSAVED, "", "", | |
2722 | FALSE, | |
2723 | G_PARAM_READABLE | | |
2724 | G_PARAM_STATIC_STRINGS); | |
2725 | ||
2726 | obj_properties[PROP_READY] = | |
2727 | g_param_spec_boolean (NM_SETTINGS_CONNECTION_READY, "", "", | |
2728 | TRUE, | |
2729 | G_PARAM_READWRITE | | |
2730 | G_PARAM_STATIC_STRINGS); | |
2731 | ||
2732 | obj_properties[PROP_FLAGS] = | |
2744 | 2733 | g_param_spec_uint (NM_SETTINGS_CONNECTION_FLAGS, "", "", |
2745 | 2734 | NM_SETTINGS_CONNECTION_FLAGS_NONE, |
2746 | 2735 | NM_SETTINGS_CONNECTION_FLAGS_ALL, |
2747 | 2736 | NM_SETTINGS_CONNECTION_FLAGS_NONE, |
2748 | 2737 | G_PARAM_READWRITE | |
2749 | G_PARAM_STATIC_STRINGS)); | |
2750 | ||
2751 | g_object_class_install_property | |
2752 | (object_class, PROP_FILENAME, | |
2753 | g_param_spec_string (NM_SETTINGS_CONNECTION_FILENAME, "", "", | |
2754 | NULL, | |
2755 | G_PARAM_READWRITE | | |
2756 | G_PARAM_STATIC_STRINGS)); | |
2738 | G_PARAM_STATIC_STRINGS); | |
2739 | ||
2740 | obj_properties[PROP_FILENAME] = | |
2741 | g_param_spec_string (NM_SETTINGS_CONNECTION_FILENAME, "", "", | |
2742 | NULL, | |
2743 | G_PARAM_READWRITE | | |
2744 | G_PARAM_STATIC_STRINGS); | |
2745 | ||
2746 | g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); | |
2757 | 2747 | |
2758 | 2748 | /* Signals */ |
2759 | 2749 | |
2760 | /* Emitted when the connection is changed for any reason */ | |
2761 | 2750 | signals[UPDATED] = |
2762 | g_signal_new (NM_SETTINGS_CONNECTION_UPDATED, | |
2763 | G_TYPE_FROM_CLASS (class), | |
2764 | G_SIGNAL_RUN_FIRST, | |
2765 | 0, | |
2766 | NULL, NULL, | |
2767 | g_cclosure_marshal_VOID__VOID, | |
2768 | G_TYPE_NONE, 0); | |
2769 | ||
2770 | /* Emitted when connection is changed from D-Bus */ | |
2771 | signals[UPDATED_BY_USER] = | |
2772 | g_signal_new (NM_SETTINGS_CONNECTION_UPDATED_BY_USER, | |
2773 | G_TYPE_FROM_CLASS (class), | |
2774 | G_SIGNAL_RUN_FIRST, | |
2775 | 0, NULL, NULL, | |
2776 | g_cclosure_marshal_VOID__VOID, | |
2777 | G_TYPE_NONE, 0); | |
2778 | ||
2779 | signals[REMOVED] = | |
2780 | g_signal_new (NM_SETTINGS_CONNECTION_REMOVED, | |
2781 | G_TYPE_FROM_CLASS (class), | |
2782 | G_SIGNAL_RUN_FIRST, | |
2783 | 0, | |
2784 | NULL, NULL, | |
2785 | g_cclosure_marshal_VOID__VOID, | |
2786 | G_TYPE_NONE, 0); | |
2751 | g_signal_new (NM_SETTINGS_CONNECTION_UPDATED, | |
2752 | G_TYPE_FROM_CLASS (class), | |
2753 | G_SIGNAL_RUN_FIRST, | |
2754 | 0, | |
2755 | NULL, NULL, | |
2756 | g_cclosure_marshal_VOID__VOID, | |
2757 | G_TYPE_NONE, 0); | |
2758 | ||
2759 | /* internal signal, with an argument (gboolean by_user). */ | |
2760 | signals[UPDATED_INTERNAL] = | |
2761 | g_signal_new (NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, | |
2762 | G_TYPE_FROM_CLASS (class), | |
2763 | G_SIGNAL_RUN_FIRST, | |
2764 | 0, NULL, NULL, | |
2765 | g_cclosure_marshal_VOID__BOOLEAN, | |
2766 | G_TYPE_NONE, 1, G_TYPE_BOOLEAN); | |
2767 | ||
2768 | signals[REMOVED] = | |
2769 | g_signal_new (NM_SETTINGS_CONNECTION_REMOVED, | |
2770 | G_TYPE_FROM_CLASS (class), | |
2771 | G_SIGNAL_RUN_FIRST, | |
2772 | 0, | |
2773 | NULL, NULL, | |
2774 | g_cclosure_marshal_VOID__VOID, | |
2775 | G_TYPE_NONE, 0); | |
2787 | 2776 | |
2788 | 2777 | nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (class), |
2789 | 2778 | NMDBUS_TYPE_SETTINGS_CONNECTION_SKELETON, |
42 | 42 | #define NM_SETTINGS_CONNECTION_GET_SECRETS "get-secrets" |
43 | 43 | #define NM_SETTINGS_CONNECTION_CANCEL_SECRETS "cancel-secrets" |
44 | 44 | |
45 | /* Emitted when connection is changed by a user action */ | |
46 | #define NM_SETTINGS_CONNECTION_UPDATED_BY_USER "updated-by-user" | |
45 | /* Internal signals */ | |
46 | #define NM_SETTINGS_CONNECTION_UPDATED_INTERNAL "updated-internal" | |
47 | 47 | |
48 | 48 | /* Properties */ |
49 | 49 | #define NM_SETTINGS_CONNECTION_VISIBLE "visible" |
35 | 35 | #include <selinux/selinux.h> |
36 | 36 | #endif |
37 | 37 | |
38 | #include "nm-common-macros.h" | |
38 | 39 | #include "nm-dbus-interface.h" |
39 | 40 | #include "nm-connection.h" |
40 | 41 | #include "nm-setting-8021x.h" |
156 | 157 | |
157 | 158 | struct { |
158 | 159 | char *value; |
159 | char *file; | |
160 | 160 | GFileMonitor *monitor; |
161 | 161 | GFileMonitor *dhcp_monitor; |
162 | 162 | gulong monitor_id; |
170 | 170 | enum { |
171 | 171 | CONNECTION_ADDED, |
172 | 172 | CONNECTION_UPDATED, |
173 | CONNECTION_UPDATED_BY_USER, | |
174 | 173 | CONNECTION_REMOVED, |
175 | 174 | CONNECTION_VISIBILITY_CHANGED, |
176 | 175 | AGENT_REGISTERED, |
180 | 179 | }; |
181 | 180 | static guint signals[LAST_SIGNAL] = { 0 }; |
182 | 181 | |
183 | enum { | |
184 | PROP_0, | |
182 | NM_GOBJECT_PROPERTIES_DEFINE (NMSettings, | |
185 | 183 | PROP_UNMANAGED_SPECS, |
186 | 184 | PROP_HOSTNAME, |
187 | 185 | PROP_CAN_MODIFY, |
188 | 186 | PROP_CONNECTIONS, |
189 | 187 | PROP_STARTUP_COMPLETE, |
190 | ||
191 | LAST_PROP | |
192 | }; | |
188 | ); | |
193 | 189 | |
194 | 190 | static void |
195 | 191 | check_startup_complete (NMSettings *self) |
208 | 204 | } |
209 | 205 | |
210 | 206 | priv->startup_complete = TRUE; |
211 | g_object_notify (G_OBJECT (self), NM_SETTINGS_STARTUP_COMPLETE); | |
207 | _notify (self, PROP_STARTUP_COMPLETE); | |
212 | 208 | } |
213 | 209 | |
214 | 210 | static void |
588 | 584 | #endif |
589 | 585 | |
590 | 586 | #if defined(HOSTNAME_PERSIST_GENTOO) |
591 | hostname = read_hostname_gentoo (priv->hostname.file); | |
587 | hostname = read_hostname_gentoo (HOSTNAME_FILE); | |
592 | 588 | #elif defined(HOSTNAME_PERSIST_SLACKWARE) |
593 | hostname = read_hostname_slackware (priv->hostname.file); | |
589 | hostname = read_hostname_slackware (HOSTNAME_FILE); | |
594 | 590 | #else |
595 | if (g_file_get_contents (priv->hostname.file, &hostname, NULL, NULL)) | |
591 | if (g_file_get_contents (HOSTNAME_FILE, &hostname, NULL, NULL)) | |
596 | 592 | g_strchomp (hostname); |
597 | 593 | #endif |
598 | 594 | |
651 | 647 | |
652 | 648 | update_specs (self, &priv->unmanaged_specs, |
653 | 649 | nm_settings_plugin_get_unmanaged_specs); |
654 | g_object_notify (G_OBJECT (self), NM_SETTINGS_UNMANAGED_SPECS); | |
650 | _notify (self, PROP_UNMANAGED_SPECS); | |
655 | 651 | } |
656 | 652 | |
657 | 653 | static void |
882 | 878 | } |
883 | 879 | |
884 | 880 | static void |
885 | connection_updated (NMSettingsConnection *connection, gpointer user_data) | |
886 | { | |
887 | /* Re-emit for listeners like NMPolicy */ | |
881 | connection_updated (NMSettingsConnection *connection, gboolean by_user, gpointer user_data) | |
882 | { | |
888 | 883 | g_signal_emit (NM_SETTINGS (user_data), |
889 | 884 | signals[CONNECTION_UPDATED], |
890 | 885 | 0, |
891 | connection); | |
886 | connection, | |
887 | by_user); | |
892 | 888 | g_signal_emit_by_name (NM_SETTINGS (user_data), NM_CP_SIGNAL_CONNECTION_UPDATED, connection); |
893 | } | |
894 | ||
895 | static void | |
896 | connection_updated_by_user (NMSettingsConnection *connection, gpointer user_data) | |
897 | { | |
898 | /* Re-emit for listeners like NMPolicy */ | |
899 | g_signal_emit (NM_SETTINGS (user_data), | |
900 | signals[CONNECTION_UPDATED_BY_USER], | |
901 | 0, | |
902 | connection); | |
903 | 889 | } |
904 | 890 | |
905 | 891 | static void |
932 | 918 | |
933 | 919 | g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_removed), self); |
934 | 920 | g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_updated), self); |
935 | g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_updated_by_user), self); | |
936 | 921 | g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_visibility_changed), self); |
937 | 922 | g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_ready_changed), self); |
938 | 923 | g_object_unref (self); |
945 | 930 | |
946 | 931 | /* Re-emit for listeners like NMPolicy */ |
947 | 932 | g_signal_emit_by_name (self, NM_CP_SIGNAL_CONNECTION_REMOVED, connection); |
948 | g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTIONS); | |
933 | _notify (self, PROP_CONNECTIONS); | |
949 | 934 | if (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (connection))) |
950 | 935 | nm_exported_object_unexport (NM_EXPORTED_OBJECT (connection)); |
951 | 936 | |
1064 | 1049 | g_object_ref (self); |
1065 | 1050 | g_signal_connect (connection, NM_SETTINGS_CONNECTION_REMOVED, |
1066 | 1051 | G_CALLBACK (connection_removed), self); |
1067 | g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED, | |
1052 | g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, | |
1068 | 1053 | G_CALLBACK (connection_updated), self); |
1069 | g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED_BY_USER, | |
1070 | G_CALLBACK (connection_updated_by_user), self); | |
1071 | 1054 | g_signal_connect (connection, "notify::" NM_SETTINGS_CONNECTION_VISIBLE, |
1072 | 1055 | G_CALLBACK (connection_visibility_changed), |
1073 | 1056 | self); |
1095 | 1078 | /* Internal added signal */ |
1096 | 1079 | g_signal_emit (self, signals[CONNECTION_ADDED], 0, connection); |
1097 | 1080 | g_signal_emit_by_name (self, NM_CP_SIGNAL_CONNECTION_ADDED, connection); |
1098 | g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTIONS); | |
1081 | _notify (self, PROP_CONNECTIONS); | |
1099 | 1082 | |
1100 | 1083 | /* Exported D-Bus signal */ |
1101 | 1084 | g_signal_emit (self, signals[NEW_CONNECTION], 0, connection); |
1110 | 1093 | * not save to disk |
1111 | 1094 | * @error: on return, a location to store any errors that may occur |
1112 | 1095 | * |
1113 | * Creates a new #NMSettingsConnection for the given source @connection. | |
1096 | * Creates a new #NMSettingsConnection for the given source @connection. | |
1114 | 1097 | * The returned object is owned by @self and the caller must reference |
1115 | 1098 | * the object to continue using it. |
1116 | 1099 | * |
1634 | 1617 | char *hostname_eol; |
1635 | 1618 | gboolean ret; |
1636 | 1619 | gs_free_error GError *error = NULL; |
1637 | const char *file = priv->hostname.file; | |
1620 | const char *file = HOSTNAME_FILE; | |
1638 | 1621 | gs_free char *link_path = NULL; |
1639 | 1622 | gs_unref_variant GVariant *var = NULL; |
1640 | 1623 | struct stat file_stat; |
1663 | 1646 | */ |
1664 | 1647 | if ( lstat (file, &file_stat) == 0 |
1665 | 1648 | && S_ISLNK (file_stat.st_mode) |
1666 | && (link_path = g_file_read_link (file, NULL))) | |
1649 | && (link_path = nm_utils_read_link_absolute (file, NULL))) | |
1667 | 1650 | file = link_path; |
1668 | 1651 | |
1669 | 1652 | #if HAVE_SELINUX |
1829 | 1812 | NM_PRINT_FMT_QUOTED (new_hostname, "\"", new_hostname, "\"", "(none)")); |
1830 | 1813 | g_free (priv->hostname.value); |
1831 | 1814 | priv->hostname.value = new_hostname; |
1832 | g_object_notify (G_OBJECT (settings), NM_SETTINGS_HOSTNAME); | |
1815 | _notify (settings, PROP_HOSTNAME); | |
1833 | 1816 | } else |
1834 | 1817 | g_free (new_hostname); |
1835 | 1818 | } |
1931 | 1914 | } |
1932 | 1915 | |
1933 | 1916 | static void |
1934 | default_wired_connection_updated_by_user_cb (NMSettingsConnection *connection, NMSettings *self) | |
1917 | default_wired_connection_updated_by_user_cb (NMSettingsConnection *connection, gboolean by_user, NMSettings *self) | |
1935 | 1918 | { |
1936 | 1919 | NMDevice *device; |
1920 | ||
1921 | if (!by_user) | |
1922 | return; | |
1937 | 1923 | |
1938 | 1924 | /* The connection has been changed by the user, it should no longer be |
1939 | 1925 | * considered a default wired connection, and should no longer affect |
2009 | 1995 | g_object_set_data (G_OBJECT (added), DEFAULT_WIRED_DEVICE_TAG, device); |
2010 | 1996 | g_object_set_data (G_OBJECT (device), DEFAULT_WIRED_CONNECTION_TAG, added); |
2011 | 1997 | |
2012 | g_signal_connect (added, NM_SETTINGS_CONNECTION_UPDATED_BY_USER, | |
1998 | g_signal_connect (added, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, | |
2013 | 1999 | G_CALLBACK (default_wired_connection_updated_by_user_cb), self); |
2014 | 2000 | g_signal_connect (added, NM_SETTINGS_CONNECTION_REMOVED, |
2015 | 2001 | G_CALLBACK (default_wired_connection_removed_cb), self); |
2173 | 2159 | char **invalidated_properties, |
2174 | 2160 | gpointer user_data) |
2175 | 2161 | { |
2176 | NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (user_data); | |
2162 | NMSettings *self = user_data; | |
2163 | NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); | |
2177 | 2164 | GVariant *v_hostname; |
2178 | 2165 | const char *hostname; |
2179 | 2166 | |
2190 | 2177 | NM_PRINT_FMT_QUOTED (hostname, "\"", hostname, "\"", "(none)")); |
2191 | 2178 | g_free (priv->hostname.value); |
2192 | 2179 | priv->hostname.value = g_strdup (hostname); |
2193 | g_object_notify (G_OBJECT (user_data), NM_SETTINGS_HOSTNAME); | |
2180 | _notify (self, PROP_HOSTNAME); | |
2194 | 2181 | nm_dispatcher_call (DISPATCHER_ACTION_HOSTNAME, NULL, NULL, NULL, NULL, NULL, NULL); |
2195 | 2182 | } |
2196 | 2183 | |
2204 | 2191 | GFileMonitor *monitor; |
2205 | 2192 | GFile *file; |
2206 | 2193 | |
2207 | priv->hostname.file = HOSTNAME_FILE; | |
2208 | 2194 | priv->hostname.value = nm_settings_get_hostname (self); |
2209 | 2195 | |
2210 | 2196 | /* monitor changes to hostname file */ |
2211 | file = g_file_new_for_path (priv->hostname.file); | |
2197 | file = g_file_new_for_path (HOSTNAME_FILE); | |
2212 | 2198 | monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); |
2213 | 2199 | g_object_unref (file); |
2214 | 2200 | if (monitor) { |
2295 | 2281 | setup_hostname_file_monitors (self); |
2296 | 2282 | |
2297 | 2283 | priv->started = TRUE; |
2298 | g_object_notify (G_OBJECT (self), NM_SETTINGS_HOSTNAME); | |
2284 | _notify (self, PROP_HOSTNAME); | |
2299 | 2285 | return TRUE; |
2300 | 2286 | } |
2301 | 2287 | |
2446 | 2432 | |
2447 | 2433 | /* properties */ |
2448 | 2434 | |
2449 | g_object_class_install_property | |
2450 | (object_class, PROP_UNMANAGED_SPECS, | |
2451 | g_param_spec_boxed (NM_SETTINGS_UNMANAGED_SPECS, "", "", | |
2452 | G_TYPE_STRV, | |
2453 | G_PARAM_READABLE | | |
2454 | G_PARAM_STATIC_STRINGS)); | |
2455 | ||
2456 | g_object_class_install_property | |
2457 | (object_class, PROP_HOSTNAME, | |
2458 | g_param_spec_string (NM_SETTINGS_HOSTNAME, "", "", | |
2459 | NULL, | |
2460 | G_PARAM_READABLE | | |
2461 | G_PARAM_STATIC_STRINGS)); | |
2462 | ||
2463 | g_object_class_install_property | |
2464 | (object_class, PROP_CAN_MODIFY, | |
2465 | g_param_spec_boolean (NM_SETTINGS_CAN_MODIFY, "", "", | |
2466 | FALSE, | |
2467 | G_PARAM_READABLE | | |
2468 | G_PARAM_STATIC_STRINGS)); | |
2469 | ||
2470 | g_object_class_install_property | |
2471 | (object_class, PROP_CONNECTIONS, | |
2472 | g_param_spec_boxed (NM_SETTINGS_CONNECTIONS, "", "", | |
2473 | G_TYPE_STRV, | |
2474 | G_PARAM_READABLE | | |
2475 | G_PARAM_STATIC_STRINGS)); | |
2435 | obj_properties[PROP_UNMANAGED_SPECS] = | |
2436 | g_param_spec_boxed (NM_SETTINGS_UNMANAGED_SPECS, "", "", | |
2437 | G_TYPE_STRV, | |
2438 | G_PARAM_READABLE | | |
2439 | G_PARAM_STATIC_STRINGS); | |
2440 | ||
2441 | obj_properties[PROP_HOSTNAME] = | |
2442 | g_param_spec_string (NM_SETTINGS_HOSTNAME, "", "", | |
2443 | NULL, | |
2444 | G_PARAM_READABLE | | |
2445 | G_PARAM_STATIC_STRINGS); | |
2446 | ||
2447 | obj_properties[PROP_CAN_MODIFY] = | |
2448 | g_param_spec_boolean (NM_SETTINGS_CAN_MODIFY, "", "", | |
2449 | FALSE, | |
2450 | G_PARAM_READABLE | | |
2451 | G_PARAM_STATIC_STRINGS); | |
2452 | ||
2453 | obj_properties[PROP_CONNECTIONS] = | |
2454 | g_param_spec_boxed (NM_SETTINGS_CONNECTIONS, "", "", | |
2455 | G_TYPE_STRV, | |
2456 | G_PARAM_READABLE | | |
2457 | G_PARAM_STATIC_STRINGS); | |
2458 | ||
2459 | obj_properties[PROP_STARTUP_COMPLETE] = | |
2460 | g_param_spec_boolean (NM_SETTINGS_STARTUP_COMPLETE, "", "", | |
2461 | FALSE, | |
2462 | G_PARAM_READABLE | | |
2463 | G_PARAM_STATIC_STRINGS); | |
2464 | ||
2465 | g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); | |
2476 | 2466 | |
2477 | 2467 | /* signals */ |
2478 | signals[CONNECTION_ADDED] = | |
2479 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_ADDED, | |
2480 | G_OBJECT_CLASS_TYPE (object_class), | |
2481 | G_SIGNAL_RUN_FIRST, | |
2482 | G_STRUCT_OFFSET (NMSettingsClass, connection_added), | |
2483 | NULL, NULL, | |
2484 | g_cclosure_marshal_VOID__OBJECT, | |
2485 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2486 | ||
2487 | signals[CONNECTION_UPDATED] = | |
2488 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, | |
2489 | G_OBJECT_CLASS_TYPE (object_class), | |
2490 | G_SIGNAL_RUN_FIRST, | |
2491 | G_STRUCT_OFFSET (NMSettingsClass, connection_updated), | |
2492 | NULL, NULL, | |
2493 | g_cclosure_marshal_VOID__OBJECT, | |
2494 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2495 | ||
2496 | signals[CONNECTION_UPDATED_BY_USER] = | |
2497 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER, | |
2498 | G_OBJECT_CLASS_TYPE (object_class), | |
2499 | G_SIGNAL_RUN_FIRST, | |
2500 | 0, | |
2501 | NULL, NULL, | |
2502 | g_cclosure_marshal_VOID__OBJECT, | |
2503 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2504 | ||
2505 | signals[CONNECTION_REMOVED] = | |
2506 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, | |
2507 | G_OBJECT_CLASS_TYPE (object_class), | |
2508 | G_SIGNAL_RUN_FIRST, | |
2509 | G_STRUCT_OFFSET (NMSettingsClass, connection_removed), | |
2510 | NULL, NULL, | |
2511 | g_cclosure_marshal_VOID__OBJECT, | |
2512 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2513 | ||
2514 | signals[CONNECTION_VISIBILITY_CHANGED] = | |
2515 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED, | |
2516 | G_OBJECT_CLASS_TYPE (object_class), | |
2517 | G_SIGNAL_RUN_FIRST, | |
2518 | G_STRUCT_OFFSET (NMSettingsClass, connection_visibility_changed), | |
2519 | NULL, NULL, | |
2520 | g_cclosure_marshal_VOID__OBJECT, | |
2521 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2468 | signals[CONNECTION_ADDED] = | |
2469 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_ADDED, | |
2470 | G_OBJECT_CLASS_TYPE (object_class), | |
2471 | G_SIGNAL_RUN_FIRST, | |
2472 | 0, NULL, NULL, | |
2473 | g_cclosure_marshal_VOID__OBJECT, | |
2474 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2475 | ||
2476 | signals[CONNECTION_UPDATED] = | |
2477 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, | |
2478 | G_OBJECT_CLASS_TYPE (object_class), | |
2479 | G_SIGNAL_RUN_FIRST, | |
2480 | 0, NULL, NULL, | |
2481 | NULL, | |
2482 | G_TYPE_NONE, 2, NM_TYPE_SETTINGS_CONNECTION, G_TYPE_BOOLEAN); | |
2483 | ||
2484 | signals[CONNECTION_REMOVED] = | |
2485 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, | |
2486 | G_OBJECT_CLASS_TYPE (object_class), | |
2487 | G_SIGNAL_RUN_FIRST, | |
2488 | 0, NULL, NULL, | |
2489 | g_cclosure_marshal_VOID__OBJECT, | |
2490 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2491 | ||
2492 | signals[CONNECTION_VISIBILITY_CHANGED] = | |
2493 | g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED, | |
2494 | G_OBJECT_CLASS_TYPE (object_class), | |
2495 | G_SIGNAL_RUN_FIRST, | |
2496 | 0, NULL, NULL, | |
2497 | g_cclosure_marshal_VOID__OBJECT, | |
2498 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2522 | 2499 | |
2523 | 2500 | signals[AGENT_REGISTERED] = |
2524 | g_signal_new (NM_SETTINGS_SIGNAL_AGENT_REGISTERED, | |
2525 | G_OBJECT_CLASS_TYPE (object_class), | |
2526 | G_SIGNAL_RUN_FIRST, | |
2527 | G_STRUCT_OFFSET (NMSettingsClass, agent_registered), | |
2528 | NULL, NULL, | |
2529 | g_cclosure_marshal_VOID__OBJECT, | |
2530 | G_TYPE_NONE, 1, NM_TYPE_SECRET_AGENT); | |
2531 | ||
2532 | ||
2533 | signals[NEW_CONNECTION] = | |
2534 | g_signal_new ("new-connection", | |
2535 | G_OBJECT_CLASS_TYPE (object_class), | |
2536 | G_SIGNAL_RUN_FIRST, 0, NULL, NULL, | |
2537 | g_cclosure_marshal_VOID__OBJECT, | |
2538 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2501 | g_signal_new (NM_SETTINGS_SIGNAL_AGENT_REGISTERED, | |
2502 | G_OBJECT_CLASS_TYPE (object_class), | |
2503 | G_SIGNAL_RUN_FIRST, | |
2504 | 0, NULL, NULL, | |
2505 | g_cclosure_marshal_VOID__OBJECT, | |
2506 | G_TYPE_NONE, 1, NM_TYPE_SECRET_AGENT); | |
2507 | ||
2508 | ||
2509 | signals[NEW_CONNECTION] = | |
2510 | g_signal_new ("new-connection", | |
2511 | G_OBJECT_CLASS_TYPE (object_class), | |
2512 | G_SIGNAL_RUN_FIRST, 0, NULL, NULL, | |
2513 | g_cclosure_marshal_VOID__OBJECT, | |
2514 | G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); | |
2539 | 2515 | |
2540 | 2516 | nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (class), |
2541 | 2517 | NMDBUS_TYPE_SETTINGS_SKELETON, |
40 | 40 | #define NM_SETTINGS_HOSTNAME "hostname" |
41 | 41 | #define NM_SETTINGS_CAN_MODIFY "can-modify" |
42 | 42 | #define NM_SETTINGS_CONNECTIONS "connections" |
43 | #define NM_SETTINGS_STARTUP_COMPLETE "connections" | |
43 | #define NM_SETTINGS_STARTUP_COMPLETE "startup-complete" | |
44 | 44 | |
45 | 45 | #define NM_SETTINGS_SIGNAL_CONNECTION_ADDED "connection-added" |
46 | 46 | #define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED "connection-updated" |
47 | #define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER "connection-updated-by-user" | |
48 | 47 | #define NM_SETTINGS_SIGNAL_CONNECTION_REMOVED "connection-removed" |
49 | 48 | #define NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed" |
50 | 49 | #define NM_SETTINGS_SIGNAL_AGENT_REGISTERED "agent-registered" |
55 | 54 | |
56 | 55 | typedef struct { |
57 | 56 | NMExportedObjectClass parent_class; |
58 | ||
59 | /* Signals */ | |
60 | void (*properties_changed) (NMSettings *self, GHashTable *properties); | |
61 | ||
62 | void (*connection_added) (NMSettings *self, NMSettingsConnection *connection); | |
63 | ||
64 | void (*connection_updated) (NMSettings *self, NMSettingsConnection *connection); | |
65 | ||
66 | void (*connection_removed) (NMSettings *self, NMSettingsConnection *connection); | |
67 | ||
68 | void (*connection_visibility_changed) (NMSettings *self, NMSettingsConnection *connection); | |
69 | ||
70 | void (*agent_registered) (NMSettings *self, NMSecretAgent *agent); | |
71 | 57 | } NMSettingsClass; |
72 | 58 | |
73 | 59 | typedef void (*NMSettingsSetHostnameCb) (const char *name, gboolean result, gpointer user_data); |
327 | 327 | NM = @NM@ |
328 | 328 | NMEDIT = @NMEDIT@ |
329 | 329 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
330 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
330 | 331 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
331 | 332 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
332 | 333 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
394 | 394 | NM = @NM@ |
395 | 395 | NMEDIT = @NMEDIT@ |
396 | 396 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
397 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
397 | 398 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
398 | 399 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
399 | 400 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
522 | 522 | NM = @NM@ |
523 | 523 | NMEDIT = @NMEDIT@ |
524 | 524 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
525 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
525 | 526 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
526 | 527 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
527 | 528 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
404 | 404 | NM = @NM@ |
405 | 405 | NMEDIT = @NMEDIT@ |
406 | 406 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
407 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
407 | 408 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
408 | 409 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
409 | 410 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
942 | 942 | * On SIGHUP and SIGUSR1 try to re-connect to D-Bus. So in the unlikely |
943 | 943 | * event that the D-Bus conneciton is broken, that allows for recovery |
944 | 944 | * without need for restarting NetworkManager. */ |
945 | if ( NM_FLAGS_HAS (changes, NM_CONFIG_CHANGE_SIGHUP) | |
946 | || NM_FLAGS_HAS (changes, NM_CONFIG_CHANGE_SIGUSR1)) { | |
945 | if (NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_CAUSE_SIGHUP | |
946 | | NM_CONFIG_CHANGE_CAUSE_SIGUSR1)) { | |
947 | 947 | if (!SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (self)->dbus.connection) |
948 | 948 | _dbus_setup (self); |
949 | 949 | } |
983 | 983 | goto done; |
984 | 984 | (void) nm_setting_ip_config_add_address (s_ip4, addr); |
985 | 985 | nm_ip_address_unref (addr); |
986 | if (never_default) | |
987 | PARSE_WARNING ("GATEWAY will be ignored when DEFROUTE is disabled"); | |
986 | 988 | g_object_set (s_ip4, NM_SETTING_IP_CONFIG_GATEWAY, gateway, NULL); |
987 | 989 | } |
988 | 990 | return NM_SETTING (s_ip4); |
1080 | 1082 | } |
1081 | 1083 | } |
1082 | 1084 | g_object_set (s_ip4, NM_SETTING_IP_CONFIG_GATEWAY, gateway, NULL); |
1085 | ||
1086 | if (gateway && never_default) | |
1087 | PARSE_WARNING ("GATEWAY will be ignored when DEFROUTE is disabled"); | |
1083 | 1088 | |
1084 | 1089 | /* DNS servers |
1085 | 1090 | * Pick up just IPv4 addresses (IPv6 addresses are taken by make_ip6_setting()) |
576 | 576 | NM = @NM@ |
577 | 577 | NMEDIT = @NMEDIT@ |
578 | 578 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
579 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
579 | 580 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
580 | 581 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
581 | 582 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
395 | 395 | NM = @NM@ |
396 | 396 | NMEDIT = @NMEDIT@ |
397 | 397 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
398 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
398 | 399 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
399 | 400 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
400 | 401 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
528 | 528 | NM = @NM@ |
529 | 529 | NMEDIT = @NMEDIT@ |
530 | 530 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
531 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
531 | 532 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
532 | 533 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
533 | 534 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
394 | 394 | NM = @NM@ |
395 | 395 | NMEDIT = @NMEDIT@ |
396 | 396 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
397 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
397 | 398 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
398 | 399 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
399 | 400 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
523 | 523 | NM = @NM@ |
524 | 524 | NMEDIT = @NMEDIT@ |
525 | 525 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
526 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
526 | 527 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
527 | 528 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
528 | 529 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
363 | 363 | NM = @NM@ |
364 | 364 | NMEDIT = @NMEDIT@ |
365 | 365 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
366 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
366 | 367 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
367 | 368 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
368 | 369 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
567 | 567 | NM = @NM@ |
568 | 568 | NMEDIT = @NMEDIT@ |
569 | 569 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
570 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
570 | 571 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
571 | 572 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
572 | 573 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
561 | 561 | NM = @NM@ |
562 | 562 | NMEDIT = @NMEDIT@ |
563 | 563 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
564 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
564 | 565 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
565 | 566 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
566 | 567 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
631 | 631 | NM = @NM@ |
632 | 632 | NMEDIT = @NMEDIT@ |
633 | 633 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
634 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
634 | 635 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
635 | 636 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
636 | 637 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
520 | 520 | NM = @NM@ |
521 | 521 | NMEDIT = @NMEDIT@ |
522 | 522 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
523 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
523 | 524 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
524 | 525 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
525 | 526 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
342 | 342 | g_assert (!nm_config_get_no_auto_default_for_device (config, dev3)); |
343 | 343 | g_assert (nm_config_get_no_auto_default_for_device (config, dev4)); |
344 | 344 | |
345 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: update * (no-auto-default)*"); | |
345 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: signal NO_AUTO_DEFAULT,no-auto-default *"); | |
346 | 346 | nm_config_set_no_auto_default_for_device (config, dev3); |
347 | 347 | g_test_assert_expected_messages (); |
348 | 348 | |
510 | 510 | g_assert (config_changed_data); |
511 | 511 | g_assert (config_changed_data->changes == NM_CONFIG_CHANGE_NONE); |
512 | 512 | |
513 | if (changes == NM_CONFIG_CHANGE_SIGHUP) | |
513 | if (changes == NM_CONFIG_CHANGE_CAUSE_SIGHUP) | |
514 | 514 | return; |
515 | changes &= ~NM_CONFIG_CHANGE_SIGHUP; | |
515 | changes &= ~NM_CONFIG_CHANGE_CAUSE_SIGHUP; | |
516 | 516 | |
517 | 517 | config_changed_data->changes = changes; |
518 | 518 | |
555 | 555 | config_data_before = g_object_ref (nm_config_get_data (config)); |
556 | 556 | |
557 | 557 | if (expected_changes != NM_CONFIG_CHANGE_NONE) |
558 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: update *"); | |
558 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: signal *"); | |
559 | 559 | else |
560 | 560 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: signal SIGHUP (no changes from disk)*"); |
561 | 561 | |
562 | nm_config_reload (config, SIGHUP); | |
562 | nm_config_reload (config, NM_CONFIG_CHANGE_CAUSE_SIGHUP); | |
563 | 563 | |
564 | 564 | g_test_assert_expected_messages (); |
565 | 565 | |
599 | 599 | &config_changed_data); |
600 | 600 | |
601 | 601 | if (expected_changes != NM_CONFIG_CHANGE_NONE) |
602 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: update *"); | |
602 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: signal *"); | |
603 | 603 | |
604 | 604 | nm_config_set_values (config, keyfile_intern, TRUE, FALSE); |
605 | 605 | |
648 | 648 | _set_values_intern_internal_set (NMConfig *config, gboolean set_user, GKeyFile *keyfile, NMConfigChangeFlags *out_expected_changes) |
649 | 649 | { |
650 | 650 | g_key_file_set_string (keyfile, NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN"section1", "key", "internal-section"); |
651 | *out_expected_changes = NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN; | |
651 | *out_expected_changes = NM_CONFIG_CHANGE_CAUSE_SET_VALUES | NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN; | |
652 | 652 | } |
653 | 653 | |
654 | 654 | static void |
655 | 655 | _set_values_intern_internal_check (NMConfig *config, NMConfigData *config_data, gboolean is_change_event, NMConfigChangeFlags changes, NMConfigData *old_data) |
656 | 656 | { |
657 | 657 | if (is_change_event) |
658 | g_assert (changes == (NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN)); | |
658 | g_assert (changes == (NM_CONFIG_CHANGE_CAUSE_SET_VALUES | NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN)); | |
659 | 659 | assert_config_value (config_data, NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN"section1", "key", "internal-section"); |
660 | 660 | } |
661 | 661 | |
689 | 689 | g_key_file_set_string (keyfile, "atomic-prefix-1.section-a", "key3", "intern-value3"); |
690 | 690 | g_key_file_set_string (keyfile, "non-atomic-prefix-1.section-a", "nap1-key1", "intern-value1"); |
691 | 691 | g_key_file_set_string (keyfile, "non-atomic-prefix-1.section-a", "nap1-key3", "intern-value3"); |
692 | *out_expected_changes = NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN; | |
692 | *out_expected_changes = NM_CONFIG_CHANGE_CAUSE_SET_VALUES | NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN; | |
693 | 693 | } |
694 | 694 | |
695 | 695 | static void |
696 | 696 | _set_values_intern_atomic_section_1_check (NMConfig *config, NMConfigData *config_data, gboolean is_change_event, NMConfigChangeFlags changes, NMConfigData *old_data) |
697 | 697 | { |
698 | 698 | if (is_change_event) |
699 | g_assert (changes == (NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN)); | |
699 | g_assert (changes == (NM_CONFIG_CHANGE_CAUSE_SET_VALUES | NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN)); | |
700 | 700 | assert_config_value (config_data, "atomic-prefix-1.section-a", "key1", "intern-value1"); |
701 | 701 | assert_config_value (config_data, "atomic-prefix-1.section-a", "key2", NULL); |
702 | 702 | assert_config_value (config_data, "atomic-prefix-1.section-a", "key3", "intern-value3"); |
743 | 743 | g_key_file_set_string (keyfile, "non-atomic-prefix-1.section-a", "nap1-key3", "intern-value3"); |
744 | 744 | g_key_file_set_string (keyfile, NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN"with-whitespace", "key1", " b c\\, d "); |
745 | 745 | g_key_file_set_value (keyfile, NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN"with-whitespace", "key2", " b c\\, d "); |
746 | *out_expected_changes = NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN; | |
746 | *out_expected_changes = NM_CONFIG_CHANGE_CAUSE_SET_VALUES | NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN; | |
747 | 747 | } |
748 | 748 | |
749 | 749 | static void |
750 | 750 | _set_values_intern_atomic_section_2_check (NMConfig *config, NMConfigData *config_data, gboolean is_change_event, NMConfigChangeFlags changes, NMConfigData *old_data) |
751 | 751 | { |
752 | 752 | if (is_change_event) |
753 | g_assert (changes == (NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN)); | |
753 | g_assert (changes == (NM_CONFIG_CHANGE_CAUSE_SET_VALUES | NM_CONFIG_CHANGE_VALUES | NM_CONFIG_CHANGE_VALUES_INTERN)); | |
754 | 754 | g_assert (!nm_config_data_has_group (config_data, "atomic-prefix-1.section-a")); |
755 | 755 | assert_config_value (config_data, "atomic-prefix-1.section-b", "key1", "user-value1"); |
756 | 756 | assert_config_value (config_data, "non-atomic-prefix-1.section-a", "nap1-key1", NULL); |
861 | 861 | G_CALLBACK (_test_signal_config_changed_cb), |
862 | 862 | &expected); |
863 | 863 | |
864 | expected = NM_CONFIG_CHANGE_SIGUSR1; | |
864 | expected = NM_CONFIG_CHANGE_CAUSE_SIGUSR1; | |
865 | 865 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: signal SIGUSR1"); |
866 | nm_config_reload (config, SIGUSR1); | |
867 | ||
868 | expected = NM_CONFIG_CHANGE_SIGUSR2; | |
866 | nm_config_reload (config, expected); | |
867 | ||
868 | expected = NM_CONFIG_CHANGE_CAUSE_SIGUSR2; | |
869 | 869 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: signal SIGUSR2"); |
870 | nm_config_reload (config, SIGUSR2); | |
871 | ||
872 | expected = NM_CONFIG_CHANGE_SIGHUP; | |
870 | nm_config_reload (config, expected); | |
871 | ||
872 | expected = NM_CONFIG_CHANGE_CAUSE_SIGHUP; | |
873 | 873 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: signal SIGHUP (no changes from disk)*"); |
874 | nm_config_reload (config, SIGHUP); | |
874 | nm_config_reload (config, expected); | |
875 | 875 | |
876 | 876 | |
877 | 877 | /* test with subscribing two signals... |
882 | 882 | NM_CONFIG_SIGNAL_CONFIG_CHANGED, |
883 | 883 | G_CALLBACK (_test_signal_config_changed_cb2), |
884 | 884 | &expected); |
885 | expected = NM_CONFIG_CHANGE_SIGUSR2; | |
885 | expected = NM_CONFIG_CHANGE_CAUSE_SIGUSR2; | |
886 | 886 | g_test_expect_message ("NetworkManager", G_LOG_LEVEL_INFO, "*config: signal SIGUSR2"); |
887 | nm_config_reload (config, SIGUSR2); | |
887 | nm_config_reload (config, NM_CONFIG_CHANGE_CAUSE_SIGUSR2); | |
888 | 888 | g_signal_handlers_disconnect_by_func (config, _test_signal_config_changed_cb2, &expected); |
889 | 889 | |
890 | 890 |
1360 | 1360 | v_result[0] = TEST_MAX (v_const[0], nmtst_get_rand_int () % 5) + v2; |
1361 | 1361 | } |
1362 | 1362 | |
1363 | static void | |
1364 | test_reverse_dns_ip4 (void) | |
1365 | { | |
1366 | guint32 addr; | |
1367 | GPtrArray *domains = g_ptr_array_new_full (8, g_free); | |
1368 | ||
1369 | inet_pton (AF_INET, "7.2.3.0", &addr); | |
1370 | nm_utils_get_reverse_dns_domains_ip4 (addr, 27, domains); | |
1371 | g_assert_cmpuint (domains->len, ==, 32); | |
1372 | g_assert_cmpstr (domains->pdata[0], ==, "0.3.2.7.in-addr.arpa"); | |
1373 | g_assert_cmpstr (domains->pdata[31], ==, "31.3.2.7.in-addr.arpa"); | |
1374 | ||
1375 | g_ptr_array_set_size (domains, 0); | |
1376 | ||
1377 | inet_pton (AF_INET, "10.155.16.0", &addr); | |
1378 | nm_utils_get_reverse_dns_domains_ip4 (addr, 22, domains); | |
1379 | g_assert_cmpuint (domains->len, ==, 4); | |
1380 | g_assert_cmpstr (domains->pdata[0], ==, "16.155.10.in-addr.arpa"); | |
1381 | g_assert_cmpstr (domains->pdata[1], ==, "17.155.10.in-addr.arpa"); | |
1382 | g_assert_cmpstr (domains->pdata[2], ==, "18.155.10.in-addr.arpa"); | |
1383 | g_assert_cmpstr (domains->pdata[3], ==, "19.155.10.in-addr.arpa"); | |
1384 | ||
1385 | g_ptr_array_set_size (domains, 0); | |
1386 | ||
1387 | inet_pton (AF_INET, "4.5.6.7", &addr); | |
1388 | nm_utils_get_reverse_dns_domains_ip4 (addr, 32, domains); | |
1389 | g_assert_cmpuint (domains->len, ==, 1); | |
1390 | g_assert_cmpstr (domains->pdata[0], ==, "7.6.5.4.in-addr.arpa"); | |
1391 | ||
1392 | g_ptr_array_set_size (domains, 0); | |
1393 | ||
1394 | inet_pton (AF_INET, "4.5.6.7", &addr); | |
1395 | nm_utils_get_reverse_dns_domains_ip4 (addr, 8, domains); | |
1396 | g_assert_cmpuint (domains->len, ==, 1); | |
1397 | g_assert_cmpstr (domains->pdata[0], ==, "4.in-addr.arpa"); | |
1398 | ||
1399 | g_ptr_array_set_size (domains, 0); | |
1400 | ||
1401 | inet_pton (AF_INET, "4.180.6.7", &addr); | |
1402 | nm_utils_get_reverse_dns_domains_ip4 (addr, 9, domains); | |
1403 | g_assert_cmpuint (domains->len, ==, 128); | |
1404 | g_assert_cmpstr (domains->pdata[0], ==, "128.4.in-addr.arpa"); | |
1405 | g_assert_cmpstr (domains->pdata[1], ==, "129.4.in-addr.arpa"); | |
1406 | g_assert_cmpstr (domains->pdata[127], ==, "255.4.in-addr.arpa"); | |
1407 | ||
1408 | g_ptr_array_set_size (domains, 0); | |
1409 | ||
1410 | inet_pton (AF_INET, "172.16.0.0", &addr); | |
1411 | nm_utils_get_reverse_dns_domains_ip4 (addr, 12, domains); | |
1412 | g_assert_cmpuint (domains->len, ==, 16); | |
1413 | g_assert_cmpstr (domains->pdata[0], ==, "16.172.in-addr.arpa"); | |
1414 | g_assert_cmpstr (domains->pdata[1], ==, "17.172.in-addr.arpa"); | |
1415 | g_assert_cmpstr (domains->pdata[14], ==, "30.172.in-addr.arpa"); | |
1416 | g_assert_cmpstr (domains->pdata[15], ==, "31.172.in-addr.arpa"); | |
1417 | ||
1418 | g_ptr_array_set_size (domains, 0); | |
1419 | ||
1420 | inet_pton (AF_INET, "1.2.3.4", &addr); | |
1421 | nm_utils_get_reverse_dns_domains_ip4 (addr, 0, domains); | |
1422 | g_assert_cmpuint (domains->len, ==, 0); | |
1423 | ||
1424 | g_ptr_array_unref (domains); | |
1425 | } | |
1426 | ||
1427 | static void | |
1428 | test_reverse_dns_ip6 (void) | |
1429 | { | |
1430 | struct in6_addr addr; | |
1431 | GPtrArray *domains = g_ptr_array_new_full (8, g_free); | |
1432 | ||
1433 | inet_pton (AF_INET6, "1234::56", &addr); | |
1434 | nm_utils_get_reverse_dns_domains_ip6 (&addr, 16, domains); | |
1435 | g_assert_cmpuint (domains->len, ==, 1); | |
1436 | g_assert_cmpstr (domains->pdata[0], ==, "4.3.2.1.ip6.arpa"); | |
1437 | ||
1438 | g_ptr_array_set_size (domains, 0); | |
1439 | ||
1440 | inet_pton (AF_INET6, "1234::56", &addr); | |
1441 | nm_utils_get_reverse_dns_domains_ip6 (&addr, 17, domains); | |
1442 | g_assert_cmpuint (domains->len, ==, 8); | |
1443 | g_assert_cmpstr (domains->pdata[0], ==, "0.4.3.2.1.ip6.arpa"); | |
1444 | g_assert_cmpstr (domains->pdata[1], ==, "1.4.3.2.1.ip6.arpa"); | |
1445 | g_assert_cmpstr (domains->pdata[7], ==, "7.4.3.2.1.ip6.arpa"); | |
1446 | ||
1447 | g_ptr_array_set_size (domains, 0); | |
1448 | ||
1449 | inet_pton (AF_INET6, "2001:db8::", &addr); | |
1450 | nm_utils_get_reverse_dns_domains_ip6 (&addr, 29, domains); | |
1451 | g_assert_cmpuint (domains->len, ==, 8); | |
1452 | g_assert_cmpstr (domains->pdata[0], ==, "8.b.d.0.1.0.0.2.ip6.arpa"); | |
1453 | g_assert_cmpstr (domains->pdata[1], ==, "9.b.d.0.1.0.0.2.ip6.arpa"); | |
1454 | g_assert_cmpstr (domains->pdata[7], ==, "f.b.d.0.1.0.0.2.ip6.arpa"); | |
1455 | ||
1456 | g_ptr_array_set_size (domains, 0); | |
1457 | ||
1458 | inet_pton (AF_INET6, "0123:4567:89ab:cdef::", &addr); | |
1459 | nm_utils_get_reverse_dns_domains_ip6 (&addr, 63, domains); | |
1460 | g_assert_cmpuint (domains->len, ==, 2); | |
1461 | g_assert_cmpstr (domains->pdata[0], ==, "e.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0.ip6.arpa"); | |
1462 | g_assert_cmpstr (domains->pdata[1], ==, "f.e.d.c.b.a.9.8.7.6.5.4.3.2.1.0.ip6.arpa"); | |
1463 | ||
1464 | g_ptr_array_set_size (domains, 0); | |
1465 | ||
1466 | inet_pton (AF_INET6, "fec0:1234:5678:9ab0::", &addr); | |
1467 | nm_utils_get_reverse_dns_domains_ip6 (&addr, 61, domains); | |
1468 | g_assert_cmpuint (domains->len, ==, 8); | |
1469 | g_assert_cmpstr (domains->pdata[0], ==, "0.b.a.9.8.7.6.5.4.3.2.1.0.c.e.f.ip6.arpa"); | |
1470 | g_assert_cmpstr (domains->pdata[7], ==, "7.b.a.9.8.7.6.5.4.3.2.1.0.c.e.f.ip6.arpa"); | |
1471 | ||
1472 | g_ptr_array_set_size (domains, 0); | |
1473 | ||
1474 | inet_pton (AF_INET6, "0123:4567:89ab:cdee::", &addr); | |
1475 | nm_utils_get_reverse_dns_domains_ip6 (&addr, 0, domains); | |
1476 | g_assert_cmpuint (domains->len, ==, 0); | |
1477 | ||
1478 | g_ptr_array_unref (domains); | |
1479 | } | |
1480 | ||
1363 | 1481 | /*****************************************************************************/ |
1364 | 1482 | |
1365 | 1483 | NMTST_DEFINE (); |
1396 | 1514 | g_test_add_func ("/general/nm_match_spec_match_config", test_nm_match_spec_match_config); |
1397 | 1515 | g_test_add_func ("/general/duplicate_decl_specifier", test_duplicate_decl_specifier); |
1398 | 1516 | |
1517 | g_test_add_func ("/general/reverse_dns/ip4", test_reverse_dns_ip4); | |
1518 | g_test_add_func ("/general/reverse_dns/ip6", test_reverse_dns_ip6); | |
1519 | ||
1399 | 1520 | return g_test_run (); |
1400 | 1521 | } |
1401 | 1522 |
43 | 43 | #include "nm-config.h" |
44 | 44 | #include "nm-vpn-plugin-info.h" |
45 | 45 | #include "nm-vpn-manager.h" |
46 | #include "nm-dns-manager.h" | |
46 | 47 | |
47 | 48 | #include "nmdbus-vpn-connection.h" |
48 | 49 | |
191 | 192 | "%s%s" /*con-uuid*/ |
192 | 193 | "%s%s%s%s" /*con-id*/ |
193 | 194 | ",%d" /*ifindex*/ |
194 | "%s%s%s%s" /*iface*/ | |
195 | "%s%s%s" /*iface*/ | |
195 | 196 | "]", |
196 | 197 | _NMLOG_PREFIX_NAME, |
197 | 198 | self, |
198 | 199 | con ? "," : "--", con ? (nm_connection_get_uuid (con) ?: "??") : "", |
199 | 200 | con ? "," : "", NM_PRINT_FMT_QUOTED (id, "\"", id, "\"", con ? "??" : ""), |
200 | 201 | priv->ip_ifindex, |
201 | priv->ip_iface ? ":" : "", NM_PRINT_FMT_QUOTED (priv->ip_iface, "(", priv->ip_iface, ")", "") | |
202 | NM_PRINT_FMT_QUOTED (priv->ip_iface, ":(", priv->ip_iface, ")", "") | |
202 | 203 | ); |
203 | 204 | |
204 | 205 | return buf; |
908 | 909 | nm_utils_inet6_ntop (priv->ip6_external_gw, NULL)); |
909 | 910 | } |
910 | 911 | |
911 | _LOGI ("Data: Tunnel Device: %s", priv->ip_iface ? priv->ip_iface : "(none)"); | |
912 | _LOGI ("Data: Tunnel Device: %s%s%s", NM_PRINT_FMT_QUOTE_STRING (priv->ip_iface)); | |
912 | 913 | |
913 | 914 | if (priv->ip4_config) { |
914 | 915 | _LOGI ("Data: IPv4 configuration:"); |
1021 | 1022 | ifindex = nm_device_get_ip_ifindex (parent_dev); |
1022 | 1023 | if (priv->ip4_config) { |
1023 | 1024 | vpn4_parent_config = nm_ip4_config_new (ifindex); |
1024 | nm_ip4_config_merge (vpn4_parent_config, priv->ip4_config, NM_IP_CONFIG_MERGE_DEFAULT); | |
1025 | nm_ip4_config_unset_gateway (vpn4_parent_config); | |
1025 | nm_ip4_config_merge (vpn4_parent_config, priv->ip4_config, NM_IP_CONFIG_MERGE_NO_DNS); | |
1026 | 1026 | } |
1027 | 1027 | if (priv->ip6_config) { |
1028 | 1028 | vpn6_parent_config = nm_ip6_config_new (ifindex); |
1029 | nm_ip6_config_merge (vpn6_parent_config, priv->ip6_config, NM_IP_CONFIG_MERGE_DEFAULT); | |
1029 | nm_ip6_config_merge (vpn6_parent_config, priv->ip6_config, NM_IP_CONFIG_MERGE_NO_DNS); | |
1030 | 1030 | nm_ip6_config_set_gateway (vpn6_parent_config, NULL); |
1031 | 1031 | } |
1032 | 1032 | } |
1078 | 1078 | nm_default_route_manager_ip6_update_default_route (priv->default_route_manager, self); |
1079 | 1079 | |
1080 | 1080 | _LOGI ("VPN connection: (IP Config Get) complete"); |
1081 | _set_vpn_state (self, STATE_PRE_UP, NM_VPN_CONNECTION_STATE_REASON_NONE, FALSE); | |
1081 | if (priv->vpn_state < STATE_PRE_UP) | |
1082 | _set_vpn_state (self, STATE_PRE_UP, NM_VPN_CONNECTION_STATE_REASON_NONE, FALSE); | |
1082 | 1083 | return TRUE; |
1083 | 1084 | } |
1084 | 1085 | |
1217 | 1218 | } |
1218 | 1219 | |
1219 | 1220 | g_clear_pointer (&priv->ip_iface, g_free); |
1221 | priv->ip_ifindex = 0; | |
1222 | ||
1220 | 1223 | if (g_variant_lookup (dict, NM_VPN_PLUGIN_CONFIG_TUNDEV, "&s", &str)) { |
1221 | 1224 | /* Backwards compat with NM-openswan */ |
1222 | 1225 | if (g_strcmp0 (str, "_none_") != 0) |
1227 | 1230 | /* Grab the interface index for address/routing operations */ |
1228 | 1231 | priv->ip_ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface); |
1229 | 1232 | if (priv->ip_ifindex <= 0) { |
1233 | nm_platform_process_events (NM_PLATFORM_GET); | |
1234 | priv->ip_ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface); | |
1235 | } | |
1236 | if (priv->ip_ifindex <= 0) { | |
1230 | 1237 | _LOGE ("failed to look up VPN interface index for \"%s\"", priv->ip_iface); |
1238 | g_clear_pointer (&priv->ip_iface, g_free); | |
1239 | priv->ip_ifindex = 0; | |
1231 | 1240 | nm_vpn_connection_config_maybe_complete (self, FALSE); |
1232 | 1241 | return FALSE; |
1233 | 1242 | } |
1328 | 1337 | const char *str; |
1329 | 1338 | GVariant *v; |
1330 | 1339 | gboolean b; |
1331 | int ifindex; | |
1332 | 1340 | |
1333 | 1341 | g_return_if_fail (dict && g_variant_is_of_type (dict, G_VARIANT_TYPE_VARDICT)); |
1334 | 1342 | |
1356 | 1364 | priv->has_ip6 = FALSE; |
1357 | 1365 | } |
1358 | 1366 | |
1359 | if (priv->ip_ifindex > 0) { | |
1360 | ifindex = priv->ip_ifindex; | |
1361 | } else { | |
1362 | NMDevice *parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (self)); | |
1363 | ifindex = nm_device_get_ip_ifindex (parent_dev); | |
1364 | } | |
1365 | config = nm_ip4_config_new (ifindex); | |
1367 | config = nm_ip4_config_new (nm_vpn_connection_get_ip_ifindex (self, TRUE)); | |
1368 | nm_ip4_config_set_dns_priority (config, NM_DNS_PRIORITY_DEFAULT_VPN); | |
1366 | 1369 | |
1367 | 1370 | memset (&address, 0, sizeof (address)); |
1368 | 1371 | address.plen = 24; |
1463 | 1466 | nm_connection_get_setting_ip4_config (_get_applied_connection (self)), |
1464 | 1467 | route_metric); |
1465 | 1468 | |
1466 | nm_exported_object_clear_and_unexport (&priv->ip4_config); | |
1467 | priv->ip4_config = config; | |
1468 | nm_exported_object_export (NM_EXPORTED_OBJECT (config)); | |
1469 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG); | |
1469 | if (priv->ip4_config) { | |
1470 | nm_ip4_config_replace (priv->ip4_config, config, NULL); | |
1471 | g_object_unref (config); | |
1472 | } else { | |
1473 | priv->ip4_config = config; | |
1474 | nm_exported_object_export (NM_EXPORTED_OBJECT (config)); | |
1475 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG); | |
1476 | } | |
1477 | ||
1470 | 1478 | nm_vpn_connection_config_maybe_complete (self, TRUE); |
1471 | 1479 | } |
1472 | 1480 | |
1496 | 1504 | } |
1497 | 1505 | |
1498 | 1506 | config = nm_ip6_config_new (priv->ip_ifindex); |
1507 | nm_ip6_config_set_dns_priority (config, NM_DNS_PRIORITY_DEFAULT_VPN); | |
1499 | 1508 | |
1500 | 1509 | memset (&address, 0, sizeof (address)); |
1501 | 1510 | address.plen = 128; |
1599 | 1608 | nm_connection_get_setting_ip6_config (_get_applied_connection (self)), |
1600 | 1609 | route_metric); |
1601 | 1610 | |
1602 | nm_exported_object_clear_and_unexport (&priv->ip6_config); | |
1603 | priv->ip6_config = config; | |
1604 | nm_exported_object_export (NM_EXPORTED_OBJECT (config)); | |
1605 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG); | |
1611 | if (priv->ip6_config) { | |
1612 | nm_ip6_config_replace (priv->ip6_config, config, NULL); | |
1613 | g_object_unref (config); | |
1614 | } else { | |
1615 | priv->ip6_config = config; | |
1616 | nm_exported_object_export (NM_EXPORTED_OBJECT (config)); | |
1617 | g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG); | |
1618 | } | |
1619 | ||
1606 | 1620 | nm_vpn_connection_config_maybe_complete (self, TRUE); |
1607 | 1621 | } |
1608 | 1622 | |
1915 | 1929 | _LOGW ("Timed out waiting for the service to start"); |
1916 | 1930 | priv->start_timeout = 0; |
1917 | 1931 | nm_vpn_connection_disconnect (self, NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT, FALSE); |
1918 | ||
1919 | g_object_unref (self); | |
1920 | ||
1921 | 1932 | return G_SOURCE_REMOVE; |
1922 | 1933 | } |
1923 | 1934 | |
2084 | 2095 | return NM_VPN_CONNECTION_GET_PRIVATE (self)->ip6_config; |
2085 | 2096 | } |
2086 | 2097 | |
2098 | static int | |
2099 | _get_ip_iface_for_device (NMVpnConnection *self, const char **out_iface) | |
2100 | { | |
2101 | NMDevice *parent_dev; | |
2102 | int ifindex; | |
2103 | const char *iface; | |
2104 | ||
2105 | nm_assert (NM_IS_VPN_CONNECTION (self)); | |
2106 | ||
2107 | /* the ifindex and the ifname in this case should come together. | |
2108 | * They either must be both set, or none. */ | |
2109 | ||
2110 | parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (self)); | |
2111 | if (!parent_dev) | |
2112 | goto none; | |
2113 | ifindex = nm_device_get_ip_ifindex (parent_dev); | |
2114 | if (ifindex <= 0) | |
2115 | goto none; | |
2116 | iface = nm_device_get_ip_iface (parent_dev); | |
2117 | if (!iface) | |
2118 | goto none; | |
2119 | ||
2120 | NM_SET_OUT (out_iface, iface); | |
2121 | return ifindex; | |
2122 | none: | |
2123 | NM_SET_OUT (out_iface, NULL); | |
2124 | return 0; | |
2125 | } | |
2126 | ||
2087 | 2127 | const char * |
2088 | nm_vpn_connection_get_ip_iface (NMVpnConnection *self) | |
2089 | { | |
2128 | nm_vpn_connection_get_ip_iface (NMVpnConnection *self, gboolean fallback_device) | |
2129 | { | |
2130 | NMVpnConnectionPrivate *priv; | |
2131 | const char *iface; | |
2132 | ||
2090 | 2133 | g_return_val_if_fail (NM_IS_VPN_CONNECTION (self), NULL); |
2091 | 2134 | |
2092 | return NM_VPN_CONNECTION_GET_PRIVATE (self)->ip_iface; | |
2135 | priv = NM_VPN_CONNECTION_GET_PRIVATE (self); | |
2136 | ||
2137 | if (priv->ip_iface || !fallback_device) | |
2138 | return priv->ip_iface; | |
2139 | ||
2140 | _get_ip_iface_for_device (self, &iface); | |
2141 | return iface; | |
2093 | 2142 | } |
2094 | 2143 | |
2095 | 2144 | int |
2096 | nm_vpn_connection_get_ip_ifindex (NMVpnConnection *self) | |
2097 | { | |
2098 | g_return_val_if_fail (NM_IS_VPN_CONNECTION (self), -1); | |
2099 | ||
2100 | return NM_VPN_CONNECTION_GET_PRIVATE (self)->ip_ifindex; | |
2145 | nm_vpn_connection_get_ip_ifindex (NMVpnConnection *self, gboolean fallback_device) | |
2146 | { | |
2147 | NMVpnConnectionPrivate *priv; | |
2148 | ||
2149 | g_return_val_if_fail (NM_IS_VPN_CONNECTION (self), 0); | |
2150 | ||
2151 | priv = NM_VPN_CONNECTION_GET_PRIVATE (self); | |
2152 | ||
2153 | if (priv->ip_ifindex > 0) | |
2154 | return priv->ip_ifindex; | |
2155 | if (!fallback_device) | |
2156 | return 0; | |
2157 | ||
2158 | return _get_ip_iface_for_device (self, NULL); | |
2101 | 2159 | } |
2102 | 2160 | |
2103 | 2161 | guint32 |
90 | 90 | |
91 | 91 | NMIP4Config * nm_vpn_connection_get_ip4_config (NMVpnConnection *self); |
92 | 92 | NMIP6Config * nm_vpn_connection_get_ip6_config (NMVpnConnection *self); |
93 | const char * nm_vpn_connection_get_ip_iface (NMVpnConnection *self); | |
94 | int nm_vpn_connection_get_ip_ifindex (NMVpnConnection *self); | |
93 | const char * nm_vpn_connection_get_ip_iface (NMVpnConnection *self, gboolean fallback_device); | |
94 | int nm_vpn_connection_get_ip_ifindex (NMVpnConnection *self, gboolean fallback_device); | |
95 | 95 | guint32 nm_vpn_connection_get_ip4_internal_gateway (NMVpnConnection *self); |
96 | 96 | struct in6_addr * nm_vpn_connection_get_ip6_internal_gateway (NMVpnConnection *self); |
97 | 97 |
263 | 263 | NM = @NM@ |
264 | 264 | NMEDIT = @NMEDIT@ |
265 | 265 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
266 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
266 | 267 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
267 | 268 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
268 | 269 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |
782 | 782 | "org.freedesktop.NetworkManager.wifi.share.open": "yes", |
783 | 783 | "org.freedesktop.NetworkManager.settings.modify.own": "yes", |
784 | 784 | "org.freedesktop.NetworkManager.settings.modify.system": "yes", |
785 | "org.freedesktop.NetworkManager.settings.modify.hostname": "yes" } | |
785 | "org.freedesktop.NetworkManager.settings.modify.hostname": "yes", | |
786 | "org.freedesktop.NetworkManager.settings.modify.global-dns": "no", | |
787 | "org.freedesktop.NetworkManager.reload": "no", | |
788 | } | |
786 | 789 | |
787 | 790 | @dbus.service.method(dbus_interface=IFACE_NM, in_signature='ss', out_signature='') |
788 | 791 | def SetLogging(self, level, domains): |
331 | 331 | NM = @NM@ |
332 | 332 | NMEDIT = @NMEDIT@ |
333 | 333 | NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ |
334 | NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ | |
334 | 335 | NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ |
335 | 336 | NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ |
336 | 337 | NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ |