Gentoo Archives: gentoo-commits

From: Mart Raudsepp <leio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/networkmanager/, net-misc/networkmanager/files/
Date: Sun, 19 Jan 2020 19:29:12
Message-Id: 1579462098.2587f0225c6aaa23fcef6a09f4e92c3b2fda3769.leio@gentoo
1 commit: 2587f0225c6aaa23fcef6a09f4e92c3b2fda3769
2 Author: Mart Raudsepp <leio <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 19 19:25:51 2020 +0000
4 Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 19 19:28:18 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2587f022
7
8 net-misc/networkmanager: improve privacy, iwd1 compat, USE=polkit honor
9
10 Closes: https://bugs.gentoo.org/702476
11 Closes: https://bugs.gentoo.org/702900
12 Closes: https://bugs.gentoo.org/704810
13 Package-Manager: Portage-2.3.79, Repoman-2.3.12
14 Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>
15
16 .../networkmanager/files/1.18.4-iwd1-compat.patch | 81 +++++
17 .../networkmanager/networkmanager-1.18.4-r2.ebuild | 349 +++++++++++++++++++++
18 2 files changed, 430 insertions(+)
19
20 diff --git a/net-misc/networkmanager/files/1.18.4-iwd1-compat.patch b/net-misc/networkmanager/files/1.18.4-iwd1-compat.patch
21 new file mode 100644
22 index 00000000000..12c8b873e6a
23 --- /dev/null
24 +++ b/net-misc/networkmanager/files/1.18.4-iwd1-compat.patch
25 @@ -0,0 +1,81 @@
26 +From 59923ad85d1a1cf2216a4f14649702d24d3f2360 Mon Sep 17 00:00:00 2001
27 +From: Lubomir Rintel <lkundrak@××.sk>
28 +Date: Sat, 2 Nov 2019 06:55:54 +0100
29 +Subject: [PATCH 1/2] iwd: add some missing error handling
30 +
31 +g_dbus_object_manager_get_interface() can happily return NULL and we
32 +need to check for that.
33 +---
34 + src/devices/wifi/nm-iwd-manager.c | 10 ++++++++++
35 + 1 file changed, 10 insertions(+)
36 +
37 +diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c
38 +index dd1cad480..e83f8063c 100644
39 +--- a/src/devices/wifi/nm-iwd-manager.c
40 ++++ b/src/devices/wifi/nm-iwd-manager.c
41 +@@ -136,6 +136,11 @@ agent_dbus_method_cb (GDBusConnection *connection,
42 + network = g_dbus_object_manager_get_interface (priv->object_manager,
43 + network_path,
44 + NM_IWD_NETWORK_INTERFACE);
45 ++ if (!network) {
46 ++ _LOGE ("unable to find the network object");
47 ++ return;
48 ++ }
49 ++
50 +
51 + device_path = get_property_string_or_null (G_DBUS_PROXY (network), "Device");
52 + if (!device_path) {
53 +@@ -260,6 +265,11 @@ register_agent (NMIwdManager *self)
54 + "/",
55 + NM_IWD_AGENT_MANAGER_INTERFACE);
56 +
57 ++ if (!agent_manager) {
58 ++ _LOGE ("unable to register the IWD Agent: PSK/8021x Wi-Fi networks may not work");
59 ++ return;
60 ++ }
61 ++
62 + /* Register our agent */
63 + g_dbus_proxy_call (G_DBUS_PROXY (agent_manager),
64 + "RegisterAgent",
65 +--
66 +2.20.1
67 +
68 +
69 +From 186d22a9634e2bf94658ed6f1cf2b332ecb3a32c Mon Sep 17 00:00:00 2001
70 +From: Lubomir Rintel <lkundrak@××.sk>
71 +Date: Sat, 2 Nov 2019 07:01:28 +0100
72 +Subject: [PATCH 2/2] iwd: unbreak iwd-1.0
73 +
74 +The upstream apparently thought it's a great idea to change the agent
75 +manager path. This fixes things for those unfortunate enough to run
76 +IWD.
77 +---
78 + src/devices/wifi/nm-iwd-manager.c | 10 +++++++++-
79 + 1 file changed, 9 insertions(+), 1 deletion(-)
80 +
81 +diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c
82 +index e83f8063c..470cb1c90 100644
83 +--- a/src/devices/wifi/nm-iwd-manager.c
84 ++++ b/src/devices/wifi/nm-iwd-manager.c
85 +@@ -262,9 +262,17 @@ register_agent (NMIwdManager *self)
86 + GDBusInterface *agent_manager;
87 +
88 + agent_manager = g_dbus_object_manager_get_interface (priv->object_manager,
89 +- "/",
90 ++ "/net/connman/iwd",
91 + NM_IWD_AGENT_MANAGER_INTERFACE);
92 +
93 ++ if (!agent_manager) {
94 ++ /* IWD prior to 1.0 dated 30 October, 2019 has the agent manager on a
95 ++ * different path. */
96 ++ agent_manager = g_dbus_object_manager_get_interface (priv->object_manager,
97 ++ "/",
98 ++ NM_IWD_AGENT_MANAGER_INTERFACE);
99 ++ }
100 ++
101 + if (!agent_manager) {
102 + _LOGE ("unable to register the IWD Agent: PSK/8021x Wi-Fi networks may not work");
103 + return;
104 +--
105 +2.20.1
106 +
107
108 diff --git a/net-misc/networkmanager/networkmanager-1.18.4-r2.ebuild b/net-misc/networkmanager/networkmanager-1.18.4-r2.ebuild
109 new file mode 100644
110 index 00000000000..b5aa6112e4e
111 --- /dev/null
112 +++ b/net-misc/networkmanager/networkmanager-1.18.4-r2.ebuild
113 @@ -0,0 +1,349 @@
114 +# Copyright 1999-2020 Gentoo Authors
115 +# Distributed under the terms of the GNU General Public License v2
116 +
117 +EAPI=6
118 +GNOME_ORG_MODULE="NetworkManager"
119 +GNOME2_LA_PUNT="yes"
120 +VALA_USE_DEPEND="vapigen"
121 +PYTHON_COMPAT=( python{2_7,3_6,3_7} )
122 +
123 +inherit bash-completion-r1 gnome2 linux-info multilib python-any-r1 systemd readme.gentoo-r1 vala virtualx udev multilib-minimal
124 +
125 +DESCRIPTION="A set of co-operative tools that make networking simple and straightforward"
126 +HOMEPAGE="https://wiki.gnome.org/Projects/NetworkManager"
127 +
128 +LICENSE="GPL-2+"
129 +SLOT="0" # add subslot if libnm-util.so.2 or libnm-glib.so.4 bumps soname version
130 +
131 +IUSE="audit bluetooth connection-sharing consolekit +dhclient dhcpcd elogind gnutls +introspection iwd json kernel_linux +nss +modemmanager ncurses ofono ovs policykit +ppp resolvconf selinux systemd teamd test vala +wext +wifi"
132 +RESTRICT="!test? ( test )"
133 +
134 +REQUIRED_USE="
135 + bluetooth? ( modemmanager )
136 + iwd? ( wifi )
137 + vala? ( introspection )
138 + wext? ( wifi )
139 + || ( nss gnutls )
140 + ?? ( consolekit elogind systemd )
141 +"
142 +
143 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
144 +
145 +# gobject-introspection-0.10.3 is needed due to gnome bug 642300
146 +# wpa_supplicant-0.7.3-r3 is needed due to bug 359271
147 +COMMON_DEPEND="
148 + >=sys-apps/dbus-1.2[${MULTILIB_USEDEP}]
149 + >=dev-libs/dbus-glib-0.100[${MULTILIB_USEDEP}]
150 + >=dev-libs/glib-2.40:2[${MULTILIB_USEDEP}]
151 + policykit? ( >=sys-auth/polkit-0.106 )
152 + net-libs/libndp[${MULTILIB_USEDEP}]
153 + >=net-misc/curl-7.24
154 + net-misc/iputils
155 + sys-apps/util-linux[${MULTILIB_USEDEP}]
156 + sys-libs/readline:0=
157 + >=virtual/libudev-175:=[${MULTILIB_USEDEP}]
158 + audit? ( sys-process/audit )
159 + bluetooth? ( >=net-wireless/bluez-5 )
160 + connection-sharing? (
161 + net-dns/dnsmasq[dbus,dhcp]
162 + net-firewall/iptables )
163 + consolekit? ( >=sys-auth/consolekit-1.0.0 )
164 + dhclient? ( >=net-misc/dhcp-4[client] )
165 + dhcpcd? ( net-misc/dhcpcd )
166 + elogind? ( >=sys-auth/elogind-219 )
167 + introspection? ( >=dev-libs/gobject-introspection-0.10.3:= )
168 + json? ( >=dev-libs/jansson-2.5[${MULTILIB_USEDEP}] )
169 + modemmanager? ( >=net-misc/modemmanager-0.7.991:0= )
170 + ncurses? ( >=dev-libs/newt-0.52.15 )
171 + nss? ( >=dev-libs/nss-3.11:=[${MULTILIB_USEDEP}] )
172 + !nss? ( gnutls? (
173 + dev-libs/libgcrypt:0=[${MULTILIB_USEDEP}]
174 + >=net-libs/gnutls-2.12:=[${MULTILIB_USEDEP}] ) )
175 + ofono? ( net-misc/ofono )
176 + ovs? ( dev-libs/jansson )
177 + ppp? ( >=net-dialup/ppp-2.4.5:=[ipv6] )
178 + resolvconf? ( net-dns/openresolv )
179 + selinux? ( sys-libs/libselinux )
180 + systemd? ( >=sys-apps/systemd-209:0= )
181 + teamd? (
182 + dev-libs/jansson
183 + >=net-misc/libteam-1.9
184 + )
185 +"
186 +RDEPEND="${COMMON_DEPEND}
187 + acct-group/plugdev
188 + || (
189 + net-misc/iputils[arping(+)]
190 + net-analyzer/arping
191 + )
192 + wifi? (
193 + !iwd? ( >=net-wireless/wpa_supplicant-0.7.3-r3[dbus] )
194 + iwd? ( net-wireless/iwd )
195 + )
196 +"
197 +DEPEND="${COMMON_DEPEND}
198 + dev-util/gdbus-codegen
199 + dev-util/glib-utils
200 + dev-util/gtk-doc-am
201 + >=dev-util/intltool-0.40
202 + >=sys-devel/gettext-0.17
203 + >=sys-kernel/linux-headers-3.18
204 + virtual/pkgconfig[${MULTILIB_USEDEP}]
205 + introspection? (
206 + $(python_gen_any_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]')
207 + dev-lang/perl
208 + dev-libs/libxslt
209 + )
210 + vala? ( $(vala_depend) )
211 + test? (
212 + $(python_gen_any_dep '
213 + dev-python/dbus-python[${PYTHON_USEDEP}]
214 + dev-python/pygobject:3[${PYTHON_USEDEP}]')
215 + )
216 +"
217 +
218 +PATCHES=(
219 + "${FILESDIR}"/${PN}-data-fix-the-ID_NET_DRIVER-udev-rule.patch
220 + "${FILESDIR}"/${PV}-iwd1-compat.patch # included in 1.21.3+
221 +)
222 +
223 +python_check_deps() {
224 + if use introspection; then
225 + has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]" || return
226 + fi
227 + if use test; then
228 + has_version "dev-python/dbus-python[${PYTHON_USEDEP}]" &&
229 + has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]"
230 + fi
231 +}
232 +
233 +sysfs_deprecated_check() {
234 + ebegin "Checking for SYSFS_DEPRECATED support"
235 +
236 + if { linux_chkconfig_present SYSFS_DEPRECATED_V2; }; then
237 + eerror "Please disable SYSFS_DEPRECATED_V2 support in your kernel config and recompile your kernel"
238 + eerror "or NetworkManager will not work correctly."
239 + eerror "See https://bugs.gentoo.org/333639 for more info."
240 + die "CONFIG_SYSFS_DEPRECATED_V2 support detected!"
241 + fi
242 + eend $?
243 +}
244 +
245 +pkg_pretend() {
246 + if use kernel_linux; then
247 + get_version
248 + if linux_config_exists; then
249 + sysfs_deprecated_check
250 + else
251 + ewarn "Was unable to determine your kernel .config"
252 + ewarn "Please note that if CONFIG_SYSFS_DEPRECATED_V2 is set in your kernel .config, NetworkManager will not work correctly."
253 + ewarn "See https://bugs.gentoo.org/333639 for more info."
254 + fi
255 +
256 + fi
257 +}
258 +
259 +pkg_setup() {
260 + if use connection-sharing; then
261 + if kernel_is lt 5 1; then
262 + CONFIG_CHECK="~NF_NAT_IPV4 ~NF_NAT_MASQUERADE_IPV4"
263 + else
264 + CONFIG_CHECK="~NF_NAT ~NF_NAT_MASQUERADE"
265 + fi
266 + linux-info_pkg_setup
267 + fi
268 + if use introspection || use test; then
269 + python-any-r1_pkg_setup
270 + fi
271 +}
272 +
273 +src_prepare() {
274 + DOC_CONTENTS="To modify system network connections without needing to enter the
275 + root password, add your user account to the 'plugdev' group."
276 +
277 + use vala && vala_src_prepare
278 + gnome2_src_prepare
279 +}
280 +
281 +multilib_src_configure() {
282 + local myconf=(
283 + --disable-more-warnings
284 + --disable-static
285 + --localstatedir=/var
286 + --disable-lto
287 + --disable-config-plugin-ibft
288 + --disable-qt
289 + --without-netconfig
290 + --with-dbus-sys-dir=/etc/dbus-1/system.d
291 + # We need --with-libnm-glib (and dbus-glib dep) as reverse deps are
292 + # still not ready for removing that lib, bug #665338
293 + --with-libnm-glib
294 + $(multilib_native_with nmcli)
295 + --with-udev-dir="$(get_udevdir)"
296 + --with-config-plugins-default=keyfile
297 + --with-iptables=/sbin/iptables
298 + --with-ebpf=yes
299 + $(multilib_native_enable concheck)
300 + --with-crypto=$(usex nss nss gnutls)
301 + --with-session-tracking=$(multilib_native_usex systemd systemd $(multilib_native_usex elogind elogind $(multilib_native_usex consolekit consolekit no)))
302 + # ConsoleKit has no build-time dependency, so use it as the default case.
303 + # There is no off switch, and we do not support upower.
304 + --with-suspend-resume=$(multilib_native_usex systemd systemd $(multilib_native_usex elogind elogind consolekit))
305 + $(multilib_native_use_with audit libaudit)
306 + $(multilib_native_use_enable bluetooth bluez5-dun)
307 + $(use_with dhclient)
308 + $(use_with dhcpcd)
309 + $(multilib_native_use_enable introspection)
310 + $(use_enable json json-validation)
311 + $(multilib_native_use_enable ppp)
312 + --without-libpsl
313 + $(multilib_native_use_with modemmanager modem-manager-1)
314 + $(multilib_native_use_with ncurses nmtui)
315 + $(multilib_native_use_with ofono)
316 + $(multilib_native_use_enable ovs)
317 + $(multilib_native_use_enable policykit polkit)
318 + $(multilib_native_use_enable policykit polkit-agent)
319 + $(multilib_native_use_with resolvconf)
320 + $(multilib_native_use_with selinux)
321 + $(multilib_native_use_with systemd systemd-journal)
322 + $(multilib_native_use_enable teamd teamdctl)
323 + $(multilib_native_use_enable test tests)
324 + $(multilib_native_use_enable vala)
325 + --without-valgrind
326 + $(multilib_native_use_with wifi iwd)
327 + $(multilib_native_use_with wext)
328 + $(multilib_native_use_enable wifi)
329 + )
330 +
331 + # Same hack as net-dialup/pptpd to get proper plugin dir for ppp, bug #519986
332 + if use ppp; then
333 + local PPPD_VER=`best_version net-dialup/ppp`
334 + PPPD_VER=${PPPD_VER#*/*-} #reduce it to ${PV}-${PR}
335 + PPPD_VER=${PPPD_VER%%[_-]*} # main version without beta/pre/patch/revision
336 + myconf+=( --with-pppd-plugin-dir=/usr/$(get_libdir)/pppd/${PPPD_VER} )
337 + fi
338 +
339 + # unit files directory needs to be passed only when systemd is enabled,
340 + # otherwise systemd support is not disabled completely, bug #524534
341 + use systemd && myconf+=( --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" )
342 +
343 + if multilib_is_native_abi; then
344 + # work-around man out-of-source brokenness, must be done before configure
345 + ln -s "${S}/docs" docs || die
346 + ln -s "${S}/man" man || die
347 + fi
348 +
349 + ECONF_SOURCE=${S} runstatedir="/run" gnome2_src_configure "${myconf[@]}"
350 +}
351 +
352 +multilib_src_compile() {
353 + if multilib_is_native_abi; then
354 + emake
355 + else
356 + local targets=(
357 + libnm/libnm.la
358 + libnm-util/libnm-util.la
359 + libnm-glib/libnm-glib.la
360 + libnm-glib/libnm-glib-vpn.la
361 + )
362 + emake "${targets[@]}"
363 + fi
364 +}
365 +
366 +multilib_src_test() {
367 + if use test && multilib_is_native_abi; then
368 + python_setup
369 + virtx emake check
370 + fi
371 +}
372 +
373 +multilib_src_install() {
374 + if multilib_is_native_abi; then
375 + # Install completions at proper place, bug #465100
376 + gnome2_src_install completiondir="$(get_bashcompdir)"
377 + insinto /usr/lib/NetworkManager/conf.d #702476
378 + doins "${S}"/examples/nm-conf.d/{30-anon,31-mac-addr-change}.conf
379 + else
380 + local targets=(
381 + install-libLTLIBRARIES
382 + install-libdeprecatedHEADERS
383 + install-libnm_glib_libnmvpnHEADERS
384 + install-libnm_glib_libnmincludeHEADERS
385 + install-libnm_util_libnm_util_includeHEADERS
386 + install-libnmincludeHEADERS
387 + install-nodist_libnm_glib_libnmincludeHEADERS
388 + install-nodist_libnm_glib_libnmvpnHEADERS
389 + install-nodist_libnm_util_libnm_util_includeHEADERS
390 + install-nodist_libnmincludeHEADERS
391 + install-pkgconfigDATA
392 + )
393 + emake DESTDIR="${D}" "${targets[@]}"
394 + fi
395 +}
396 +
397 +multilib_src_install_all() {
398 + einstalldocs
399 + ! use systemd && readme.gentoo_create_doc
400 +
401 + newinitd "${FILESDIR}/init.d.NetworkManager-r1" NetworkManager
402 + newconfd "${FILESDIR}/conf.d.NetworkManager" NetworkManager
403 +
404 + # Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scripts
405 + keepdir /etc/NetworkManager/dispatcher.d
406 +
407 + # Provide openrc net dependency only when nm is connected
408 + exeinto /etc/NetworkManager/dispatcher.d
409 + newexe "${FILESDIR}/10-openrc-status-r4" 10-openrc-status
410 + sed -e "s:@EPREFIX@:${EPREFIX}:g" \
411 + -i "${ED}/etc/NetworkManager/dispatcher.d/10-openrc-status" || die
412 +
413 + keepdir /etc/NetworkManager/system-connections
414 + chmod 0600 "${ED}"/etc/NetworkManager/system-connections/.keep* # bug #383765, upstream bug #754594
415 +
416 + # Allow users in plugdev group to modify system connections
417 + insinto /usr/share/polkit-1/rules.d/
418 + doins "${FILESDIR}/01-org.freedesktop.NetworkManager.settings.modify.system.rules"
419 +
420 + if use iwd; then
421 + # This goes to $nmlibdir/conf.d/ and $nmlibdir is '${prefix}'/lib/$PACKAGE, thus always lib, not get_libdir
422 + cat <<-EOF > "${ED%/}"/usr/lib/NetworkManager/conf.d/iwd.conf
423 + [device]
424 + wifi.backend=iwd
425 + EOF
426 + fi
427 +
428 + # Empty
429 + rmdir "${ED%/}"/var{/lib{/NetworkManager,},} || die
430 +}
431 +
432 +pkg_postinst() {
433 + gnome2_pkg_postinst
434 + systemd_reenable NetworkManager.service
435 + ! use systemd && readme.gentoo_print_elog
436 +
437 + if [[ -e "${EROOT}etc/NetworkManager/nm-system-settings.conf" ]]; then
438 + ewarn "The ${PN} system configuration file has moved to a new location."
439 + ewarn "You must migrate your settings from ${EROOT}/etc/NetworkManager/nm-system-settings.conf"
440 + ewarn "to ${EROOT}etc/NetworkManager/NetworkManager.conf"
441 + ewarn
442 + ewarn "After doing so, you can remove ${EROOT}etc/NetworkManager/nm-system-settings.conf"
443 + fi
444 +
445 + # NM fallbacks to plugin specified at compile time (upstream bug #738611)
446 + # but still show a warning to remember people to have cleaner config file
447 + if [[ -e "${EROOT}etc/NetworkManager/NetworkManager.conf" ]]; then
448 + if grep plugins "${EROOT}etc/NetworkManager/NetworkManager.conf" | grep -q ifnet; then
449 + ewarn
450 + ewarn "You seem to use 'ifnet' plugin in ${EROOT}etc/NetworkManager/NetworkManager.conf"
451 + ewarn "Since it won't be used, you will need to stop setting ifnet plugin there."
452 + ewarn
453 + fi
454 + fi
455 +
456 + # NM shows lots of errors making nmcli almost unusable, bug #528748 upstream bug #690457
457 + if grep -r "psk-flags=1" "${EROOT}"/etc/NetworkManager/; then
458 + ewarn "You have psk-flags=1 setting in above files, you will need to"
459 + ewarn "either reconfigure affected networks or, at least, set the flag"
460 + ewarn "value to '0'."
461 + fi
462 +}