summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* dhcp: force IPv4-only for dhcpcdDan Williams2013-11-272-0/+11
| | | | | | | | | | | | | | | | | | dhcpcd v5.99 and later automatically enabled IPv6 behavior unless specifically disabled. This is undesirable for two reason: 1) dhcpcd sends IPv4 Router Solicitations, which NetworkManager handles itself, so there's no need to do it twice. NetworkManager knows better than dhcpcd whether IPv6 is supposed to be used for that interface or not. 2) Some devices don't react well to IPv6 when they aren't expecting it. For example, older Qualcomm Gobi-based devices will listen for Router Solicitations and attempt to set up IPv6, but if other settings are not done correctly, or the firmware doesn't actually support it, the firmware will then crash. So simply upgrading your dhcpcd from 5.x to 6.x magically stops WWAN working for these devices.
* libnm-util: refactor NMSetting construction, assert of setting nameThomas Haller2013-11-271-27/+3
| | | | | | | Make the name property CONSTRUCT_ONLY. With this there is also no more need to overwrite the constructor(). Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-util: fix minor memory leak in infiniband settingThomas Haller2013-11-271-0/+1
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-util: trivial: rename private field and enum value in NMSettingVlanThomas Haller2013-11-271-13/+13
| | | | | | | | The public property is called NM_SETTING_VLAN_INTERFACE_NAME, so also the internal field and the PROP_* enum should carry the same name. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-util: fix minor memory leaks in bond and team settingThomas Haller2013-11-272-0/+3
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: add support for DCB settingsDan Williams2013-11-273-1/+561
|
* devices: if IP4 and IP6 config both fail right away, fail the deviceDan Winship2013-11-271-0/+5
| | | | | | | | Previously, the device activation would stall in this case, because the code wasn't expecting it to happen. In particular, this happens when trying to assume a device that is up but has no IP config. https://bugzilla.gnome.org/show_bug.cgi?id=715181
* agents: fix crash in nm_secret_agent_cancel_secrets() (rh #922855)Jiří Klimeš2013-11-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When request for getting secrets is being freed in request_free(), cancel_callback is get_cancel_cb(). It uses parent->current as a secret agent object. However, this object can be already freed and thus there is a problem getting priv in nm_secret_agent_cancel_secrets: g_return_if_fail (self != NULL); priv = NM_SECRET_AGENT_GET_PRIVATE (self); (gdb) p self $66 = (NMSecretAgent *) 0x7fae9afd42e0 (gdb) p *self $67 = {parent = {g_type_instance = {g_class = 0x0}, ref_count = 0, qdata = 0x0}} #0 nm_secret_agent_cancel_secrets (self=0x7fae9afd42e0, call=0x1) at settings/nm-secret-agent.c:325 #1 0x00007fae9a774882 in request_free (req=0x7fae9afc48f0) at settings/nm-agent-manager.c:496 #2 0x00007fae967b251a in g_hash_table_remove_internal (hash_table=0x7fae9aefdf00, key=0x2, notify=1) at ghash.c:1276 #3 0x00007fae9a72b340 in dispose (object=0x7fae9af77200) at nm-activation-request.c:446 #4 0x00007fae96cbeee8 in g_object_unref (_object=0x7fae9af77200) at gobject.c:3160 #5 0x00007fae9a73d87c in _active_connection_cleanup (user_data=<optimized out>) at nm-manager.c:359 #6 0x00007fae967c32a6 in g_main_dispatch (context=0x7fae9aedb180) at gmain.c:3066 #7 g_main_context_dispatch (context=context@entry=0x7fae9aedb180) at gmain.c:3642 #8 0x00007fae967c3628 in g_main_context_iterate (context=0x7fae9aedb180, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713 #9 0x00007fae967c3a3a in g_main_loop_run (loop=0x7fae9aedb860) at gmain.c:3907 So we need to ref() 'agent' when adding it to pending list, so that the object is not freed if the secret agent unregisters and is removed. Test case: 1. run NM and nm-applet 2. activate a Wi-Fi network 3. nm-applet will ask for a password; ignore the popup window and kill nm-applet 4. start nm-applet again 5. click the same Wi-Fi network in nm-applet 6. NM will experience problems in nm_secret_agent_cancel_secrets() or crashes (the procedure may not be 100%, but reproduces most of the time) https://bugzilla.redhat.com/show_bug.cgi?id=922855
* agents: fix removing requests from hash table while iterating itJiří Klimeš2013-11-261-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLib-CRITICAL **: g_hash_table_iter_next: assertion 'ri->version == ri->hash_table->version' failed It is not allowed to modify hash table while it is iterated. Unfortunately, request_remove_agent() may remove the request from the 'requests' hash table, making it not usable in the loop hash table looping. We need to store the request into a temporary list and call request_next_agent() on them later (after the hash loop). Test case: 1. start NM and nm-applet 2. activate a Wi-Fi WPA connection 3. nm-applet displays a dialog asking for a password 4. kill nm-applet 5. NetworkManager removes the nm-applet's secret agent and runs into removing the request from hash table in the iterating loop (via get_complete_cb) #0 get_complete_cb (parent=0x7f3f250f2970, secrets=0x0, agent_dbus_owner=0x0, agent_username=0x0, error=0x7f3f250f7830, user_data=0x7f3f25020e10) at settings/nm-agent-manager.c:1111 #1 0x00007f3f23b46ea5 in req_complete_error (error=0x7f3f250f7830, req=0x7f3f250f2970) at settings/nm-agent-manager.c:509 #2 request_next_agent (req=0x7f3f250f2970) at settings/nm-agent-manager.c:615 #3 0x00007f3f23b48596 in request_remove_agent (agent=0x7f3f250f4a20, req=0x7f3f250f2970) at settings/nm-agent-manager.c:631 #4 remove_agent (self=<optimized out>, owner=0x7f3f250dbff0 ":1.275") at settings/nm-agent-manager.c:130 #5 0x00007f3f23b4868d in impl_agent_manager_unregister (self=0x7f3f25020e10, context=0x7f3f250f5480) at settings/nm-agent-manager.c:374 #0 0x00007f3f1fb9c4e9 in g_logv (log_domain=0x7f3f1fbfef4e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fff156b77c0) at gmessages.c:989 #1 0x00007f3f1fb9c63f in g_log (log_domain=log_domain@entry=0x7f3f1fbfef4e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7f3f1fc0889a "%s: assertion '%s' failed") at gmessages.c:1025 #2 0x00007f3f1fb9c679 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7f3f1fbfef4e "GLib", pretty_function=pretty_function@entry=0x7f3f1fc03c30 <__PRETTY_FUNCTION__.4571> "g_hash_table_iter_next", expression=expression@entry=0x7f3f1fc038f0 "ri->version == ri->hash_table->version") at gmessages.c:1034 #3 0x00007f3f1fb849c0 in g_hash_table_iter_next (iter=<optimized out>, key=<optimized out>, value=<optimized out>) at ghash.c:733 #4 0x00007f3f23b484e5 in remove_agent (self=<optimized out>, owner=0x7f3f250dbff0 ":1.275") at settings/nm-agent-manager.c:129 #5 0x00007f3f23b4868d in impl_agent_manager_unregister (self=0x7f3f25020e10, context=0x7f3f250f5480) at settings/nm-agent-manager.c:374
* Revert "core: add Devices property to Manager"Dan Williams2013-11-253-31/+4
| | | | | | | This reverts commit c1768154c4cfdc394cd175396157e5e4c48359af. Not supposed to be committed yet, see dcbw/dbus-properties for the real patch.
* trivial: fix leak in hostname reverse-lookup codeDan Williams2013-11-251-2/+4
| | | | g_inet_address_to_string() returns an allocated value.
* core: add Devices property to ManagerDan Williams2013-11-253-4/+31
| | | | Helps other bindings.
* core: capture DNS configuration from resolv.conf when generating connections ↵Dan Williams2013-11-2211-42/+459
|\ | | | | | | | | | | | | | | | | (rh #1031763) Ensures that resolv.conf is valid when assuming an already-configured device that may have DNS information already written to resolv.conf. https://bugzilla.redhat.com/show_bug.cgi?id=1031763
| * core: don't leave additional default routes in captured IP configDan Williams2013-11-222-10/+15
| | | | | | | | | | | | | | There can be multiple default routes for an interface with different metrics. Grab the gateway of the default route with the lowest metric as the overall gateway of the IP config. Otherwise the rest could get left in the config and applied at random times.
| * core: capture DNS configuration from resolv.conf when generating connectionsDan Williams2013-11-2210-10/+425
| | | | | | | | | | | | | | | | | | | | | | | | | | If the interface who's IP configuration is being captured has the default route, then read DNS servers from resolv.conf into the NMIP[4|6]Config. This allows NetworkManager to repopulate resolv.conf if anything changes. For example, if the system does not define a persistent hostname, then when a device which has generated a connection activates, a hostname lookup will be performed. The results of that lookup may change resolv.conf, and thus NetworkManager must rewrite resolv.conf. Without capturing DNS information at startup when generating connections, an empty resolv.conf would be written.
| * policy: ignore nameservers when starting lookup thread (rh #1031763)Dan Williams2013-11-221-22/+19
|/ | | | | | | | | | | | | | | | | | | When generating connections at startup for active interfaces, the generation code may not always be able to read DNS information for the connection. Thus, the device's IP4Config won't have any nameservers and the device won't be considered for reverse-address lookup. However, since any device that gets this far is already the "best" device and has the default route, and thus should be the one used for reverse-address lookup. Second, reorganize the code better handle dual-stack in the future by checking the IP configs directly, instead of the devices. Since 'best4' and 'best6' may be different devices, we want to operate on the IP configs, not devices, to handle situations where the best IP4Config may not be suitable for reverse lookup, but the best IP6Config is. https://bugzilla.redhat.com/show_bug.cgi?id=1031763
* core: fix crash in nm-manager-authThomas Haller2013-11-221-44/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When doing nm_auth_chain_unref(), the code iterated over the ->calls and cancelled them. However, some of these calls might not have passed on to polkit_authority_check_authorization(), but instead being scheduled with g_idle_add(). These calls have to be canceled too because the NMAuthChain will already be destroyed when auth_call_complete() calls. Now, we g_source_remove() these calls and free them immediatly. Before these calls leaked and led to use after free crash. Also fix a memory leak by always get the results with polkit_authority_check_authorization_finish(), even when being cancelled. This is the backtrace of the crash: #0 0x00007f166efda359 in g_slist_remove () from /lib64/libglib-2.0.so.0 #1 0x00007f167311bcc1 in auth_call_complete () #2 0x00007f166efbde06 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #3 0x00007f166efbe158 in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0 #4 0x00007f166efbe55a in g_main_loop_run () from /lib64/libglib-2.0.so.0 #5 0x00007f16730d3c0d in main () Co-Authored-By: Dan Williams <dcbw@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: add NMC_RESULT_ERROR_NOT_FOUND and use as appropriateDan Winship2013-11-224-20/+25
| | | | | | | This will allow callers to distinguish "no such connection" from "connection failed to activate", etc. https://bugzilla.redhat.com/show_bug.cgi?id=1022256
* cli: initialize interface-name for new team connections in editorJiří Klimeš2013-11-221-1/+5
|
* cli: bash completion completes filenames for team "config" propertyThomas Haller2013-11-221-1/+7
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: complete file names for properties whose value is a file nameJiří Klimeš2013-11-221-6/+83
| | | | | | | | | | Note: Tilde expansion is enabled, so ~/abc<TAB> expands the string to /home/joe/abc. However, when user did not use the completion and typed "~/myfile" manually, the path could not be opened. nmcli 802-1x.ca-cert> set ~/newca.crt Error: failed to set 'ca-cert' property: Failed to open file '~/newca.crt': No such file or directory
* cli: support file names for 'config' argument when creating team connectionsJiří Klimeš2013-11-224-17/+163
| | | | | | | | | nmcli con add type team config /home/cimrman/team-config.json libteam (and in turn NetworkManager) configures team devices via plain config data in JSON format. However, it is useful and more user-friendly for nmcli to accept also a file name that contains the config data, and read it. Thus the user is not forced to type whole (possibly long) config on the command line.
* core: ignore RA-provided default routes (rh #1029213)Dan Williams2013-11-201-5/+11
| | | | | | | | | The router has no idea what the local configuration or user preferences are, so sending routes with a prefix length of 0 is at best misinformed and at worst breaks things. The kernel also ignores plen=0 routes in its in-kernel RA processing code in net/ipv6/ndisc.c. https://bugzilla.redhat.com/show_bug.cgi?id=1029213
* core: do not generate a connection for loopback interface (rh #1032594)Jiří Klimeš2013-11-201-9/+10
| | | | | | | Else loopback is managed, and could be easily disconnected, which causes various issues with applications. So do not manage it for now, to be on the safer side. https://bugzilla.redhat.com/show_bug.cgi?id=1032594
* dispatcher: fix crash while logging from signal handlerThomas Haller2013-11-191-20/+10
| | | | | | | | | | | | | | | | | | Bug rh#1017884 describes a crash, where dbus_init() failed, which causes a g_warning(). While writing the warning, a SIGTERM hit, and the signal_handler() tries to call again g_message(). The logging functions of glib are not reentrant and call abort() when invoked recursivly. The solution, is to use g_unix_signal_add, which will dispatch the handler on the mainloop asynchronously. This bug is not that serious, because the dispatcher was about to terminate anyway. However, it gets registered as a crash by the system (ABRT). https://bugzilla.redhat.com/show_bug.cgi?id=1017884 Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-glib: fix crash by taking additional ref in nm-remote-connection/result_cbThomas Haller2013-11-181-0/+2
| | | | | | | | | | | | result_cb invokes a function pointer provided by the user. Nothing prevents the user from destroying the NMRemoteConnection in the callback, which leads to a crash. Take an additional ref of NMRemoteConnection to keep it alive. This probably caused a crash for nm-applet: https://bugzilla.redhat.com/show_bug.cgi?id=1030403 Signed-off-by: Thomas Haller <thaller@redhat.com>
* device: remove invalid assertion in slave_state_changed()Jiří Klimeš2013-11-181-1/+0
| | | | | | | | | | | | | | | | When activating a team slave and 'teamd' binary is not installed, the priv->state of master device will be NM_DEVICE_STATE_FAILED, which is greater than NM_DEVICE_STATE_ACTIVATED. <info> Activation (nm-team) Stage 1 of 5 (Device Prepare) started... <warn> Activation (nm-team) to start teamd: not found <info> (nm-team): device state change: prepare -> failed (reason 'none') [40 120 0] ... <debug> master_state_cb(): (0x81d6968): master ActiveConnection [0x91d69d0] 'team0' failed <info> (eth1): device state change: config -> failed (reason 'dependency-failed') [50 120 50] ... <debug> slave_state_changed(): (nm-team): slave eth1 state change 50 (config) -> 120 (failed) --- ASSERTION ---
* build: fix for `make distcheck` without enable-gtk-docThomas Haller2013-11-182-1/+2
| | | | | | | | | | | | | | | | | | | Without this patch, the following fails with a rather obscure message about missing make target. ./autogen.sh && make && make distcheck ... *** No rule to make target `NetworkManager.8', needed by `distdir'. Stop. Swap the order of the subdirectories 'docs' and 'man' to build 'docs' earlier. This way, `make distcheck` fails in the directory 'docs' with a better error message: *** gtk-doc must be installed and enabled in order to make dist Also, add 'man/nmcli-examples.5' to the list of files, to determine whether to use the pre generated doc files. Signed-off-by: Thomas Haller <thaller@redhat.com>
* trivial: fix some prototypesDan Williams2013-11-181-2/+2
|
* cli: bash completion must not suggest IP options for adding slave typesThomas Haller2013-11-181-0/+3
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* trivial: ifcfg-rh: remove unused code/variablesThomas Haller2013-11-181-3/+0
|
* cli: add missing reason-to-string mappings for NMDeviceStateReasonJiří Klimeš2013-11-181-0/+7
|
* doc: fix description of nm_setting_set_secret_flags()Jiří Klimeš2013-11-181-1/+1
|
* team: correct the message telling the teamd binary is missingJiří Klimeš2013-11-181-1/+2
|
* cli: add 'config' option to bash completion when adding team-slave connectionThomas Haller2013-11-181-1/+1
| | | | | | | Like 'team', 'team-slave' also understands the property 'config'. Add it to bash completion for the 'connection add' command. Signed-off-by: Thomas Haller <thaller@redhat.com>
* settings: fix return value in nm_system_config_interface_load_connection()Jiří Klimeš2013-11-181-1/+1
| | | | when g_return_val_if_fail fails.
* libnm-glib: fix return value in nm_remote_settings_load_connections()Jiří Klimeš2013-11-181-2/+2
| | | | when g_return_val_if_fail() fails.
* cli: adjust bash completion for `nmcli connection load <file>...`Thomas Haller2013-11-151-0/+6
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: add "nmcli con load file..."Dan Winship2013-11-152-2/+57
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=709830
* libnm-glib: add nm_remote_settings_load_connections()Dan Winship2013-11-153-0/+77
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=709830
* core: add o.fd.NM.Settings.LoadConnectionsDan Winship2013-11-156-7/+163
| | | | | | | Add a D-Bus method to reload connection files specified by filename, and implement it in the ifcfg-rh and keyfile backends. https://bugzilla.gnome.org/show_bug.cgi?id=709830
* devices: use disable_ipv6 as appropriateDan Winship2013-11-151-3/+30
| | | | | | | | | | | | | | | Set and clear disable_ipv6 on devices as needed to ensure that: 1) devices never get IPv6 link local addresses until they are actually activated 2) devices always lose their IPv6 link local addresses when they are deactivated 3) slaves never get IPv6 link local addresses at all https://bugzilla.gnome.org/show_bug.cgi?id=700414 https://bugzilla.redhat.com/show_bug.cgi?id=1004255
* devices: enable/disable kernel IPv6 autoconf at the appropriate timesDan Winship2013-11-151-22/+16
| | | | | | | | | | | | | Set accept_ra and use_tempaddr to "0" when managing a device (and restore them to their original values after unmanaging it) to ensure that calling nm_device_bring_up() on a managed device won't ever cause kernel IPv6 autoconf to happen. Remove some other redundant accept_ra setting. Fix up the deconfigure case of dispose() to clear the device's IP6 config as well as its IP4 config. https://bugzilla.gnome.org/show_bug.cgi?id=700414
* devices: clean up accept_ra/use_tempaddr handlingDan Winship2013-11-151-68/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | update_accept_ra_path() and update_ip6_privacy_save() were freeing their path variables if they failed to read the existing values, but if this ever actually happened it would cause problems later since other code assumed that the variables were always set. Use "priv->ip6_accept_ra_save = -1", etc, instead to indicate that the value couldn't be read (and so shouldn't be restored later). Merge the accept_ra and use_tempaddr code save/restore code together, since they're always called together. Fix the accept_ra-restoring code to correctly handle an original value of "2". Call update_ip6_properties_paths() from nm_device_set_ip_iface() rather than act_stage3_ip6_config_start(), since set_ip_iface() is when the paths actually change. Also, split the default-value-saving code out into a separate function, since we only care about doing that at construct time; if the IP6 property paths change later (because iface != ip_iface), then we don't need to save and restore the values on the ip_iface, since the interface will go away when we're done with it. https://bugzilla.gnome.org/show_bug.cgi?id=700414
* devices: rename ip6_privacy_tempaddr_* vars to match sysctlDan Winship2013-11-151-19/+19
| | | | | | Rename ip6_privacy_tempaddr_path and ip6_privacy_tempaddr_save to ip6_use_tempaddr_*, to match the sysctls, for consistency with the accept_ra variables.
* devices: "deactivate" devices when going from UNMANAGED->UNAVAILABLEDan Winship2013-11-151-2/+4
| | | | | | | | We used to call nm_device_deactivate() when moving a device from UNMANAGED to UNAVAILABLE (unless we were assuming the existing connection), but this got lost when default-unmanaged was added. Fix it to do this again, so the device will be in a known-clean state when it is activated.
* core: remove redundant sysctl utilitiesDan Winship2013-11-156-142/+43
| | | | | | NMDevice was still using the old sysctl functions from NetworkManagerUtils rather than the new NMPlatform ones. Fix it, and remove the old functions.
* libnm-glib: fix a crash in NMObjectDan Winship2013-11-141-0/+3
| | | | | | | deferred_notify_cb() needs to take a ref on the object around emitting its deferred signals, since otherwise if a notify:: handler drops the last reference on an object, a following g_object_notify() call would crash.
* core: allow default wired connections to stay up when quittingDan Williams2013-11-143-4/+9
| | | | | | | | | Previously, the default wired connection was removed on quit when the device was cleaned up. This is inconsistent with other connections. Leave the default wired connection up when quitting to fix this inconsistency. This allows default wired connections to be assumed when NM starts.
* settings: simplify connection signal handlingDan Williams2013-11-141-55/+34
| | | | No need to store the ID since we can use g_signal_handlers_disconnect_by_func()