Bug 1136733

Summary: all addresses deleted after delete the first ip on device
Product: Red Hat Enterprise Linux 6 Reporter: Sun Baoliang <blsun>
Component: kernelAssignee: Jiri Benc <jbenc>
Status: CLOSED NOTABUG QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0CC: dspurek, kzhang, psimerda
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-03 08:58:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sun Baoliang 2014-09-03 07:42:47 UTC
Description of problem:


Version-Release number of selected component (if applicable):

[root@hp-dl385pg8-04 sysctl2]# uname -r
2.6.32-497.el6.x86_64
How reproducible:
always

Steps to Reproduce:
1.add 4 ip to eth9
[root@hp-dl385pg8-04 sysctl2]# ip addr add 3.3.3.4/24 dev eth9
[root@hp-dl385pg8-04 sysctl2]# ip addr add 3.3.3.3/24 dev eth9
[root@hp-dl385pg8-04 sysctl2]# ip addr add 3.3.3.2/24 dev eth9
[root@hp-dl385pg8-04 sysctl2]# ip addr add 3.3.3.1/24 dev eth9
[root@hp-dl385pg8-04 sysctl2]# ip addr show
11: eth9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 8c:7c:ff:2e:14:01 brd ff:ff:ff:ff:ff:ff
    inet 3.3.3.4/24 scope global eth9
    inet 3.3.3.3/24 scope global secondary eth9
    inet 3.3.3.2/24 scope global secondary eth9
    inet 3.3.3.1/24 scope global secondary eth9
    inet6 2001::8e7c:ffff:fe2e:1401/64 scope global dynamic 
       valid_lft 86344sec preferred_lft 14344sec
    inet6 fe80::8e7c:ffff:fe2e:1401/64 scope link 
       valid_lft forever preferred_lft forever

2.delete last on[3.3.3.1/24]
[root@hp-dl385pg8-04 sysctl2]# ip addr del 3.3.3.1/24 dev eth9
[root@hp-dl385pg8-04 sysctl2]# 
[root@hp-dl385pg8-04 sysctl2]# ip addr show dev eth9
11: eth9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 8c:7c:ff:2e:14:01 brd ff:ff:ff:ff:ff:ff
    inet 3.3.3.4/24 scope global eth9
    inet 3.3.3.3/24 scope global secondary eth9
    inet 3.3.3.2/24 scope global secondary eth9
    inet6 2001::8e7c:ffff:fe2e:1401/64 scope global dynamic 
       valid_lft 86392sec preferred_lft 14392sec
    inet6 fe80::8e7c:ffff:fe2e:1401/64 scope link 
       valid_lft forever preferred_lft forever

3.delete the first one[3.3.3.4/24]
[root@hp-dl385pg8-04 sysctl2]# ip addr del 3.3.3.4/24 dev eth9
[root@hp-dl385pg8-04 sysctl2]# ip addr show dev eth9
11: eth9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 8c:7c:ff:2e:14:01 brd ff:ff:ff:ff:ff:ff
    inet6 2001::8e7c:ffff:fe2e:1401/64 scope global dynamic 
       valid_lft 86385sec preferred_lft 14385sec
    inet6 fe80::8e7c:ffff:fe2e:1401/64 scope link 
       valid_lft forever preferred_lft forever
Actual results:
delete the first ip,all ip deleted.
delete other ip , there is no problem.

Expected results:
delete a ip, just delete one ip

Additional info:

Comment 2 Pavel Šimerda (pavlix) 2014-09-03 08:44:39 UTC
Switching to component kernel after consulting with Jiří Benc, as this is kernel behaviour, looking forward to more details from Jiří.

Note: Bugzilla is currently not capable of changing the component.

Comment 3 Jiri Benc 2014-09-03 08:58:54 UTC
You're adding multiple addresses in the same subnet, thus the second and subsequent ones become secondaries. This can be seen in the "ip addr show" output, note the keyword "secondary" next to those addresses.

By default, when deleting a primary address, kernel deletes also all respective secondaries.

If you want one of the secondaries to be promoted to be a new primary on primary deletion, set the net.ipv4.conf.eth9.promote_secondaries sysctl.

Comment 4 Sun Baoliang 2014-09-03 11:06:18 UTC
(In reply to Jiri Benc from comment #3)
> You're adding multiple addresses in the same subnet, thus the second and
> subsequent ones become secondaries. This can be seen in the "ip addr show"
> output, note the keyword "secondary" next to those addresses.
> 
> By default, when deleting a primary address, kernel deletes also all
> respective secondaries.
> 
> If you want one of the secondaries to be promoted to be a new primary on
> primary deletion, set the net.ipv4.conf.eth9.promote_secondaries sysctl.

Got it. Thanks for your answer.