summaryrefslogtreecommitdiffstats
path: root/net/ipv6/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r--net/ipv6/udp.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index dad035fb0afd..ce4b16fbf81c 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -886,7 +886,7 @@ static int udp_v6_push_pending_frames(struct sock *sk)
886 struct udphdr *uh; 886 struct udphdr *uh;
887 struct udp_sock *up = udp_sk(sk); 887 struct udp_sock *up = udp_sk(sk);
888 struct inet_sock *inet = inet_sk(sk); 888 struct inet_sock *inet = inet_sk(sk);
889 struct flowi *fl = &inet->cork.fl; 889 struct flowi6 *fl6 = &inet->cork.fl.u.ip6;
890 int err = 0; 890 int err = 0;
891 int is_udplite = IS_UDPLITE(sk); 891 int is_udplite = IS_UDPLITE(sk);
892 __wsum csum = 0; 892 __wsum csum = 0;
@@ -899,23 +899,23 @@ static int udp_v6_push_pending_frames(struct sock *sk)
899 * Create a UDP header 899 * Create a UDP header
900 */ 900 */
901 uh = udp_hdr(skb); 901 uh = udp_hdr(skb);
902 uh->source = fl->fl6_sport; 902 uh->source = fl6->uli.ports.sport;
903 uh->dest = fl->fl6_dport; 903 uh->dest = fl6->uli.ports.dport;
904 uh->len = htons(up->len); 904 uh->len = htons(up->len);
905 uh->check = 0; 905 uh->check = 0;
906 906
907 if (is_udplite) 907 if (is_udplite)
908 csum = udplite_csum_outgoing(sk, skb); 908 csum = udplite_csum_outgoing(sk, skb);
909 else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */ 909 else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */
910 udp6_hwcsum_outgoing(sk, skb, &fl->fl6_src, &fl->fl6_dst, 910 udp6_hwcsum_outgoing(sk, skb, &fl6->saddr, &fl6->daddr,
911 up->len); 911 up->len);
912 goto send; 912 goto send;
913 } else 913 } else
914 csum = udp_csum_outgoing(sk, skb); 914 csum = udp_csum_outgoing(sk, skb);
915 915
916 /* add protocol-dependent pseudo-header */ 916 /* add protocol-dependent pseudo-header */
917 uh->check = csum_ipv6_magic(&fl->fl6_src, &fl->fl6_dst, 917 uh->check = csum_ipv6_magic(&fl6->saddr, &fl6->daddr,
918 up->len, fl->flowi_proto, csum); 918 up->len, fl6->flowi6_proto, csum);
919 if (uh->check == 0) 919 if (uh->check == 0)
920 uh->check = CSUM_MANGLED_0; 920 uh->check = CSUM_MANGLED_0;
921 921
@@ -947,7 +947,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
947 struct in6_addr *daddr, *final_p, final; 947 struct in6_addr *daddr, *final_p, final;
948 struct ipv6_txoptions *opt = NULL; 948 struct ipv6_txoptions *opt = NULL;
949 struct ip6_flowlabel *flowlabel = NULL; 949 struct ip6_flowlabel *flowlabel = NULL;
950 struct flowi fl; 950 struct flowi6 fl6;
951 struct dst_entry *dst; 951 struct dst_entry *dst;
952 int addr_len = msg->msg_namelen; 952 int addr_len = msg->msg_namelen;
953 int ulen = len; 953 int ulen = len;
@@ -1030,19 +1030,19 @@ do_udp_sendmsg:
1030 } 1030 }
1031 ulen += sizeof(struct udphdr); 1031 ulen += sizeof(struct udphdr);
1032 1032
1033 memset(&fl, 0, sizeof(fl)); 1033 memset(&fl6, 0, sizeof(fl6));
1034 1034
1035 if (sin6) { 1035 if (sin6) {
1036 if (sin6->sin6_port == 0) 1036 if (sin6->sin6_port == 0)
1037 return -EINVAL; 1037 return -EINVAL;
1038 1038
1039 fl.fl6_dport = sin6->sin6_port; 1039 fl6.uli.ports.dport = sin6->sin6_port;
1040 daddr = &sin6->sin6_addr; 1040 daddr = &sin6->sin6_addr;
1041 1041
1042 if (np->sndflow) { 1042 if (np->sndflow) {
1043 fl.fl6_flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; 1043 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK;
1044 if (fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) { 1044 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
1045 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 1045 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
1046 if (flowlabel == NULL) 1046 if (flowlabel == NULL)
1047 return -EINVAL; 1047 return -EINVAL;
1048 daddr = &flowlabel->dst; 1048 daddr = &flowlabel->dst;
@@ -1060,38 +1060,38 @@ do_udp_sendmsg:
1060 if (addr_len >= sizeof(struct sockaddr_in6) && 1060 if (addr_len >= sizeof(struct sockaddr_in6) &&
1061 sin6->sin6_scope_id && 1061 sin6->sin6_scope_id &&
1062 ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL) 1062 ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
1063 fl.flowi_oif = sin6->sin6_scope_id; 1063 fl6.flowi6_oif = sin6->sin6_scope_id;
1064 } else { 1064 } else {
1065 if (sk->sk_state != TCP_ESTABLISHED) 1065 if (sk->sk_state != TCP_ESTABLISHED)
1066 return -EDESTADDRREQ; 1066 return -EDESTADDRREQ;
1067 1067
1068 fl.fl6_dport = inet->inet_dport; 1068 fl6.uli.ports.dport = inet->inet_dport;
1069 daddr = &np->daddr; 1069 daddr = &np->daddr;
1070 fl.fl6_flowlabel = np->flow_label; 1070 fl6.flowlabel = np->flow_label;
1071 connected = 1; 1071 connected = 1;
1072 } 1072 }
1073 1073
1074 if (!fl.flowi_oif) 1074 if (!fl6.flowi6_oif)
1075 fl.flowi_oif = sk->sk_bound_dev_if; 1075 fl6.flowi6_oif = sk->sk_bound_dev_if;
1076 1076
1077 if (!fl.flowi_oif) 1077 if (!fl6.flowi6_oif)
1078 fl.flowi_oif = np->sticky_pktinfo.ipi6_ifindex; 1078 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
1079 1079
1080 fl.flowi_mark = sk->sk_mark; 1080 fl6.flowi6_mark = sk->sk_mark;
1081 1081
1082 if (msg->msg_controllen) { 1082 if (msg->msg_controllen) {
1083 opt = &opt_space; 1083 opt = &opt_space;
1084 memset(opt, 0, sizeof(struct ipv6_txoptions)); 1084 memset(opt, 0, sizeof(struct ipv6_txoptions));
1085 opt->tot_len = sizeof(*opt); 1085 opt->tot_len = sizeof(*opt);
1086 1086
1087 err = datagram_send_ctl(sock_net(sk), msg, &fl, opt, &hlimit, 1087 err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit,
1088 &tclass, &dontfrag); 1088 &tclass, &dontfrag);
1089 if (err < 0) { 1089 if (err < 0) {
1090 fl6_sock_release(flowlabel); 1090 fl6_sock_release(flowlabel);
1091 return err; 1091 return err;
1092 } 1092 }
1093 if ((fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { 1093 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) {
1094 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 1094 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
1095 if (flowlabel == NULL) 1095 if (flowlabel == NULL)
1096 return -EINVAL; 1096 return -EINVAL;
1097 } 1097 }
@@ -1105,27 +1105,27 @@ do_udp_sendmsg:
1105 opt = fl6_merge_options(&opt_space, flowlabel, opt); 1105 opt = fl6_merge_options(&opt_space, flowlabel, opt);
1106 opt = ipv6_fixup_options(&opt_space, opt); 1106 opt = ipv6_fixup_options(&opt_space, opt);
1107 1107
1108 fl.flowi_proto = sk->sk_protocol; 1108 fl6.flowi6_proto = sk->sk_protocol;
1109 if (!ipv6_addr_any(daddr)) 1109 if (!ipv6_addr_any(daddr))
1110 ipv6_addr_copy(&fl.fl6_dst, daddr); 1110 ipv6_addr_copy(&fl6.daddr, daddr);
1111 else 1111 else
1112 fl.fl6_dst.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ 1112 fl6.daddr.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */
1113 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) 1113 if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr))
1114 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 1114 ipv6_addr_copy(&fl6.saddr, &np->saddr);
1115 fl.fl6_sport = inet->inet_sport; 1115 fl6.uli.ports.sport = inet->inet_sport;
1116 1116
1117 final_p = fl6_update_dst(&fl, opt, &final); 1117 final_p = fl6_update_dst(&fl6, opt, &final);
1118 if (final_p) 1118 if (final_p)
1119 connected = 0; 1119 connected = 0;
1120 1120
1121 if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst)) { 1121 if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) {
1122 fl.flowi_oif = np->mcast_oif; 1122 fl6.flowi6_oif = np->mcast_oif;
1123 connected = 0; 1123 connected = 0;
1124 } 1124 }
1125 1125
1126 security_sk_classify_flow(sk, &fl); 1126 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
1127 1127
1128 dst = ip6_sk_dst_lookup_flow(sk, &fl, final_p, true); 1128 dst = ip6_sk_dst_lookup_flow(sk, &fl6, final_p, true);
1129 if (IS_ERR(dst)) { 1129 if (IS_ERR(dst)) {
1130 err = PTR_ERR(dst); 1130 err = PTR_ERR(dst);
1131 dst = NULL; 1131 dst = NULL;
@@ -1133,7 +1133,7 @@ do_udp_sendmsg:
1133 } 1133 }
1134 1134
1135 if (hlimit < 0) { 1135 if (hlimit < 0) {
1136 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 1136 if (ipv6_addr_is_multicast(&fl6.daddr))
1137 hlimit = np->mcast_hops; 1137 hlimit = np->mcast_hops;
1138 else 1138 else
1139 hlimit = np->hop_limit; 1139 hlimit = np->hop_limit;
@@ -1168,7 +1168,7 @@ do_append_data:
1168 up->len += ulen; 1168 up->len += ulen;
1169 getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; 1169 getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag;
1170 err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen, 1170 err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen,
1171 sizeof(struct udphdr), hlimit, tclass, opt, &fl, 1171 sizeof(struct udphdr), hlimit, tclass, opt, &fl6,
1172 (struct rt6_info*)dst, 1172 (struct rt6_info*)dst,
1173 corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag); 1173 corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag);
1174 if (err) 1174 if (err)
@@ -1181,10 +1181,10 @@ do_append_data:
1181 if (dst) { 1181 if (dst) {
1182 if (connected) { 1182 if (connected) {
1183 ip6_dst_store(sk, dst, 1183 ip6_dst_store(sk, dst,
1184 ipv6_addr_equal(&fl.fl6_dst, &np->daddr) ? 1184 ipv6_addr_equal(&fl6.daddr, &np->daddr) ?
1185 &np->daddr : NULL, 1185 &np->daddr : NULL,
1186#ifdef CONFIG_IPV6_SUBTREES 1186#ifdef CONFIG_IPV6_SUBTREES
1187 ipv6_addr_equal(&fl.fl6_src, &np->saddr) ? 1187 ipv6_addr_equal(&fl6.saddr, &np->saddr) ?
1188 &np->saddr : 1188 &np->saddr :
1189#endif 1189#endif
1190 NULL); 1190 NULL);