Alfonso Sanchez-Beato has proposed merging 
~alfonsosanchezbeato/network-manager:add-wifi-ap-support into 
network-manager:snap-1.10.

Commit message:
Add missing bits to enable sharing connections and be able to access points.

Requested reviews:
  Network-manager (network-manager)

For more details, see:
https://code.launchpad.net/~alfonsosanchezbeato/network-manager/+git/network-manager/+merge/369325

Add missing bits to enable sharing connections and be able to access points.
-- 
Your team Network-manager is requested to review the proposed merge of 
~alfonsosanchezbeato/network-manager:add-wifi-ap-support into 
network-manager:snap-1.10.
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
 add-snap-support.patch
 disable-tests-that-fail-under-launchpad-builds.patch
 snap-support-ppp.patch
+set-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
new file mode 100644
index 0000000..ececb61
--- /dev/null
+++ b/debian/patches/set-ld-library-path-for-iptables.patch
@@ -0,0 +1,21 @@
+diff --git a/src/nm-act-request.c b/src/nm-act-request.c
+index 87070794..bcf3e0bb 100644
+--- a/src/nm-act-request.c
++++ b/src/nm-act-request.c
+@@ -309,7 +309,6 @@ nm_act_request_set_shared (NMActRequest *req, gboolean shared)
+ 	/* Send the rules to iptables */
+ 	for (iter = list; iter; iter = g_slist_next (iter)) {
+ 		ShareRule *rule = (ShareRule *) iter->data;
+-		char *envp[1] = { NULL };
+ 		gs_strfreev char **argv = NULL;
+ 		gs_free char *cmd = NULL;
+ 
+@@ -327,7 +326,7 @@ nm_act_request_set_shared (NMActRequest *req, gboolean shared)
+ 			GError *error = NULL;
+ 
+ 			nm_log_info (LOGD_SHARING, "Executing: %s", cmd);
+-			if (!g_spawn_sync ("/", argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
++			if (!g_spawn_sync ("/", argv, NULL, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
+ 			                   NULL, NULL, NULL, NULL, &status, &error)) {
+ 				nm_log_warn (LOGD_SHARING, "Error executing command: %s",
+ 				             error->message);
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
 mkdir -p "$SNAP_DATA"/state
 mkdir -p "$SNAP_DATA"/state/dhcp
 
+# Folders needed by dnsmasq
+mkdir -p "$SNAP_DATA"/var/lib/misc
+mkdir -p "$SNAP_DATA"/etc
+mkdir -p "$SNAP_DATA"/var/run
+
 # Apply current snapctl settings
 . "$SNAP"/bin/snap-config.sh
 apply_snap_config
diff --git a/snap-common/usr/share/doc/dnsmasq/copyright b/snap-common/usr/share/doc/dnsmasq/copyright
new file mode 100644
index 0000000..d516e43
--- /dev/null
+++ b/snap-common/usr/share/doc/dnsmasq/copyright
@@ -0,0 +1,21 @@
+dnsmasq is Copyright (c) 2000-2018 Simon Kelley
+
+It was downloaded from: http://www.thekelleys.org.uk/dnsmasq/
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 dated June, 1991, or
+   (at your option) version 3 dated 29 June, 2007.
+ 
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+On Debian GNU/Linux systems, the text of the GNU general public license is 
+available in the file /usr/share/common-licenses/GPL-2 or 
+/usr/share/common-licenses/GPL-3
+
+The Debian package of dnsmasq was created by Simon Kelley with assistance 
+from Lars Bahner.
+
diff --git a/snap-patch/dnsmasq.patch b/snap-patch/dnsmasq.patch
new file mode 100644
index 0000000..fbd6904
--- /dev/null
+++ b/snap-patch/dnsmasq.patch
@@ -0,0 +1,102 @@
+From 8e829e18fc739f05b1a25cc40ce1722f65831950 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alfonso=20S=C3=A1nchez-Beato?=
+ <[email protected]>
+Date: Tue, 25 Jun 2019 17:36:41 +0200
+Subject: [PATCH] snap: do not tinker with uid/gid, change fixed paths
+
+---
+ src/config.h  |  6 +++---
+ src/dnsmasq.c | 30 +++++++++++++++---------------
+ 2 files changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/src/config.h b/src/config.h
+index ecefb87..25b92ba 100644
+--- a/src/config.h
++++ b/src/config.h
+@@ -190,7 +190,7 @@ RESOLVFILE
+ #   elif defined(__ANDROID__)
+ #      define LEASEFILE "/data/misc/dhcp/dnsmasq.leases"
+ #   else
+-#      define LEASEFILE "/var/lib/misc/dnsmasq.leases"
++#      define LEASEFILE "/var/snap/network-manager/current/var/lib/misc/dnsmasq.leases"
+ #   endif
+ #endif
+ 
+@@ -198,7 +198,7 @@ RESOLVFILE
+ #   if defined(__FreeBSD__)
+ #      define CONFFILE "/usr/local/etc/dnsmasq.conf"
+ #   else
+-#      define CONFFILE "/etc/dnsmasq.conf"
++#      define CONFFILE "/var/snap/network-manager/current/etc/dnsmasq.conf"
+ #   endif
+ #endif
+ 
+@@ -214,7 +214,7 @@ RESOLVFILE
+ #   if defined(__ANDROID__)
+ #      define RUNFILE "/data/dnsmasq.pid"
+ #    else
+-#      define RUNFILE "/var/run/dnsmasq.pid"
++#      define RUNFILE "/var/snap/network-manager/current/var/run/dnsmasq.pid"
+ #    endif
+ #endif
+ 
+diff --git a/src/dnsmasq.c b/src/dnsmasq.c
+index ce44809..17c451b 100644
+--- a/src/dnsmasq.c
++++ b/src/dnsmasq.c
+@@ -548,8 +548,8 @@ int main (int argc, char **argv)
+ 		 of the directory containing the file. That directory will
+ 		 need to by owned by the dnsmasq user, and the ownership of the
+ 		 file has to match, to keep systemd >273 happy. */
+-	      if (getuid() == 0 && ent_pw && ent_pw->pw_uid != 0 && fchown(fd, ent_pw->pw_uid, ent_pw->pw_gid) == -1)
+-		chown_warn = errno;
++	      /* if (getuid() == 0 && ent_pw && ent_pw->pw_uid != 0 && fchown(fd, ent_pw->pw_uid, ent_pw->pw_gid) == -1) */
++	      /*   chown_warn = errno; */
+ 
+ 	      if (!read_write(fd, (unsigned char *)daemon->namebuff, strlen(daemon->namebuff), 0))
+ 		err = 1;
+@@ -595,16 +595,16 @@ int main (int argc, char **argv)
+   if (!option_bool(OPT_DEBUG) && getuid() == 0)   
+     {
+       int bad_capabilities = 0;
+-      gid_t dummy;
++      /* gid_t dummy; */
+       
+       /* remove all supplementary groups */
+-      if (gp && 
+-	  (setgroups(0, &dummy) == -1 ||
+-	   setgid(gp->gr_gid) == -1))
+-	{
+-	  send_event(err_pipe[1], EVENT_GROUP_ERR, errno, daemon->groupname);
+-	  _exit(0);
+-	}
++      /* if (gp &&  */
++      /*     (setgroups(0, &dummy) == -1 || */
++      /*      setgid(gp->gr_gid) == -1)) */
++      /*   { */
++      /*     send_event(err_pipe[1], EVENT_GROUP_ERR, errno, daemon->groupname); */
++      /*     _exit(0); */
++      /*   } */
+   
+       if (ent_pw && ent_pw->pw_uid != 0)
+ 	{     
+@@ -654,11 +654,11 @@ int main (int argc, char **argv)
+ 	    }
+ 	  
+ 	  /* finally drop root */
+-	  if (setuid(ent_pw->pw_uid) == -1)
+-	    {
+-	      send_event(err_pipe[1], EVENT_USER_ERR, errno, daemon->username);
+-	      _exit(0);
+-	    }     
++	  /* if (setuid(ent_pw->pw_uid) == -1) */
++	  /*   { */
++	  /*     send_event(err_pipe[1], EVENT_USER_ERR, errno, daemon->username); */
++	  /*     _exit(0); */
++	  /*   }      */
+ 
+ #ifdef HAVE_LINUX_NETWORK
+ 	  if (is_dad_listeners() || option_bool(OPT_CLEVERBIND))
+-- 
+2.17.1
+
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:
     command: bin/networkmanager
     daemon: simple
     slots: [service]
-    plugs: [modem-manager, ppp, network-setup-observe, wpa, firewall-control, hardware-observe]
+    plugs: [modem-manager, ppp, network-setup-observe, wpa, firewall-control, hardware-observe, kernel-module-control]
+
+layout:
+  /usr/lib/x86_64-linux-gnu/xtables:
+    bind: $SNAP/usr/lib/x86_64-linux-gnu/xtables
+
 parts:
   networkmanager-common:
     plugin: dump
     source: snap-common
+
+  dnsmasq:
+    plugin: make
+    source: https://git.launchpad.net/ubuntu/+source/dnsmasq
+    source-type: git
+    source-branch: applied/ubuntu/bionic
+    build-packages:
+      - build-essential
+    make-parameters:
+      - PREFIX=/
+    override-build: |
+      git apply ../../../snap-patch/dnsmasq.patch
+      snapcraftctl build
+    filesets:
+      binaries:
+        - sbin/dnsmasq
+    prime:
+      - $binaries
+
   #
   # TODO: investigate whether this HACK is still needed. The script
   # dhcp-lease-mover relies on inotifywait to determine if any DHCP
@@ -288,6 +312,7 @@ parts:
         - usr/lib/*/libteamdctl*
         - usr/lib/*/libwind*
         - usr/lib/*/libxtables*
+        - usr/lib/*/xtables/*
       unwanted:
         # We don't use dhclient so we don't need this helper
         - -usr/lib/NetworkManager/nm-dhcp-helper
-- 
ubuntu-desktop mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

Reply via email to