CPSC 441: Checksum1 Instructor: Carey Williamson Office: ICT Class Location: MFH 164 Lectures: TR 8:00 – 9:15 Notes derived from “ Computer Networking: A Top Down Approach Featuring the Internet”, 2005, 3 rd edition, Jim Kurose, Keith Ross, Addison-Wesley. Slides are adapted from the companion web site of the book, as modified by Anirban Mahanti (and Carey Williamson). Checksum Calculations
CPSC 441: Checksum2 IP Checksum Calculation At the sender r Set the value of the checksum field to 0. r Divide the header into 16-bit words m Add all segments using one’s complement arithmetic r The final result is complemented to obtain the checksum At the receiver r Divide header into 16-bit words, adds them, and complement’s the results r All zero’s => accept datagram, else reject
CPSC 441: Checksum3 Binary Checksum Example Carry from 1 st column Carry from 2 nd column Carry from 3 rd column Carry from 4 th column Carry from 5 th column Carry from 13 th column Carry from 12 th column Carry from 16 th column
CPSC 441: Checksum4 UDP Checksum r Add pseudo-header r Fill checksum with 0’s r Divide into 16-bit words (adding padding if required) r Add words using 1’s complement arithmetic r Complement the result and put in checksum field r Drop pseudo-header and padding r Deliver UDP segment to IP source port #dest port # 32 bits data (add padding to make data a multiple of 16 bits) length checksum 32-bit source IP address 32-bit destination IP address length protocol 0’s The pseudo-header
CPSC 441: Checksum5 Checksum calculation at Receiver r Add pseudo-header to the UDP segment r Add padding, if needed r Divide into 16-bit words and add words using 1’s complement arithmetic r Complement result r If result is all 0’s m Drop pseudo-header and padding (if any) m Accept segment Else drop segment