aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/ip_fib.h10
-rw-r--r--net/ipv4/fib_frontend.c14
-rw-r--r--net/ipv4/fib_rules.c10
3 files changed, 15 insertions, 19 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index be70b33b744c..39f944a096d9 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -193,14 +193,6 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp,
193 return -ENETUNREACH; 193 return -ENETUNREACH;
194} 194}
195 195
196static inline void fib_select_default(const struct flowi *flp,
197 struct fib_result *res)
198{
199 struct fib_table *table = fib_get_table(&init_net, RT_TABLE_MAIN);
200 if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK)
201 table->tb_select_default(table, flp, res);
202}
203
204#else /* CONFIG_IP_MULTIPLE_TABLES */ 196#else /* CONFIG_IP_MULTIPLE_TABLES */
205extern int __net_init fib4_rules_init(struct net *net); 197extern int __net_init fib4_rules_init(struct net *net);
206extern void __net_exit fib4_rules_exit(struct net *net); 198extern void __net_exit fib4_rules_exit(struct net *net);
@@ -213,7 +205,6 @@ extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res);
213 205
214extern struct fib_table *fib_new_table(struct net *net, u32 id); 206extern struct fib_table *fib_new_table(struct net *net, u32 id);
215extern struct fib_table *fib_get_table(struct net *net, u32 id); 207extern struct fib_table *fib_get_table(struct net *net, u32 id);
216extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
217 208
218#endif /* CONFIG_IP_MULTIPLE_TABLES */ 209#endif /* CONFIG_IP_MULTIPLE_TABLES */
219 210
@@ -222,6 +213,7 @@ extern const struct nla_policy rtm_ipv4_policy[];
222extern void ip_fib_init(void); 213extern void ip_fib_init(void);
223extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 214extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
224 struct net_device *dev, __be32 *spec_dst, u32 *itag); 215 struct net_device *dev, __be32 *spec_dst, u32 *itag);
216extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
225 217
226/* Exported by fib_semantics.c */ 218/* Exported by fib_semantics.c */
227extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 219extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 6761639dd0e9..13bf01de0ed8 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -116,6 +116,20 @@ struct fib_table *fib_get_table(struct net *net, u32 id)
116} 116}
117#endif /* CONFIG_IP_MULTIPLE_TABLES */ 117#endif /* CONFIG_IP_MULTIPLE_TABLES */
118 118
119void fib_select_default(const struct flowi *flp, struct fib_result *res)
120{
121 struct fib_table *tb;
122 int table = RT_TABLE_MAIN;
123#ifdef CONFIG_IP_MULTIPLE_TABLES
124 if (res->r == NULL || res->r->action != FR_ACT_TO_TBL)
125 return;
126 table = res->r->table;
127#endif
128 tb = fib_get_table(&init_net, table);
129 if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK)
130 tb->tb_select_default(tb, flp, res);
131}
132
119static void fib_flush(struct net *net) 133static void fib_flush(struct net *net)
120{ 134{
121 int flushed = 0; 135 int flushed = 0;
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 1effb4ab688c..19274d01afa4 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -102,16 +102,6 @@ errout:
102} 102}
103 103
104 104
105void fib_select_default(const struct flowi *flp, struct fib_result *res)
106{
107 if (res->r && res->r->action == FR_ACT_TO_TBL &&
108 FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) {
109 struct fib_table *tb;
110 if ((tb = fib_get_table(&init_net, res->r->table)) != NULL)
111 tb->tb_select_default(tb, flp, res);
112 }
113}
114
115static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) 105static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
116{ 106{
117 struct fib4_rule *r = (struct fib4_rule *) rule; 107 struct fib4_rule *r = (struct fib4_rule *) rule;