ipv6: Convert to use flowi6 where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
126
net/dccp/ipv6.c
126
net/dccp/ipv6.c
@@ -147,22 +147,22 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||
dst = __sk_dst_check(sk, np->dst_cookie);
|
||||
if (dst == NULL) {
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
|
||||
/* BUGGG_FUTURE: Again, it is not clear how
|
||||
to handle rthdr case. Ignore this complexity
|
||||
for now.
|
||||
*/
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
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.fl6_dport = inet->inet_dport;
|
||||
fl.fl6_sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &np->daddr);
|
||||
ipv6_addr_copy(&fl6.saddr, &np->saddr);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.uli.ports.dport = inet->inet_dport;
|
||||
fl6.uli.ports.sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, NULL, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, NULL, false);
|
||||
if (IS_ERR(dst)) {
|
||||
sk->sk_err_soft = -PTR_ERR(dst);
|
||||
goto out;
|
||||
@@ -243,25 +243,25 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
|
||||
struct sk_buff *skb;
|
||||
struct ipv6_txoptions *opt = NULL;
|
||||
struct in6_addr *final_p, final;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
int err = -1;
|
||||
struct dst_entry *dst;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
|
||||
fl.fl6_flowlabel = 0;
|
||||
fl.flowi_oif = ireq6->iif;
|
||||
fl.fl6_dport = inet_rsk(req)->rmt_port;
|
||||
fl.fl6_sport = inet_rsk(req)->loc_port;
|
||||
security_req_classify_flow(req, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
|
||||
ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
|
||||
fl6.flowlabel = 0;
|
||||
fl6.flowi6_oif = ireq6->iif;
|
||||
fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
|
||||
fl6.uli.ports.sport = inet_rsk(req)->loc_port;
|
||||
security_req_classify_flow(req, flowi6_to_flowi(&fl6));
|
||||
|
||||
opt = np->opt;
|
||||
|
||||
final_p = fl6_update_dst(&fl, opt, &final);
|
||||
final_p = fl6_update_dst(&fl6, opt, &final);
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
|
||||
if (IS_ERR(dst)) {
|
||||
err = PTR_ERR(dst);
|
||||
dst = NULL;
|
||||
@@ -275,8 +275,8 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
|
||||
dh->dccph_checksum = dccp_v6_csum_finish(skb,
|
||||
&ireq6->loc_addr,
|
||||
&ireq6->rmt_addr);
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
|
||||
err = ip6_xmit(sk, skb, &fl, opt);
|
||||
ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
|
||||
err = ip6_xmit(sk, skb, &fl6, opt);
|
||||
err = net_xmit_eval(err);
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
|
||||
{
|
||||
struct ipv6hdr *rxip6h;
|
||||
struct sk_buff *skb;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct net *net = dev_net(skb_dst(rxskb)->dev);
|
||||
struct sock *ctl_sk = net->dccp.v6_ctl_sk;
|
||||
struct dst_entry *dst;
|
||||
@@ -317,21 +317,21 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
|
||||
dccp_hdr(skb)->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr,
|
||||
&rxip6h->daddr);
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &rxip6h->daddr);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
ipv6_addr_copy(&fl6.daddr, &rxip6h->saddr);
|
||||
ipv6_addr_copy(&fl6.saddr, &rxip6h->daddr);
|
||||
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
fl.flowi_oif = inet6_iif(rxskb);
|
||||
fl.fl6_dport = dccp_hdr(skb)->dccph_dport;
|
||||
fl.fl6_sport = dccp_hdr(skb)->dccph_sport;
|
||||
security_skb_classify_flow(rxskb, &fl);
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
fl6.flowi6_oif = inet6_iif(rxskb);
|
||||
fl6.uli.ports.dport = dccp_hdr(skb)->dccph_dport;
|
||||
fl6.uli.ports.sport = dccp_hdr(skb)->dccph_sport;
|
||||
security_skb_classify_flow(rxskb, flowi6_to_flowi(&fl6));
|
||||
|
||||
/* sk = NULL, but it is safe for now. RST socket required. */
|
||||
dst = ip6_dst_lookup_flow(ctl_sk, &fl, NULL, false);
|
||||
dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false);
|
||||
if (!IS_ERR(dst)) {
|
||||
skb_dst_set(skb, dst);
|
||||
ip6_xmit(ctl_sk, skb, &fl, NULL);
|
||||
ip6_xmit(ctl_sk, skb, &fl6, NULL);
|
||||
DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
|
||||
DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
|
||||
return;
|
||||
@@ -527,19 +527,19 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
|
||||
|
||||
if (dst == NULL) {
|
||||
struct in6_addr *final_p, final;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
|
||||
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.fl6_dport = inet_rsk(req)->rmt_port;
|
||||
fl.fl6_sport = inet_rsk(req)->loc_port;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
|
||||
final_p = fl6_update_dst(&fl6, opt, &final);
|
||||
ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
|
||||
fl6.uli.ports.sport = inet_rsk(req)->loc_port;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
|
||||
if (IS_ERR(dst))
|
||||
goto out;
|
||||
}
|
||||
@@ -859,7 +859,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
struct in6_addr *saddr = NULL, *final_p, final;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct dst_entry *dst;
|
||||
int addr_type;
|
||||
int err;
|
||||
@@ -872,14 +872,14 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
if (usin->sin6_family != AF_INET6)
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
|
||||
if (np->sndflow) {
|
||||
fl.fl6_flowlabel = usin->sin6_flowinfo & IPV6_FLOWINFO_MASK;
|
||||
IP6_ECN_flow_init(fl.fl6_flowlabel);
|
||||
if (fl.fl6_flowlabel & IPV6_FLOWLABEL_MASK) {
|
||||
fl6.flowlabel = usin->sin6_flowinfo & IPV6_FLOWINFO_MASK;
|
||||
IP6_ECN_flow_init(fl6.flowlabel);
|
||||
if (fl6.flowlabel & IPV6_FLOWLABEL_MASK) {
|
||||
struct ip6_flowlabel *flowlabel;
|
||||
flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel);
|
||||
flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
|
||||
if (flowlabel == NULL)
|
||||
return -EINVAL;
|
||||
ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst);
|
||||
@@ -916,7 +916,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
}
|
||||
|
||||
ipv6_addr_copy(&np->daddr, &usin->sin6_addr);
|
||||
np->flow_label = fl.fl6_flowlabel;
|
||||
np->flow_label = fl6.flowlabel;
|
||||
|
||||
/*
|
||||
* DCCP over IPv4
|
||||
@@ -953,24 +953,24 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
if (!ipv6_addr_any(&np->rcv_saddr))
|
||||
saddr = &np->rcv_saddr;
|
||||
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
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.fl6_dport = usin->sin6_port;
|
||||
fl.fl6_sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &np->daddr);
|
||||
ipv6_addr_copy(&fl6.saddr, saddr ? saddr : &np->saddr);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.uli.ports.dport = usin->sin6_port;
|
||||
fl6.uli.ports.sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
final_p = fl6_update_dst(&fl, np->opt, &final);
|
||||
final_p = fl6_update_dst(&fl6, np->opt, &final);
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, true);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, true);
|
||||
if (IS_ERR(dst)) {
|
||||
err = PTR_ERR(dst);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
if (saddr == NULL) {
|
||||
saddr = &fl.fl6_src;
|
||||
saddr = &fl6.saddr;
|
||||
ipv6_addr_copy(&np->rcv_saddr, saddr);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user