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>
This commit is contained in:
parent
aa79e66eee
commit
1fb9489bf1
8 changed files with 18 additions and 10 deletions
|
@ -1619,7 +1619,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|||
|
||||
if (res.type == RTN_LOCAL) {
|
||||
err = fib_validate_source(skb, saddr, daddr, tos,
|
||||
net->loopback_dev->ifindex,
|
||||
LOOPBACK_IFINDEX,
|
||||
dev, in_dev, &itag);
|
||||
if (err < 0)
|
||||
goto martian_source_keep_err;
|
||||
|
@ -1895,7 +1895,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
|
|||
|
||||
orig_oif = fl4->flowi4_oif;
|
||||
|
||||
fl4->flowi4_iif = net->loopback_dev->ifindex;
|
||||
fl4->flowi4_iif = LOOPBACK_IFINDEX;
|
||||
fl4->flowi4_tos = tos & IPTOS_RT_MASK;
|
||||
fl4->flowi4_scope = ((tos & RTO_ONLINK) ?
|
||||
RT_SCOPE_LINK : RT_SCOPE_UNIVERSE);
|
||||
|
@ -1984,7 +1984,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
|
|||
if (!fl4->daddr)
|
||||
fl4->daddr = fl4->saddr = htonl(INADDR_LOOPBACK);
|
||||
dev_out = net->loopback_dev;
|
||||
fl4->flowi4_oif = net->loopback_dev->ifindex;
|
||||
fl4->flowi4_oif = LOOPBACK_IFINDEX;
|
||||
res.type = RTN_LOCAL;
|
||||
flags |= RTCF_LOCAL;
|
||||
goto make_route;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue