summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* manager: check for master existence before realizing the devicebg/virt-dev-check-masterBeniamino Galvani2020-01-281-13/+13
| | | | | If we find out that no compatible master connection exists, we shouldn't realize the slave in the first place.
* manager: skip activation of a virtual device if master is missingBeniamino Galvani2020-01-281-0/+14
| | | | | | Don't realize a virtual device if the master is missing because in such case the autoactivation can't start and a stale link will be created.
* dhcp: merge branch 'bg/nettools-dup-options-issue324'Beniamino Galvani2020-01-252-5/+5
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/401
| * dhcp: don't add server-id option to the parameter request listBeniamino Galvani2020-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | The option is mandatory in the replies from server and so we don't need to ask for it. dhclient doesn't do it either. But especially, it seems that requesting the option causes some broken server implementations to send duplicate instances of the option. So, remove the option from the parameter request list of the internal nettools and systemd DHCP implementation.
| * n-dhcp4: accept options that are longer than requestedBeniamino Galvani2020-01-251-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the server sends a packet with multiple instances of the same option, they are concatenated during n_dhcp4_incoming_linearize() and evaluated as a single option as per section 7 of RFC 3396. However, there are broken server implementations that send self-contained options in multiple copies. They are reassembled to form a single instance by the nettools client, which then fails to parse them because they have a length greater than the expected one. This problem can be reproduced by starting a server with: dnsmasq --bind-interfaces --interface veth1 -d --dhcp-range=172.25.1.100,172.25.1.200,1m --dhcp-option=54,172.25.1.1 In this way dnsmasq sends a duplicate option 54 (server-id) when the client requests it in the 'parameter request list' option, as dhcp=systemd and dhcp=nettools currently do. While this is a violation of the RFC by the server, both isc-dhcp and systemd-networkd client implementations have mechanisms to deal with this situation. dhclient simply takes the first bytes of the aggregated option. systemd-networkd doesn't follow RFC 3396 and doesn't aggregate multiple options; it considers only the last occurrence of each option. Change the parsing code to accept options that are longer than necessary. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/324
* device: minor cleanup NMDevice's _set_state_full() for unrefing activation ↵Thomas Haller2020-01-201-7/+4
| | | | request
* libnm: fix another leak when cleaning up NMClientThomas Haller2020-01-161-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We now move the deletion of the context-busy-watcher to and idle handler on the D-Bus GMainContext. Note that the idle source does not take an additional reference on the context. Hence, in certain cases it might happen that the context will be completely unrefed before the idle handler runs. In that case, we would leak the object. Avoid that, by taking an additional reference to the GMainContext. Note that the alternative would be to unref the context-busy-watcher via the GSource's GDestroyNotify. That is not done, because then the busy watcher might be unrefed in a different thread. Instead, we want that to happen for the right context. The only minor downside of this is that the user now always pays the price and must iterate the context to fully clean up. But note that the user anyway must be prepared to iterate the context after NMClient is gone. And that depends on some unpredictable events that the user cannot control. That means, either the user handles this correctly already, or the problem anyway exists (randomly). Of course all of the discussed "problems" are very specific. In practice, the users uses the g_main_context_default() instance and anyway will either keep iterating it or quit the process after the NMClient instance goes away.
* libnm: merge branch 'th/client-object-manager-dbus-leak'Thomas Haller2020-01-165-126/+124
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/398
| * libnm: keep context-busy-watcher of NMClient alive for one more idle roundThomas Haller2020-01-161-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The context-busy-watch has two purposes: 1) it allows the user to watch whether the NMClient still has pending GSource'es attached to the GMainContext. 2) thereby, it also keeps the inner GMainContext integrated into the caller's (in case of synchronous initialization of NMClient). Especially for 2), we must not get this wrong. Otherwise, we might un-integrate the inner GMainContext too early and it will be leaked indefinitely (because the user has no means to access or iterate it). To be extra careful, extend the lifetime of the context-busy-watcher for one more idle invocation. Theoretically, this should not be necessary, but it's not clear whether something else is still pending. The downside of that extra safety is that it is probably unnecessary in practice. And in case where it is necessary, it hides an actual issue, making it harder to notice and fix it.
| * shared: remove nm_dbus_connection_signal_subscribe_object_manager() helperThomas Haller2020-01-164-125/+21
| | | | | | | | | | | | It seems to complicate things more than helping. Drop it. What we still have is a wrapper around plain g_dbus_connection_signal_subscribe(). That one is trivial and helpful. The previous wrapper seems to add more complexity.
| * core/bluetooth: don't use nm_dbus_connection_signal_subscribe_object_manager()Thomas Haller2020-01-161-13/+46
| | | | | | | | | | | | | | | | | | | | | | | | nm_dbus_connection_signal_subscribe_object_manager() wraps the subscription. The problem is that this requires to pass a destroy notify function for cleaning up. Such a destroy notify function will result in an idle source when unsubscribing, which keeps the associated GMainContext alive (until it gets iterated some more). That seems error prone and outright unsuitable for NMClient. While the helper may be useful, it cannot be used by NMClient. So, there is only one user of this function and we don't expect a second one. It seems better to get rid of this wrapper and implement it directly.
| * libnm: avoid leaking GMainContext for sync initialization after ↵Thomas Haller2020-01-161-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | context-busy-watcher quits When passing a destroy notify to g_dbus_connection_signal_subscribe(), that callback gets invoked as an idle handler of the associated GMainContext. That caused to have yet another source attached to the context after the NMClient gets destroyed. Especially with synchronous initialization of NMClient that is bad, because we may destroy the context-busy-watcher too early. That results in removing the integration of the inner GMainContext into the caller's context, and thus we leak the inner context indefinitely. Avoid that leak by not passing a cleanup function to g_dbus_connection_signal_subscribe(). Fixes: ce0e898fb476 ('libnm: refactor caching of D-Bus objects in NMClient')
| * shared: add nm_source_func_unref_gobject() helperThomas Haller2020-01-161-0/+8
|/
* ifcfg-rh: merge branch 'th/ifcfg-parse-route-file-cleanup'Thomas Haller2020-01-167-79/+209
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/392
| * ifcfg-rh: avoid creaing route file twice in make_ip4_setting()Thomas Haller2020-01-161-16/+17
| | | | | | | | | | | | | | | | | | Just read the content once. It's wasteful to read the file twice while parsing. But what is worse, the file content can change any time we read it. We make decisions based on what we read, and hence we should only read the file once in the parsing process to get one consistent result.
| * ifcfg-rh: expose constructor for shvarFile that doesn't read content from fileThomas Haller2020-01-162-26/+46
| |
| * ifcfg-rh: split reading file and parsing from read_route_file() functionThomas Haller2020-01-161-21/+46
| | | | | | | | | | | | | | | | | | | | Split the parsing of the file content to a separate function. Next we will load IPv4 files only once, and thus only need to parse the content without reading it. Note that the function temporarily modifies the input buffer, but restores the original content before returning.
| * ifcfg-rh: split reading file and parsing in ↵Thomas Haller2020-01-162-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | utils_has_route_file_new_syntax() function We will need both variants, so that the caller can read the file only once. Note that also utils_has_route_file_new_syntax_content() will restore the original contents and not modify the input (from point of view of the caller). In practice it will momentarily modify the content.
| * ifcfg-rh: don't use GRegex in utils_has_route_file_new_syntax()Thomas Haller2020-01-161-14/+34
| | | | | | | | | | It's simple enough to iterate the file content line by line and search for a suitable prefix.
| * ifcfg-rh/tests: add test for utils_has_route_file_new_syntax()Thomas Haller2020-01-161-0/+37
| |
| * shared/tests: add nmtst_file_set_contents_size() helperThomas Haller2020-01-161-2/+14
|/
* clients: avoid compiler warning about redefining NDEBUG for qrcodegenThomas Haller2020-01-151-0/+1
| | | | | | | | [1/5] Compiling C object 'clients/common/913ef36@@nmc-base@sta/nm-client-utils.c.o'. ../clients/common/nm-client-utils.c:528: warning: "NDEBUG" redefined 528 | #define NDEBUG | <command-line>: note: this is the location of the previous definition
* build: fix linking of "src/devices/wifi/tests/test-devices-wifi"Thomas Haller2020-01-151-1/+2
| | | | | | On ppc64le, the linking fails due to unresolved symbols. Fixes: 7d8da6c9c150 ('build: build intermediate library with core wifi for device-plugin and tests')
* po: update Esperanto (eo) translationCarmen Bianca Bakker2020-01-151-2934/+3134
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/395
* core: remove code for unused NM_WIFI_P2P_PEER_GROUPS propertyThomas Haller2020-01-152-45/+0
|
* core: drop "Groups" property from WifiP2PPeer D-Bus APIThomas Haller2020-01-152-1/+6
| | | | | | | | | | | | This property is currently most likely not used. Also, because libnm doesn't expose it and the only known user of this API (gnome-network-displays) doesn't use it. In the future we may want to expand on the Groups API. E.g. exposing groups as separate D-Bus objects, in which case a better property type would be "ao" and not "as". For now, that is unclear nor requested. Remove the property for now.
* libnm: ignore "Groups" property of WifiP2PPeerThomas Haller2020-01-151-10/+11
| | | | | | | | | | | | | Groups currently are not exposed on D-Bus as separate objects. Also, we might want to expose the property as "ao" instead of "as". This API needs more thought. There are likely no users that rely on this property. So, we will drop it from server side, until it will be requested and newly designed. Regardless, NMClient needs to gracefully ignore the property. Despite we will remove it from 1.24 API, libnm should ignore the property on previous versions. Mark it accordingly.
* libnm: fix exposing nm_wifi_p2p_peer_get_name() from D-Bus propertyThomas Haller2020-01-151-0/+1
| | | | Fixes: ce0e898fb476 ('libnm: refactor caching of D-Bus objects in NMClient')
* introspection: belatedly add Wi-Fi P2P peer "Name" property to D-Bus ↵Thomas Haller2020-01-151-0/+9
| | | | | | introspection file Fixes: 00e64d13320f ('core/devices: Add P2P Wifi device and peer tracking')
* libnm: fix wrong assertion in nm_client_add_and_activate_connection2_finish()Thomas Haller2020-01-151-1/+1
| | | | Fixes: ce0e898fb476 ('libnm: refactor caching of D-Bus objects in NMClient')
* libnm: fix interface and object path for P2P StartFind/StopFind callsBenjamin Berg2020-01-151-4/+4
| | | | | | | | | | The change to use a GDBusConnection (7871105ff9) introduced a bug by using the wrong hardcoded path and the wrong interface. Correct this mistake again. Fixes: 7871105ff90b ('libnm: implement nm_device_wifi_p2p_start_find()/nm_device_wifi_p2p_stop_find() by using GDBusConnection directly') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/399
* license: add Iñigo to RELICENSE.mdThomas Haller2020-01-141-0/+1
| | | | https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00014.html
* license: add Dan, Dan, Lubomir and Franceso to RELICENSE.mdThomas Haller2020-01-141-0/+4
| | | | | | | Dan Williams: https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00013.html Dan Winship: https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00012.html Francesco Giudici: https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00015.html Lubomir Rintel: https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00018.html
* license: add list for legal entities to track their relation of contributorsThomas Haller2020-01-141-3/+12
| | | | And add "Red Hat, Inc." there. The actual consent is not yet determined.
* license: relicense "shared/nm-std-aux/nm-dbus-compat.h" under LGPL-2.1+Thomas Haller2020-01-141-49/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | "nm-dbus-compat.h" was GPL licensed. That is a problem, because we use it from libnm (which is LGPL). The history of this file in NetworkManager source tree: $ git shortlog -n -s e055bdbbc3e7bb3ff3bc73860c4479f15bbfe7b2 -- shared/nm-std-aux/nm-dbus-compat.h include/nm-dbus-compat.h shared/nm-dbus-compat.h 5 Thomas Haller 1 Dan Winship 1 Lubomir Rintel Note that commit dd0e19895532 ('include: add nm-dbus-compat.h') introduced this file from dbus sources ([1]). Hence, originally the file is (like all of dbus sources) dual-licensed under GPL-2.0+ and Academic Free License 2.1 (AFL-2.1). That makes it problematic to change the license of this file to LGPL also because of the old history of the file. Instead, drop everything from the header except the bits that we actually use. I claim the remainder is trivial and only contains defines for documented D-Bus API. I don't think that the remainder is copyrightable and hence get rid of the copy-right notice and the GPL license. [1] https://gitlab.freedesktop.org/dbus/dbus/blob/39ea37b587c9fa4c5e8d0aff08b043617b22f50a/dbus/dbus-shared.h
* initrd: merge branch 'lr/a-pair-of-ibft-fixes'Thomas Haller2020-01-144-43/+92
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/393
| * initrd/cmdline: minor style cleanupsThomas Haller2020-01-142-2/+3
| |
| * initrd/cmdline: obey rd.iscsi.ibftLubomir Rintel2020-01-142-43/+63
| | | | | | | | | | | | | | | | Do process the connections from the iBFT block if the rd.iscsi.ibft or rd.iscsi.ibft=1 argument is present. This is supposed to fix what was originally reported by Kairui Song <kasong@redhat.com> here: https://github.com/dracutdevs/dracut/pull/697
| * initrd/ibft-reader: don't set con.interface-name in iBFT connectionsLubomir Rintel2020-01-143-0/+28
|/ | | | | | | | | | | | | If an argument in form ip=eth0:ibft is specified, we'd first create a wired connection with con.interface-name and then proceed completing it from the iBFT block. At that point we also add the MAC address, so the interface-name is no longer necessary.. Worse even, for VLAN connections, it results in an attempt to create a VLAN with the same name as the parent wired device. Ooops. Let's just drop it. MAC address is guarranteed to be there and does the right thing for both plain wired devices as well as VLANs.
* n-dhcp4: fix integer context in n_dhcp4_client_probe_transition_nak() on 32 bitThomas Haller2020-01-141-3/+3
| | | | | | Fixes: 218782a9a3c3 ('n-dhcp4: restart the transaction after a NAK') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/339
* platform: merge branch 'th/ifa-broadcast'Thomas Haller2020-01-147-37/+114
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/391
| * platform: generate IFA_BROADCAST address based on the peer IFA_ADDRESSThomas Haller2020-01-141-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is also what iproute2 does ([1]) when creating a default broadcast address with `ip addr add 192.168.1.5/24 brd + dev eth0`. Also, kernel does in fib_add_ifaddr() ([2]): ``` __be32 addr = ifa->ifa_local; __be32 prefix = ifa->ifa_address & mask; ... /* Add broadcast address, if it is explicitly assigned. */ if (ifa->ifa_broadcast && ifa->ifa_broadcast != htonl(0xFFFFFFFF)) fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim, 0); if (!ipv4_is_zeronet(prefix) && !(ifa->ifa_flags & IFA_F_SECONDARY) && (prefix != addr || ifa->ifa_prefixlen < 32)) { if (!(ifa->ifa_flags & IFA_F_NOPREFIXROUTE)) fib_magic(RTM_NEWROUTE, dev->flags & IFF_LOOPBACK ? RTN_LOCAL : RTN_UNICAST, prefix, ifa->ifa_prefixlen, prim, ifa->ifa_rt_priority); /* Add network specific broadcasts, when it takes a sense */ if (ifa->ifa_prefixlen < 31) { fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix, 32, prim, 0); fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix | ~mask, 32, prim, 0); } } ``` Which means by default kernel already adds those special broadcast routes which are identical to what we configure with IFA_BROADCAST. However, kernel too bases them on the peer (IFA_ADDRESS). [1] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/ip/ipaddress.c?id=d5391e186f04214315a5a80797c78e50ad9f5271#n2380 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv4/fib_frontend.c?id=bef1d88263ff769f15aa0e1515cdcede84e61d15#n1109
| * platform: track IFA_BROADCAST address in NMPlatformIP4AddressThomas Haller2020-01-147-37/+113
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - track the broadcast address in NMPlatformIP4Address. For addresses that we receive from kernel and that we cache in NMPlatform, this allows us to show the additional information. For example, we can see it in debug logging. - when setting the address, we still mostly generate our default broadcast address. This is done in the only relevant caller nm_platform_ip4_address_sync(). Basically, we merely moved setting the broadcast address to the caller. That is, because no callers explicitly set the "use_ip4_broadcast_address" flag (yet). However, in the future some caller might want to set an explicit broadcast address. In practice, we currently don't support configuring special broadcast addresses in NetworkManager. Instead, we always add the default one with "address|~netmask" (for plen < 31). Note that a main point of IFA_BROADCAST is to add a broadcast route to the local table. Also note that kernel anyway will add such a "address|~netmask" route, that is regardless whether IFA_BROADCAST is set or not. Hence, setting it or not makes very little difference for normal broadcast addresses -- because kernel tends to add this route either way. It would make a difference if NetworkManager configured an unusual IFA_BROADCAST address or an address for prefixes >= 31 (in which cases kernel wouldn't add them automatically). But we don't do that at the moment. So, while what NM does has little effect in practice, it still seems more correct to add the broadcast address, only so that you see it in `ip addr show`.
* merge: branch 'bg/vrf'Beniamino Galvani2020-01-1447-11/+1113
|\ | | | | | | | | | | Add support for virtual routing and forwarding (VRF) interfaces. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/375
| * core,libnm: add VRF supportBeniamino Galvani2020-01-1421-3/+647
| | | | | | | | | | | | | | | | Add VRF support to the daemon. When the device we are activating is a VRF or a VRF's slave, put routes in the table specified by the VRF connection. Also, introduce a VRF device type in libnm.
| * platform: add VRF supportBeniamino Galvani2020-01-149-0/+174
| | | | | | | | Add support for creating and parsing VRF links.
| * ifcfg-rh: add support for VRF slavesBeniamino Galvani2020-01-144-1/+24
| | | | | | | | | | | | Even if the ifcfg-rh plugin doesn't support VRF connections, it must be able to read and write other connection types that have a VRF master.
| * libnm-core,cli: add VRF settingBeniamino Galvani2020-01-1417-7/+268
|/ | | | | Add new VRF setting and connection types to libnm-core and support them in nmcli.
* all: merge branch 'th/unix-fd-source'Thomas Haller2020-01-1316-174/+240
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/378
| * session-monitor: don't use GIOChannel to watch plain file descriptorThomas Haller2020-01-131-9/+13
| |