aboutsummaryrefslogtreecommitdiff
path: root/include/net/flow.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/flow.h')
-rw-r--r--include/net/flow.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/net/flow.h b/include/net/flow.h
index c91e2aae3fb1..1426681f7cf3 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -12,6 +12,14 @@
#include <linux/atomic.h>
#include <linux/uidgid.h>
+/*
+ * ifindex generation is per-net namespace, and loopback is
+ * always the 1st device in ns (see net_dev_init), thus any
+ * loopback device should get ifindex 1
+ */
+
+#define LOOPBACK_IFINDEX 1
+
struct flowi_common {
int flowic_oif;
int flowic_iif;
@@ -85,7 +93,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
kuid_t uid)
{
fl4->flowi4_oif = oif;
- fl4->flowi4_iif = 0;
+ fl4->flowi4_iif = LOOPBACK_IFINDEX;
fl4->flowi4_mark = mark;
fl4->flowi4_tos = tos;
fl4->flowi4_scope = scope;