From 6281dcc94a96bd73017b2baa8fa83925405109ef Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sat, 12 Mar 2011 00:43:55 -0500 Subject: 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 --- net/ipv6/af_inet6.c | 4 ++-- net/ipv6/datagram.c | 6 +++--- net/ipv6/icmp.c | 10 +++++----- net/ipv6/inet6_connection_sock.c | 8 ++++---- net/ipv6/mip6.c | 6 +++--- net/ipv6/netfilter/ip6t_REJECT.c | 4 ++-- net/ipv6/raw.c | 6 +++--- net/ipv6/syncookies.c | 4 ++-- net/ipv6/tcp_ipv6.c | 16 ++++++++-------- net/ipv6/udp.c | 10 +++++----- net/ipv6/xfrm6_policy.c | 12 ++++++------ net/ipv6/xfrm6_state.c | 4 ++-- 12 files changed, 45 insertions(+), 45 deletions(-) (limited to 'net/ipv6') diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 35b0be0463f9..923febea8989 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -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); diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 6c24b26f67ec..07e03e68243b 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -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); diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 9e123e08b9b7..52ff7aa1f9fc 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -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); } diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 673f9bf28958..1b06a24019c6 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c @@ -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); diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index e2f852cd0f4e..5038e6b2b55b 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c @@ -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; diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index fd3938803eb3..d1e905b7f563 100644 --- a/net/ipv6/netfilter/ip6t_REJECT.c +++ b/net/ipv6/netfilter/ip6t_REJECT.c @@ -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) { diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 323ad44ff775..d061465d6827 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -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 diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index ca5255c08371..5b9eded1432c 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c @@ -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); diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index a3d1229b4004..c531ad5fbccc 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -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 diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 91f8047463ec..dad035fb0afd 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -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) diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index d62496c1a6f9..213c7594144b 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c @@ -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; } diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c index 805d0e14c331..71277ce78590 100644 --- a/net/ipv6/xfrm6_state.c +++ b/net/ipv6/xfrm6_state.c @@ -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; -- cgit v1.2.3