aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2012-08-08 17:53:36 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-09 19:18:07 -0400
commit1fb9489bf190ce2b3fc03891f3de4b2d30600e28 (patch)
treeda4e17036949e72ae0b1f0fc3b6b31557de18353 /net/ipv4/route.c
parentaa79e66eee5d525e2fcbd2a5fcb87ae3dd4aa9e9 (diff)
net: Loopback ifindex is constant now
As pointed out, there are places, that access net->loopback_dev->ifindex and after ifindex generation is made per-net this value becomes constant equals 1. So go ahead and introduce the LOOPBACK_IFINDEX constant and use it where appropriate. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 21ad369014c0..c58137391a3d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1619,7 +1619,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1619 1619
1620 if (res.type == RTN_LOCAL) { 1620 if (res.type == RTN_LOCAL) {
1621 err = fib_validate_source(skb, saddr, daddr, tos, 1621 err = fib_validate_source(skb, saddr, daddr, tos,
1622 net->loopback_dev->ifindex, 1622 LOOPBACK_IFINDEX,
1623 dev, in_dev, &itag); 1623 dev, in_dev, &itag);
1624 if (err < 0) 1624 if (err < 0)
1625 goto martian_source_keep_err; 1625 goto martian_source_keep_err;
@@ -1895,7 +1895,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
1895 1895
1896 orig_oif = fl4->flowi4_oif; 1896 orig_oif = fl4->flowi4_oif;
1897 1897
1898 fl4->flowi4_iif = net->loopback_dev->ifindex; 1898 fl4->flowi4_iif = LOOPBACK_IFINDEX;
1899 fl4->flowi4_tos = tos & IPTOS_RT_MASK; 1899 fl4->flowi4_tos = tos & IPTOS_RT_MASK;
1900 fl4->flowi4_scope = ((tos & RTO_ONLINK) ? 1900 fl4->flowi4_scope = ((tos & RTO_ONLINK) ?
1901 RT_SCOPE_LINK : RT_SCOPE_UNIVERSE); 1901 RT_SCOPE_LINK : RT_SCOPE_UNIVERSE);
@@ -1984,7 +1984,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
1984 if (!fl4->daddr) 1984 if (!fl4->daddr)
1985 fl4->daddr = fl4->saddr = htonl(INADDR_LOOPBACK); 1985 fl4->daddr = fl4->saddr = htonl(INADDR_LOOPBACK);
1986 dev_out = net->loopback_dev; 1986 dev_out = net->loopback_dev;
1987 fl4->flowi4_oif = net->loopback_dev->ifindex; 1987 fl4->flowi4_oif = LOOPBACK_IFINDEX;
1988 res.type = RTN_LOCAL; 1988 res.type = RTN_LOCAL;
1989 flags |= RTCF_LOCAL; 1989 flags |= RTCF_LOCAL;
1990 goto make_route; 1990 goto make_route;