[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1285751929.2615.30.camel@edumazet-laptop>
Date: Wed, 29 Sep 2010 11:18:49 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: nicolas.dichtel@...nd.com
Cc: netdev <netdev@...r.kernel.org>,
Octavian Purdila <opurdila@...acom.com>
Subject: Re: [PATCH] ipv4: remove all rt cache entries on UNREGISTER event
I found following patch was enough to avoid route being created if
device is down. This is still racy and needs more thinking.
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index ac6559c..1ee0b1a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2586,9 +2586,10 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
goto out;
/* RACE: Check return value of inet_select_addr instead. */
- if (__in_dev_get_rtnl(dev_out) == NULL) {
+ if (!(dev_out->flags & IFF_UP) || __in_dev_get_rtnl(dev_out) == NULL) {
dev_put(dev_out);
- goto out; /* Wrong error code */
+ err = -ENETUNREACH;
+ goto out;
}
if (ipv4_is_local_multicast(oldflp->fl4_dst) ||
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists