Package: open-iscsi
Version: 2.0.874-5
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu disco ubuntu-patch

Dear Maintainer,

iBFT has no mechanism to provide the DNS search domain, so when open-iscsi 
creates
a /run/net-$DEVICE.conf file (which will never contain any value for 
DOMAINSEARCH)
it prevents ipconfig from running, and creating its own .conf file which *does*
contain a DNS search domain (if the dhcp server provides one).  At runtime, if
no dhcp client is specified to run for the interface (it does not need to, since
open-iscsi configured the networking from the initramfs), then /etc/resolv.conf
will have no DNS search domain.

In Ubuntu, the attached patch was applied to achieve the following:

  [Scott Moser]
  * debian/extra/initramfs.local-top: handle iSCSI iBFT DHCP to correctly
    run ipconfig to gather all DHCP config info, including DNS search
    domain, which iBFT can't provide.  (LP: #1806777)


Thanks for considering the patch.


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

Kernel: Linux 4.18.0-11-generic (SMP w/24 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru open-iscsi-2.0.874/debian/control open-iscsi-2.0.874/debian/control
--- open-iscsi-2.0.874/debian/control   2018-11-14 16:50:29.000000000 -0500
+++ open-iscsi-2.0.874/debian/control   2018-12-05 11:28:12.000000000 -0500
@@ -1,8 +1,7 @@
 Source: open-iscsi
 Section: net
 Priority: optional
-Maintainer: Ubuntu Developers <[email protected]>
-XSBC-Original-Maintainer: Debian iSCSI Maintainers 
<[email protected]>
+Maintainer: Debian iSCSI Maintainers 
<[email protected]>
 Uploaders: Ritesh Raj Sarraf <[email protected]>,
            Christian Seiler <[email protected]>
 Build-Depends: autotools-dev,
diff -Nru open-iscsi-2.0.874/debian/extra/initramfs.local-top 
open-iscsi-2.0.874/debian/extra/initramfs.local-top
--- open-iscsi-2.0.874/debian/extra/initramfs.local-top 2018-11-14 
16:50:29.000000000 -0500
+++ open-iscsi-2.0.874/debian/extra/initramfs.local-top 2018-12-05 
11:28:12.000000000 -0500
@@ -93,6 +93,7 @@
        . /scripts/functions
 
        udevadm settle
+       IBFT_DHCP_DEVICE=""
 
        if [ -n "$ISCSI_AUTO" ] ; then
                # try to auto-configure network interface based
@@ -136,7 +137,13 @@
                                        echo "UPTIME='${UPTIME}'"
                                        echo "DHCPLEASETIME='${DHCPLEASETIME}'"
                                        echo "DOMAINSEARCH=''"
-                               } > "/run/net-${DEVICE}.conf"
+                               } > "/run/net-${DEVICE}.conf.ibft"
+                               if [ "$PROTO" != "dhcp" -a "$DHCPLEASETIME" = 
"0" ]; then
+                                       # this is static ibft configuration.
+                                       mv "/run/net-${DEVICE}.conf.ibft" 
"/run/net-${DEVICE}.conf"
+                               else
+                                       IBFT_DHCP_DEVICE="$DEVICE"
+                               fi
                                echo "${DEVICE}" > 
/run/initramfs/open-iscsi.interface
                                # iscsistart -N doesn't set the default 
gateway. Therefore,
                                # we need to add it ourselves. However, the ip 
command is
@@ -172,9 +179,23 @@
 
        # run configure_networking even if we have iscsi_auto, because there
        # could be other network interfaces that need to be configured
-       # manually
+       # also, if we set up DHCP iBFT, we need ipconfig to run so it creates
+       # a proper /run/net-${DEVICE}.conf file that includes the DNS search
+       # domain, which we don't get in our iBFT data (see LP: #1806777)
        configure_networking
 
+       if [ -n "$IBFT_DHCP_DEVICE" ]; then
+               if ! [ -e "/run/net-${DEVICE}.conf" ] ; then
+                       echo "ipconfig dhcp failed, using iSCSI iBFT config - 
DNS search domain may be missing at runtime" >&2
+                       # We have DHCP iBFT, but ipconfig DHCP failed;
+                       # so we should fallback to just using the iBFT config,
+                       # though that will not include the DNS search domain
+                       mv "/run/net-${DEVICE}.conf.ibft" 
"/run/net-${DEVICE}.conf"
+                       # need to re-run configure_networking to process conf 
file
+                       configure_networking
+               fi
+       fi
+
        # Save network device we configured via configure_networking, but only
        # if we didn't already get one from autoconfiguration (then we always
        # prefer that).

Reply via email to