Skip to content

Commit

Permalink
[DCCP] ccid3: Avoid congestion control on zero-sized data packets
Browse files Browse the repository at this point in the history
This resolves an `XXX' in ccid3_hc_tx_send_packet().

The function is only called on Data and DataAck packets and returns a negative
result on zero-sized messages. This is a reasonable policy since CCID 3 is a
congestion-control module and congestion control on zero-sized Data(Ack)
packets is in a way pathological.

The patch uses a more suitable error code for this case, it returns the Posix.1
code `EBADMSG' ("Not a data message") instead of `ENOTCONN'.

As a result of ignoring zero-sized packets, a the condition for a warning
"First packet is data" in ccid3_hc_tx_packet_sent is always satisfied; this
message has been removed since it will always be printed.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
  • Loading branch information
Gerrit Renker authored and David S. Miller committed Dec 3, 2006
1 parent 7da7f45 commit da335ba
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,13 @@ static int ccid3_hc_tx_send_packet(struct sock *sk,

BUG_ON(hctx == NULL);

/* Check if pure ACK or Terminating*/
/*
* XXX: We only call this function for DATA and DATAACK, on, these
* packets can have zero length, but why the comment about "pure ACK"?
* This function is called only for Data and DataAck packets. Sending
* zero-sized Data(Ack)s is theoretically possible, but for congestion
* control this case is pathological - ignore it.
*/
if (unlikely(len == 0))
return -ENOTCONN;
return -EBADMSG;

/* See if last packet allocated was not sent */
new_packet = dccp_tx_hist_head(&hctx->ccid3hctx_hist);
Expand Down Expand Up @@ -387,11 +387,7 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len)

switch (hctx->ccid3hctx_state) {
case TFRC_SSTATE_NO_SENT:
/* if first wasn't pure ack */
if (len != 0)
DCCP_CRIT("%s, First packet sent is noted "
"as a data packet", dccp_role(sk));
return;
/* fall through */
case TFRC_SSTATE_NO_FBACK:
/* t_nom, t_ipi, delta do not change until feedback arrives */
return;
Expand Down

0 comments on commit da335ba

Please sign in to comment.