diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-16 19:58:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-16 19:58:33 -0400 |
commit | 0c10c5d96865ce611d6a780888eff0ef4fab358b (patch) | |
tree | ab1303166355b32730185445557623bec09a1dcb /net/dccp/input.c | |
parent | 37f7f421cce13435fdc0d870caf51141e5ebf079 (diff) |
[DCCP]: More precisely set reset_code when sending RESET packets
Moving the setting of DCCP_SKB_CB(skb)->dccpd_reset_code to the places
where events happen that trigger sending a RESET packet.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/input.c')
-rw-r--r-- | net/dccp/input.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c index c74034cf7ede..062e9f8359d0 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -384,9 +384,9 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, | |||
384 | } | 384 | } |
385 | 385 | ||
386 | out_invalid_packet: | 386 | out_invalid_packet: |
387 | return 1; /* dccp_v4_do_rcv will send a reset, but... | 387 | /* dccp_v4_do_rcv will send a reset */ |
388 | FIXME: the reset code should be | 388 | DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR; |
389 | DCCP_RESET_CODE_PACKET_ERROR */ | 389 | return 1; |
390 | } | 390 | } |
391 | 391 | ||
392 | static int dccp_rcv_respond_partopen_state_process(struct sock *sk, | 392 | static int dccp_rcv_respond_partopen_state_process(struct sock *sk, |
@@ -433,6 +433,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
433 | struct dccp_hdr *dh, unsigned len) | 433 | struct dccp_hdr *dh, unsigned len) |
434 | { | 434 | { |
435 | struct dccp_sock *dp = dccp_sk(sk); | 435 | struct dccp_sock *dp = dccp_sk(sk); |
436 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); | ||
436 | const int old_state = sk->sk_state; | 437 | const int old_state = sk->sk_state; |
437 | int queued = 0; | 438 | int queued = 0; |
438 | 439 | ||
@@ -473,7 +474,8 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
473 | if (dh->dccph_type == DCCP_PKT_RESET) | 474 | if (dh->dccph_type == DCCP_PKT_RESET) |
474 | goto discard; | 475 | goto discard; |
475 | 476 | ||
476 | /* Caller (dccp_v4_do_rcv) will send Reset(No Connection)*/ | 477 | /* Caller (dccp_v4_do_rcv) will send Reset */ |
478 | dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; | ||
477 | return 1; | 479 | return 1; |
478 | } | 480 | } |
479 | 481 | ||
@@ -487,8 +489,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
487 | if (dccp_parse_options(sk, skb)) | 489 | if (dccp_parse_options(sk, skb)) |
488 | goto discard; | 490 | goto discard; |
489 | 491 | ||
490 | if (DCCP_SKB_CB(skb)->dccpd_ack_seq != | 492 | if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) |
491 | DCCP_PKT_WITHOUT_ACK_SEQ) | ||
492 | dccp_event_ack_recv(sk, skb); | 493 | dccp_event_ack_recv(sk, skb); |
493 | 494 | ||
494 | ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); | 495 | ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); |
@@ -500,7 +501,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
500 | */ | 501 | */ |
501 | if (dp->dccps_options.dccpo_send_ack_vector) { | 502 | if (dp->dccps_options.dccpo_send_ack_vector) { |
502 | if (dccp_ackpkts_add(dp->dccps_hc_rx_ackpkts, sk, | 503 | if (dccp_ackpkts_add(dp->dccps_hc_rx_ackpkts, sk, |
503 | DCCP_SKB_CB(skb)->dccpd_seq, | 504 | dcb->dccpd_seq, |
504 | DCCP_ACKPKTS_STATE_RECEIVED)) | 505 | DCCP_ACKPKTS_STATE_RECEIVED)) |
505 | goto discard; | 506 | goto discard; |
506 | /* | 507 | /* |
@@ -551,8 +552,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
551 | dh->dccph_type == DCCP_PKT_REQUEST) || | 552 | dh->dccph_type == DCCP_PKT_REQUEST) || |
552 | (sk->sk_state == DCCP_RESPOND && | 553 | (sk->sk_state == DCCP_RESPOND && |
553 | dh->dccph_type == DCCP_PKT_DATA)) { | 554 | dh->dccph_type == DCCP_PKT_DATA)) { |
554 | dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, | 555 | dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNC); |
555 | DCCP_PKT_SYNC); | ||
556 | goto discard; | 556 | goto discard; |
557 | } else if (dh->dccph_type == DCCP_PKT_CLOSEREQ) { | 557 | } else if (dh->dccph_type == DCCP_PKT_CLOSEREQ) { |
558 | dccp_rcv_closereq(sk, skb); | 558 | dccp_rcv_closereq(sk, skb); |
@@ -563,13 +563,13 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
563 | } | 563 | } |
564 | 564 | ||
565 | if (unlikely(dh->dccph_type == DCCP_PKT_SYNC)) { | 565 | if (unlikely(dh->dccph_type == DCCP_PKT_SYNC)) { |
566 | dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, | 566 | dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNCACK); |
567 | DCCP_PKT_SYNCACK); | ||
568 | goto discard; | 567 | goto discard; |
569 | } | 568 | } |
570 | 569 | ||
571 | switch (sk->sk_state) { | 570 | switch (sk->sk_state) { |
572 | case DCCP_CLOSED: | 571 | case DCCP_CLOSED: |
572 | dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; | ||
573 | return 1; | 573 | return 1; |
574 | 574 | ||
575 | case DCCP_REQUESTING: | 575 | case DCCP_REQUESTING: |