Merge ~vorlon/ubuntu/+source/ifupdown:ubuntu/devel into ubuntu/+source/ifupdown:ubuntu/devel

Proposed by Steve Langasek
Status: Needs review
Proposed branch: ~vorlon/ubuntu/+source/ifupdown:ubuntu/devel
Merge into: ubuntu/+source/ifupdown:ubuntu/devel
Diff against target: 202 lines (+153/-1)
6 files modified
debian/changelog (+18/-0)
debian/control (+1/-1)
debian/ifupdown.dhclient-enter-hook (+20/-0)
debian/ifupdown.dhclient-exit-hook (+110/-0)
debian/ifupdown.maintscript (+1/-0)
debian/install (+3/-0)
Reviewer Review Type Date Requested Status
Dimitri John Ledkov (community) code-review Approve
Review via email: mp+382729@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) wrote :

We will also need a corresponding upload of resolvconf, and we will also need to SRU systemd asap to remove its dhclient hook from the package, then add appropriate breaks in various places.

2a6b134... by Steve Langasek

add bug link

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

code-review is good. Some minor comments.

will proceed to test builds & interactive testing.

review: Approve (code-review)
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Do we need any breaks/reaplaces on systemd? or like just drop conffile in systemd too?

Revision history for this message
Steve Langasek (vorlon) wrote :

On Thu, Apr 23, 2020 at 02:11:15PM -0000, Dimitri John Ledkov wrote:

> Do we need any breaks/reaplaces on systemd? or like just drop conffile in
> systemd too?

Yes we should, but we don't know the versions to use in the field until
systemd is uploaded.

>
> Diff comments:
>
> > diff --git a/debian/ifupdown.maintscript b/debian/ifupdown.maintscript
> > index 2203f84..11fd04c 100644
> > --- a/debian/ifupdown.maintscript
> > +++ b/debian/ifupdown.maintscript
> > @@ -7,3 +7,4 @@ rm_conffile /etc/init/network-interface-security.conf 0.8.25~ ifupdown
> > rm_conffile /etc/init/network-interface.conf 0.8.25~ ifupdown
> > rm_conffile /etc/network/if-up.d/upstart 0.8.29~ ifupdown
> > rm_conffile /etc/network/if-down.d/upstart 0.8.29~ ifupdown
> > +rm_conffile /etc/dhcp/dhclient-enter-hooks.d/resolved 0.8.35ubuntu2 systemd

> Given we do this, we need to also want systemd upload to remove the
> conffile there too, right?

Yes, definitely (and that determines what versions should be in the Breaks
field).

Unmerged commits

2a6b134... by Steve Langasek

add bug link

1528925... by Steve Langasek

suppress noise from cmp

509311f... by Steve Langasek

Make the exit hook also talk to resolved over dbus in the case that it is already running.

7c20bf9... by Steve Langasek

fix wrong shell quoting in state files

8dec9ea... by Steve Langasek

Split the hook into an enter and exit hook, using the enter hook only to undefine the hostile make_resolv_conf() and doing all the work in the exit hook.

add6bd1... by Steve Langasek

Make the hook write to a state file under /run/systemd/resolve/netif instead of feeding resolvconf.

20c8542... by Steve Langasek

resolved, not resolvconf

36e9f32... by Steve Langasek

Check whether the systemd-resolved unit is enabled before diverting resolv.conf handling, instead of just whether systemd-resolved binary is on the filesystem. LP: #1853164.

a64658f... by Steve Langasek

resolved, not resolvconf

c89d93b... by Steve Langasek

* Take over /etc/dhcp/dhclient-enter-hooks.d/resolved from systemd and move
  it to /etc/dhcp/dhclient-enter-hooks.d/ifupdown.
* Build-depend on dh-exec to support renaming files at install time.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 123923e..23379e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
1ifupdown (0.8.35ubuntu2) UNRELEASED; urgency=medium
2
3 * Take over /etc/dhcp/dhclient-enter-hooks.d/resolved from systemd and
4 move it to /etc/dhcp/dhclient-enter-hooks.d/ifupdown. LP: #1874337.
5 * Build-depend on dh-exec to support renaming files at install time.
6 * Check whether the systemd-resolved unit is enabled before diverting
7 resolv.conf handling, instead of just whether systemd-resolved binary is
8 on the filesystem. LP: #1853164.
9 * Make the hook write to a state file under /run/systemd/resolve/netif
10 instead of feeding resolvconf.
11 * Split the hook into an enter and exit hook, using the enter hook only to
12 undefine the hostile make_resolv_conf() and doing all the work in the
13 exit hook.
14 * Make the exit hook also talk to resolved over dbus in the case that
15 it is already running.
16
17 -- Steve Langasek <steve.langasek@ubuntu.com> Tue, 21 Apr 2020 21:58:37 -0700
18
1ifupdown (0.8.35ubuntu1) eoan; urgency=low19ifupdown (0.8.35ubuntu1) eoan; urgency=low
220
3 * Merge from Debian unstable. Remaining changes:21 * Merge from Debian unstable. Remaining changes:
diff --git a/debian/control b/debian/control
index 71b2df6..50662d8 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: important
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5XSBC-Original-Maintainer: Guus Sliepen <guus@debian.org>5XSBC-Original-Maintainer: Guus Sliepen <guus@debian.org>
6Standards-Version: 4.3.06Standards-Version: 4.3.0
7Build-Depends: debhelper-compat (= 12)7Build-Depends: debhelper-compat (= 12), dh-exec
8Vcs-Git: https://salsa.debian.org/debian/ifupdown.git8Vcs-Git: https://salsa.debian.org/debian/ifupdown.git
9Vcs-Browser: https://salsa.debian.org/debian/ifupdown9Vcs-Browser: https://salsa.debian.org/debian/ifupdown
10Rules-Requires-Root: no10Rules-Requires-Root: no
diff --git a/debian/ifupdown.dhclient-enter-hook b/debian/ifupdown.dhclient-enter-hook
11new file mode 10075511new file mode 100755
index 0000000..ac75532
--- /dev/null
+++ b/debian/ifupdown.dhclient-enter-hook
@@ -0,0 +1,20 @@
1#
2# Script fragment to make dhclient supply nameserver information to resolved
3#
4
5# Tips:
6# * Be careful about changing the environment since this is sourced
7# * This script fragment uses bash features
8# * As of isc-dhcp-client 4.2 the "reason" (for running the script) can be one of the following.
9# (Listed on man page:) MEDIUM(0) PREINIT(0) BOUND(M) RENEW(M) REBIND(M) REBOOT(M) EXPIRE(D) FAIL(D) RELEASE(D) STOP(D) NBI(-) TIMEOUT(M)
10# (Also used in master script:) ARPCHECK(0), ARPSEND(0)
11# (Also used in master script:) PREINIT6(0) BOUND6(M) RENEW6(M) REBIND6(M) DEPREF6(0) EXPIRE6(D) RELEASE6(D) STOP6(D)
12# (0) = master script does not run make_resolv_conf
13# (M) = master script runs make_resolv_conf
14# (D) = master script downs interface
15# (-) = master script does nothing with this
16
17if systemctl is-enabled systemd-resolved > /dev/null 2>&1; then
18 # For safety, undefine the nasty default make_resolv_conf()
19 make_resolv_conf() { : ; }
20 fi
diff --git a/debian/ifupdown.dhclient-exit-hook b/debian/ifupdown.dhclient-exit-hook
0new file mode 10075521new file mode 100755
index 0000000..15d2740
--- /dev/null
+++ b/debian/ifupdown.dhclient-exit-hook
@@ -0,0 +1,110 @@
1#
2# Script fragment to make dhclient supply nameserver information to resolved
3#
4
5# Tips:
6# * Be careful about changing the environment since this is sourced
7# * This script fragment uses bash features
8# * As of isc-dhcp-client 4.2 the "reason" (for running the script) can be one of the following.
9# (Listed on man page:) MEDIUM(0) PREINIT(0) BOUND(M) RENEW(M) REBIND(M) REBOOT(M) EXPIRE(D) FAIL(D) RELEASE(D) STOP(D) NBI(-) TIMEOUT(M)
10# (Also used in master script:) ARPCHECK(0), ARPSEND(0)
11# (Also used in master script:) PREINIT6(0) BOUND6(M) RENEW6(M) REBIND6(M) DEPREF6(0) EXPIRE6(D) RELEASE6(D) STOP6(D)
12# (0) = master script does not run make_resolv_conf
13# (M) = master script runs make_resolv_conf
14# (D) = master script downs interface
15# (-) = master script does nothing with this
16
17if systemctl is-enabled systemd-resolved > /dev/null 2>&1; then
18 local mystatedir statedir ifindex all_domain_servers
19
20 if [ ! "$interface" ] ; then
21 return
22 fi
23 ifindex=$(cat "/sys/class/net/$interface/ifindex")
24 if [ ! "$ifindex" ]; then
25 return
26 fi
27 mystatedir=/run/network
28 mkdir -p $mystatedir
29
30 statedir=/run/systemd/resolve/netif
31 mkdir -p $statedir
32
33 local oldstate="$(mktemp)"
34 # ignore errors due to nonexistent file
35 md5sum "$mystatedir/isc-dhcp-v4-$interface" "$mystatedir/isc-dhcp-v6-interface" > "$oldstate" 2> /dev/null || true
36
37 case "$reason" in
38 BOUND|RENEW|REBIND|REBOOT|TIMEOUT|BOUND6|RENEW6|REBIND6)
39 if [ -n "$new_domain_name_servers" ] ; then
40 cat <<EOF >"$mystatedir/isc-dhcp-v4-$interface"
41DNS="$new_domain_name_servers"
42EOF
43 if [ -n "$new_domain_name" ] || [ -n "$new_domain_search" ] ; then
44 cat <<EOF >>"$mystatedir/isc-dhcp-v4-$interface"
45DOMAINS="$new_domain_search $new_domain_name"
46EOF
47 fi
48 fi
49 if [ -n "$new_dhcp6_name_servers" ] ; then
50 cat <<EOF >"$mystatedir/isc-dhcp-v6-$interface"
51DNS6="$new_dhcp6_name_servers"
52EOF
53 if [ -n "$new_dhcp6_domain_search" ] ; then
54 cat <<EOF >>"$mystatedir/isc-dhcp-v6-$interface"
55DOMAINS6="$new_dhcp6_domain_search"
56EOF
57 fi
58 fi
59 ;;
60
61 EXPIRE|FAIL|RELEASE|STOP)
62 rm -f "/run/network/isc-dhcp-v4-$interface"
63 ;;
64 EXPIRE6|RELEASE6|STOP6)
65 rm -f "/run/network/isc-dhcp-v6-$interface"
66 ;;
67 esac
68
69 local newstate="$(mktemp)"
70 # ignore errors due to nonexistent file
71 md5sum "$mystatedir/isc-dhcp-v4-$interface" "$mystatedir/isc-dhcp-v6-$interface" > "$newstate" 2> /dev/null || true
72 if ! cmp "$oldstate" "$newstate" 2>/dev/null; then
73 local DNS DNS6 DOMAINS DOMAINS6
74 if [ -e "$mystatedir/isc-dhcp-v4-$interface" ]; then
75 . "$mystatedir/isc-dhcp-v4-$interface"
76 fi
77 if [ -e "$mystatedir/isc-dhcp-v6-$interface" ]; then
78 . "$mystatedir/isc-dhcp-v6-$interface"
79 fi
80
81 all_domain_servers="${DNS:+$DNS }$DNS6"
82 if [ -n "$all_domain_servers" ] ; then
83 cat <<EOF >"$statedir/$ifindex"
84# This is private data. Do not parse.
85LLMNR=yes
86MDNS=no
87SERVERS=$all_domain_servers
88DOMAINS=~. $DOMAINS $DOMAINS6
89EOF
90
91 # In addition to creating the state file (needed if we run before
92 # resolved is started), also feed the information directly to
93 # resolved.
94 if systemctl --quiet is-active systemd-resolved; then
95 resolvectl llmnr "$ifindex" yes
96 resolvectl mdns "$ifindex" no
97 resolvectl domain "$ifindex" ~. $DOMAINS $DOMAINS6
98 resolvectl dns "$ifindex" $all_domain_servers
99 fi
100 else
101 rm -f "$statedir/$ifindex"
102 if systemctl --quiet is-active systemd-resolved; then
103 resolvectl domain "$ifindex" ~.
104 resolvectl dns "$ifindex" ""
105 fi
106 fi
107
108 rm "$oldstate" "$newstate"
109 fi
110fi
diff --git a/debian/ifupdown.maintscript b/debian/ifupdown.maintscript
index 2203f84..11fd04c 100644
--- a/debian/ifupdown.maintscript
+++ b/debian/ifupdown.maintscript
@@ -7,3 +7,4 @@ rm_conffile /etc/init/network-interface-security.conf 0.8.25~ ifupdown
7rm_conffile /etc/init/network-interface.conf 0.8.25~ ifupdown7rm_conffile /etc/init/network-interface.conf 0.8.25~ ifupdown
8rm_conffile /etc/network/if-up.d/upstart 0.8.29~ ifupdown8rm_conffile /etc/network/if-up.d/upstart 0.8.29~ ifupdown
9rm_conffile /etc/network/if-down.d/upstart 0.8.29~ ifupdown9rm_conffile /etc/network/if-down.d/upstart 0.8.29~ ifupdown
10rm_conffile /etc/dhcp/dhclient-enter-hooks.d/resolved 0.8.35ubuntu2 systemd
diff --git a/debian/install b/debian/install
10old mode 10064411old mode 100644
11new mode 10075512new mode 100755
index e8c928b..e288c72
--- a/debian/install
+++ b/debian/install
@@ -1,2 +1,5 @@
1#!/usr/bin/dh-exec
1contrib/* usr/share/doc/ifupdown/contrib2contrib/* usr/share/doc/ifupdown/contrib
2debian/ifupdown-hotplug lib/udev3debian/ifupdown-hotplug lib/udev
4debian/ifupdown.dhclient-enter-hook => etc/dhcp/dhclient-enter-hooks.d/ifupdown
5debian/ifupdown.dhclient-exit-hook => etc/dhcp/dhclient-exit-hooks.d/ifupdown

Subscribers

People subscribed via source and target branches