linux-stable/include
Gerrit Renker 0c86962076 [DCCP]: Integrate state transitions for passive-close
This adds the necessary state transitions for the two forms of passive-close

 * PASSIVE_CLOSE    - which is entered when a host   receives a Close;
 * PASSIVE_CLOSEREQ - which is entered when a client receives a CloseReq.

Here is a detailed account of what the patch does in each state.

1) Receiving CloseReq

  The pseudo-code in 8.5 says:

     Step 13: Process CloseReq
          If P.type == CloseReq and S.state < CLOSEREQ,
              Generate Close
              S.state := CLOSING
              Set CLOSING timer.

  This means we need to address what to do in CLOSED, LISTEN, REQUEST, RESPOND, PARTOPEN, and OPEN.

   * CLOSED:         silently ignore - it may be a late or duplicate CloseReq;
   * LISTEN/RESPOND: will not appear, since Step 7 is performed first (we know we are the client);
   * REQUEST:        perform Step 13 directly (no need to enqueue packet);
   * OPEN/PARTOPEN:  enter PASSIVE_CLOSEREQ so that the application has a chance to process unread data.

  When already in PASSIVE_CLOSEREQ, no second CloseReq is enqueued. In any other state, the CloseReq is ignored.
  I think that this offers some robustness against rare and pathological cases: e.g. a simultaneous close where
  the client sends a Close and the server a CloseReq. The client will then be retransmitting its Close until it
  gets the Reset, so ignoring the CloseReq while in state CLOSING is sane.

2) Receiving Close

  The code below from 8.5 is unconditional.

     Step 14: Process Close
          If P.type == Close,
              Generate Reset(Closed)
              Tear down connection
              Drop packet and return

  Thus we need to consider all states:
   * CLOSED:           silently ignore, since this can happen when a retransmitted or late Close arrives;
   * LISTEN:           dccp_rcv_state_process() will generate a Reset ("No Connection");
   * REQUEST:          perform Step 14 directly (no need to enqueue packet);
   * RESPOND:          dccp_check_req() will generate a Reset ("Packet Error") -- left it at that;
   * OPEN/PARTOPEN:    enter PASSIVE_CLOSE so that application has a chance to process unread data;
   * CLOSEREQ:         server performed active-close -- perform Step 14;
   * CLOSING:          simultaneous-close: use a tie-breaker to avoid message ping-pong (see comment);
   * PASSIVE_CLOSEREQ: ignore - the peer has a bug (sending first a CloseReq and now a Close);
   * TIMEWAIT:         packet is ignored.

   Note that the condition of receiving a packet in state CLOSED here is different from the condition "there
   is no socket for such a connection": the socket still exists, but its state indicates it is unusable.

   Last, dccp_finish_passive_close sets either DCCP_CLOSED or DCCP_CLOSING = TCP_CLOSING, so that
   sk_stream_wait_close() will wait for the final Reset (which will trigger CLOSING => CLOSED).

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28 14:55:13 -08:00
..
acpi kobject: convert /sys/firmware/acpi/ to use kobject_create 2008-01-24 20:40:23 -08:00
asm-alpha alpha: build fixes 2007-12-17 19:28:16 -08:00
asm-arm Merge branch 'pxa-plat' into devel 2008-01-28 13:21:38 +00:00
asm-avr32 [ARM] 4764/1: [AT91] AT91CAP9 core support 2008-01-26 15:01:13 +00:00
asm-blackfin [Blackfin] arch: Add the semtimedop syscall. Upstream uClibc doesn't compile without it. 2008-01-27 19:56:43 +08:00
asm-cris ide: remove stale ide.h "configuration options" 2008-01-25 22:17:08 +01:00
asm-frv ide: remove stale ide.h "configuration options" 2008-01-25 22:17:08 +01:00
asm-generic sched: SCHED_FIFO/SCHED_RR watchdog timer 2008-01-25 21:08:27 +01:00
asm-h8300 asm-h8300: parentheses around definition CLOCK_TICK_RATE 2007-12-10 19:43:54 -08:00
asm-ia64 [IA64] Update Altix BTE error return status patch 2008-01-03 13:18:58 -08:00
asm-m32r m32r: Update sys_rt_sigsuspend 2007-11-28 01:24:04 +09:00
asm-m68k
asm-m68knommu m68knommu: fix pread/pwrite defines 2007-11-05 15:12:33 -08:00
asm-mips [MIPS] SMTC: Fix build error. 2008-01-22 00:35:23 +00:00
asm-parisc [PARISC] print more than one character at a time for pdc console 2007-12-06 09:32:15 -08:00
asm-powerpc ide: remove stale ide.h "configuration options" 2008-01-25 22:17:08 +01:00
asm-ppc
asm-s390 [S390] do local_irq_restore while spinning in spin_lock_irqsave. 2008-01-26 14:11:31 +01:00
asm-sh sh: add spi header and r2d platform data V3 2008-01-28 16:24:46 +09:00
asm-sparc [SPARC32]: Silence sparc32 warnings on missing syscalls. 2007-12-14 10:59:50 -08:00
asm-sparc64 [SPARC64]: Implement pci_resource_to_user() 2007-12-26 19:33:46 -08:00
asm-um uml: update address space affected by pud_clear 2007-11-14 18:45:37 -08:00
asm-v850
asm-x86 sched: high-res preemption tick 2008-01-25 21:08:29 +01:00
asm-xtensa
crypto [CRYPTO] api: Include sched.h for cond_resched in scatterwalk.h 2008-01-11 08:16:59 +11:00
keys
linux [DCCP]: Integrate state transitions for passive-close 2008-01-28 14:55:13 -08:00
math-emu
media i2c: Constify client address data 2008-01-27 18:14:46 +01:00
mtd
net [IPV6]: Add RFC4214 support 2008-01-28 14:55:09 -08:00
pcmcia [AVR32] pcmcia ioaddr_t should be 32 bits on AVR32 2007-11-15 13:47:19 +01:00
rdma RDMA/cma: add support for rdma_migrate_id() 2008-01-25 14:15:32 -08:00
rxrpc
scsi SG: Convert SCSI to use scatterlist helpers for sg chaining 2008-01-28 10:05:27 +01:00
sound [ALSA] version 1.0.15 2007-11-20 20:16:43 +01:00
video
xen
Kbuild