diff options
-rw-r--r-- | include/net/flow.h | 8 | ||||
-rw-r--r-- | include/net/ip_fib.h | 6 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 8 | ||||
-rw-r--r-- | net/ipv4/fib_rules.c | 6 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 2 | ||||
-rw-r--r-- | net/ipv4/fib_trie.c | 12 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 |
7 files changed, 28 insertions, 20 deletions
diff --git a/include/net/flow.h b/include/net/flow.h index 8139257ee11e..3e4630ebde32 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -50,6 +50,14 @@ union flowi_uli { | |||
50 | 50 | ||
51 | struct flowi4 { | 51 | struct flowi4 { |
52 | struct flowi_common __fl_common; | 52 | struct flowi_common __fl_common; |
53 | #define flowi4_oif __fl_common.flowic_oif | ||
54 | #define flowi4_iif __fl_common.flowic_iif | ||
55 | #define flowi4_mark __fl_common.flowic_mark | ||
56 | #define flowi4_tos __fl_common.flowic_tos | ||
57 | #define flowi4_scope __fl_common.flowic_scope | ||
58 | #define flowi4_proto __fl_common.flowic_proto | ||
59 | #define flowi4_flags __fl_common.flowic_flags | ||
60 | #define flowi4_secid __fl_common.flowic_secid | ||
53 | __be32 daddr; | 61 | __be32 daddr; |
54 | __be32 saddr; | 62 | __be32 saddr; |
55 | union flowi_uli uli; | 63 | union flowi_uli uli; |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index d948e232eb06..a1a858035913 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -155,7 +155,7 @@ struct fib_table { | |||
155 | unsigned char tb_data[0]; | 155 | unsigned char tb_data[0]; |
156 | }; | 156 | }; |
157 | 157 | ||
158 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | 158 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, |
159 | struct fib_result *res, int fib_flags); | 159 | struct fib_result *res, int fib_flags); |
160 | extern int fib_table_insert(struct fib_table *, struct fib_config *); | 160 | extern int fib_table_insert(struct fib_table *, struct fib_config *); |
161 | extern int fib_table_delete(struct fib_table *, struct fib_config *); | 161 | extern int fib_table_delete(struct fib_table *, struct fib_config *); |
@@ -186,7 +186,7 @@ static inline struct fib_table *fib_new_table(struct net *net, u32 id) | |||
186 | return fib_get_table(net, id); | 186 | return fib_get_table(net, id); |
187 | } | 187 | } |
188 | 188 | ||
189 | static inline int fib_lookup(struct net *net, const struct flowi *flp, | 189 | static inline int fib_lookup(struct net *net, const struct flowi4 *flp, |
190 | struct fib_result *res) | 190 | struct fib_result *res) |
191 | { | 191 | { |
192 | struct fib_table *table; | 192 | struct fib_table *table; |
@@ -209,7 +209,7 @@ extern void __net_exit fib4_rules_exit(struct net *net); | |||
209 | extern u32 fib_rules_tclass(const struct fib_result *res); | 209 | extern u32 fib_rules_tclass(const struct fib_result *res); |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res); | 212 | extern int fib_lookup(struct net *n, struct flowi4 *flp, struct fib_result *res); |
213 | 213 | ||
214 | extern struct fib_table *fib_new_table(struct net *net, u32 id); | 214 | extern struct fib_table *fib_new_table(struct net *net, u32 id); |
215 | extern struct fib_table *fib_get_table(struct net *net, u32 id); | 215 | extern struct fib_table *fib_get_table(struct net *net, u32 id); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 76105284a81c..48125d559f17 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -158,7 +158,7 @@ static inline unsigned __inet_dev_addr_type(struct net *net, | |||
158 | if (local_table) { | 158 | if (local_table) { |
159 | ret = RTN_UNICAST; | 159 | ret = RTN_UNICAST; |
160 | rcu_read_lock(); | 160 | rcu_read_lock(); |
161 | if (!fib_table_lookup(local_table, &fl, &res, FIB_LOOKUP_NOREF)) { | 161 | if (!fib_table_lookup(local_table, &fl.u.ip4, &res, FIB_LOOKUP_NOREF)) { |
162 | if (!dev || dev == res.fi->fib_dev) | 162 | if (!dev || dev == res.fi->fib_dev) |
163 | ret = res.type; | 163 | ret = res.type; |
164 | } | 164 | } |
@@ -222,7 +222,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
222 | goto e_inval; | 222 | goto e_inval; |
223 | 223 | ||
224 | net = dev_net(dev); | 224 | net = dev_net(dev); |
225 | if (fib_lookup(net, &fl, &res)) | 225 | if (fib_lookup(net, &fl.u.ip4, &res)) |
226 | goto last_resort; | 226 | goto last_resort; |
227 | if (res.type != RTN_UNICAST) { | 227 | if (res.type != RTN_UNICAST) { |
228 | if (res.type != RTN_LOCAL || !accept_local) | 228 | if (res.type != RTN_LOCAL || !accept_local) |
@@ -256,7 +256,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
256 | fl.flowi_oif = dev->ifindex; | 256 | fl.flowi_oif = dev->ifindex; |
257 | 257 | ||
258 | ret = 0; | 258 | ret = 0; |
259 | if (fib_lookup(net, &fl, &res) == 0) { | 259 | if (fib_lookup(net, &fl.u.ip4, &res) == 0) { |
260 | if (res.type == RTN_UNICAST) { | 260 | if (res.type == RTN_UNICAST) { |
261 | *spec_dst = FIB_RES_PREFSRC(res); | 261 | *spec_dst = FIB_RES_PREFSRC(res); |
262 | ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; | 262 | ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; |
@@ -813,7 +813,7 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb) | |||
813 | 813 | ||
814 | frn->tb_id = tb->tb_id; | 814 | frn->tb_id = tb->tb_id; |
815 | rcu_read_lock(); | 815 | rcu_read_lock(); |
816 | frn->err = fib_table_lookup(tb, &fl, &res, FIB_LOOKUP_NOREF); | 816 | frn->err = fib_table_lookup(tb, &fl.u.ip4, &res, FIB_LOOKUP_NOREF); |
817 | 817 | ||
818 | if (!frn->err) { | 818 | if (!frn->err) { |
819 | frn->prefixlen = res.prefixlen; | 819 | frn->prefixlen = res.prefixlen; |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 3018efbaea77..0c63c4ab0936 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -53,7 +53,7 @@ u32 fib_rules_tclass(const struct fib_result *res) | |||
53 | } | 53 | } |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | int fib_lookup(struct net *net, struct flowi *flp, struct fib_result *res) | 56 | int fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res) |
57 | { | 57 | { |
58 | struct fib_lookup_arg arg = { | 58 | struct fib_lookup_arg arg = { |
59 | .result = res, | 59 | .result = res, |
@@ -61,7 +61,7 @@ int fib_lookup(struct net *net, struct flowi *flp, struct fib_result *res) | |||
61 | }; | 61 | }; |
62 | int err; | 62 | int err; |
63 | 63 | ||
64 | err = fib_rules_lookup(net->ipv4.rules_ops, flp, 0, &arg); | 64 | err = fib_rules_lookup(net->ipv4.rules_ops, flowi4_to_flowi(flp), 0, &arg); |
65 | res->r = arg.rule; | 65 | res->r = arg.rule; |
66 | 66 | ||
67 | return err; | 67 | return err; |
@@ -95,7 +95,7 @@ static int fib4_rule_action(struct fib_rule *rule, struct flowi *flp, | |||
95 | if (!tbl) | 95 | if (!tbl) |
96 | goto errout; | 96 | goto errout; |
97 | 97 | ||
98 | err = fib_table_lookup(tbl, flp, (struct fib_result *) arg->result, arg->flags); | 98 | err = fib_table_lookup(tbl, &flp->u.ip4, (struct fib_result *) arg->result, arg->flags); |
99 | if (err > 0) | 99 | if (err > 0) |
100 | err = -EAGAIN; | 100 | err = -EAGAIN; |
101 | errout: | 101 | errout: |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 79179ade5294..a721013fdf46 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -569,7 +569,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, | |||
569 | /* It is not necessary, but requires a bit of thinking */ | 569 | /* It is not necessary, but requires a bit of thinking */ |
570 | if (fl.fl4_scope < RT_SCOPE_LINK) | 570 | if (fl.fl4_scope < RT_SCOPE_LINK) |
571 | fl.fl4_scope = RT_SCOPE_LINK; | 571 | fl.fl4_scope = RT_SCOPE_LINK; |
572 | err = fib_lookup(net, &fl, &res); | 572 | err = fib_lookup(net, &fl.u.ip4, &res); |
573 | if (err) { | 573 | if (err) { |
574 | rcu_read_unlock(); | 574 | rcu_read_unlock(); |
575 | return err; | 575 | return err; |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index d5ff80ef001a..3d28a35c2e1a 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1341,7 +1341,7 @@ err: | |||
1341 | 1341 | ||
1342 | /* should be called with rcu_read_lock */ | 1342 | /* should be called with rcu_read_lock */ |
1343 | static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, | 1343 | static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, |
1344 | t_key key, const struct flowi *flp, | 1344 | t_key key, const struct flowi4 *flp, |
1345 | struct fib_result *res, int fib_flags) | 1345 | struct fib_result *res, int fib_flags) |
1346 | { | 1346 | { |
1347 | struct leaf_info *li; | 1347 | struct leaf_info *li; |
@@ -1360,9 +1360,9 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, | |||
1360 | struct fib_info *fi = fa->fa_info; | 1360 | struct fib_info *fi = fa->fa_info; |
1361 | int nhsel, err; | 1361 | int nhsel, err; |
1362 | 1362 | ||
1363 | if (fa->fa_tos && fa->fa_tos != flp->fl4_tos) | 1363 | if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) |
1364 | continue; | 1364 | continue; |
1365 | if (fa->fa_scope < flp->fl4_scope) | 1365 | if (fa->fa_scope < flp->flowi4_scope) |
1366 | continue; | 1366 | continue; |
1367 | fib_alias_accessed(fa); | 1367 | fib_alias_accessed(fa); |
1368 | err = fib_props[fa->fa_type].error; | 1368 | err = fib_props[fa->fa_type].error; |
@@ -1379,7 +1379,7 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, | |||
1379 | 1379 | ||
1380 | if (nh->nh_flags & RTNH_F_DEAD) | 1380 | if (nh->nh_flags & RTNH_F_DEAD) |
1381 | continue; | 1381 | continue; |
1382 | if (flp->flowi_oif && flp->flowi_oif != nh->nh_oif) | 1382 | if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif) |
1383 | continue; | 1383 | continue; |
1384 | 1384 | ||
1385 | #ifdef CONFIG_IP_FIB_TRIE_STATS | 1385 | #ifdef CONFIG_IP_FIB_TRIE_STATS |
@@ -1406,7 +1406,7 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, | |||
1406 | return 1; | 1406 | return 1; |
1407 | } | 1407 | } |
1408 | 1408 | ||
1409 | int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | 1409 | int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, |
1410 | struct fib_result *res, int fib_flags) | 1410 | struct fib_result *res, int fib_flags) |
1411 | { | 1411 | { |
1412 | struct trie *t = (struct trie *) tb->tb_data; | 1412 | struct trie *t = (struct trie *) tb->tb_data; |
@@ -1414,7 +1414,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | |||
1414 | struct rt_trie_node *n; | 1414 | struct rt_trie_node *n; |
1415 | struct tnode *pn; | 1415 | struct tnode *pn; |
1416 | unsigned int pos, bits; | 1416 | unsigned int pos, bits; |
1417 | t_key key = ntohl(flp->fl4_dst); | 1417 | t_key key = ntohl(flp->daddr); |
1418 | unsigned int chopped_off; | 1418 | unsigned int chopped_off; |
1419 | t_key cindex = 0; | 1419 | t_key cindex = 0; |
1420 | unsigned int current_prefix_length = KEYLENGTH; | 1420 | unsigned int current_prefix_length = KEYLENGTH; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index c9aa4f9effe2..027b4cc0f4a0 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1707,7 +1707,7 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt) | |||
1707 | }; | 1707 | }; |
1708 | 1708 | ||
1709 | rcu_read_lock(); | 1709 | rcu_read_lock(); |
1710 | if (fib_lookup(dev_net(rt->dst.dev), &fl, &res) == 0) | 1710 | if (fib_lookup(dev_net(rt->dst.dev), &fl.u.ip4, &res) == 0) |
1711 | src = FIB_RES_PREFSRC(res); | 1711 | src = FIB_RES_PREFSRC(res); |
1712 | else | 1712 | else |
1713 | src = inet_select_addr(rt->dst.dev, rt->rt_gateway, | 1713 | src = inet_select_addr(rt->dst.dev, rt->rt_gateway, |
@@ -2125,7 +2125,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2125 | fl.fl4_src = saddr; | 2125 | fl.fl4_src = saddr; |
2126 | fl.fl4_tos = tos; | 2126 | fl.fl4_tos = tos; |
2127 | fl.fl4_scope = RT_SCOPE_UNIVERSE; | 2127 | fl.fl4_scope = RT_SCOPE_UNIVERSE; |
2128 | err = fib_lookup(net, &fl, &res); | 2128 | err = fib_lookup(net, &fl.u.ip4, &res); |
2129 | if (err != 0) { | 2129 | if (err != 0) { |
2130 | if (!IN_DEV_FORWARD(in_dev)) | 2130 | if (!IN_DEV_FORWARD(in_dev)) |
2131 | goto e_hostunreach; | 2131 | goto e_hostunreach; |
@@ -2551,7 +2551,7 @@ static struct rtable *ip_route_output_slow(struct net *net, | |||
2551 | goto make_route; | 2551 | goto make_route; |
2552 | } | 2552 | } |
2553 | 2553 | ||
2554 | if (fib_lookup(net, &fl, &res)) { | 2554 | if (fib_lookup(net, &fl.u.ip4, &res)) { |
2555 | res.fi = NULL; | 2555 | res.fi = NULL; |
2556 | if (oldflp->flowi_oif) { | 2556 | if (oldflp->flowi_oif) { |
2557 | /* Apparently, routing tables are wrong. Assume, | 2557 | /* Apparently, routing tables are wrong. Assume, |