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.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index a1a858035913..cd92b923a578 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -62,6 +62,7 @@ struct fib_nh {
62 int nh_oif; 62 int nh_oif;
63 __be32 nh_gw; 63 __be32 nh_gw;
64 __be32 nh_saddr; 64 __be32 nh_saddr;
65 int nh_saddr_genid;
65}; 66};
66 67
67/* 68/*
@@ -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;