aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/net_namespace.h
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 /include/net/net_namespace.h
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 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 6dc3db3466bf..97e441945c13 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -105,6 +105,13 @@ struct net {
105 struct sock *diag_nlsk; 105 struct sock *diag_nlsk;
106}; 106};
107 107
108/*
109 * ifindex generation is per-net namespace, and loopback is
110 * always the 1st device in ns (see net_dev_init), thus any
111 * loopback device should get ifindex 1
112 */
113
114#define LOOPBACK_IFINDEX 1
108 115
109#include <linux/seq_file_net.h> 116#include <linux/seq_file_net.h>
110 117