Errors Flashcards
Cyclic Redundancy Check - Can detect
Detects all single bit errors, almost all 2-bit errors, any odd number of errors, all bursts up to M (where generator length is M), longer bursts with probability 2^-m.
Cyclic Redundancy Check - Implementation
Hardware - shift register which is easy with ASIC/FPGA
Software - precompute remainders for 16-bit words, add remainders to a running sum, needs only one lookup per 16-but block
CRC - TCP/UDP/IP
Treat data bytes as 16-bit integers, add with end-around carry, one’s complement = checksum, catches all 1-bit errors, longer with low prob
Types of Packet Error
Loss, Duplication, Insertion, Reordering
Sequence Numbers
Contain in each header, increment for non-retrnasmitted packets.
Using them:
loss - gaps indicate
reordering - trivially
duplication - trivially
insertion - if received seq # is v. different
Sequence number size
Must be long enough so sender does not confuse sequence numbers on acks.
2^seq_size > R(2 MPL + T + A) where R is rate, MPL is maximum packet lifetime, T is timeout time, A is time taken for receiver to respond)
MPL
Maximum Packet Lifetime
Bounded by counter in header which is decremented per hop.
Packet Insertion
Packets have source IP, dest IP, source port, dest port. Insertion occurs if open connection to B, then terminate on transport layer, then open new connection with same port numbers and delayed packet from old connection arrives.
Preventing Packet Insertion
Per-connection incarnation number -incremented for each connection from each host. (Takes up header space and may repeat on crash)
Reassign port numbers only after 1 Maximum Packet Lifetime
Wait 1 MPL after boot up to flush old packets from network.
3-way handshake
Protects against delayed SYNs
Timeout Schemes - Static
Know round trip time a priori
Timer set to this value
Works well when RTT changes little
Timeout Schemes - Dynamic
Measure RTT
Timeout is a function of measured RTTs
Timeout Schemes - Old TCP
RTTs are measured periodically.
Smoothed RTT:
srtt = a * srtt + (1-a) * RTT
timeout = b*srtt
a = 0.9, b=2
bad in practice
Timeout Schemes - New TCP
Introduce new term = mean deviation from mean
m = |srtt - RTT| sm = a *sm + (1-a) * m
timeout = srtt + b*sm
Go Back N Retransmission
On timeout, retransmite entire error control window so receiver only accepts in-order packets. Used in TCP.