Bug 1526790 - dhclient-script and BOOTPROTO=dhcp in /etc/sysconfig/network-scripts/ifcfg-eth0:0
Summary: dhclient-script and BOOTPROTO=dhcp in /etc/sysconfig/network-scripts/ifcfg-et...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: dhcp
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Pavel Zhukov
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-17 13:17 UTC by Jean-Claude
Modified: 2018-11-30 22:21 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-11-30 22:21:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch for script /usr/sbin/dhclient-script from packet dhcp-client (1.06 KB, patch)
2018-07-31 22:39 UTC, Jean-Claude
no flags Details | Diff
Patch for script /usr/sbin/dhclient-script from packet dhcp-client (1.06 KB, patch)
2018-08-04 14:17 UTC, Jean-Claude
no flags Details | Diff
Adding do_dhcp in file network-functions (3.81 KB, patch)
2018-08-04 16:01 UTC, Jean-Claude
no flags Details | Diff

Description Jean-Claude 2017-12-17 13:17:59 UTC
Description of problem:

If /etc/sysconfig/network-scripts/ifcfg-eth0 contain ISALIAS=yes and BOOTPROTO=dhcp, then ifup fails to obtain/assign an ipv4 address from a dhcp server. 

Version-Release number of selected component (if applicable):
dhcp-client-4.3.6-5.fc27.x86_64
initscripts-9.77-1.fc27.x86_64

How reproducible:
Create a alias network configuration file like in this example :
[root@maintenance ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPV4INIT=no
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
UUID=f6720bed-e752-310d-913d-c3f3584aa41a
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
DEVICE=eth0
NM_CONTROLLED=no
USER_CONTROLLED=no
[root@maintenance ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0:0
ISALIAS=yes
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME="Université de Lorraine"
UUID=f6720bed-e752-310d-913d-c3f3584aa41a
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
DEVICE=eth0:0
NM_CONTROLLED=yes
USER_CONTROLLED=no

Steps to Reproduce:
1. ifdown eth0
2. ifup eth0
3. ifconfig (to see if ipv4 is assigned to eth0:0)

Actual results:
[root@maintenance ~]# ifup eth0
ERROR     : [/etc/sysconfig/network-scripts/ifup-aliases] error in ifcfg-eth0:0: didn't specify device or ipaddr
[root@maintenance ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::xxx:xxff:fexx:xxxx  prefixlen 64  scopeid 0x20<link>
        inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx  prefixlen 64  scopeid 0x0<global>
        ether 00:xx:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 586488  bytes 877536872 (836.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 310845  bytes 21218533 (20.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Boucle locale)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@maintenance ~]# 


Expected results:
[root@maintenance ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Boucle locale)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@maintenance ~]# ifup eth0

Determining IP information for eth0:0... done.
[root@maintenance ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::xxx:xxff:fexx:xxxx  prefixlen 64  scopeid 0x20<link>
        inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx  prefixlen 64  scopeid 0x0<global>
        ether 00:xx:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 585391  bytes 876713511 (836.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 310305  bytes 21172992 (20.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.73  netmask 255.255.255.0  broadcast 192.168.1.255
        ether xx:xx:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Boucle locale)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@maintenance ~]# 

Additional info:

[root@maintenance ~]# diff /usr/sbin/dhclient-script /tmp/
387c387
<     ip -4 addr replace "${new_ip_address}/${new_prefix}" broadcast "${new_broadcast_address}" dev "${interface}" \
---
>     ip -4 addr replace "${new_ip_address}/${new_prefix}" broadcast "${new_broadcast_address}" dev "${INTERFACE}" label "${interface}" \
872c872,873
<         if arping -D -q -c2 -I "${interface}" "${new_ip_address}"; then
---
> 	INTERFACE="$( echo "$interface" | awk -F ':' '{ print $1 }')"
>         if arping -D -q -c2 -I "${INTERFACE}" "${new_ip_address}"; then
[root@maintenance ~]# diff /etc/sysconfig/network-scripts/ifup-aliases /tmp/
187a188,191
>     if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
>         do_dhclient
>         exit
>     fi    
[root@maintenance ~]# diff /etc/sysconfig/network-scripts/ifup-eth /tmp/
198,232c198
<     if is_true "${PERSISTENT_DHCLIENT}"; then
<         ONESHOT="";
<     else
<         ONESHOT="-1";
<     fi;
<     generate_config_file_name
<     generate_lease_file_name
< 
<     # Initialize the dhclient args and obtain the hostname options if needed:
<     DHCLIENTARGS="${DHCLIENTARGS} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /run/dhclient-${DEVICE}.pid"
<     set_hostname_options DHCLIENTARGS
< 
<     echo
<     echo -n $"Determining IP information for ${DEVICE}..."
<     if ! is_true "${PERSISTENT_DHCLIENT}" && check_link_down ${DEVICE}; then
<         echo $" failed; no link present.  Check cable?"
<         exit 1
<     fi
< 
<     ethtool_set
< 
<     if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
<         echo $" done."
<         dhcpipv4="good"
<     else
<         echo $" failed."
<         if is_true "${IPV4_FAILURE_FATAL}"; then
<             exit 1
<         fi
<         if is_false "$IPV6INIT" || ! is_true "$DHCPV6C"; then
<             exit 1
<         fi
<         net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
<     fi
<     # end dynamic device configuration
---
>     do_dhclient
[root@maintenance ~]# diff /etc/sysconfig/network-scripts/network-functions /tmp/
699a700,738
> 
> do_dhclient()
> {
>     if is_true "${PERSISTENT_DHCLIENT}"; then
>         ONESHOT="";
>     else
>         ONESHOT="-1";
>     fi;
>     generate_config_file_name
>     generate_lease_file_name
> 
>     # Initialize the dhclient args and obtain the hostname options if needed:
>     DHCLIENTARGS="${DHCLIENTARGS} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /run/dhclient-${device}.pid"
>     set_hostname_options DHCLIENTARGS
> 
>     echo
>     echo -n $"Determining IP information for ${DEVICE}..."
>     if ! is_true "${PERSISTENT_DHCLIENT}" && check_link_down ${DEVICE}; then
>         echo $" failed; no link present.  Check cable?"
>         exit 1
>     fi
> 
>     ethtool_set
> 
>     if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
>         echo $" done."
>         dhcpipv4="good"
>     else
>         echo $" failed."
>         if is_true "${IPV4_FAILURE_FATAL}"; then
>             exit 1
>         fi
>         if is_false "$IPV6INIT" || ! is_true "$DHCPV6C"; then
>             exit 1
>         fi
>         net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
>     fi
>     # end dynamic device configuration
> }
[root@maintenance ~]#

Comment 1 Pavel Zhukov 2018-01-08 15:34:43 UTC
Thank you for reporting the issue.
From the dhclient side it's enough to add label ${interface} to make dhcp for aliases working like:

@@ -385,7 +385,7 @@
 
     # replace = add if it doesn't exist or override (update lifetimes) if it's there
     ip -4 addr replace "${new_ip_address}/${new_prefix}" broadcast "${new_broadcast_address}" dev "${interface}" \
-       valid_lft "${new_dhcp_lease_time}" preferred_lft "${new_dhcp_lease_time}"  >/dev/null 2>&1
+       valid_lft "${new_dhcp_lease_time}" preferred_lft "${new_dhcp_lease_time}" label "${interface}" >/dev/null 2>&1
 
     if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] ||
        [ ! "${old_ip_address}" = "${new_ip_address}" ] ||

Comment 2 Jean-Claude 2018-05-02 08:48:49 UTC
(In reply to Pavel Zhukov from comment #1)
> Thank you for reporting the issue.
> From the dhclient side it's enough to add label ${interface} to make dhcp
> for aliases working like:
> 
> @@ -385,7 +385,7 @@
>  
>      # replace = add if it doesn't exist or override (update lifetimes) if
> it's there
>      ip -4 addr replace "${new_ip_address}/${new_prefix}" broadcast
> "${new_broadcast_address}" dev "${interface}" \
> -       valid_lft "${new_dhcp_lease_time}" preferred_lft
> "${new_dhcp_lease_time}"  >/dev/null 2>&1
> +       valid_lft "${new_dhcp_lease_time}" preferred_lft
> "${new_dhcp_lease_time}" label "${interface}" >/dev/null 2>&1
>  
>      if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] ||
>         [ ! "${old_ip_address}" = "${new_ip_address}" ] ||

It's work for me with ifup eth0 and after a reboot. The ip of eth0:0 is obtained by dhcp.

It's ok after an ifup eth0 if eth0:0 have statical ip.

Comment 3 Jean-Claude 2018-07-31 22:39:59 UTC
Created attachment 1471945 [details]
Patch for script /usr/sbin/dhclient-script from packet dhcp-client

Adding label "${interface}" to /usr/sbin/dhclient-script
Based on dhcp-client-4.3.6-21.fc28.x86_64

Comment 4 Jean-Claude 2018-08-04 14:17:21 UTC
Created attachment 1473290 [details]
Patch for script /usr/sbin/dhclient-script from packet dhcp-client

Based on dhcp-client-4.3.6-21.fc28.x86_64

Comment 5 Jean-Claude 2018-08-04 16:01:07 UTC
Created attachment 1473303 [details]
Adding do_dhcp in file network-functions

Moving dhcp code from file ifup-eth to file network-functions.
Doing a call of do_dhcp in ifup-eth.
Using do_dhcp in ifup-aliases.
All files are in directory /etc/sysconfig/network-scripts/.
Based on initscripts-9.80-1.fc28.x86_64

Comment 6 Ben Cotton 2018-11-27 14:50:45 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Ben Cotton 2018-11-30 22:21:05 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.