IP Function and Implementation

Document Sample
IP Function and Implementation Powered By Docstoc
					   IP Function and
   Implementation


 Chuck Davin
UPenn CSE 350
 12 April 2001
OSI Reference Model
     Application Layer

     Presentation Layer

       Session Layer

      Transport Layer

      Network Layer

      Data Link Layer

      Physical Layer
Unix Network Implementation

  Application                           Application

                System Call Interface

                       Sockets

                      Protocols

            Abstract Network Interface

                      Devices
Model vs. Implementation
Application Layer
Presentation Layer   Application      Application
  Session Layer
                        System Call Interface

                               Sockets
 Transport Layer
                              Protocols
 Network Layer
                       Abstract Network Interface
 Data Link Layer
                               Devices
 Physical Layer
        OSI Reference Model
Possible Points of Multiplexing
          Application Layer

          Presentation Layer

            Session Layer

           Transport Layer

           Network Layer

           Data Link Layer

           Physical Layer
       Unix Network Implementation
Possible Points of Multiplexing
   Application                           Application

                 System Call Interface

                        Sockets

                       Protocols

             Abstract Network Interface

                       Devices
    Protocol Layer Functions
l Protocol-Specific   Functions
  – UDP
  – TCP

  – IP
     Protocol Layer Service
           Interface
l XXX_usrreq  (so, cmd, …)
l XXX_input (data, …)
l XXX_ctlinput (so, cmd, …)
l XXX_ctloutput (so, cmd, …)
l XXX_init ()
      Protocol User Requests
l   PRU_ATTACH
l   PRU_DETACH
l   PRU_SEND
l   PRU_RECV
l   PRU_BIND
l   PRU_CONNECT
l   PRU_SHUTDOWN
l   And so forth
                 Generic Protocol Data
                      Structures
             Application                                Application
                             System Call Interface
                                    Sockets
To Protocol-
Specific State
(if any)          Protocol
                  Control
                   Block           Protocol-Specific Links
                   (PCB)


                         Abstract Network Interface
                                   Devices
           IP Observations
l Raw   IP sockets are available
  – But less often used
l The  most frequent “users” of IP services are
  UDP and TCP
l The most interesting data structures for IP
  are unrelated to sockets
                  IP Data Flows
         Application                                    Application
                       System Call Interface
                                Sockets
                 TCP                                   UDP
IP Packets             Ip_output()        XXX_input()


                                     IP

IP Packets        Ifp->if_output()        Ip_input()

                                Devices
        IP Input Processing
l Remove    packet from delivery queue
l Validate IP header checksum, version
l Check packet length for consistency
l Is it for me?
  – See if_withaddr()
l Reassemble   if packet is a fragment
l Deliver entire packets to ULP based on
  protocol number
      IP Output Processing
l Complete   IP header, compute IP header
  checksum
l Determine outgoing interface and next hop
  for this packet
l Fragment if packet exceeds MTU of chosen
  interface
l Present packet(s) plus next hop IP address
  to device via abstract network interface
          IP Routing Table
l Destination IP Address
l Destination Netmask
l Route Type (e.g., local or remote)
l Route Metric
l Next Hop IP
l Cached MTU, Network Device, …
  – See if_withaddr()
    IP Forwarding Procedure
l Find routing entries for which the masked
  destination address matches the masked
  destination address of the packet
l Of these entries, pick the one with the
  longest netmask
  – Contiguous subnet masks
l Forwarding   table vs. routing table
  Network Device Functions
l Device congestion management
l Protocol adaptation
l Buffer management
    Network Device Interface
l Generic interface presented to ULPs (IP)
l IF_ENQUEUE()
l IF_QFULL()
l Ifp->If_output()
l Ifp->If_start()
l…
  Network Device Data
      Structures
Application                                   Application
              System Call Interface
                          Sockets
                   Protocols
          Abstract Network Interface

              Ifnet             Ifnet
              Structure         Structure

  Ifnet
  Chain
               Private
               Device
                                    Private
                                    Device
                                                 …
                Data                 Data
     Network Device Output
          Procedure
l ULP   has already enqueued packets and next
  hop addresses on the output queue
l If the medium is multipoint, then resolve the
  passed ULP address into a local medium
  address (e.g., ARP)
l If the device is currently idle, take a packet
  from the output queue, frame it and start I/O
       Network Device Input
           Procedure
l Received  frame is checked for integrity and
  length consistency
l Frame is examined to identify ULP
l Frame is stripped of data link header
l Frame Payload plus notation of receiving
  device are enqueued on ULP input queue
  – E.g., ipintrq
       Questions to Ponder
l 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?
l To what degree should/need a network
  device do its own routing?
l What must a network device do to properly
  receive striped IP traffic?

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:2
posted:7/14/2013
language:English
pages:22