Otherwise the packet is divided into several segments

Info icon This preview shows pages 7–10. Sign up to view the full content.

which hands the segment to the NIC. Otherwise, the packet is divided into several segments. Open Source Implementation 4.2: IPv4 Packet Forwarding Exercises 1. Use an example to trace __ip_route_output_key() and write down how routing cache is searched. 2. Trace fib_lookup() to explore how FIB is searched. Answer (3 hours): IPV4 ip_route_output_slow() ip_route_output_flow() ip_queue_xmit() rt_hash_code() fib_lookup() __ip_route_output_key() IPv4
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Computer Networks: An Open Source Approach 8 __ip_route_output_key() rt_hash_code : returns a hash value which will be used by __ip_route_output_key() to look for routing information from the cache. ip_route_output_slow: it calls fib_lookup() to look up the routing table and store the result into cache. fib_lookup: will look up the routing table. The ip_route_output_key() function will call rt_hash_code() first to obtain a hash value. The rt_hash_code() will use source and destination addresses as the input to the hash function. The hash value is then used to search the rt_hash_table, i.e., the routing cache. If found, it returns 0. If not, ip_route_output_slow() is called. ip_route_output_slow() will call fib_lookup() to look up the routing entry through FIB. The result is also put into the routing cache. fib_lookup: ip_route_output_slow: If routing cannot be found in the routing cache and the destination address is not a multicast address, then ip_route_output_slow() is called which in term calls fib_lookup() to look up the route in FIB and store the result into the routing cache. fib_lookup: fib_lookup() first checks routing policy based on source address, destination address, service type, forwarding tag, and I/O device. If successful, it calls tb_lookup () to retrieve the corresponding routing table and then calls tb_lookupt () to search the table. If successful, the routing policy and routing information will be used. FIB is the data structure for storing the detailed routing information. When a route is found through FIB, it will also be stored into the route cache. ip_route_input() handles the incoming IP packets. If the packet is destined to upper layer protocol, it passes the packet to upper layer. Otherwise, it is forwarded to the next hop. ip_queue_xmit() is called to send out an IP packet.. Open Source Implementation 4.3: IPv4 Checksum in Assembly Exercises Write a program to compute IP checksum and verify the correctness of the program by comparing to a real IP packet captured by the wireshark software. Answer (1.5 hours): (1) Checksum algorithm from RFC1071: {
Image of page 8
Computer Networks: An Open Source Approach 9 /* Compute Internet Checksum for "count" bytes * beginning at location "addr". */ register long sum = 0; while( count > 1 ) { /* This is the inner loop */ sum += * (unsigned short) addr++; count -= 2; } /* Add left-over byte, if any */ if( count > 0 ) sum += * (unsigned char *) addr; /* Fold 32-bit sum to 16 bits */ while (sum>>16) sum = (sum & 0xffff) + (sum >> 16); checksum = ~sum; } (2) We use the captured packets by Wireshark for reference.
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 10
This is the end of the preview. Sign up to access the rest of the document.
  • Winter '15
  • MAhmoudali
  • IP address, Transmission Control Protocol

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern