Bug 741786 - dhclient-script wipes acquired address when aliases are defined
Summary: dhclient-script wipes acquired address when aliases are defined
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dhcp
Version: 15
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jiri Popelka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-27 21:31 UTC by Scott Shambarger
Modified: 2011-10-03 18:04 UTC (History)
1 user (show)

Fixed In Version: dhcp-4.2.2-9.fc16
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-03 18:04:17 UTC
Type: ---


Attachments (Terms of Use)
patch (2.93 KB, text/plain)
2011-09-27 21:31 UTC, Scott Shambarger
no flags Details

Description Scott Shambarger 2011-09-27 21:31:38 UTC
Created attachment 525215 [details]
patch

Description of problem:
Adding an alias entry to dhclient.conf leads to dhclient-script overwriting the a newly bound ip address with the alias address when address is configured with initscripts (untested with NetworkManager).

Version-Release number of selected component (if applicable):
dhclient-4.2.1-11.P1
iproute-2.6.38.1-4
initscripts-9.30-2

How reproducible:
Always with an alias configured in dhclient.conf
Add an entry for an alias to dhclient.conf on an interface configured for dhcp via initscripts.

Steps to Reproduce:
1. Configure an interface for dhcp in initscripts, eg: ifcfg-em1

  File: ifcfg-em1
    DEVICE=em1
    BOOTPROTO=dhcp
    ONBOOT=yes
    NM_CONTROLLED=no

  File: ifcfg-em1:0
    DEVICE=em1:0
    ONPARENT=yes
    IPADDR=192.168.100.2
    NETMASK=255.255.255.0
    NM_CONTROLLED=no

2. Add an entry for alias for the interface in dhclient.conf, eg:

  File: dhclient.conf
  alias {
    interface "em1";
    fixed-address 192.168.100.2;
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.100.255;
  }

3. Bring the interface up: # ifup em1

  
Actual results:

  Only alias address is present on device after bind, eg:

  # ip addr show dev em1
  1: em: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
    inet 192.168.100.2/24 scope global em1

Expected results:

  Both alias and newly bound address should be on link, with alias correctly labeled.

  # ip addr show dev em1
  1: em: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
    inet 10.0.10.121/24 brd 255.255.255.255 scope global em1
    inet 192.168.100.2/24 brd 192.168.100.255 scope global em1:0

Additional info:

It appears that the script is performing a flush on ${interface}:0, however iproute2 will flush the device, not the alias, removing the existing bound address.

When configured with initscripts, aliases such as "${interface}:0" are created with ifconfig which uses labels to distinguish the alias address from the primary address on the interface.  To flush just the labeled address, the correct syntax is:

  # ip addr flush dev ${interface} label ${interface}:0

There appears to be numerous errors in dhclient-script with respect to aliases, with the script using the "dev ${interface}:0" syntax rather than "dev ${interface} label ${interface}:0"

In addition, there appears to be a few places where dhclient-script sets the link down when it appears to actually just wish to purge the alias address.

Also, the alias address is set without using the "broadcast ${alias_broadcast_address}" clause.

I've attached a patch to dhclient-script with some proposed fixes, including:
  1. label the alias using the ${interface}:0 label
  2. add "broadcast ${alias_broadcast_address}" clause where appropriate
  3. correct syntax of "dev ${interface}:0" clauses where appropriate
  4. replace alias link down with flush on the alias label

Comment 1 Jiri Popelka 2011-09-29 12:39:07 UTC
I've applied your patch.
Thank you !

Comment 2 Fedora Update System 2011-09-30 15:23:23 UTC
dhcp-4.2.2-9.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/dhcp-4.2.2-9.fc16

Comment 3 Fedora Update System 2011-09-30 19:14:47 UTC
Package dhcp-4.2.2-9.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dhcp-4.2.2-9.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/dhcp-4.2.2-9.fc16
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2011-10-03 18:04:03 UTC
dhcp-4.2.2-9.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.


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