aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-06-05 02:36:06 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-06-07 16:39:26 -0400
commit71e27da9618b5f4d525ec821def83991da20429f (patch)
tree521645ee5c7e43cc0de100bc4425668e078d92f9 /net/ipv4/devinet.c
parent31be308541e990592a2d0a3e77e8e51bd0cea0e0 (diff)
[IPV4]: Restore old behaviour of default config values
Previously inet devices were only constructed when addresses are added (or rarely in ipmr). Therefore the default config values they get are the ones at the time of these operations. Now that we're creating inet devices earlier, this changes the behaviour of default config values in an incompatible way (see bug #8519). This patch creates a compromise by setting the default values at the same point as before but only for those that have not been explicitly set by the user since the inet device's creation. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index e19734795a7b..354e800be18d 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -147,7 +147,7 @@ void in_dev_finish_destroy(struct in_device *idev)
147 } 147 }
148} 148}
149 149
150struct in_device *inetdev_init(struct net_device *dev) 150static struct in_device *inetdev_init(struct net_device *dev)
151{ 151{
152 struct in_device *in_dev; 152 struct in_device *in_dev;
153 153
@@ -405,12 +405,10 @@ static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
405 ASSERT_RTNL(); 405 ASSERT_RTNL();
406 406
407 if (!in_dev) { 407 if (!in_dev) {
408 in_dev = inetdev_init(dev); 408 inet_free_ifa(ifa);
409 if (!in_dev) { 409 return -ENOBUFS;
410 inet_free_ifa(ifa);
411 return -ENOBUFS;
412 }
413 } 410 }
411 ipv4_devconf_setall(in_dev);
414 if (ifa->ifa_dev != in_dev) { 412 if (ifa->ifa_dev != in_dev) {
415 BUG_TRAP(!ifa->ifa_dev); 413 BUG_TRAP(!ifa->ifa_dev);
416 in_dev_hold(in_dev); 414 in_dev_hold(in_dev);
@@ -520,13 +518,12 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
520 518
521 in_dev = __in_dev_get_rtnl(dev); 519 in_dev = __in_dev_get_rtnl(dev);
522 if (in_dev == NULL) { 520 if (in_dev == NULL) {
523 in_dev = inetdev_init(dev); 521 err = -ENOBUFS;
524 if (in_dev == NULL) { 522 goto errout;
525 err = -ENOBUFS;
526 goto errout;
527 }
528 } 523 }
529 524
525 ipv4_devconf_setall(in_dev);
526
530 ifa = inet_alloc_ifa(); 527 ifa = inet_alloc_ifa();
531 if (ifa == NULL) { 528 if (ifa == NULL) {
532 /* 529 /*