netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Popovich <popovich_sergei@mail.ru>
To: netdev@vger.kernel.org
Subject: [PATCH 1/4] ipv4: don't disable interface if last ipv4 address is removed
Date: Tue, 21 Jan 2014 13:48:48 +0200	[thread overview]
Message-ID: <2748ead3b814852075f954ea157fe5d7288531e2.1390304505.git.popovich_sergei@mail.ru> (raw)
In-Reply-To: <cover.1390304505.git.popovich_sergei@mail.ru>
In-Reply-To: <cover.1390304505.git.popovich_sergei@mail.ru>

Since

  commit 876fd05ddbae03166e7037fca957b55bb3be6594
  Author: Hannes Frederic Sowa <>
  Date:   Mon Jun 24 00:22:20 2013 +0200

    ipv6: don't disable interface if last ipv6 address is removed

we have disabled this behavior for IPv6. Adjust behavior for IPv4.

There is at least one additional reason to do the same for IPv4.
Suppose we have following configuration:

  # ip link add dev dummy1 type dummy
  # ip -4 addr add 192.168.1.254/24 dev dummy1
  # ip link set up dev dummy1

  # ip link add dev veth1a type veth peer name veth1b
  # ip link set up dev veth1a
  # ip -4 route add 192.168.1.1/32 dev veth1a src 192.168.1.254 proto static

  # ip netns add pc1
  # ip link set netns pc1 dev veth1b
  # ip netns exec pc1 ip -4 addr add 192.168.1.1/24 dev veth1b
  # ip netns exec pc1 ip link set up dev veth1b
  # ip netns exec pc1 ip link set up dev lo

  # ip -4 addr add 10.0.1.1/30 dev veth1a
  # ip -4 addr sh dev veth1a
  32: veth1a: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 10.0.1.1/30 scope global veth1a
       valid_lft forever preferred_lft forever
  # ip -4 route show dev veth1a
  10.0.1.0/30  proto kernel  scope link  src 10.0.1.1
  192.168.1.1  proto static  scope link  src 192.168.1.254

  # ping -I192.168.1.254 192.168.1.1 -c1
  PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
  64 bytes from 192.168.1.1: icmp_req=1 ttl=64 time=0.039 ms

  --- 192.168.1.1 ping statistics ---
  1 packets transmitted, 1 received, 0% packet loss, time 0ms
  rtt min/avg/max/mdev = 0.039/0.039/0.039/0.000 ms
  # ip -4 neigh sh dev veth1a
  192.168.1.1 lladdr 9a:7e:a5:aa:1b:a0 REACHABLE

  and after removing last ipv4 address from veth1a
  ------------------------------------------------

  # ip -4 addr del 10.0.1.1/30 dev veth1a
  # ip -4 neigh sh dev veth1a
  # ip -4 route show dev veth1a

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
---
 net/ipv4/fib_frontend.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index d846304..ae5f35f 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1021,14 +1021,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
 	case NETDEV_DOWN:
 		fib_del_ifaddr(ifa, NULL);
 		atomic_inc(&net->ipv4.dev_addr_genid);
-		if (ifa->ifa_dev->ifa_list == NULL) {
-			/* Last address was deleted from this interface.
-			 * Disable IP.
-			 */
-			fib_disable_ip(dev, 1);
-		} else {
-			rt_cache_flush(dev_net(dev));
-		}
+		rt_cache_flush(dev_net(dev));
 		break;
 	}
 	return NOTIFY_DONE;
-- 
1.8.3.4

  reply	other threads:[~2014-01-21 11:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 11:48 [PATCH 0/4] ipv4: small set of fixes Sergey Popovich
2014-01-21 11:48 ` Sergey Popovich [this message]
2014-01-23  1:52   ` [PATCH 1/4] ipv4: don't disable interface if last ipv4 address is removed David Miller
2014-01-21 11:48 ` [PATCH 2/4] ipv4: fib_semantics: increment fib_info_cnt after fib_info allocation Sergey Popovich
2014-01-21 11:48 ` [PATCH 3/4] ipv4: use SNMP macro assuming softirq context in ip_forward() Sergey Popovich
2014-01-23  1:52   ` David Miller
2014-01-21 11:48 ` [PATCH 4/4] ipv4: mark nexthop as dead when it's subnet becomes unreachable Sergey Popovich
2014-01-23  1:53   ` David Miller
2014-01-23 10:06   ` Julian Anastasov
2014-01-23 15:05     ` Sergey Popovich
2014-01-23 21:58       ` Julian Anastasov
2014-01-24 10:12         ` Sergey Popovich
2014-01-24 10:25           ` [PATCH 4/4 v3] " Sergey Popovich
2014-01-24 21:49             ` Julian Anastasov
2014-01-24 10:15         ` [PATCH 4/4 v3] ipv4: mark nexthop as dead when it's subnet becomes Sergey Popovich
2014-01-24 10:26           ` Sergey Popovich
2014-01-23  1:54 ` [PATCH 0/4] ipv4: small set of fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2748ead3b814852075f954ea157fe5d7288531e2.1390304505.git.popovich_sergei@mail.ru \
    --to=popovich_sergei@mail.ru \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).