diff options
Diffstat (limited to 'net/dccp/ipv6.c')
-rw-r--r-- | net/dccp/ipv6.c | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index d954e8319dbd..b7c0f66e2834 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -301,50 +301,23 @@ static void dccp_v6_reqsk_destructor(struct request_sock *req) | |||
301 | 301 | ||
302 | static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | 302 | static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) |
303 | { | 303 | { |
304 | struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh; | ||
305 | struct ipv6hdr *rxip6h; | 304 | struct ipv6hdr *rxip6h; |
306 | const u32 dccp_hdr_reset_len = sizeof(struct dccp_hdr) + | ||
307 | sizeof(struct dccp_hdr_ext) + | ||
308 | sizeof(struct dccp_hdr_reset); | ||
309 | struct sk_buff *skb; | 305 | struct sk_buff *skb; |
310 | struct flowi fl; | 306 | struct flowi fl; |
311 | u64 seqno = 0; | ||
312 | 307 | ||
313 | if (rxdh->dccph_type == DCCP_PKT_RESET) | 308 | if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) |
314 | return; | 309 | return; |
315 | 310 | ||
316 | if (!ipv6_unicast_destination(rxskb)) | 311 | if (!ipv6_unicast_destination(rxskb)) |
317 | return; | 312 | return; |
318 | 313 | ||
319 | skb = alloc_skb(dccp_v6_ctl_socket->sk->sk_prot->max_header, | 314 | skb = dccp_ctl_make_reset(dccp_v6_ctl_socket, rxskb); |
320 | GFP_ATOMIC); | ||
321 | if (skb == NULL) | 315 | if (skb == NULL) |
322 | return; | 316 | return; |
323 | 317 | ||
324 | skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header); | ||
325 | |||
326 | dh = dccp_zeroed_hdr(skb, dccp_hdr_reset_len); | ||
327 | |||
328 | /* Swap the send and the receive. */ | ||
329 | dh->dccph_type = DCCP_PKT_RESET; | ||
330 | dh->dccph_sport = rxdh->dccph_dport; | ||
331 | dh->dccph_dport = rxdh->dccph_sport; | ||
332 | dh->dccph_doff = dccp_hdr_reset_len / 4; | ||
333 | dh->dccph_x = 1; | ||
334 | dccp_hdr_reset(skb)->dccph_reset_code = | ||
335 | DCCP_SKB_CB(rxskb)->dccpd_reset_code; | ||
336 | |||
337 | /* See "8.3.1. Abnormal Termination" in RFC 4340 */ | ||
338 | if (DCCP_SKB_CB(rxskb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) | ||
339 | seqno = ADD48(DCCP_SKB_CB(rxskb)->dccpd_ack_seq, 1); | ||
340 | |||
341 | dccp_hdr_set_seq(dh, seqno); | ||
342 | dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq); | ||
343 | |||
344 | dccp_csum_outgoing(skb); | ||
345 | rxip6h = ipv6_hdr(rxskb); | 318 | rxip6h = ipv6_hdr(rxskb); |
346 | dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr, | 319 | dccp_hdr(skb)->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr, |
347 | &rxip6h->daddr); | 320 | &rxip6h->daddr); |
348 | 321 | ||
349 | memset(&fl, 0, sizeof(fl)); | 322 | memset(&fl, 0, sizeof(fl)); |
350 | ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr); | 323 | ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr); |
@@ -352,8 +325,8 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | |||
352 | 325 | ||
353 | fl.proto = IPPROTO_DCCP; | 326 | fl.proto = IPPROTO_DCCP; |
354 | fl.oif = inet6_iif(rxskb); | 327 | fl.oif = inet6_iif(rxskb); |
355 | fl.fl_ip_dport = dh->dccph_dport; | 328 | fl.fl_ip_dport = dccp_hdr(skb)->dccph_dport; |
356 | fl.fl_ip_sport = dh->dccph_sport; | 329 | fl.fl_ip_sport = dccp_hdr(skb)->dccph_sport; |
357 | security_skb_classify_flow(rxskb, &fl); | 330 | security_skb_classify_flow(rxskb, &fl); |
358 | 331 | ||
359 | /* sk = NULL, but it is safe for now. RST socket required. */ | 332 | /* sk = NULL, but it is safe for now. RST socket required. */ |