aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip_fib.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ip_fib.h')
-rw-r--r--include/net/ip_fib.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index a1a858035913..e5d66ec88cf6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -51,7 +51,6 @@ struct fib_nh {
51 struct fib_info *nh_parent; 51 struct fib_info *nh_parent;
52 unsigned nh_flags; 52 unsigned nh_flags;
53 unsigned char nh_scope; 53 unsigned char nh_scope;
54 unsigned char nh_cfg_scope;
55#ifdef CONFIG_IP_ROUTE_MULTIPATH 54#ifdef CONFIG_IP_ROUTE_MULTIPATH
56 int nh_weight; 55 int nh_weight;
57 int nh_power; 56 int nh_power;
@@ -62,6 +61,7 @@ struct fib_nh {
62 int nh_oif; 61 int nh_oif;
63 __be32 nh_gw; 62 __be32 nh_gw;
64 __be32 nh_saddr; 63 __be32 nh_saddr;
64 int nh_saddr_genid;
65}; 65};
66 66
67/* 67/*
@@ -74,9 +74,10 @@ struct fib_info {
74 struct net *fib_net; 74 struct net *fib_net;
75 int fib_treeref; 75 int fib_treeref;
76 atomic_t fib_clntref; 76 atomic_t fib_clntref;
77 int fib_dead;
78 unsigned fib_flags; 77 unsigned fib_flags;
79 int fib_protocol; 78 unsigned char fib_dead;
79 unsigned char fib_protocol;
80 unsigned char fib_scope;
80 __be32 fib_prefsrc; 81 __be32 fib_prefsrc;
81 u32 fib_priority; 82 u32 fib_priority;
82 u32 *fib_metrics; 83 u32 *fib_metrics;
@@ -141,12 +142,19 @@ struct fib_result_nl {
141 142
142#endif /* CONFIG_IP_ROUTE_MULTIPATH */ 143#endif /* CONFIG_IP_ROUTE_MULTIPATH */
143 144
144#define FIB_RES_SADDR(res) (FIB_RES_NH(res).nh_saddr) 145extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
146
147#define FIB_RES_SADDR(net, res) \
148 ((FIB_RES_NH(res).nh_saddr_genid == \
149 atomic_read(&(net)->ipv4.dev_addr_genid)) ? \
150 FIB_RES_NH(res).nh_saddr : \
151 fib_info_update_nh_saddr((net), &FIB_RES_NH(res)))
145#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) 152#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw)
146#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) 153#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev)
147#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) 154#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif)
148 155
149#define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : FIB_RES_SADDR(res)) 156#define FIB_RES_PREFSRC(net, res) ((res).fi->fib_prefsrc ? : \
157 FIB_RES_SADDR(net, res))
150 158
151struct fib_table { 159struct fib_table {
152 struct hlist_node tb_hlist; 160 struct hlist_node tb_hlist;