diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-03-20 22:25:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 22:25:24 -0500 |
commit | 017487d7d1e905a5bb529f6a2bc8cf8ea14e2307 (patch) | |
tree | 6a68904ea48ccae0c4c17f7dc248831fd46bd3e6 /net/dccp/output.c | |
parent | e55d912f5b75723159348a7fc7692f869a86636a (diff) |
[DCCP]: Generalize dccp_v4_send_reset
Renaming it to dccp_send_reset and moving it from the ipv4 specific
code to the core dccp code.
This fixes some bugs in IPV6 where timers would send v4 resets, etc.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/output.c')
-rw-r--r-- | net/dccp/output.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/net/dccp/output.c b/net/dccp/output.c index 0cc2bcf56522..9922d2696b9c 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -323,8 +323,8 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst, | |||
323 | 323 | ||
324 | EXPORT_SYMBOL_GPL(dccp_make_response); | 324 | EXPORT_SYMBOL_GPL(dccp_make_response); |
325 | 325 | ||
326 | struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, | 326 | static struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, |
327 | const enum dccp_reset_codes code) | 327 | const enum dccp_reset_codes code) |
328 | 328 | ||
329 | { | 329 | { |
330 | struct dccp_hdr *dh; | 330 | struct dccp_hdr *dh; |
@@ -366,14 +366,34 @@ struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, | |||
366 | dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), dp->dccps_gsr); | 366 | dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), dp->dccps_gsr); |
367 | 367 | ||
368 | dccp_hdr_reset(skb)->dccph_reset_code = code; | 368 | dccp_hdr_reset(skb)->dccph_reset_code = code; |
369 | 369 | inet_csk(sk)->icsk_af_ops->send_check(sk, skb->len, skb); | |
370 | dh->dccph_checksum = dccp_v4_checksum(skb, inet_sk(sk)->saddr, | ||
371 | inet_sk(sk)->daddr); | ||
372 | 370 | ||
373 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); | 371 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); |
374 | return skb; | 372 | return skb; |
375 | } | 373 | } |
376 | 374 | ||
375 | int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code) | ||
376 | { | ||
377 | /* | ||
378 | * FIXME: what if rebuild_header fails? | ||
379 | * Should we be doing a rebuild_header here? | ||
380 | */ | ||
381 | int err = inet_sk_rebuild_header(sk); | ||
382 | |||
383 | if (err == 0) { | ||
384 | struct sk_buff *skb = dccp_make_reset(sk, sk->sk_dst_cache, | ||
385 | code); | ||
386 | if (skb != NULL) { | ||
387 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | ||
388 | err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, 0); | ||
389 | if (err == NET_XMIT_CN) | ||
390 | err = 0; | ||
391 | } | ||
392 | } | ||
393 | |||
394 | return err; | ||
395 | } | ||
396 | |||
377 | /* | 397 | /* |
378 | * Do all connect socket setups that can be done AF independent. | 398 | * Do all connect socket setups that can be done AF independent. |
379 | */ | 399 | */ |