aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2007-09-25 22:16:28 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:14 -0400
commitde3cb747ffac5f2a4a6bb156e7e2fd5229e688e5 (patch)
treefe79764b8093843934c9b9f82f573e7a92cef406 /net/ipv4/route.c
parent556829657397b9b05baec6691ead4e22ee8d1567 (diff)
[NET]: Dynamically allocate the loopback device, part 1.
This patch replaces all occurences to the static variable loopback_dev to a pointer loopback_dev. That provides the mindless, trivial, uninteressting change part for the dynamic allocation for the loopback. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Acked-By: Kirill Korotaev <dev@sw.ru> Acked-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 006d6058a806..ca2878dc6188 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1402,8 +1402,8 @@ static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
1402{ 1402{
1403 struct rtable *rt = (struct rtable *) dst; 1403 struct rtable *rt = (struct rtable *) dst;
1404 struct in_device *idev = rt->idev; 1404 struct in_device *idev = rt->idev;
1405 if (dev != &loopback_dev && idev && idev->dev == dev) { 1405 if (dev != loopback_dev && idev && idev->dev == dev) {
1406 struct in_device *loopback_idev = in_dev_get(&loopback_dev); 1406 struct in_device *loopback_idev = in_dev_get(loopback_dev);
1407 if (loopback_idev) { 1407 if (loopback_idev) {
1408 rt->idev = loopback_idev; 1408 rt->idev = loopback_idev;
1409 in_dev_put(idev); 1409 in_dev_put(idev);
@@ -1555,7 +1555,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1555#endif 1555#endif
1556 rth->rt_iif = 1556 rth->rt_iif =
1557 rth->fl.iif = dev->ifindex; 1557 rth->fl.iif = dev->ifindex;
1558 rth->u.dst.dev = &loopback_dev; 1558 rth->u.dst.dev = loopback_dev;
1559 dev_hold(rth->u.dst.dev); 1559 dev_hold(rth->u.dst.dev);
1560 rth->idev = in_dev_get(rth->u.dst.dev); 1560 rth->idev = in_dev_get(rth->u.dst.dev);
1561 rth->fl.oif = 0; 1561 rth->fl.oif = 0;
@@ -1812,7 +1812,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1812 if (res.type == RTN_LOCAL) { 1812 if (res.type == RTN_LOCAL) {
1813 int result; 1813 int result;
1814 result = fib_validate_source(saddr, daddr, tos, 1814 result = fib_validate_source(saddr, daddr, tos,
1815 loopback_dev.ifindex, 1815 loopback_dev->ifindex,
1816 dev, &spec_dst, &itag); 1816 dev, &spec_dst, &itag);
1817 if (result < 0) 1817 if (result < 0)
1818 goto martian_source; 1818 goto martian_source;
@@ -1879,7 +1879,7 @@ local_input:
1879#endif 1879#endif
1880 rth->rt_iif = 1880 rth->rt_iif =
1881 rth->fl.iif = dev->ifindex; 1881 rth->fl.iif = dev->ifindex;
1882 rth->u.dst.dev = &loopback_dev; 1882 rth->u.dst.dev = loopback_dev;
1883 dev_hold(rth->u.dst.dev); 1883 dev_hold(rth->u.dst.dev);
1884 rth->idev = in_dev_get(rth->u.dst.dev); 1884 rth->idev = in_dev_get(rth->u.dst.dev);
1885 rth->rt_gateway = daddr; 1885 rth->rt_gateway = daddr;
@@ -2149,7 +2149,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2149 RT_SCOPE_UNIVERSE), 2149 RT_SCOPE_UNIVERSE),
2150 } }, 2150 } },
2151 .mark = oldflp->mark, 2151 .mark = oldflp->mark,
2152 .iif = loopback_dev.ifindex, 2152 .iif = loopback_dev->ifindex,
2153 .oif = oldflp->oif }; 2153 .oif = oldflp->oif };
2154 struct fib_result res; 2154 struct fib_result res;
2155 unsigned flags = 0; 2155 unsigned flags = 0;
@@ -2243,9 +2243,9 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2243 fl.fl4_dst = fl.fl4_src = htonl(INADDR_LOOPBACK); 2243 fl.fl4_dst = fl.fl4_src = htonl(INADDR_LOOPBACK);
2244 if (dev_out) 2244 if (dev_out)
2245 dev_put(dev_out); 2245 dev_put(dev_out);
2246 dev_out = &loopback_dev; 2246 dev_out = loopback_dev;
2247 dev_hold(dev_out); 2247 dev_hold(dev_out);
2248 fl.oif = loopback_dev.ifindex; 2248 fl.oif = loopback_dev->ifindex;
2249 res.type = RTN_LOCAL; 2249 res.type = RTN_LOCAL;
2250 flags |= RTCF_LOCAL; 2250 flags |= RTCF_LOCAL;
2251 goto make_route; 2251 goto make_route;
@@ -2290,7 +2290,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2290 fl.fl4_src = fl.fl4_dst; 2290 fl.fl4_src = fl.fl4_dst;
2291 if (dev_out) 2291 if (dev_out)
2292 dev_put(dev_out); 2292 dev_put(dev_out);
2293 dev_out = &loopback_dev; 2293 dev_out = loopback_dev;
2294 dev_hold(dev_out); 2294 dev_hold(dev_out);
2295 fl.oif = dev_out->ifindex; 2295 fl.oif = dev_out->ifindex;
2296 if (res.fi) 2296 if (res.fi)