net: Make flowi ports AF dependent.
authorDavid S. Miller <davem@davemloft.net>
Sat, 12 Mar 2011 05:43:55 +0000 (00:43 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sat, 12 Mar 2011 23:08:46 +0000 (15:08 -0800)
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>
28 files changed:
include/net/flow.h
include/net/route.h
include/net/xfrm.h
net/dccp/ipv4.c
net/dccp/ipv6.c
net/ipv4/icmp.c
net/ipv4/inet_connection_sock.c
net/ipv4/ip_output.c
net/ipv4/netfilter/nf_nat_standalone.c
net/ipv4/raw.c
net/ipv4/syncookies.c
net/ipv4/udp.c
net/ipv4/xfrm4_policy.c
net/ipv4/xfrm4_state.c
net/ipv6/af_inet6.c
net/ipv6/datagram.c
net/ipv6/icmp.c
net/ipv6/inet6_connection_sock.c
net/ipv6/mip6.c
net/ipv6/netfilter/ip6t_REJECT.c
net/ipv6/raw.c
net/ipv6/syncookies.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/ipv6/xfrm6_policy.c
net/ipv6/xfrm6_state.c
net/sctp/protocol.c
net/xfrm/xfrm_policy.c

index 541ac13f245a54e7ab4c2f4e53c9968a8934ed03..f19f41d7dafc89d7eca16aacda4fa21e7d65b0ca 100644 (file)
@@ -89,13 +89,20 @@ struct flowi {
 #define fl4_scope      flowi_scope
 
        union flowi_uli uli_u;
-#define fl_ip_sport    uli_u.ports.sport
-#define fl_ip_dport    uli_u.ports.dport
-#define fl_icmp_type   uli_u.icmpt.type
-#define fl_icmp_code   uli_u.icmpt.code
-#define fl_ipsec_spi   uli_u.spi
-#define fl_mh_type     uli_u.mht.type
-#define fl_gre_key     uli_u.gre_key
+#define fl4_sport      uli_u.ports.sport
+#define fl4_dport      uli_u.ports.dport
+#define fl4_icmp_type  uli_u.icmpt.type
+#define fl4_icmp_code  uli_u.icmpt.code
+#define fl4_ipsec_spi  uli_u.spi
+#define fl4_mh_type    uli_u.mht.type
+#define fl4_gre_key    uli_u.gre_key
+#define fl6_sport      uli_u.ports.sport
+#define fl6_dport      uli_u.ports.dport
+#define fl6_icmp_type  uli_u.icmpt.type
+#define fl6_icmp_code  uli_u.icmpt.code
+#define fl6_ipsec_spi  uli_u.spi
+#define fl6_mh_type    uli_u.mht.type
+#define fl6_gre_key    uli_u.gre_key
 } __attribute__((__aligned__(BITS_PER_LONG/8)));
 
 #define FLOW_DIR_IN    0
index 3d814f84abd0bc95190bd76aab2aee7b81cdb019..4c207f9fe0cb45d10678d539e18f7ebe90afd62d 100644 (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)
index d5a12d10a0d424e0427e3ddd7f81c69c83028040..aa860add570bfecf4afdcf2e8a92c6102b9b81b4 100644 (file)
@@ -800,7 +800,7 @@ static inline bool addr_match(const void *token1, const void *token2,
 }
 
 static __inline__
-__be16 xfrm_flowi_sport(const struct flowi *fl)
+__be16 xfrm_flowi_sport(const struct flowi *fl, const union flowi_uli *uli)
 {
        __be16 port;
        switch(fl->flowi_proto) {
@@ -808,17 +808,17 @@ __be16 xfrm_flowi_sport(const struct flowi *fl)
        case IPPROTO_UDP:
        case IPPROTO_UDPLITE:
        case IPPROTO_SCTP:
-               port = fl->fl_ip_sport;
+               port = uli->ports.sport;
                break;
        case IPPROTO_ICMP:
        case IPPROTO_ICMPV6:
-               port = htons(fl->fl_icmp_type);
+               port = htons(uli->icmpt.type);
                break;
        case IPPROTO_MH:
-               port = htons(fl->fl_mh_type);
+               port = htons(uli->mht.type);
                break;
        case IPPROTO_GRE:
-               port = htons(ntohl(fl->fl_gre_key) >> 16);
+               port = htons(ntohl(uli->gre_key) >> 16);
                break;
        default:
                port = 0;       /*XXX*/
@@ -827,7 +827,7 @@ __be16 xfrm_flowi_sport(const struct flowi *fl)
 }
 
 static __inline__
-__be16 xfrm_flowi_dport(const struct flowi *fl)
+__be16 xfrm_flowi_dport(const struct flowi *fl, const union flowi_uli *uli)
 {
        __be16 port;
        switch(fl->flowi_proto) {
@@ -835,14 +835,14 @@ __be16 xfrm_flowi_dport(const struct flowi *fl)
        case IPPROTO_UDP:
        case IPPROTO_UDPLITE:
        case IPPROTO_SCTP:
-               port = fl->fl_ip_dport;
+               port = uli->ports.dport;
                break;
        case IPPROTO_ICMP:
        case IPPROTO_ICMPV6:
-               port = htons(fl->fl_icmp_code);
+               port = htons(uli->icmpt.code);
                break;
        case IPPROTO_GRE:
-               port = htons(ntohl(fl->fl_gre_key) & 0xffff);
+               port = htons(ntohl(uli->gre_key) & 0xffff);
                break;
        default:
                port = 0;       /*XXX*/
index 09a09911c5ea2bbad26120c62726b2162b379b6d..d934b20402305f52b73d238aa0272aa55f3cc459 100644 (file)
@@ -471,8 +471,8 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
                .fl4_src = ip_hdr(skb)->daddr,
                .fl4_tos = RT_CONN_FLAGS(sk),
                .flowi_proto = sk->sk_protocol,
-               .fl_ip_sport = dccp_hdr(skb)->dccph_dport,
-               .fl_ip_dport = dccp_hdr(skb)->dccph_sport,
+               .fl4_sport = dccp_hdr(skb)->dccph_dport,
+               .fl4_dport = dccp_hdr(skb)->dccph_sport,
        };
 
        security_skb_classify_flow(skb, &fl);
index 5209ee7a3dc2c953052412ea8a5db3a931305751..2b351c6da49a68ae78fb792278b6e0d03ae140f3 100644 (file)
@@ -158,8 +158,8 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                        ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
                        ipv6_addr_copy(&fl.fl6_src, &np->saddr);
                        fl.flowi_oif = sk->sk_bound_dev_if;
-                       fl.fl_ip_dport = inet->inet_dport;
-                       fl.fl_ip_sport = inet->inet_sport;
+                       fl.fl6_dport = inet->inet_dport;
+                       fl.fl6_sport = inet->inet_sport;
                        security_sk_classify_flow(sk, &fl);
 
                        dst = ip6_dst_lookup_flow(sk, &fl, NULL, false);
@@ -253,8 +253,8 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
        ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
        fl.fl6_flowlabel = 0;
        fl.flowi_oif = ireq6->iif;
-       fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-       fl.fl_ip_sport = inet_rsk(req)->loc_port;
+       fl.fl6_dport = inet_rsk(req)->rmt_port;
+       fl.fl6_sport = inet_rsk(req)->loc_port;
        security_req_classify_flow(req, &fl);
 
        opt = np->opt;
@@ -323,8 +323,8 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
 
        fl.flowi_proto = IPPROTO_DCCP;
        fl.flowi_oif = inet6_iif(rxskb);
-       fl.fl_ip_dport = dccp_hdr(skb)->dccph_dport;
-       fl.fl_ip_sport = dccp_hdr(skb)->dccph_sport;
+       fl.fl6_dport = dccp_hdr(skb)->dccph_dport;
+       fl.fl6_sport = dccp_hdr(skb)->dccph_sport;
        security_skb_classify_flow(rxskb, &fl);
 
        /* sk = NULL, but it is safe for now. RST socket required. */
@@ -535,8 +535,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
                final_p = fl6_update_dst(&fl, opt, &final);
                ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
                fl.flowi_oif = sk->sk_bound_dev_if;
-               fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-               fl.fl_ip_sport = inet_rsk(req)->loc_port;
+               fl.fl6_dport = inet_rsk(req)->rmt_port;
+               fl.fl6_sport = inet_rsk(req)->loc_port;
                security_sk_classify_flow(sk, &fl);
 
                dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
@@ -957,8 +957,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
        ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
        ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr);
        fl.flowi_oif = sk->sk_bound_dev_if;
-       fl.fl_ip_dport = usin->sin6_port;
-       fl.fl_ip_sport = inet->inet_sport;
+       fl.fl6_dport = usin->sin6_port;
+       fl.fl6_sport = inet->inet_sport;
        security_sk_classify_flow(sk, &fl);
 
        final_p = fl6_update_dst(&fl, np->opt, &final);
index 3fde7f23c70ba9edb7d46436822a18eb71887df8..8d091954625bfaec2cbd3d74273d5174fd35e539 100644 (file)
@@ -384,8 +384,8 @@ static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in,
                .fl4_src = saddr,
                .fl4_tos = RT_TOS(tos),
                .flowi_proto = IPPROTO_ICMP,
-               .fl_icmp_type = type,
-               .fl_icmp_code = code,
+               .fl4_icmp_type = type,
+               .fl4_icmp_code = code,
        };
        struct rtable *rt, *rt2;
        int err;
index 97081702dffd94548bc067eb6a5a77456e06ed46..10a8e9523578ad4c4aea1109162b9f58f28c9757 100644 (file)
@@ -365,8 +365,8 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,
                .fl4_tos = RT_CONN_FLAGS(sk),
                .flowi_proto = sk->sk_protocol,
                .flowi_flags = inet_sk_flowi_flags(sk),
-               .fl_ip_sport = inet_sk(sk)->inet_sport,
-               .fl_ip_dport = ireq->rmt_port,
+               .fl4_sport = inet_sk(sk)->inet_sport,
+               .fl4_dport = ireq->rmt_port,
        };
        struct net *net = sock_net(sk);
 
index e35ca40df03b8f8d4112b178ea8f68876bd0b961..67e5f71303226eae3519e5863fc85ca3b4f0d7e1 100644 (file)
@@ -1479,8 +1479,8 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
                        .fl4_dst = daddr,
                        .fl4_src = rt->rt_spec_dst,
                        .fl4_tos = RT_TOS(ip_hdr(skb)->tos),
-                       .fl_ip_sport = tcp_hdr(skb)->dest,
-                       .fl_ip_dport = tcp_hdr(skb)->source,
+                       .fl4_sport = tcp_hdr(skb)->dest,
+                       .fl4_dport = tcp_hdr(skb)->source,
                        .flowi_proto = sk->sk_protocol,
                        .flowi_flags = ip_reply_arg_flowi_flags(arg),
                };
index 95481fee8bdbfafec767a2ba2c1d19bef938fb85..1f3c695a47c8f098c27293f422373e610af4078b 100644 (file)
@@ -55,7 +55,7 @@ static void nat_decode_session(struct sk_buff *skb, struct flowi *fl)
                    t->dst.protonum == IPPROTO_UDPLITE ||
                    t->dst.protonum == IPPROTO_DCCP ||
                    t->dst.protonum == IPPROTO_SCTP)
-                       fl->fl_ip_dport = t->dst.u.tcp.port;
+                       fl->fl4_dport = t->dst.u.tcp.port;
        }
 
        statusbit ^= IPS_NAT_MASK;
@@ -67,7 +67,7 @@ static void nat_decode_session(struct sk_buff *skb, struct flowi *fl)
                    t->dst.protonum == IPPROTO_UDPLITE ||
                    t->dst.protonum == IPPROTO_DCCP ||
                    t->dst.protonum == IPPROTO_SCTP)
-                       fl->fl_ip_sport = t->src.u.tcp.port;
+                       fl->fl4_sport = t->src.u.tcp.port;
        }
 }
 #endif
index b42b7cd56c0378f7915ea9372cb9b47f57506a96..333b826c1871d10a7206c11567464710566a6645 100644 (file)
@@ -433,8 +433,8 @@ static int raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
                                code = iov->iov_base;
 
                        if (type && code) {
-                               if (get_user(fl->fl_icmp_type, type) ||
-                                   get_user(fl->fl_icmp_code, code))
+                               if (get_user(fl->fl4_icmp_type, type) ||
+                                   get_user(fl->fl4_icmp_code, code))
                                        return -EFAULT;
                                probed = 1;
                        }
index 98d47dc60c897576f4c90a35fd19c0a1b4347dc2..d90529d45ee6b1bf0cc1caead3a773b927d063a8 100644 (file)
@@ -353,8 +353,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
                        .fl4_tos = RT_CONN_FLAGS(sk),
                        .flowi_proto = IPPROTO_TCP,
                        .flowi_flags = inet_sk_flowi_flags(sk),
-                       .fl_ip_sport = th->dest,
-                       .fl_ip_dport = th->source,
+                       .fl4_sport = th->dest,
+                       .fl4_dport = th->source,
                };
                security_req_classify_flow(req, &fl);
                rt = ip_route_output_key(sock_net(sk), &fl);
index e10f62e6c07c602b62a4b51057055bcecc0ba999..116e4a8bfb7318b1d82fc7a54835ac9eaf7e6800 100644 (file)
@@ -778,7 +778,7 @@ static int udp_push_pending_frames(struct sock *sk)
        if (!skb)
                goto out;
 
-       err = udp_send_skb(skb, fl->fl4_dst, fl->fl_ip_dport);
+       err = udp_send_skb(skb, fl->fl4_dst, fl->fl4_dport);
 
 out:
        up->len = 0;
@@ -917,8 +917,8 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                        .flowi_proto = sk->sk_protocol,
                        .flowi_flags = (inet_sk_flowi_flags(sk) |
                                     FLOWI_FLAG_CAN_SLEEP),
-                       .fl_ip_sport = inet->inet_sport,
-                       .fl_ip_dport = dport,
+                       .fl4_sport = inet->inet_sport,
+                       .fl4_dport = dport,
                };
                struct net *net = sock_net(sk);
 
@@ -973,9 +973,9 @@ back_from_confirm:
         *      Now cork the socket to pend data.
         */
        inet->cork.fl.fl4_dst = daddr;
-       inet->cork.fl.fl_ip_dport = dport;
+       inet->cork.fl.fl4_dport = dport;
        inet->cork.fl.fl4_src = saddr;
-       inet->cork.fl.fl_ip_sport = inet->inet_sport;
+       inet->cork.fl.fl4_sport = inet->inet_sport;
        up->pending = AF_INET;
 
 do_append_data:
index 4294f121a749db2c8d22bc9407711da126dfadeb..b7b0921b425d75ac48c6db4b637299438f865029 100644 (file)
@@ -117,8 +117,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
                            pskb_may_pull(skb, xprth + 4 - skb->data)) {
                                __be16 *ports = (__be16 *)xprth;
 
-                               fl->fl_ip_sport = ports[!!reverse];
-                               fl->fl_ip_dport = ports[!reverse];
+                               fl->fl4_sport = ports[!!reverse];
+                               fl->fl4_dport = ports[!reverse];
                        }
                        break;
 
@@ -126,8 +126,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
                        if (pskb_may_pull(skb, xprth + 2 - skb->data)) {
                                u8 *icmp = xprth;
 
-                               fl->fl_icmp_type = icmp[0];
-                               fl->fl_icmp_code = icmp[1];
+                               fl->fl4_icmp_type = icmp[0];
+                               fl->fl4_icmp_code = icmp[1];
                        }
                        break;
 
@@ -135,7 +135,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
                        if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
                                __be32 *ehdr = (__be32 *)xprth;
 
-                               fl->fl_ipsec_spi = ehdr[0];
+                               fl->fl4_ipsec_spi = ehdr[0];
                        }
                        break;
 
@@ -143,7 +143,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
                        if (pskb_may_pull(skb, xprth + 8 - skb->data)) {
                                __be32 *ah_hdr = (__be32*)xprth;
 
-                               fl->fl_ipsec_spi = ah_hdr[1];
+                               fl->fl4_ipsec_spi = ah_hdr[1];
                        }
                        break;
 
@@ -151,7 +151,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
                        if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
                                __be16 *ipcomp_hdr = (__be16 *)xprth;
 
-                               fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
+                               fl->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
                        }
                        break;
 
@@ -163,13 +163,13 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
                                if (greflags[0] & GRE_KEY) {
                                        if (greflags[0] & GRE_CSUM)
                                                gre_hdr++;
-                                       fl->fl_gre_key = gre_hdr[1];
+                                       fl->fl4_gre_key = gre_hdr[1];
                                }
                        }
                        break;
 
                default:
-                       fl->fl_ipsec_spi = 0;
+                       fl->fl4_ipsec_spi = 0;
                        break;
                }
        }
index d2314348dd2a89773d5617e1060af48be70f18ad..663b5501abcd96d0b8bc4aeee84350b6f0c87b36 100644 (file)
@@ -25,9 +25,9 @@ __xfrm4_init_tempsel(struct xfrm_selector *sel, const struct flowi *fl)
 {
        sel->daddr.a4 = fl->fl4_dst;
        sel->saddr.a4 = fl->fl4_src;
-       sel->dport = xfrm_flowi_dport(fl);
+       sel->dport = xfrm_flowi_dport(fl, &fl->uli_u);
        sel->dport_mask = htons(0xffff);
-       sel->sport = xfrm_flowi_sport(fl);
+       sel->sport = xfrm_flowi_sport(fl, &fl->uli_u);
        sel->sport_mask = htons(0xffff);
        sel->family = AF_INET;
        sel->prefixlen_d = 32;
index 35b0be0463f91ffde2d40fddc240869ae97a8ba7..923febea89892cc890eac04a9777c264f0a29df7 100644 (file)
@@ -661,8 +661,8 @@ int inet6_sk_rebuild_header(struct sock *sk)
                fl.fl6_flowlabel = np->flow_label;
                fl.flowi_oif = sk->sk_bound_dev_if;
                fl.flowi_mark = sk->sk_mark;
-               fl.fl_ip_dport = inet->inet_dport;
-               fl.fl_ip_sport = inet->inet_sport;
+               fl.fl6_dport = inet->inet_dport;
+               fl.fl6_sport = inet->inet_sport;
                security_sk_classify_flow(sk, &fl);
 
                final_p = fl6_update_dst(&fl, np->opt, &final);
index 6c24b26f67ec7942179399da7d061cef59f74287..07e03e68243b63b6d38306991644fc5391eb7bb9 100644 (file)
@@ -151,8 +151,8 @@ ipv4_connected:
        ipv6_addr_copy(&fl.fl6_src, &np->saddr);
        fl.flowi_oif = sk->sk_bound_dev_if;
        fl.flowi_mark = sk->sk_mark;
-       fl.fl_ip_dport = inet->inet_dport;
-       fl.fl_ip_sport = inet->inet_sport;
+       fl.fl6_dport = inet->inet_dport;
+       fl.fl6_sport = inet->inet_sport;
 
        if (!fl.flowi_oif && (addr_type&IPV6_ADDR_MULTICAST))
                fl.flowi_oif = np->mcast_oif;
@@ -261,7 +261,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
        serr->ee.ee_info = info;
        serr->ee.ee_data = 0;
        serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
-       serr->port = fl->fl_ip_dport;
+       serr->port = fl->fl6_dport;
 
        __skb_pull(skb, skb_tail_pointer(skb) - skb->data);
        skb_reset_transport_header(skb);
index 9e123e08b9b75837ef730e6b5f2b8fdca1f8d5c8..52ff7aa1f9fca995e41fc098f6c83738af4cd4fd 100644 (file)
@@ -448,8 +448,8 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
        if (saddr)
                ipv6_addr_copy(&fl.fl6_src, saddr);
        fl.flowi_oif = iif;
-       fl.fl_icmp_type = type;
-       fl.fl_icmp_code = code;
+       fl.fl6_icmp_type = type;
+       fl.fl6_icmp_code = code;
        security_skb_classify_flow(skb, &fl);
 
        sk = icmpv6_xmit_lock(net);
@@ -544,7 +544,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
        if (saddr)
                ipv6_addr_copy(&fl.fl6_src, saddr);
        fl.flowi_oif = skb->dev->ifindex;
-       fl.fl_icmp_type = ICMPV6_ECHO_REPLY;
+       fl.fl6_icmp_type = ICMPV6_ECHO_REPLY;
        security_skb_classify_flow(skb, &fl);
 
        sk = icmpv6_xmit_lock(net);
@@ -794,8 +794,8 @@ void icmpv6_flow_init(struct sock *sk, struct flowi *fl,
        ipv6_addr_copy(&fl->fl6_src, saddr);
        ipv6_addr_copy(&fl->fl6_dst, daddr);
        fl->flowi_proto         = IPPROTO_ICMPV6;
-       fl->fl_icmp_type        = type;
-       fl->fl_icmp_code        = 0;
+       fl->fl6_icmp_type       = type;
+       fl->fl6_icmp_code       = 0;
        fl->flowi_oif           = oif;
        security_sk_classify_flow(sk, fl);
 }
index 673f9bf289587320267b0efb1ef0ba0795a68e64..1b06a24019c62b99e6f26e002be4582e5c6b1817 100644 (file)
@@ -70,8 +70,8 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
        ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr);
        fl.flowi_oif = sk->sk_bound_dev_if;
        fl.flowi_mark = sk->sk_mark;
-       fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-       fl.fl_ip_sport = inet_rsk(req)->loc_port;
+       fl.fl6_dport = inet_rsk(req)->rmt_port;
+       fl.fl6_sport = inet_rsk(req)->loc_port;
        security_req_classify_flow(req, &fl);
 
        dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
@@ -220,8 +220,8 @@ int inet6_csk_xmit(struct sk_buff *skb)
        IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel);
        fl.flowi_oif = sk->sk_bound_dev_if;
        fl.flowi_mark = sk->sk_mark;
-       fl.fl_ip_sport = inet->inet_sport;
-       fl.fl_ip_dport = inet->inet_dport;
+       fl.fl6_sport = inet->inet_sport;
+       fl.fl6_dport = inet->inet_dport;
        security_sk_classify_flow(sk, &fl);
 
        final_p = fl6_update_dst(&fl, np->opt, &final);
index e2f852cd0f4e9ca0bc9e156d7cc65f83fa127a22..5038e6b2b55b98adc8ede33d349b175f2dd28939 100644 (file)
@@ -215,7 +215,7 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
        int err = 0;
 
        if (unlikely(fl->flowi_proto == IPPROTO_MH &&
-                    fl->fl_mh_type <= IP6_MH_TYPE_MAX))
+                    fl->fl6_mh_type <= IP6_MH_TYPE_MAX))
                goto out;
 
        if (likely(opt->dsthao)) {
@@ -241,10 +241,10 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
        sel.prefixlen_s = 128;
        sel.family = AF_INET6;
        sel.proto = fl->flowi_proto;
-       sel.dport = xfrm_flowi_dport(fl);
+       sel.dport = xfrm_flowi_dport(fl, &fl->uli_u);
        if (sel.dport)
                sel.dport_mask = htons(~0);
-       sel.sport = xfrm_flowi_sport(fl);
+       sel.sport = xfrm_flowi_sport(fl, &fl->uli_u);
        if (sel.sport)
                sel.sport_mask = htons(~0);
        sel.ifindex = fl->flowi_oif;
index fd3938803eb39c31678d6cc553e9863782abc365..d1e905b7f563fd0dffb322d62e708a3453fb0bb3 100644 (file)
@@ -93,8 +93,8 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
        fl.flowi_proto = IPPROTO_TCP;
        ipv6_addr_copy(&fl.fl6_src, &oip6h->daddr);
        ipv6_addr_copy(&fl.fl6_dst, &oip6h->saddr);
-       fl.fl_ip_sport = otcph.dest;
-       fl.fl_ip_dport = otcph.source;
+       fl.fl6_sport = otcph.dest;
+       fl.fl6_dport = otcph.source;
        security_skb_classify_flow(oldskb, &fl);
        dst = ip6_route_output(net, NULL, &fl);
        if (dst == NULL || dst->error) {
index 323ad44ff775661595ee1120eb5db83c874fa2e2..d061465d6827ed1a2facbe96979575981c7f7866 100644 (file)
@@ -694,8 +694,8 @@ static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
                                code = iov->iov_base;
 
                        if (type && code) {
-                               if (get_user(fl->fl_icmp_type, type) ||
-                                   get_user(fl->fl_icmp_code, code))
+                               if (get_user(fl->fl6_icmp_type, type) ||
+                                   get_user(fl->fl6_icmp_code, code))
                                        return -EFAULT;
                                probed = 1;
                        }
@@ -706,7 +706,7 @@ static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
                        /* check if type field is readable or not. */
                        if (iov->iov_len > 2 - len) {
                                u8 __user *p = iov->iov_base;
-                               if (get_user(fl->fl_mh_type, &p[2 - len]))
+                               if (get_user(fl->fl6_mh_type, &p[2 - len]))
                                        return -EFAULT;
                                probed = 1;
                        } else
index ca5255c08371e94177fd4ce4a877925d9cae0c41..5b9eded1432cc993b6b166e39acf3455f60a4fd3 100644 (file)
@@ -240,8 +240,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
                ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
                fl.flowi_oif = sk->sk_bound_dev_if;
                fl.flowi_mark = sk->sk_mark;
-               fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-               fl.fl_ip_sport = inet_sk(sk)->inet_sport;
+               fl.fl6_dport = inet_rsk(req)->rmt_port;
+               fl.fl6_sport = inet_sk(sk)->inet_sport;
                security_req_classify_flow(req, &fl);
 
                dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
index a3d1229b4004b19c1f518ec3a13c8ebc8210de50..c531ad5fbccc773c0ca8153b3f696e4c9351ceb9 100644 (file)
@@ -248,8 +248,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
                       (saddr ? saddr : &np->saddr));
        fl.flowi_oif = sk->sk_bound_dev_if;
        fl.flowi_mark = sk->sk_mark;
-       fl.fl_ip_dport = usin->sin6_port;
-       fl.fl_ip_sport = inet->inet_sport;
+       fl.fl6_dport = usin->sin6_port;
+       fl.fl6_sport = inet->inet_sport;
 
        final_p = fl6_update_dst(&fl, np->opt, &final);
 
@@ -401,8 +401,8 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                        ipv6_addr_copy(&fl.fl6_src, &np->saddr);
                        fl.flowi_oif = sk->sk_bound_dev_if;
                        fl.flowi_mark = sk->sk_mark;
-                       fl.fl_ip_dport = inet->inet_dport;
-                       fl.fl_ip_sport = inet->inet_sport;
+                       fl.fl6_dport = inet->inet_dport;
+                       fl.fl6_sport = inet->inet_sport;
                        security_skb_classify_flow(skb, &fl);
 
                        dst = ip6_dst_lookup_flow(sk, &fl, NULL, false);
@@ -493,8 +493,8 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
        fl.fl6_flowlabel = 0;
        fl.flowi_oif = treq->iif;
        fl.flowi_mark = sk->sk_mark;
-       fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-       fl.fl_ip_sport = inet_rsk(req)->loc_port;
+       fl.fl6_dport = inet_rsk(req)->rmt_port;
+       fl.fl6_sport = inet_rsk(req)->loc_port;
        security_req_classify_flow(req, &fl);
 
        opt = np->opt;
@@ -1057,8 +1057,8 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
 
        fl.flowi_proto = IPPROTO_TCP;
        fl.flowi_oif = inet6_iif(skb);
-       fl.fl_ip_dport = t1->dest;
-       fl.fl_ip_sport = t1->source;
+       fl.fl6_dport = t1->dest;
+       fl.fl6_sport = t1->source;
        security_skb_classify_flow(skb, &fl);
 
        /* Pass a socket to ip6_dst_lookup either it is for RST
index 91f8047463ecd8bc710ca7d90bb0b09b08d8b723..dad035fb0afd524cb7379b5c6eed670be71bd359 100644 (file)
@@ -899,8 +899,8 @@ static int udp_v6_push_pending_frames(struct sock *sk)
         * Create a UDP header
         */
        uh = udp_hdr(skb);
-       uh->source = fl->fl_ip_sport;
-       uh->dest = fl->fl_ip_dport;
+       uh->source = fl->fl6_sport;
+       uh->dest = fl->fl6_dport;
        uh->len = htons(up->len);
        uh->check = 0;
 
@@ -1036,7 +1036,7 @@ do_udp_sendmsg:
                if (sin6->sin6_port == 0)
                        return -EINVAL;
 
-               fl.fl_ip_dport = sin6->sin6_port;
+               fl.fl6_dport = sin6->sin6_port;
                daddr = &sin6->sin6_addr;
 
                if (np->sndflow) {
@@ -1065,7 +1065,7 @@ do_udp_sendmsg:
                if (sk->sk_state != TCP_ESTABLISHED)
                        return -EDESTADDRREQ;
 
-               fl.fl_ip_dport = inet->inet_dport;
+               fl.fl6_dport = inet->inet_dport;
                daddr = &np->daddr;
                fl.fl6_flowlabel = np->flow_label;
                connected = 1;
@@ -1112,7 +1112,7 @@ do_udp_sendmsg:
                fl.fl6_dst.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */
        if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr))
                ipv6_addr_copy(&fl.fl6_src, &np->saddr);
-       fl.fl_ip_sport = inet->inet_sport;
+       fl.fl6_sport = inet->inet_sport;
 
        final_p = fl6_update_dst(&fl, opt, &final);
        if (final_p)
index d62496c1a6f941f7b1b9445e01d37e3521340975..213c7594144b6310cfc3e5ea1fed6c8b8ea03790 100644 (file)
@@ -158,8 +158,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
                             pskb_may_pull(skb, nh + offset + 4 - skb->data))) {
                                __be16 *ports = (__be16 *)exthdr;
 
-                               fl->fl_ip_sport = ports[!!reverse];
-                               fl->fl_ip_dport = ports[!reverse];
+                               fl->fl6_sport = ports[!!reverse];
+                               fl->fl6_dport = ports[!reverse];
                        }
                        fl->flowi_proto = nexthdr;
                        return;
@@ -168,8 +168,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
                        if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) {
                                u8 *icmp = (u8 *)exthdr;
 
-                               fl->fl_icmp_type = icmp[0];
-                               fl->fl_icmp_code = icmp[1];
+                               fl->fl6_icmp_type = icmp[0];
+                               fl->fl6_icmp_code = icmp[1];
                        }
                        fl->flowi_proto = nexthdr;
                        return;
@@ -180,7 +180,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
                                struct ip6_mh *mh;
                                mh = (struct ip6_mh *)exthdr;
 
-                               fl->fl_mh_type = mh->ip6mh_type;
+                               fl->fl6_mh_type = mh->ip6mh_type;
                        }
                        fl->flowi_proto = nexthdr;
                        return;
@@ -191,7 +191,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
                case IPPROTO_ESP:
                case IPPROTO_COMP:
                default:
-                       fl->fl_ipsec_spi = 0;
+                       fl->fl6_ipsec_spi = 0;
                        fl->flowi_proto = nexthdr;
                        return;
                }
index 805d0e14c331b55fb27f70f4996b8ed1543575e8..71277ce78590cf8aa70be3c6189372bff7c62f4a 100644 (file)
@@ -26,9 +26,9 @@ __xfrm6_init_tempsel(struct xfrm_selector *sel, const struct flowi *fl)
         * to current session. */
        ipv6_addr_copy((struct in6_addr *)&sel->daddr, &fl->fl6_dst);
        ipv6_addr_copy((struct in6_addr *)&sel->saddr, &fl->fl6_src);
-       sel->dport = xfrm_flowi_dport(fl);
+       sel->dport = xfrm_flowi_dport(fl, &fl->uli_u);
        sel->dport_mask = htons(0xffff);
-       sel->sport = xfrm_flowi_sport(fl);
+       sel->sport = xfrm_flowi_sport(fl, &fl->uli_u);
        sel->sport_mask = htons(0xffff);
        sel->family = AF_INET6;
        sel->prefixlen_d = 128;
index 832665ac2100012a9f6cd24c0212c6ee5b0f50e6..b6fa2940e30b99484ae818f645c0246770277aa0 100644 (file)
@@ -476,16 +476,16 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
 
        memset(&fl, 0x0, sizeof(struct flowi));
        fl.fl4_dst  = daddr->v4.sin_addr.s_addr;
-       fl.fl_ip_dport = daddr->v4.sin_port;
+       fl.fl4_dport = daddr->v4.sin_port;
        fl.flowi_proto = IPPROTO_SCTP;
        if (asoc) {
                fl.fl4_tos = RT_CONN_FLAGS(asoc->base.sk);
                fl.flowi_oif = asoc->base.sk->sk_bound_dev_if;
-               fl.fl_ip_sport = htons(asoc->base.bind_addr.port);
+               fl.fl4_sport = htons(asoc->base.bind_addr.port);
        }
        if (saddr) {
                fl.fl4_src = saddr->v4.sin_addr.s_addr;
-               fl.fl_ip_sport = saddr->v4.sin_port;
+               fl.fl4_sport = saddr->v4.sin_port;
        }
 
        SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ",
@@ -534,7 +534,7 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
                if ((laddr->state == SCTP_ADDR_SRC) &&
                    (AF_INET == laddr->a.sa.sa_family)) {
                        fl.fl4_src = laddr->a.v4.sin_addr.s_addr;
-                       fl.fl_ip_sport = laddr->a.v4.sin_port;
+                       fl.fl4_sport = laddr->a.v4.sin_port;
                        rt = ip_route_output_key(&init_net, &fl);
                        if (!IS_ERR(rt)) {
                                dst = &rt->dst;
index dd6243f9d933fd74c8a08916e80df347261763f5..d54b6e7165c6efb6bf2e2f7525445532908d5a90 100644 (file)
@@ -61,8 +61,8 @@ __xfrm4_selector_match(const struct xfrm_selector *sel, const struct flowi *fl)
 {
        return  addr_match(&fl->fl4_dst, &sel->daddr, sel->prefixlen_d) &&
                addr_match(&fl->fl4_src, &sel->saddr, sel->prefixlen_s) &&
-               !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) &&
-               !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) &&
+               !((xfrm_flowi_dport(fl, &fl->uli_u) ^ sel->dport) & sel->dport_mask) &&
+               !((xfrm_flowi_sport(fl, &fl->uli_u) ^ sel->sport) & sel->sport_mask) &&
                (fl->flowi_proto == sel->proto || !sel->proto) &&
                (fl->flowi_oif == sel->ifindex || !sel->ifindex);
 }
@@ -72,8 +72,8 @@ __xfrm6_selector_match(const struct xfrm_selector *sel, const struct flowi *fl)
 {
        return  addr_match(&fl->fl6_dst, &sel->daddr, sel->prefixlen_d) &&
                addr_match(&fl->fl6_src, &sel->saddr, sel->prefixlen_s) &&
-               !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) &&
-               !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) &&
+               !((xfrm_flowi_dport(fl, &fl->uli_u) ^ sel->dport) & sel->dport_mask) &&
+               !((xfrm_flowi_sport(fl, &fl->uli_u) ^ sel->sport) & sel->sport_mask) &&
                (fl->flowi_proto == sel->proto || !sel->proto) &&
                (fl->flowi_oif == sel->ifindex || !sel->ifindex);
 }