Download PPT

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Internet Protocol V4
Reading: Chapter 14
Fall 2004
FSU CIS 5930 Internet Protocols
1
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
Fall 2004
FSU CIS 5930 Internet Protocols
2
IP packet header
IP packet format
0
3
Version
15
7
IHL
Total length
TOSt/Codepoint
D
F
Identification
Time to Live
31
M
F
Fragment Offset
Checksum
Protocol
Source address
Destination address
Optionen and payload
Fall 2004
FSU CIS 5930 Internet Protocols
3
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
Fall 2004
FSU CIS 5930 Internet Protocols
4
IP addresses
• Classes in the original definition
– A, B, C, D, E
IP address classes
Class
0
A
B
C
D
E
Fall 2004
8
16
110
1110
11110
Host address
range
128.0.0.0 –
191.255.255.255
Host
Network
10
31
1.0.0.0 –
127.255.255.255
Host
Network
0
24
Host
Network
192.0.0.0 –
223.255.255.255
Multicast group addresses
224.0.0.0 –
239.255.255.255
Reserved
240.0.0.0 –
247.255.255.255
FSU CIS 5930 Internet Protocols
5
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
Fall 2004
FSU CIS 5930 Internet Protocols
6
Special addresses
• 127.x.y.z
– Loopback address
• Host part == 0
– The network itself
• Host part == 1
– All hosts in the network
Fall 2004
FSU CIS 5930 Internet Protocols
7
Implementation of IP
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_forward.c
IP_FORWARD
ip_queue_xmit2
ip_local_deliver
ip_forward
ip_rcv_finish
ROUTING
IP_PRE_ROUTING
Forwarding
Information Base
ip_rcv
ip_route_input
ip_forward_finish
ip_output
ip_fragment
ip_finish_output
IP_POST_ROUTING
ip_finish_output2
ARP
ARP
neigh_resolve_
output
dev.c
dev_queue_xmit
net_rx_action
Fall 2004
dev.c
FSU CIS 5930 Internet Protocols
8
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()
Fall 2004
FSU CIS 5930 Internet Protocols
9
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()
Fall 2004
FSU CIS 5930 Internet Protocols
10
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())
Fall 2004
FSU CIS 5930 Internet Protocols
11
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
Fall 2004
FSU CIS 5930 Internet Protocols
12
Demultiplexing IP packets
inet_protocol
0
inet_protos[MAX_INET_PROTOS]
handler
udp_rcv()
udp_err()
err_handler
next
inet_protocol
protocol: IPPROTO_UDP
copy
data
name: "UDP"
inet_protocol
1
handler
igmp_rcv()
Null
err_handler
next
protocol:IPPROTO_IGMP
copy
data
name: "IGMP"
MAX_INET_
PROTOS
Fall 2004
inet_protocol
FSU CIS 5930 Internet Protocols
13
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
Fall 2004
FSU CIS 5930 Internet Protocols
14
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()
Fall 2004
FSU CIS 5930 Internet Protocols
15
Data of IP instance
net_device
name: eth1
dev_base
...
net_device
Network Layer
name: eth0
ip_ptr
...
in_device
state
next
in_ifaddr
...
Hardware
MAC layer
Network layer
ip_ptr
...
in_device
ip_mc_list
dev
refcnt
lock
dead
in_ifaddr
in_ifaddr
ifa_list
mc_list
ip_mc_list
mr_v1_seen
arp_parms
ip_mc_list
...
cnf
ipv4_devconf
Fall 2004
FSU CIS 5930 Internet Protocols
neigh_parms
16
Related documents