Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 72611
b: refs/heads/master
c: d8ef2c2
h: refs/heads/master
i:
  72609: 559a9d3
  72607: 7959737
v: v3
  • Loading branch information
Gerrit Renker authored and Arnaldo Carvalho de Melo committed Oct 24, 2007
1 parent 8f06ab8 commit e5c9e9d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1238d0873b29f7a2de75d576b4cc706c1c75ffbf
refs/heads/master: d8ef2c29a0dcfccb2d90cac990143d1a4668708a
2 changes: 2 additions & 0 deletions trunk/include/linux/dccp.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ enum dccp_reset_codes {
DCCP_RESET_CODE_TOO_BUSY,
DCCP_RESET_CODE_BAD_INIT_COOKIE,
DCCP_RESET_CODE_AGGRESSION_PENALTY,

DCCP_MAX_RESET_CODES /* Leave at the end! */
};

/* DCCP options */
Expand Down
48 changes: 39 additions & 9 deletions trunk/net/dccp/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,42 @@ static void dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
dccp_send_close(sk, 0);
}

static u8 dccp_reset_code_convert(const u8 code)
{
const u8 error_code[] = {
[DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */
[DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */
[DCCP_RESET_CODE_ABORTED] = ECONNRESET,

[DCCP_RESET_CODE_NO_CONNECTION] = ECONNREFUSED,
[DCCP_RESET_CODE_CONNECTION_REFUSED] = ECONNREFUSED,
[DCCP_RESET_CODE_TOO_BUSY] = EUSERS,
[DCCP_RESET_CODE_AGGRESSION_PENALTY] = EDQUOT,

[DCCP_RESET_CODE_PACKET_ERROR] = ENOMSG,
[DCCP_RESET_CODE_BAD_INIT_COOKIE] = EBADR,
[DCCP_RESET_CODE_BAD_SERVICE_CODE] = EBADRQC,
[DCCP_RESET_CODE_OPTION_ERROR] = EILSEQ,
[DCCP_RESET_CODE_MANDATORY_ERROR] = EOPNOTSUPP,
};

return code >= DCCP_MAX_RESET_CODES ? 0 : error_code[code];
}

static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb)
{
u8 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code);

sk->sk_err = err;

/* Queue the equivalent of TCP fin so that dccp_recvmsg exits the loop */
dccp_fin(sk, skb);

if (err && !sock_flag(sk, SOCK_DEAD))
sk_wake_async(sk, 0, POLL_ERR);
dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
}

static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb)
{
struct dccp_sock *dp = dccp_sk(sk);
Expand Down Expand Up @@ -191,9 +227,8 @@ static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
* S.state := TIMEWAIT
* Set TIMEWAIT timer
* Drop packet and return
*/
dccp_fin(sk, skb);
dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
*/
dccp_rcv_reset(sk, skb);
return 0;
case DCCP_PKT_CLOSEREQ:
dccp_rcv_closereq(sk, skb);
Expand Down Expand Up @@ -521,12 +556,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
* Drop packet and return
*/
if (dh->dccph_type == DCCP_PKT_RESET) {
/*
* Queue the equivalent of TCP fin so that dccp_recvmsg
* exits the loop
*/
dccp_fin(sk, skb);
dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
dccp_rcv_reset(sk, skb);
return 0;
/*
* Step 7: Check for unexpected packet types
Expand Down

0 comments on commit e5c9e9d

Please sign in to comment.