160 likes | 178 Views
This summary explains the essential functions of IPv4, including datagram service provision, packet formatting, addressing schemes, packet routing across networks, and fragmentation/reassembly processes. It covers IP packet fields, header details, address classes, private and special address ranges, and implementation aspects like packet handling, forwarding, and local delivery. Additionally, it discusses higher layers' interactions, network device configurations, and management functions. This comprehensive guide provides insights into how IPv4 operates and enhances network communication efficiently.
E N D
Internet Protocol V4 Reading: Chapter 14 FSU CIS 5930 Internet Protocols
A summary of IPV4 functions • Providing unreliable connectionless datagram service • Defining IP packet format • Defining IP addressing scheme • Routing/forwarding IP packets across interconnected networks • Preventing looping of IP packets • Fragmenting/reassembling IP packets FSU CIS 5930 Internet Protocols
IP packet format 0 15 31 3 7 Version IHL TOSt/Codepoint Total length Identification D F Fragment Offset M F Time to Live Protocol Checksum Source address Destination address Optionen and payload IP packet header FSU CIS 5930 Internet Protocols
Some fields • IHL: Internet Header Length • Multiple of 32 bits • Identification • Unique for each packet (generated at source) • Increased by 1 for each packet, normally • Checksum • Only covers the header part FSU CIS 5930 Internet Protocols
IP address classes Class Host address range 0 31 8 16 24 A Host 0 Network 1.0.0.0 – 127.255.255.255 B Host 1 0 Network 128.0.0.0 – 191.255.255.255 C 1 1 0 192.0.0.0 – 223.255.255.255 Host Network D Multicast group addresses 1 1 1 0 224.0.0.0 – 239.255.255.255 E 1 1 1 1 0 Reserved 240.0.0.0 – 247.255.255.255 IP addresses • Classes in the original definition • A, B, C, D, E FSU CIS 5930 Internet Protocols
Private addresses • Class A • 10.0.0.0 – 10.255.255.255 • Class B • 172.16.0.0 – 172.31.0.0 • Class C • 192.168.0.0 – 192.168.255.0 FSU CIS 5930 Internet Protocols
Special addresses • 127.x.y.z • Loopback address • Host part == 0 • The network itself • Host part == 1 • All hosts in the network FSU CIS 5930 Internet Protocols
Higher layers ip_input.c ip_output.c ip_queue_xmit ip_local_deliver MULTICAST IP_LOCAL_OUTPUT ip_mr_input . . . IP_LOCAL_INPUT ip_queue_xmit2 ip_forward.c IP_FORWARD ip_local_deliver ip_forward_finish ip_forward ip_output ip_fragment ip_finish_output ip_rcv_finish ROUTING ForwardingInformation Base IP_POST_ROUTING IP_PRE_ROUTING ip_route_input ip_rcv ip_finish_output2 ARP ARP neigh_resolve_output dev.c dev.c dev_queue_xmit net_rx_action Implementation of IP FSU CIS 5930 Internet Protocols
Handling incoming packet • ip_rcv() • Drop packets that should not be processed • Correctness checking • NF_IP_PRE_ROUTING • ip_rcv_finish() • ip_rcv_finish() • Determining the route (ip_route_input()) • Processing options • Passing to the element that should further processes the packet, skb->dst->input() • ip_local_deliver() • ip_forward() • ip_mr_input() FSU CIS 5930 Internet Protocols
Forwarding packets • ip_forward() • Some sanity checking (e.g., TTL) • ICMP to source if dropping pkts because of TTL • Making sure having enough space • Fragmentation related processing • NF_IP_FORWARD • ip_forward_finish() • ip_forward_finish() • Processing IP options • ip_send() • Ip_send() • Fragmenting if necessary • Ip_finish_output() FSU CIS 5930 Internet Protocols
Forwarding IP packets • ip_finish_output() • Preparing something for layer 2 • Pointing the network device • Indicating the packet type (IP) • NF_IP_POST_ROUTING • ip_finish_output2() • ip_finish_output2() • Passing to the lower layer (e.g., dev_queue_xmit()) FSU CIS 5930 Internet Protocols
Delivering packets locally • ip_local_deliver() • Reassembling fragmented IP packets • NF_IP_LOCAL_IN • ip_local_deliver_finish() • ip_local_deliver_finish() • Demultiplexing to other (upper) layers • Tcp_v4_rcv() • Udp_rcv() • Icmp_rcv() • Igmp_rcv() • ICMP packets generated if dropping packet FSU CIS 5930 Internet Protocols
inet_protocol udp_rcv() 0 inet_protos[MAX_INET_PROTOS] handler udp_err() err_handler next inet_protocol protocol: IPPROTO_UDP copy data name: "UDP" inet_protocol igmp_rcv() 1 handler Null err_handler next protocol:IPPROTO_IGMP copy data name: "IGMP" MAX_INET_PROTOS inet_protocol Demultiplexing IP packets FSU CIS 5930 Internet Protocols
Some management functions • inet_add_protocol() • inet_del_protocol() • Some useful functions • in_ntoa() • IP address to dotted decimal format • in_aton() • Dotted decimal format to IP address FSU CIS 5930 Internet Protocols
Transport-layer packets • ip_queue_xmit() • Determining route • Ip_route_output() if no route yet • Filling fields of header • Adding option field if there is • NF_IP_LOCAL_OUT • ip_queue_xmit2() • ip_queue_xmit2() • Some sanity check • Enough buffer space to hold packet • Setting output network device, dst • Dst->output(), ip_output() FSU CIS 5930 Internet Protocols
net_device name: eth1 dev_base ... Network Layer . . . net_device in_device name: eth0 ip_ptr state next in_ifaddr ... Hardware in_device ip_mc_list MAC layer dev Network layer . . . refcnt lock ip_ptr in_ifaddr in_ifaddr dead ifa_list ip_mc_list mc_list mr_v1_seen arp_parms . . . ip_mc_list cnf ipv4_devconf neigh_parms Data of IP instance FSU CIS 5930 Internet Protocols