summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | settings: preserve agent-owned secrets on connection updateBeniamino Galvani2018-02-141-0/+14
| | | | | | | | | | | | | | | | | | | | | | After writing the connection to disk and rereading it, in addition to restoring agent-owned secrets in the cache we must also restore agent-owned secrets from the original connections since they are lost during the write. Reported-by: Märt Bakhoff <anon@sigil.red> https://bugzilla.gnome.org/show_bug.cgi?id=793324
* | cli: fix connections completionBeniamino Galvani2018-02-131-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let the matching continue when we are autocompleting arguments and we have already found 'id', 'uuid' or 'path'. Before: # nmcli connection modify path<TAB> path After: # nmcli connection modify path<TAB> path pathfinder-wifi
* | cli: fix completion of help sub-commandBeniamino Galvani2018-02-131-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 'help' is completed without considering other alternatives: # nmcli connection modify h<TAB> help After the patch: # nmcli connection modify h<TAB> help home-wifi Fixes: 29bb6ae4fec37db177418bae9d9462b577d3b2fd
* | cli/polkit-agent: drop an extra newlineLubomir Rintel2018-02-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | It looks bad and makes everyone super-sad: $ nmcli --ask c modify 'Oracle HQ' 802-11-wireless-security.psk solaris666 System policy prevents modification of network settings for all users (action_id: org.freedesktop.NetworkManager.settings.modify.system) Password (lkundrak): ********* $
* | cli/connections: avoid using synchronous get_secrets()Lubomir Rintel2018-02-131-12/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With --ask it might call back to nmcli's agent, causing a deadlock while the client is waiting for the response. Let's give the client a chance to service the agent requests while waiting: $ nmcli --ask --show-secrets c show 'Oracle HQ' <hang> This is probably still rather suboptimal and inefficient, since we still serialize the calls and block on response. However, if we submit multiple calls to GetSecrets, the daemon would start authorizing the first one and fail the other ones immediately before the authorization succeeds. This could perhaps be addressed in the daemon, but let's settle for a fix that's compatible with the current daemon for now.
* | platform/test: drop the /sys/devices danceLubomir Rintel2018-02-121-36/+1
| | | | | | | | | | | | | | | | The bridge test (and no other either) no longer sets sysfs properties, so this whole madness is no longer needed. That is good, because Linux got somewhat stricter (at least in 4.15) about mounting sysfs and the whole thing wouldn't work with containers where /sys is red-only from the start.
* | platform/netns: don't try to overlay ro /sys with a rw oneLubomir Rintel2018-02-121-1/+5
| | | | | | | | Linux 4.15 won't allow us. No problem.
* | ppp/plugin: use g_strlcpy()Lubomir Rintel2018-02-121-15/+4
| | | | | | | | | | It's nicer but also doesn't annoy gcc 8: "error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]"
* | platform/tests: (trivial) fix a typoLubomir Rintel2018-02-121-1/+1
| |
* | platform/tests: disable tests touching sysctl when they're not writableLubomir Rintel2018-02-121-0/+17
| | | | | | | | | | This is basically the case in the COPR build system where this (mount -o bind,ro /proc/sys /proc/sys) is the case for reasons unknown.
* | connectivity: fix portal detection when using HTTP 204 based checksAleksander Morgado2018-02-121-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we're going to use a 'no content' URL (HTTP 204) to check connectivity, do not try to match prefix when the content is being received. This issue was making the check not work properly, as the content returned by the captive portal was assumed as expected (given that g_str_has_prefix(str,"") always returns TRUE!). Also, rework a log message that was being emitted on portal detection to avoid specifying that the reason is the content being shorter than expected, as that same logic now applies to the case where too much content is received and none was expected. Fixes: 88416394f8e0a51dae9f40a31ca0c8077f08808a https://mail.gnome.org/archives/networkmanager-list/2018-February/msg00009.html
* | ifcfg: merge branch 'th/ifcfg-simple-dbus'Thomas Haller2018-02-125-76/+184
|\ \ | | | | | | | | | https://github.com/NetworkManager/NetworkManager/pull/63
| * | ifcfg-rh: rework D-Bus handling of ifcfg-rh settings pluginThomas Haller2018-02-122-35/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ifcfg-rh plugin provides its own D-Bus service which initscripts query to determine whether NetworkManager handles an ifcfg file. Rework the D-Bus glue to hook GDBus with NetworkManager to use GDBusConnection directly. Don't use generated code, don't use GDBusInterfaceSkeleton. We still keep "src/settings/plugins/ifcfg-rh/nm-ifcfg-rh.xml" and still compile the static generated code. We don't actually need them anymore, maybe the should be dropped later. This is a proof of concept for reworking the D-Bus glue in NetworkManager core to directly use GDBusConnection. Reworking core is much more complicated, because there we also have properties, and a class hierarchy. Arguably, for the trivial ifcfg-rh service all this hardly matters, because the entire D-Bus service only consists of one method, which is unlikely to be extended in the future. Now we get rid of layers of glue code, that were hard to comprehend. Did you understand how nm_exported_object_skeleton_create() works and uses the generated code and GDBusInterfaceSkeleton to hook into GDBusConnection? Congratulations in that case. In my opinion, these layers of code don't simplify but complicate the code. The change also reduces the binary size of "libnm-settings-plugin-ifcfg-rh.so" (build with contrib/rpm --without debug) by 8312 bytes (243672 vs. 235360).
| * | ifcfg-rh: minor cleanup for _dbus_setup()Thomas Haller2018-02-121-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | In _dbus_setup(), call _dbus_clear(). It feels more correct to do that. Although, technically, we never even call _dbus_setup() if there is anything to clear. Also, minor refactoring of config_changed_cb(). It's not entirely clear whether we need that code, or how to handle D-Bus disconnecting, if at all.
| * | dhcp: use NM_DEFINE_GDBUS_INTERFACE_INFO() macros to define D-Bus ↵Thomas Haller2018-02-121-33/+17
| | | | | | | | | | | | registration info for DHCP listener
| * | dhcp: mark descriptor tables for D-Bus as static constThomas Haller2018-02-121-10/+10
| | | | | | | | | | | | | | | Marking static variables as const will result in write-protected memory, which is a desired property.
| * | shared: add nm_steal_int() helperThomas Haller2018-02-121-0/+19
| | |
| * | shared: add macros to define GDBus registration infoThomas Haller2018-02-121-0/+35
| | |
| * | shared: add NM_UNCONST_PTR() and NM_UNCONST_PPTR()Thomas Haller2018-02-121-0/+22
|/ / | | | | | | | | | | | | | | Add macros that cast away the constness of a pointer, but ensure that the type of the pointer is as expected. Unfortunately, there is no way (AFAIK) to remove the constness of a variable, without explicitly passing @type to the macro.
* | contrib: add -h option to NM-logThomas Haller2018-02-121-3/+20
| | | | | | | | | | | | | | Pass "-h" to highlight individual words. "-h" stands for "highlight". $ NM-log -h wlan0 j
* | team: merge 'fg/team-clean-tx-hash-on-set-rh1541922'Francesco Giudici2018-02-122-23/+33
|\ \ | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1541922
| * | nmcli: team: do strict checking on runner-tx-hashesfg/team-clean-tx-hash-on-set-rh1541922Francesco Giudici2018-02-121-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | Substrings matching the heading of valid values were allowed if not ambiguous (e.g.: "et" for "eth"). Moreover, upper case variants were accepted too. Do a plain string comparison check against the valid values. Improve also the error message: give a list of valid tx-hashes.
| * | client: fix nmc_string_is_valid ambiguous detectionFrancesco Giudici2018-02-121-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when input matched the heading of two allowed values the match was reported as ambiguous without checking if there was a perfect match following: fixed. Example of a failing input: const char **allowed = [ "ipv4, ipv6, ip" ]; const char *input = "ip"; "ip" was detected as ambiguous.
| * | nmcli: team: clear runner-tx-hash before adding new hashesFrancesco Giudici2018-02-121-0/+3
|/ / | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1541922
* | build/meson: fix printing DHCP build statusThomas Haller2018-02-111-1/+1
| |
* | ovs/trivial: fix indentationThomas Haller2018-02-091-21/+20
| |
* | wifi/iwd: merge branch 'az/more-iwd-fixes-pr62'Thomas Haller2018-02-092-40/+141
|\ \ | | | | | | | | | https://github.com/NetworkManager/NetworkManager/pull/62
| * | wifi/iwd: make NMIwdManager:dispose() reentrantThomas Haller2018-02-091-2/+4
| | | | | | | | | | | | Theoretically, dispose() could be called multiple times.
| * | iwd: avoid duplicate nm_device_iwd_set_dbus_object callAndrew Zaborowski2018-02-091-0/+3
| | | | | | | | | | | | | | | | | | | | | Avoid calling nm_device_iwd_set_dbus_object (device, NULL) if the dbus_object was NULL already. Apparently gdbus guarantees that a name-owner notification either has a NULL old owner or a NULL new owner but can also have both old and new owner NULL.
| * | iwd: recreate GDbusObjectManagerClient on reconnectAndrew Zaborowski2018-02-091-21/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reuse the apparent workaround from libnm/nm-client.c in which the GDbusObjectManagerClient is recreated every time the name owner pops up, instead of creating it once and using that object forever. Resubscribe to all the signals on the new object. The initial GDbusObjectManager we create is only used to listed for the name-owner changes. There's nothing in gdbus docs that justifies doing that but there doesn't seem to be any way to reliably receive all the signals from the dbus service the normal way. The signals do appear on dbus-monitor and the gdbus apparently subscribes to those signals with AddMatch() correctly but they sometimes won't be received by the client code, unless this workaround is applied. While making changes to got_object_manager, don't destroy the cancellable there as it is supposed to be used throughout the NMIwdManager life.
| * | iwd: keep reference to NMManager, disconnect signalsAndrew Zaborowski2018-02-091-14/+11
| | | | | | | | | | | | | | | | | | Disconnect from NMManager signals in our cleanup, make sure the NMManager singleton is not destroyed before we are by keeping a reference until we've disconnected from its signals.
| * | iwd: initialize priv->can_connect when DBus interface appearsAndrew Zaborowski2018-02-091-1/+6
| | | | | | | | | | | | | | | Call state_changed with the initial Device.State property value to make sure can_connect and can_scan are up to date.
| * | iwd: simple periodic scanningAndrew Zaborowski2018-02-091-5/+93
|/ / | | | | | | | | | | | | | | | | | | | | | | Add very simple periodic scanning because IWD itself only does periodic scanning when it is in charge of autoconnecting (by policy). Since we keep IWD out of the autoconnect state in order to use NM's autoconnect logic, we need to request the scanning. The policy in this patch is to use a simple 10s period between the end of one scan the requesting of another while not connected, and 20s when connected. This is so that users can expect similar results from both wifi backends but without duplicating the more elaborate code in the wpa_supplicant backend which can potentially be moved to a common superclass.
* | connectivity: cleanup conditions in curl_check_connectivity()Thomas Haller2018-02-091-15/+16
| | | | | | | | Refactor the nested ifs to if-else-if-else.
* | connectivity: allow 204 (no content) as connectivity testAleksander Morgado2018-02-091-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user is requesting an empty response ("") as expected string, let the connectivity check succeed if we actually get a 204 HTTP response code (reporting a successful request but without content). This allows using e.g. Android's default URLs for the connectivity check purpose: [connectivity] uri=http://google.com/generate_204 interval=60 response= https://mail.gnome.org/archives/networkmanager-list/2018-February/msg00005.html
* | platform: fix handling secondary addresses during nm_platform_ip4_address_sync()Thomas Haller2018-02-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | Although IFA_F_TEMPORARY is numerically equal to IFA_F_SECONDARY, their meaning is different. One applies to IPv6 temporary addresses, and the other to IPv4 secondary addresses. During _addr_array_clean_expired() we want to ignore and clear IPv6 temporary addresses, but not IPv4 secondary addresses. Fixes: f2c4720bcac1cf30babd77eb8b721e4e384fee8b
* | core: distinguish between IFA_F_SECONDARY and IFA_F_TEMPORARYThomas Haller2018-02-094-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the numerical values of IFA_F_SECONDARY and IFA_F_TEMPORARY are identical, their meaning is not. IFA_F_SECONDARY is only relevant for IPv4 addresses, while IFA_F_TEMPORARY is only relevant for IPv6 addresses. IFA_F_TEMPORARY is automatically set by kernel for the addresses that it generates as part of IFA_F_MANAGETEMPADDR. It cannot be actively set by user-space. IFA_F_SECONDARY is automatically set by kernel depending on the order in which the addresses for the same subnet are added. This essentially reverts 8b4f11927 (core: avoid IFA_F_TEMPORARY alias for IFA_F_SECONDARY).
* | core: merge branch 'th/ip6-temp-addr-sync-rh1542609'Thomas Haller2018-02-0910-167/+348
|\ \ | | | | | | | | | | | | https://github.com/NetworkManager/NetworkManager/pull/65 https://bugzilla.redhat.com/show_bug.cgi?id=1542609
| * | device: fix IPv6 DAD to re-check whether address really failed DADThomas Haller2018-02-092-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In device_ipx_changed() we remember the addresses for which it appears that DAD failed. Later, on an idle handler, we process them during queued_ip6_config_change(). Note that nm_plaform_ip6_address_sync() might very well decide to remove some or all addresses and re-add them immidiately later. It might do so, to get the address priority/ordering right. At that point, we already emit platform signals that the device disappeared, and track them in dad6_failed_addrs. Hence, later during queued_ip6_config_change() we must check again whether the address is really not there and not still doing DAD. Otherwise, we wrongly claim that DAD failed and remove the address, generate a new one, and the same issue might happen again.
| * | ndisc/trivial: rename name for internal signal enum to match signal nameThomas Haller2018-02-091-3/+3
| | |
| * | device: don't check addr-source for addresses that failed IPv6 DADThomas Haller2018-02-091-3/+0
| | | | | | | | | | | | | | | | | | | | | dad6_failed_addrs is populated with addresses from the platform cache. Inside the cache, all addresses have addr_source NM_IP_CONFIG_SOURCE_KERNEL, because addr_source property for addresses is only a property that is used NetworkManager internally.
| * | device: ignore temporary addresses for IPv6 DADThomas Haller2018-02-091-1/+2
| | | | | | | | | | | | | | | Temporary addresses are entirely managed by kernel, via the mngtempaddr flag of the primay address. No need to consider them for DAD.
| * | device: don't clone NMPlatformIP6Address for dad6_failed_addrsThomas Haller2018-02-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NMPObjects are never modified after being put into the cache. Hence, it is safe and encouraged to just keep a reference to them, instead of cloning them. Interestingly, NMPlatform's change signals have a platform_object pointer, which is not the pointer to the NMPObjects itself, but down-cast to the NMPlatformObject instance. It does so, because commonly callers want to have a pointer to the NMPlatformObject instance, instead of the outer NMPObjects. However, NMP_OBJECT_UP_CAST() is guaranteed to work one would expect.
| * | device: use g_slist_prepend() to track dad6_failed_addrsThomas Haller2018-02-091-2/+2
| | | | | | | | | | | | | | | | | | The order in which we add addresses to dad6_failed_addrs does not matter. Hence, use g_slist_prepend() which is O(1), instead g_slist_append() with O(n).
| * | platform: rework nm_platform_ip6_address_sync() to fix address orderThomas Haller2018-02-093-81/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to add addresses in a particular order so that source address selection works. Note that @known_addresses contains the desired addresses in order of least-important first, while @plat_addresses contains them in opposite order. Previously, this inverted order was not considered, and we essentially ended up removing and re-adding all addresses every time. Fix that. While at it, get rid of the O(n^2) runtime complexity, and make it O(n) by iterating both lists simultaneously.
| * | platform: clear temporary addresses early during nm_platform_ip6_address_sync()Thomas Haller2018-02-091-16/+29
| | | | | | | | | | | | | | | | | | Temporary addresses (RFC4941) are not handled by NetworkManager directly, but by kernel. If they are in the @known_addresses list, clear them out early. They shall be ignored.
| * | platform: modifiy @known_addresses list in nm_platform_ip6_address_sync()Thomas Haller2018-02-092-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Often, we want in API that an input argument is read-only and not modified by the function call. Not modifying input arguments is a good convention. However, in this case there are only two callers, and both clearly do not care whether the @known_addresses array will be modified. Clear out addresses that are already expired and enforce that there are no duplicate addresses. Basically, use @known_addresses for bookkeeping which addresses are to be ignored.
| * | platform: refactor initial cleanup of know-addresses list in ↵Thomas Haller2018-02-091-33/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nm_platform_ip4_address_sync() We do a pre-run that constructs an index of all addresses and drops addresses that are already expired. Move this code to a separate function, it will be reused for IPv6. Also, note that nm_platform_ip4_address_sync() has only 2 callers. Both callers make sure to not pass duplicate known addresses, because the addresses also come from a cache. Make that a requirement and assert against unique addresses. If we would allow duplicate addresses, we would have to handle them in a defined way (like, dropping the ones with lower priority). That would be more complicated, and since no caller is supposed to provide duplicate addresses, don't bother but assert.
| * | core: return remaining lifetime from nm_utils_lifetime_get()Thomas Haller2018-02-094-40/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nm_utils_lifetime_get() already has so many arguments. Essentially, the function returned %TRUE if and only if the lifetime was greater then zero. Combine the return value and the output argument for the lifetime. It also matches better the function name: to get the lifetime.
| * | platform: fix object order in platform cache during dumpThomas Haller2018-02-091-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally, the platform cache did not preserve any stable order. We added that during the large cache rework. However, we still would only care about a particular ordering for route's BY_WEAK_ID index. For all other indexes, it was sufficient to have the object in some arbitrary order, not necessarily the one as indicated by kernel. However, for addresses we actually care about the order (at least, regarding the the OBJECT_BY_IFINDEX index, which is considered by platform's address sync). During a dump we get all objects in the right order. That means, as we (re) insert the objects into the cache, we must forcefully move them to the end of their list. If the object didn't actually change, previously we would not have updated their position in the cache. Fix that now.