Package: isc-dhcp
Version: 4.3.3-5
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu artful ubuntu-patch

Dear Maintainer,

Please consider the included patch to fix the problem described below
and in Ubuntu bug report:
https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1664352

As things stand a routing metric configured in /etc/network/interfaces
is applied when the "option routers" value received from DHCP is used to
create a route but when "option classless-static-routes" values are
received the configured metric is ignored. If a system has more than one
network interface providing the same route, for example two interfaces
both providing a default route this 'metric' option (described in
interfaces(5)) is needed to configure a consistent behavior of
prioritizing the route of one interface over the other, otherwise it is a
race condition of last interface up wins.

Before https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=592735
and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=748272 were fixed,
enforcing rfc3442 complaint behavior of ignoring the 'routers' option
when a 'classless-static-routes' option is present, it was possible to
work around this limitation by omitting the default route from the
'classless-static-routes' list and using the 'routers' option to provide
the default route with metric if configured. Now you are stuck if you
need rfc3442 routes and need to prioritize conflicting routes.

This patch fixes the problem in my environment. The patch provides the
behavior I would expect from the 'metric' option, and I think it is the
correct behavior, since option is currently described in
the interfaces(5) man page dhcp method section as
"Metric for added routes (dhclient)" indicating its application should
not be limited to just cases where the 'routers' option alone is used.


*** /tmp/tmpqO9qiS/bug_body

  * Apply configured metric to rfc3442 routes. Fixes launchpad bug
    #1664352


Thanks for considering the patch.

--Matt




-- System Information:
Debian Release: stretch/sid
  APT prefers yakkety-updates
  APT policy: (500, 'yakkety-updates'), (500, 'yakkety-security'), (500, 
'yakkety'), (100, 'yakkety-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-54-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru isc-dhcp-4.3.3/debian/control isc-dhcp-4.3.3/debian/control
--- isc-dhcp-4.3.3/debian/control	2016-10-21 12:46:20.000000000 -0400
+++ isc-dhcp-4.3.3/debian/control	2017-07-07 15:31:47.000000000 -0400
@@ -1,8 +1,7 @@
 Source: isc-dhcp
 Section: net
 Priority: important
-Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
-XSBC-Original-Maintainer: Debian ISC DHCP maintainers <pkg-dhcp-de...@lists.alioth.debian.org>
+Maintainer: Debian ISC DHCP maintainers <pkg-dhcp-de...@lists.alioth.debian.org>
 Uploaders: Andrew Pollock <apoll...@debian.org>, Michael Gilbert <mgilb...@debian.org>
 Vcs-Git: git://anonscm.debian.org/pkg-dhcp/isc-dhcp.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-dhcp/isc-dhcp.git;a=summary
diff -Nru isc-dhcp-4.3.3/debian/rfc3442-classless-routes.linux isc-dhcp-4.3.3/debian/rfc3442-classless-routes.linux
--- isc-dhcp-4.3.3/debian/rfc3442-classless-routes.linux	2016-10-21 12:46:20.000000000 -0400
+++ isc-dhcp-4.3.3/debian/rfc3442-classless-routes.linux	2017-07-07 15:31:39.000000000 -0400
@@ -12,6 +12,7 @@
 	if [ -n "$new_rfc3442_classless_static_routes" ]; then
 		if [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
 
+			if_metric="$IF_METRIC"
 			set -- $new_rfc3442_classless_static_routes
 
 			while [ $# -gt 0 ]; do
@@ -71,7 +72,8 @@
 
 				# set route (ip detects host routes automatically)
 				ip -4 route add "${net_address}/${net_length}" \
-					${via_arg} dev "${interface}" >/dev/null 2>&1
+					${via_arg} dev "${interface}" \
+					${if_metric:+metric $if_metric} >/dev/null 2>&1
 			done
 		fi
 	fi

Reply via email to