net: Make flowi ports AF dependent.

Create two sets of port member accessors, one set prefixed by fl4_*
and the other prefixed by fl6_*

This will let us to create AF optimal flow instances.

It will work because every context in which we access the ports,
we have to be fully aware of which AF the flowi is anyways.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller
2011-03-12 00:43:55 -05:00
parent 08704bcbf0
commit 6281dcc94a
28 changed files with 139 additions and 129 deletions

View File

@@ -157,8 +157,8 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct sock
.fl4_src = saddr,
.fl4_tos = tos,
.flowi_proto = proto,
.fl_ip_dport = dport,
.fl_ip_sport = sport,
.fl4_dport = dport,
.fl4_sport = sport,
};
if (sk)
security_sk_classify_flow(sk, &fl);
@@ -175,7 +175,7 @@ static inline struct rtable *ip_route_output_gre(struct net *net,
.fl4_src = saddr,
.fl4_tos = tos,
.flowi_proto = IPPROTO_GRE,
.fl_gre_key = gre_key,
.fl4_gre_key = gre_key,
};
return ip_route_output_key(net, &fl);
}
@@ -228,14 +228,16 @@ static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos,
__be16 sport, __be16 dport,
struct sock *sk, bool can_sleep)
{
struct flowi fl = { .flowi_oif = oif,
.flowi_mark = sk->sk_mark,
.fl4_dst = dst,
.fl4_src = src,
.fl4_tos = tos,
.flowi_proto = protocol,
.fl_ip_sport = sport,
.fl_ip_dport = dport };
struct flowi fl = {
.flowi_oif = oif,
.flowi_mark = sk->sk_mark,
.fl4_dst = dst,
.fl4_src = src,
.fl4_tos = tos,
.flowi_proto = protocol,
.fl4_sport = sport,
.fl4_dport = dport,
};
struct net *net = sock_net(sk);
struct rtable *rt;
@@ -264,15 +266,16 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
__be16 dport, struct sock *sk)
{
if (sport != orig_sport || dport != orig_dport) {
struct flowi fl = { .flowi_oif = rt->rt_oif,
.flowi_mark = rt->rt_mark,
.fl4_dst = rt->rt_key_dst,
.fl4_src = rt->rt_key_src,
.fl4_tos = rt->rt_tos,
.flowi_proto = protocol,
.fl_ip_sport = sport,
.fl_ip_dport = dport };
struct flowi fl = {
.flowi_oif = rt->rt_oif,
.flowi_mark = rt->rt_mark,
.fl4_dst = rt->rt_key_dst,
.fl4_src = rt->rt_key_src,
.fl4_tos = rt->rt_tos,
.flowi_proto = protocol,
.fl4_sport = sport,
.fl4_dport = dport
};
if (inet_sk(sk)->transparent)
fl.flowi_flags |= FLOWI_FLAG_ANYSRC;
if (protocol == IPPROTO_TCP)