lecture 9 - when the crc and tcp checksum...

26
Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge Advanced Operating Systems 30 November, 2011 SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 1/26

Upload: others

Post on 12-Aug-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Lecture 9When The CRC and TCP Checksum Disagree

Jonathan Stone, Craig Partridge

Advanced Operating Systems

30 November, 2011

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 1/26

Page 2: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Introduction

Looking for errors

Results

Conclusions

Questions

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 2/26

Page 3: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Outline

Introduction

Looking for errors

Results

Conclusions

Questions

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 3/26

Page 4: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Issue

I as much as one packet in 1100 can fail the TCP checksum

I this happens even if the corresponding CRC is correct

I it means that transmission links aren’t the ones causing theerrors

I then who?

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 4/26

Page 5: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Recap

I CRC checksum used to detect link-layer errors

I Do we need checksums at every layer? Why?

I One reason is that you can not rely on lower layers doing errorchecking for you

I Thus, TCP has its own checksum

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 5/26

Page 6: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Fun fact

I TCP computes its checksum by using a pseudo-header

I Why?

I The explanation comes straight from the designer, DavidPatrick Reed

I http://www.postel.org/pipermail/end2end-interest/2005-February/004616.html

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 6/26

Page 7: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

First insight

I What happens if we do rely on lower layers for errorchecking?

I SUN did that

I Because checksumming takes a long time, SUN’s NFSimplementation disabled it in UDP

I What happened?

I Power fluctuations on busses caused random bits beingshuffled

I SUN’s current implementation of NFS runs withchecksumming enabled

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 7/26

Page 8: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Most important thing to realize

I Never take anything for granted

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 8/26

Page 9: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Outline

Introduction

Looking for errors

Results

Conclusions

Questions

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 9/26

Page 10: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Important issues

I capture as many errors as possible

I try to categorize errors that cause checksum failure

I define ways of eliminating those errors

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 10/26

Page 11: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Capturing errors

I use libpcap to analyze traffic. The more the merrier

I try to match each bad packet with its retransmission (twinpackets)

I look at the error patterns by examining each pair

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 11/26

Page 12: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Good/evil twins

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 12/26

Page 13: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Pretty print

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 13/26

Page 14: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

What to look for

I try to morph the good packet into the bad packet

I do this to understand how the error might have occured

I block errors can be caused by buggy DMA engines

I individual byte errors may be caused by UARTs with interruptsfor each byte. This can cause overruns on SLIP links.

I try to find similar patterns by manual examination :)

I correlate the patterns with the hardware and softwareconfigurations of the network in which you captured thepackets

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 14/26

Page 15: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Outline

Introduction

Looking for errors

Results

Conclusions

Questions

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 15/26

Page 16: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Stats

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 16/26

Page 17: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Error types

I end-host hardware errors

I end-host software errors

I router memory errors

I link-level errors

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 17/26

Page 18: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

End-host hardware errors

I network interfaces may be buggyI they may change bits before adding the CRC trailerI they may change bits after receiving the packetI usually drivers take care of hardware bugs (if possible):

http://lxr.linux.no/linux+*/drivers/net/forcedeth.c#L5591

I failures can also affect other hardware componentsI memory errors can occurI busses can malfunctionI see the SUN NFS story above

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 18/26

Page 19: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

End-host software errors

I ACK-of-FIN bug

I Bad LF in CR/LF

I In conclusion, bugs in software that has direct access topacket structure are bad.

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 19/26

Page 20: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Router memory errors

I Same as end-host errors

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 20/26

Page 21: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Link layer errors

I Complex interactions cause higher level errors

I Compression algorithms are the most likely cause

I Misinterpretation of RFCs describing these algorithms lead tothese errors

I Thus, they can be considered as software bugs too

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 21/26

Page 22: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Outline

Introduction

Looking for errors

Results

Conclusions

Questions

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 22/26

Page 23: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Conclusions 1

I Errors might occur that get past both checksums, with theprobability:

I Pue = 1 − Pef − Pead − Pedp

I Pef – error free packetsI Pead – errors always detectedI Pedp – errors detected probabilistically

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 23/26

Page 24: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Conclusions 2

I Don’t trust hardware

I Report host errors. ICMP could me modified to do thisautomatically.

I Report router errors. Use specialized software.

I Protect important data.

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 24/26

Page 25: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

THE Conclusion

I If your application handles sensitive data (financial, military,etc.)...

I You might want to implement some sort of application layererror handling

I Then again, if the code responsible for error handling runs onfaulty hardware... :)

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 25/26

Page 26: Lecture 9 - When The CRC and TCP Checksum Disagreeandrei.clubcisco.ro/cursuri/f/f-sym/5master/scpd... · Lecture 9 When The CRC and TCP Checksum Disagree Jonathan Stone, Craig Partridge

Outline

Introduction

Looking for errors

Results

Conclusions

Questions

SOA/OS Lecture 9, When The CRC and TCP Checksum Disagree 26/26