Merge ~alfonsosanchezbeato/network-manager:add-wifi-ap-support into network-manager:snap-1.10

Proposed by Alfonso Sanchez-Beato
Status: Merged
Approved by: Tony Espy
Approved revision: 7e79ba7d7a32bb4747cddd37a04ebc7eeaac7b6d
Merged at revision: 4eaf370bc6c1944c3d40bfbe0d074cb0ff121044
Proposed branch: ~alfonsosanchezbeato/network-manager:add-wifi-ap-support
Merge into: network-manager:snap-1.10
Diff against target: 249 lines (+189/-1)
6 files modified
debian/patches/series (+1/-0)
debian/patches/set-ld-library-path-for-iptables.patch (+34/-0)
snap-common/bin/networkmanager (+5/-0)
snap-common/usr/share/doc/dnsmasq/copyright (+21/-0)
snap-patch/dnsmasq.patch (+102/-0)
snap/snapcraft.yaml (+26/-1)
Reviewer Review Type Date Requested Status
System Enablement Bot continuous-integration Approve
Sebastien Bacher Approve
Konrad Zapałowicz (community) Approve
Review via email: mp+369325@code.launchpad.net

Commit message

Add missing bits to enable sharing connections and be able to access points. Fixes LP: #1832494.

Description of the change

Add missing bits to enable sharing connections and be able to access points. Fixes LP: #1832494.

To post a comment you must log in.
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work, I'm not maintaining that snap/having real knowledge about it but since we want to consolidate the deb&snap packaging at some point I'm going to comment from that angle

Please don't add undocumented patches, set-ld-library-path-for-iptables.patch should have some header with a description on why the change is needed and references to upstream/downstream bugs as appropriate

It would be also good to describe if the patch would be acceptable for the deb and see if that's something can could be upstreamed in some way

review: Needs Fixing
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

@Sebastien thanks for the review, I will a description to the NM patch.

Re: deb, no, I do not think this patch should be used by the deb package, as what it does is making sure that iptables is able to locate the right libraries coming in the snap, which is not needed for the deb.

Revision history for this message
Konrad Zapałowicz (kzapalowicz) :
review: Approve
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Looks fine to me but I know little about the snap so it should probably get another review from someone who does understand it better and knows how to do the testing

review: Approve
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

@Sebastien, well, that was already done by Konrad :)

Note also that automatic tests are passing: https://jenkins.canonical.com/system-enablement/job/snappy-hwe-snaps-snap-test/2205/console

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/patches/series b/debian/patches/series
index 3267d3c..3b31e47 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -17,3 +17,4 @@ disable-libnm-glib-test-devices-array.patch
17add-snap-support.patch17add-snap-support.patch
18disable-tests-that-fail-under-launchpad-builds.patch18disable-tests-that-fail-under-launchpad-builds.patch
19snap-support-ppp.patch19snap-support-ppp.patch
20set-ld-library-path-for-iptables.patch
diff --git a/debian/patches/set-ld-library-path-for-iptables.patch b/debian/patches/set-ld-library-path-for-iptables.patch
20new file mode 10064421new file mode 100644
index 0000000..065816c
--- /dev/null
+++ b/debian/patches/set-ld-library-path-for-iptables.patch
@@ -0,0 +1,34 @@
1From: =?UTF-8?q?Alfonso=20S=C3=A1nchez-Beato?= <alfonso.sanchez-beato@canonical.com>
2Date: Thu, 18 Jul 2019 17:48:39 +0200
3Subject: [PATCH] snap: pass NM env vars when calling iptables
4
5This is necessary so LD_LIBRARY_PATH is passed down to iptables so it is
6able to find the libraries included in the snap package.
7---
8 src/nm-act-request.c | 3 +--
9 1 file changed, 1 insertion(+), 2 deletions(-)
10
11diff --git a/src/nm-act-request.c b/src/nm-act-request.c
12index 87070794..bcf3e0bb 100644
13--- a/src/nm-act-request.c
14+++ b/src/nm-act-request.c
15@@ -309,7 +309,6 @@ nm_act_request_set_shared (NMActRequest *req, gboolean shared)
16 /* Send the rules to iptables */
17 for (iter = list; iter; iter = g_slist_next (iter)) {
18 ShareRule *rule = (ShareRule *) iter->data;
19- char *envp[1] = { NULL };
20 gs_strfreev char **argv = NULL;
21 gs_free char *cmd = NULL;
22
23@@ -327,7 +326,7 @@ nm_act_request_set_shared (NMActRequest *req, gboolean shared)
24 GError *error = NULL;
25
26 nm_log_info (LOGD_SHARING, "Executing: %s", cmd);
27- if (!g_spawn_sync ("/", argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
28+ if (!g_spawn_sync ("/", argv, NULL, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
29 NULL, NULL, NULL, NULL, &status, &error)) {
30 nm_log_warn (LOGD_SHARING, "Error executing command: %s",
31 error->message);
32--
332.17.1
34
diff --git a/snap-common/bin/networkmanager b/snap-common/bin/networkmanager
index 0ee19a1..bb8131b 100755
--- a/snap-common/bin/networkmanager
+++ b/snap-common/bin/networkmanager
@@ -31,6 +31,11 @@ mkdir -p "$SNAP_DATA"/conf.d
31mkdir -p "$SNAP_DATA"/state31mkdir -p "$SNAP_DATA"/state
32mkdir -p "$SNAP_DATA"/state/dhcp32mkdir -p "$SNAP_DATA"/state/dhcp
3333
34# Folders needed by dnsmasq
35mkdir -p "$SNAP_DATA"/var/lib/misc
36mkdir -p "$SNAP_DATA"/etc
37mkdir -p "$SNAP_DATA"/var/run
38
34# Apply current snapctl settings39# Apply current snapctl settings
35. "$SNAP"/bin/snap-config.sh40. "$SNAP"/bin/snap-config.sh
36apply_snap_config41apply_snap_config
diff --git a/snap-common/usr/share/doc/dnsmasq/copyright b/snap-common/usr/share/doc/dnsmasq/copyright
37new file mode 10064442new file mode 100644
index 0000000..d516e43
--- /dev/null
+++ b/snap-common/usr/share/doc/dnsmasq/copyright
@@ -0,0 +1,21 @@
1dnsmasq is Copyright (c) 2000-2018 Simon Kelley
2
3It was downloaded from: http://www.thekelleys.org.uk/dnsmasq/
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 dated June, 1991, or
8 (at your option) version 3 dated 29 June, 2007.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15On Debian GNU/Linux systems, the text of the GNU general public license is
16available in the file /usr/share/common-licenses/GPL-2 or
17/usr/share/common-licenses/GPL-3
18
19The Debian package of dnsmasq was created by Simon Kelley with assistance
20from Lars Bahner.
21
diff --git a/snap-patch/dnsmasq.patch b/snap-patch/dnsmasq.patch
0new file mode 10064422new file mode 100644
index 0000000..fbd6904
--- /dev/null
+++ b/snap-patch/dnsmasq.patch
@@ -0,0 +1,102 @@
1From 8e829e18fc739f05b1a25cc40ce1722f65831950 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Alfonso=20S=C3=A1nchez-Beato?=
3 <alfonso.sanchez-beato@canonical.com>
4Date: Tue, 25 Jun 2019 17:36:41 +0200
5Subject: [PATCH] snap: do not tinker with uid/gid, change fixed paths
6
7---
8 src/config.h | 6 +++---
9 src/dnsmasq.c | 30 +++++++++++++++---------------
10 2 files changed, 18 insertions(+), 18 deletions(-)
11
12diff --git a/src/config.h b/src/config.h
13index ecefb87..25b92ba 100644
14--- a/src/config.h
15+++ b/src/config.h
16@@ -190,7 +190,7 @@ RESOLVFILE
17 # elif defined(__ANDROID__)
18 # define LEASEFILE "/data/misc/dhcp/dnsmasq.leases"
19 # else
20-# define LEASEFILE "/var/lib/misc/dnsmasq.leases"
21+# define LEASEFILE "/var/snap/network-manager/current/var/lib/misc/dnsmasq.leases"
22 # endif
23 #endif
24
25@@ -198,7 +198,7 @@ RESOLVFILE
26 # if defined(__FreeBSD__)
27 # define CONFFILE "/usr/local/etc/dnsmasq.conf"
28 # else
29-# define CONFFILE "/etc/dnsmasq.conf"
30+# define CONFFILE "/var/snap/network-manager/current/etc/dnsmasq.conf"
31 # endif
32 #endif
33
34@@ -214,7 +214,7 @@ RESOLVFILE
35 # if defined(__ANDROID__)
36 # define RUNFILE "/data/dnsmasq.pid"
37 # else
38-# define RUNFILE "/var/run/dnsmasq.pid"
39+# define RUNFILE "/var/snap/network-manager/current/var/run/dnsmasq.pid"
40 # endif
41 #endif
42
43diff --git a/src/dnsmasq.c b/src/dnsmasq.c
44index ce44809..17c451b 100644
45--- a/src/dnsmasq.c
46+++ b/src/dnsmasq.c
47@@ -548,8 +548,8 @@ int main (int argc, char **argv)
48 of the directory containing the file. That directory will
49 need to by owned by the dnsmasq user, and the ownership of the
50 file has to match, to keep systemd >273 happy. */
51- if (getuid() == 0 && ent_pw && ent_pw->pw_uid != 0 && fchown(fd, ent_pw->pw_uid, ent_pw->pw_gid) == -1)
52- chown_warn = errno;
53+ /* if (getuid() == 0 && ent_pw && ent_pw->pw_uid != 0 && fchown(fd, ent_pw->pw_uid, ent_pw->pw_gid) == -1) */
54+ /* chown_warn = errno; */
55
56 if (!read_write(fd, (unsigned char *)daemon->namebuff, strlen(daemon->namebuff), 0))
57 err = 1;
58@@ -595,16 +595,16 @@ int main (int argc, char **argv)
59 if (!option_bool(OPT_DEBUG) && getuid() == 0)
60 {
61 int bad_capabilities = 0;
62- gid_t dummy;
63+ /* gid_t dummy; */
64
65 /* remove all supplementary groups */
66- if (gp &&
67- (setgroups(0, &dummy) == -1 ||
68- setgid(gp->gr_gid) == -1))
69- {
70- send_event(err_pipe[1], EVENT_GROUP_ERR, errno, daemon->groupname);
71- _exit(0);
72- }
73+ /* if (gp && */
74+ /* (setgroups(0, &dummy) == -1 || */
75+ /* setgid(gp->gr_gid) == -1)) */
76+ /* { */
77+ /* send_event(err_pipe[1], EVENT_GROUP_ERR, errno, daemon->groupname); */
78+ /* _exit(0); */
79+ /* } */
80
81 if (ent_pw && ent_pw->pw_uid != 0)
82 {
83@@ -654,11 +654,11 @@ int main (int argc, char **argv)
84 }
85
86 /* finally drop root */
87- if (setuid(ent_pw->pw_uid) == -1)
88- {
89- send_event(err_pipe[1], EVENT_USER_ERR, errno, daemon->username);
90- _exit(0);
91- }
92+ /* if (setuid(ent_pw->pw_uid) == -1) */
93+ /* { */
94+ /* send_event(err_pipe[1], EVENT_USER_ERR, errno, daemon->username); */
95+ /* _exit(0); */
96+ /* } */
97
98 #ifdef HAVE_LINUX_NETWORK
99 if (is_dad_listeners() || option_bool(OPT_CLEVERBIND))
100--
1012.17.1
102
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index da71965..7480dc5 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -50,11 +50,35 @@ apps:
50 command: bin/networkmanager50 command: bin/networkmanager
51 daemon: simple51 daemon: simple
52 slots: [service]52 slots: [service]
53 plugs: [modem-manager, ppp, network-setup-observe, wpa, firewall-control, hardware-observe]53 plugs: [modem-manager, ppp, network-setup-observe, wpa, firewall-control, hardware-observe, kernel-module-control]
54
55layout:
56 /usr/lib/x86_64-linux-gnu/xtables:
57 bind: $SNAP/usr/lib/x86_64-linux-gnu/xtables
58
54parts:59parts:
55 networkmanager-common:60 networkmanager-common:
56 plugin: dump61 plugin: dump
57 source: snap-common62 source: snap-common
63
64 dnsmasq:
65 plugin: make
66 source: https://git.launchpad.net/ubuntu/+source/dnsmasq
67 source-type: git
68 source-branch: applied/ubuntu/bionic
69 build-packages:
70 - build-essential
71 make-parameters:
72 - PREFIX=/
73 override-build: |
74 git apply ../../../snap-patch/dnsmasq.patch
75 snapcraftctl build
76 filesets:
77 binaries:
78 - sbin/dnsmasq
79 prime:
80 - $binaries
81
58 #82 #
59 # TODO: investigate whether this HACK is still needed. The script83 # TODO: investigate whether this HACK is still needed. The script
60 # dhcp-lease-mover relies on inotifywait to determine if any DHCP84 # dhcp-lease-mover relies on inotifywait to determine if any DHCP
@@ -288,6 +312,7 @@ parts:
288 - usr/lib/*/libteamdctl*312 - usr/lib/*/libteamdctl*
289 - usr/lib/*/libwind*313 - usr/lib/*/libwind*
290 - usr/lib/*/libxtables*314 - usr/lib/*/libxtables*
315 - usr/lib/*/xtables/*
291 unwanted:316 unwanted:
292 # We don't use dhclient so we don't need this helper317 # We don't use dhclient so we don't need this helper
293 - -usr/lib/NetworkManager/nm-dhcp-helper318 - -usr/lib/NetworkManager/nm-dhcp-helper

Subscribers

People subscribed via source and target branches