View
216
Download
0
Tags:
Embed Size (px)
Citation preview
IP Function and IP Function and ImplementationImplementation
Chuck Davin
UPenn CSE 350
12 April 2001
OSI Reference ModelOSI Reference Model
Application Layer
Presentation Layer
Session Layer
Transport Layer
Network Layer
Data Link Layer
Physical Layer
Unix Network ImplementationUnix Network Implementation
Application Application
Sockets
Protocols
Devices
System Call Interface
Abstract Network Interface
Model vs. ImplementationModel vs. Implementation
Application Application
Sockets
Protocols
Devices
System Call Interface
Abstract Network Interface
Application Layer
Presentation Layer
Session Layer
Transport Layer
Network Layer
Data Link Layer
Physical Layer
OSI Reference ModelOSI Reference Model
Possible Points of MultiplexingPossible Points of MultiplexingApplication Layer
Presentation Layer
Session Layer
Transport Layer
Network Layer
Data Link Layer
Physical Layer
Unix Network ImplementationUnix Network Implementation
Possible Points of MultiplexingPossible Points of Multiplexing
Application Application
Sockets
Protocols
Devices
System Call Interface
Abstract Network Interface
Protocol Layer FunctionsProtocol Layer Functions
Protocol-Specific Functions– UDP– TCP
– IP
Protocol Layer Service Protocol Layer Service InterfaceInterface
XXX_usrreq (so, cmd, …)XXX_input (data, …)XXX_ctlinput (so, cmd, …)XXX_ctloutput (so, cmd, …)XXX_init ()
Protocol User RequestsProtocol User Requests
PRU_ATTACH PRU_DETACH PRU_SEND PRU_RECV PRU_BIND PRU_CONNECT PRU_SHUTDOWN And so forth
Generic Protocol Data Generic Protocol Data StructuresStructures
Application Application
Sockets
Devices
System Call Interface
Abstract Network Interface
ProtocolControlBlock(PCB)
To Protocol-Specific State(if any)
Protocol-Specific Links
IP ObservationsIP Observations
Raw IP sockets are available– But less often used
The most frequent “users” of IP services are UDP and TCP
The most interesting data structures for IP are unrelated to sockets
IP Data FlowsIP Data FlowsApplication Application
TCP
Sockets
Devices
System Call Interface
IP
UDP
Ip_output() XXX_input()
Ifp->if_output() Ip_input()
IP Packets
IP Packets
IP Input ProcessingIP Input Processing
Remove packet from delivery queueValidate IP header checksum, versionCheck packet length for consistencyIs it for me?
– See if_withaddr()Reassemble if packet is a fragmentDeliver entire packets to ULP based on
protocol number
IP Output ProcessingIP Output Processing
Complete IP header, compute IP header checksum
Determine outgoing interface and next hop for this packet
Fragment if packet exceeds MTU of chosen interface
Present packet(s) plus next hop IP address to device via abstract network interface
IP Routing TableIP Routing Table
Destination IP AddressDestination NetmaskRoute Type (e.g., local or remote)Route MetricNext Hop IPCached MTU, Network Device, …
– See if_withaddr()
IP Forwarding ProcedureIP Forwarding Procedure
Find routing entries for which the masked destination address matches the masked destination address of the packet
Of these entries, pick the one with the longest netmask– Contiguous subnet masks
Forwarding table vs. routing table
Network Device FunctionsNetwork Device Functions
Device congestion managementProtocol adaptationBuffer management
Network Device InterfaceNetwork Device Interface
Generic interface presented to ULPs (IP)IF_ENQUEUE()IF_QFULL()Ifp->If_output()Ifp->If_start()…
Network Device Data Network Device Data StructuresStructures
Application Application
Sockets
Protocols
System Call Interface
Abstract Network Interface
IfnetChain
…
IfnetStructure
IfnetStructure
PrivateDeviceData
PrivateDeviceData
Network Device Output Network Device Output ProcedureProcedure
ULP has already enqueued packets and next hop addresses on the output queue
If the medium is multipoint, then resolve the passed ULP address into a local medium address (e.g., ARP)
If the device is currently idle, take a packet from the output queue, frame it and start I/O
Network Device Input Network Device Input ProcedureProcedure
Received frame is checked for integrity and length consistency
Frame is examined to identify ULPFrame is stripped of data link headerFrame Payload plus notation of receiving
device are enqueued on ULP input queue– E.g., ipintrq
Questions to PonderQuestions to Ponder
Private device data is stored contiguously with generic ifnet data rather than according to the linked PCB scheme in upper layers.– What are the tradeoffs?
To what degree should/need a network device do its own routing?
What must a network device do to properly receive striped IP traffic?