SlideShare une entreprise Scribd logo
1  sur  75
Télécharger pour lire hors ligne
Lab 12: Network Communication
Advanced Operating Systems

Zubair Nabi
zubair.nabi@itu.edu.pk

April 24, 2013
Introduction

• In *nix systems, the networking infrastructure abstracts away
many network architectures
Introduction

• In *nix systems, the networking infrastructure abstracts away
many network architectures
• Each network architecture consists of
• Network-communication protocols
Introduction

• In *nix systems, the networking infrastructure abstracts away
many network architectures
• Each network architecture consists of
• Network-communication protocols
• The protocol family
Introduction

• In *nix systems, the networking infrastructure abstracts away
many network architectures
• Each network architecture consists of
• Network-communication protocols
• The protocol family
• Conventions of naming end-points
Introduction

• In *nix systems, the networking infrastructure abstracts away
many network architectures
• Each network architecture consists of
•
•
•
•

Network-communication protocols
The protocol family
Conventions of naming end-points
The address family or address format
Introduction

• In *nix systems, the networking infrastructure abstracts away
many network architectures
• Each network architecture consists of
•
•
•
•
•

Network-communication protocols
The protocol family
Conventions of naming end-points
The address family or address format
Additional facilities
Introduction

• In *nix systems, the networking infrastructure abstracts away
many network architectures
• Each network architecture consists of
•
•
•
•
•

Network-communication protocols
The protocol family
Conventions of naming end-points
The address family or address format
Additional facilities

• Network facilities are accessed through the socket abstraction
Network Subsystem

Consists of three layers:
1

Transport layer: In charge of sockets-amenable addressing
structure and protocol mechanisms, such as ordering, reliability,
etc.
Network Subsystem

Consists of three layers:
1

Transport layer: In charge of sockets-amenable addressing
structure and protocol mechanisms, such as ordering, reliability,
etc.

2

Network layer: Responsible for delivery of data across the
network (must maintain a routing database)
Network Subsystem

Consists of three layers:
1

Transport layer: In charge of sockets-amenable addressing
structure and protocol mechanisms, such as ordering, reliability,
etc.

2

Network layer: Responsible for delivery of data across the
network (must maintain a routing database)

3

Link layer: Responsible for shipping messages between hosts
connected to a common transmission medium
Network Subsystem (2)

• The layering is just logical layering
Network Subsystem (2)

• The layering is just logical layering
• The network service itself might choose to use more or fewer
layers based on its requirements
Network Subsystem (2)

• The layering is just logical layering
• The network service itself might choose to use more or fewer
layers based on its requirements
• For instance, raw sockets use a null implementation at one or
more layers
Network Subsystem (2)

• The layering is just logical layering
• The network service itself might choose to use more or fewer
layers based on its requirements
• For instance, raw sockets use a null implementation at one or
more layers
• Similarly, tunneling of one protocol through another requires
additional implementations of multiple layers
Memory Management

• Memory management for communication protocols is different
than regular entities as memory is required in widely varying sizes
Memory Management

• Memory management for communication protocols is different
than regular entities as memory is required in widely varying sizes
• A special-purpose memory-management facility exists for IPC
and networking systems
Memory Management

• Memory management for communication protocols is different
than regular entities as memory is required in widely varying sizes
• A special-purpose memory-management facility exists for IPC
and networking systems
• The unit of allocation is an mbuf (skbuff in Linux), which is
128 bytes long with 100 or 108 bytes reserved for data
Memory Management

• Memory management for communication protocols is different
than regular entities as memory is required in widely varying sizes
• A special-purpose memory-management facility exists for IPC
and networking systems
• The unit of allocation is an mbuf (skbuff in Linux), which is
128 bytes long with 100 or 108 bytes reserved for data
• A chain of mbufs can be linked together (m_next) to hold an
arbitrary quantity of data
Memory Management

• Memory management for communication protocols is different
than regular entities as memory is required in widely varying sizes
• A special-purpose memory-management facility exists for IPC
and networking systems
• The unit of allocation is an mbuf (skbuff in Linux), which is
128 bytes long with 100 or 108 bytes reserved for data
• A chain of mbufs can be linked together (m_next) to hold an
arbitrary quantity of data
• For instance, a chain of mbufs is used to represent packets by
network protocols
mbuf
Data Flow

• Socket-to-network-subsystem
• Calls the transport-layer modules that support the socket
abstraction
Data Flow

• Socket-to-network-subsystem
• Calls the transport-layer modules that support the socket
abstraction
• Typically started by system calls
Data Flow

• Socket-to-network-subsystem
• Calls the transport-layer modules that support the socket
abstraction
• Typically started by system calls

• Network-subsystem-to-socket
• Flows up the stack and is placed in the receive queue of the
destination socket
Data Flow

• Socket-to-network-subsystem
• Calls the transport-layer modules that support the socket
abstraction
• Typically started by system calls

• Network-subsystem-to-socket
• Flows up the stack and is placed in the receive queue of the
destination socket
• Asynchronously received and added to the per-protocol input
message queue
Upwards Dataflow
Network Protocols
• Defined by a set of conventions, including packet formats, states,
and state transitions
Network Protocols
• Defined by a set of conventions, including packet formats, states,
and state transitions
• Each communication-protocol module implements a particular
protocol and is made up of a collection of procedures and private
data structures
Network Protocols
• Defined by a set of conventions, including packet formats, states,
and state transitions
• Each communication-protocol module implements a particular
protocol and is made up of a collection of procedures and private
data structures
• The external interface of a module is described by a
protocol-switch structure
Network Protocols
• Defined by a set of conventions, including packet formats, states,
and state transitions
• Each communication-protocol module implements a particular
protocol and is made up of a collection of procedures and private
data structures
• The external interface of a module is described by a
protocol-switch structure
• This interface is used by the socket layer for all interaction
Network Protocols
• Defined by a set of conventions, including packet formats, states,
and state transitions
• Each communication-protocol module implements a particular
protocol and is made up of a collection of procedures and private
data structures
• The external interface of a module is described by a
protocol-switch structure
• This interface is used by the socket layer for all interaction
• The address of this structure is present within the socket’s
so_proto field
Network Protocols
• Defined by a set of conventions, including packet formats, states,
and state transitions
• Each communication-protocol module implements a particular
protocol and is made up of a collection of procedures and private
data structures
• The external interface of a module is described by a
protocol-switch structure
• This interface is used by the socket layer for all interaction
• The address of this structure is present within the socket’s
so_proto field

• Each time a socket is created the protocol is selected based on
the type of socket (pr_type)
Network Protocols
• Defined by a set of conventions, including packet formats, states,
and state transitions
• Each communication-protocol module implements a particular
protocol and is made up of a collection of procedures and private
data structures
• The external interface of a module is described by a
protocol-switch structure
• This interface is used by the socket layer for all interaction
• The address of this structure is present within the socket’s
so_proto field

• Each time a socket is created the protocol is selected based on
the type of socket (pr_type)
• Also in charge of mbuf storage management
Network Interfaces
• Each interface defines a link-layer path through which messages
can be sent and received
Network Interfaces
• Each interface defines a link-layer path through which messages
can be sent and received
• Typically, a hardware device is represented by this interface
Network Interfaces
• Each interface defines a link-layer path through which messages
can be sent and received
• Typically, a hardware device is represented by this interface
• The loopback interface is in software which is used to route
traffic to local sockets
Network Interfaces
• Each interface defines a link-layer path through which messages
can be sent and received
• Typically, a hardware device is represented by this interface
• The loopback interface is in software which is used to route
traffic to local sockets

• Also in charge of encapsulation and decapsulation of link-layer
protocol headers
Network Interfaces
• Each interface defines a link-layer path through which messages
can be sent and received
• Typically, a hardware device is represented by this interface
• The loopback interface is in software which is used to route
traffic to local sockets

• Also in charge of encapsulation and decapsulation of link-layer
protocol headers
• Typically implemented as a separate layer that is shared by
various hardware drivers
Network Interfaces
• Each interface defines a link-layer path through which messages
can be sent and received
• Typically, a hardware device is represented by this interface
• The loopback interface is in software which is used to route
traffic to local sockets

• Also in charge of encapsulation and decapsulation of link-layer
protocol headers
• Typically implemented as a separate layer that is shared by
various hardware drivers
• The selection of the interface is taken care of by the network-layer
protocol
Network Interfaces
• Each interface defines a link-layer path through which messages
can be sent and received
• Typically, a hardware device is represented by this interface
• The loopback interface is in software which is used to route
traffic to local sockets

• Also in charge of encapsulation and decapsulation of link-layer
protocol headers
• Typically implemented as a separate layer that is shared by
various hardware drivers
• The selection of the interface is taken care of by the network-layer
protocol
• Represented by an ifnet structure
Socket-to-Protocol Interface

• Enabled by two routines: 1) User request, pr_usrreq() and
2) Control output, pr_ctloutput()
Socket-to-Protocol Interface

• Enabled by two routines: 1) User request, pr_usrreq() and
2) Control output, pr_ctloutput()
• These methods are present in the protocol-switch table for each
protocol
Socket-to-Protocol Interface

• Enabled by two routines: 1) User request, pr_usrreq() and
2) Control output, pr_ctloutput()
• These methods are present in the protocol-switch table for each
protocol
• Control-output: Implements getsockopt and setsockopt
system calls
Socket-to-Protocol Interface

• Enabled by two routines: 1) User request, pr_usrreq() and
2) Control output, pr_ctloutput()
• These methods are present in the protocol-switch table for each
protocol
• Control-output: Implements getsockopt and setsockopt
system calls
• User-request: Implements all other operations
Protocol-to-Network-Interface Interface

• Lowest layer in the protocol family must interact with one or more
interfaces to send and receive packets
Protocol-to-Network-Interface Interface

• Lowest layer in the protocol family must interact with one or more
interfaces to send and receive packets
• Obviously a routing decision must have already chosen the
outgoing interface
Code: Packet Sending

error = (*ifp->if_output)(ifp, m, dst, rt);
struct
struct
struct
struct

ifnet *ifp;
mbuf *m;
sockaddr *dst;
rtentry *rt;
Packet Sending

• Packet m is transmitted to destination dst via interface ifp
Packet Sending

• Packet m is transmitted to destination dst via interface ifp
• Steps:
• Validation of the destination address
Packet Sending

• Packet m is transmitted to destination dst via interface ifp
• Steps:
• Validation of the destination address
• Queuing of the packet on the send queue
Packet Sending

• Packet m is transmitted to destination dst via interface ifp
• Steps:
• Validation of the destination address
• Queuing of the packet on the send queue
• If the interface is not busy, using an interrupt-driven routine to
transmit the packet
Packet Sending

• Packet m is transmitted to destination dst via interface ifp
• Steps:
• Validation of the destination address
• Queuing of the packet on the send queue
• If the interface is not busy, using an interrupt-driven routine to
transmit the packet

• The link-layer address is chosen by ARP in case of Ethernet
Packet Receiving

• Incoming packets are queued in the corresponding protocol’s
input packet queue
Packet Receiving

• Incoming packets are queued in the corresponding protocol’s
input packet queue
• A software interrupt is posted to initiate network-layer processing
Code: Packet Receiving

if (IF_QFULL(&ipintrq)) {
IF_DROP(&ipintrq);
ifp->if_iqdrops++;
m_freem(m);
} else {
schednetisr(NETISR_IP);
IF_ENQUEUE(&ipintrq, m)
}
Routing

• The routing system has two components; one within the kernel
and one in user-space
Routing

• The routing system has two components; one within the kernel
and one in user-space
• The routing mechanism is present within the kernel while routing
policies are defined in user-space
Routing

• The routing system has two components; one within the kernel
and one in user-space
• The routing mechanism is present within the kernel while routing
policies are defined in user-space
• The routing mechanism involves a table lookup to get a first-hop
for a given destination
Routing

• The routing system has two components; one within the kernel
and one in user-space
• The routing mechanism is present within the kernel while routing
policies are defined in user-space
• The routing mechanism involves a table lookup to get a first-hop
for a given destination
• Routing policies include components that help in choosing
first-hop routes
Kernel Routing Mechanism

• Implements a routing table for first/next hop lookup
Kernel Routing Mechanism

• Implements a routing table for first/next hop lookup
• Two distinct portions:
1

A data structure with routing entries, one per specific route
Kernel Routing Mechanism

• Implements a routing table for first/next hop lookup
• Two distinct portions:
1
2

A data structure with routing entries, one per specific route
A lookup algorithm to locate the correct route for each possible
destination
Kernel Routing Mechanism

• Implements a routing table for first/next hop lookup
• Two distinct portions:
1
2

A data structure with routing entries, one per specific route
A lookup algorithm to locate the correct route for each possible
destination

• Each destination is represented by a sockaddr structure
Kernel Routing Mechanism

• Implements a routing table for first/next hop lookup
• Two distinct portions:
1
2

A data structure with routing entries, one per specific route
A lookup algorithm to locate the correct route for each possible
destination

• Each destination is represented by a sockaddr structure
• Routes are either:
1

Host or network
Kernel Routing Mechanism

• Implements a routing table for first/next hop lookup
• Two distinct portions:
1
2

A data structure with routing entries, one per specific route
A lookup algorithm to locate the correct route for each possible
destination

• Each destination is represented by a sockaddr structure
• Routes are either:
1
2

Host or network
Direct or indirect
User-space Routing Policies

• Policies add, delete, or modify kernel routing table entries
User-space Routing Policies

• Policies add, delete, or modify kernel routing table entries
• A number of routing policies exist, including the Routing
Information Protocol (RIP)
Protocol Control Blocks
• For each TCP or UDP socket, an Internet protocol control block
(inpcb) is created to hold address, ports, routing information,
and pointers to any additional data structures
Protocol Control Blocks
• For each TCP or UDP socket, an Internet protocol control block
(inpcb) is created to hold address, ports, routing information,
and pointers to any additional data structures
• TCP in addition creates a TCP control block (tcpcb) to hold
implementation-specific information
Protocol Control Blocks
• For each TCP or UDP socket, an Internet protocol control block
(inpcb) is created to hold address, ports, routing information,
and pointers to any additional data structures
• TCP in addition creates a TCP control block (tcpcb) to hold
implementation-specific information

• TCP and UDP protocol modules each have a private doubly
linked list of inpcbs
Protocol Control Blocks
• For each TCP or UDP socket, an Internet protocol control block
(inpcb) is created to hold address, ports, routing information,
and pointers to any additional data structures
• TCP in addition creates a TCP control block (tcpcb) to hold
implementation-specific information

• TCP and UDP protocol modules each have a private doubly
linked list of inpcbs
• Common routines are used by the modules to manipulate these
lists
Protocol Control Blocks
• For each TCP or UDP socket, an Internet protocol control block
(inpcb) is created to hold address, ports, routing information,
and pointers to any additional data structures
• TCP in addition creates a TCP control block (tcpcb) to hold
implementation-specific information

• TCP and UDP protocol modules each have a private doubly
linked list of inpcbs
• Common routines are used by the modules to manipulate these
lists
• Traffic is multiplexed by the IP layer on the basis of the protocol
identifier in the protocol and passed on to the individual transport
protocol
Protocol Control Blocks
• For each TCP or UDP socket, an Internet protocol control block
(inpcb) is created to hold address, ports, routing information,
and pointers to any additional data structures
• TCP in addition creates a TCP control block (tcpcb) to hold
implementation-specific information

• TCP and UDP protocol modules each have a private doubly
linked list of inpcbs
• Common routines are used by the modules to manipulate these
lists
• Traffic is multiplexed by the IP layer on the basis of the protocol
identifier in the protocol and passed on to the individual transport
protocol
• Each protocol is then responsible for passing a direct message to
the appropriate socket
Today’s task

• Design a network subsystem for xv6
Reading(s)

• Chapter 12 and 13 from “The Design and Implementation of the
4.4BSD Operating System” by Marshall Kirk McKusick, Keith
Bostic, Michael J. Karels, and John S. Quarterman.

Contenu connexe

Tendances

Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-reviewabinaya m
 
A fast file system for unix presentation by parang saraf (cs5204 VT)
A fast file system for unix presentation by parang saraf (cs5204 VT)A fast file system for unix presentation by parang saraf (cs5204 VT)
A fast file system for unix presentation by parang saraf (cs5204 VT)Parang Saraf
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsAhmed El-Arabawy
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityAndrew Case
 
Device Drivers and Running Modules
Device Drivers and Running ModulesDevice Drivers and Running Modules
Device Drivers and Running ModulesYourHelper1
 
Kernel module programming
Kernel module programmingKernel module programming
Kernel module programmingVandana Salve
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsDivye Kapoor
 
De-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory AnalysisDe-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory AnalysisAndrew Case
 
Linux internal
Linux internalLinux internal
Linux internalmcganesh
 
Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with VolatilityWorkshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with VolatilityAndrew Case
 
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)Ahmed El-Arabawy
 
Embedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 6: Linux & GNUEmbedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 6: Linux & GNUAhmed El-Arabawy
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O YourHelper1
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/CoreShay Cohen
 
Char Drivers And Debugging Techniques
Char Drivers And Debugging TechniquesChar Drivers And Debugging Techniques
Char Drivers And Debugging TechniquesYourHelper1
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)shimosawa
 

Tendances (20)

Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-review
 
Introduction to UNIX
Introduction to UNIXIntroduction to UNIX
Introduction to UNIX
 
A fast file system for unix presentation by parang saraf (cs5204 VT)
A fast file system for unix presentation by parang saraf (cs5204 VT)A fast file system for unix presentation by parang saraf (cs5204 VT)
A fast file system for unix presentation by parang saraf (cs5204 VT)
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and Permissions
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
 
Device Drivers and Running Modules
Device Drivers and Running ModulesDevice Drivers and Running Modules
Device Drivers and Running Modules
 
Kernel module programming
Kernel module programmingKernel module programming
Kernel module programming
 
Basic Linux kernel
Basic Linux kernelBasic Linux kernel
Basic Linux kernel
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOs
 
Unix kernal
Unix kernalUnix kernal
Unix kernal
 
De-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory AnalysisDe-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory Analysis
 
Linux internal
Linux internalLinux internal
Linux internal
 
Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with VolatilityWorkshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with Volatility
 
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
 
Embedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 6: Linux & GNUEmbedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 6: Linux & GNU
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Char Drivers And Debugging Techniques
Char Drivers And Debugging TechniquesChar Drivers And Debugging Techniques
Char Drivers And Debugging Techniques
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)
 

Similaire à AOS Lab 12: Network Communication

Networkprotocolstructurescope 130719081246-phpapp01
Networkprotocolstructurescope 130719081246-phpapp01Networkprotocolstructurescope 130719081246-phpapp01
Networkprotocolstructurescope 130719081246-phpapp01Gaurav Goyal
 
Network protocol structure scope
Network protocol structure scopeNetwork protocol structure scope
Network protocol structure scopeSanat Maharjan
 
Networking and Internetworking Devices
Networking and Internetworking DevicesNetworking and Internetworking Devices
Networking and Internetworking Devices21viveksingh
 
windows server installation procedure or
windows server installation procedure orwindows server installation procedure or
windows server installation procedure orYogeshKumar187055
 
Network architecure (3).pptx
Network architecure (3).pptxNetwork architecure (3).pptx
Network architecure (3).pptxKaythry P
 
06 - OSI Model.ppt
06 - OSI Model.ppt06 - OSI Model.ppt
06 - OSI Model.pptssuserf7cd2b
 
06 - OSI Model.ppt
06 - OSI Model.ppt06 - OSI Model.ppt
06 - OSI Model.pptssuserf7cd2b
 
09 Systems Software Programming-Network Programming.pptx
09 Systems Software Programming-Network Programming.pptx09 Systems Software Programming-Network Programming.pptx
09 Systems Software Programming-Network Programming.pptxKushalSrivastava23
 
Unit 2 ppt-idc
Unit 2 ppt-idcUnit 2 ppt-idc
Unit 2 ppt-idchiya123jes
 
98 366 mva slides lesson 7
98 366 mva slides lesson 798 366 mva slides lesson 7
98 366 mva slides lesson 7suddenven
 
Cisco Networking (Routing and Switching)
Cisco Networking (Routing and Switching)Cisco Networking (Routing and Switching)
Cisco Networking (Routing and Switching)Alan Mark
 
campus_design_eng1.ppt
campus_design_eng1.pptcampus_design_eng1.ppt
campus_design_eng1.pptchali100
 
Protocol and Interfaces - IPv4, IPv6, X.25 Protocol, X.75 Protocol
Protocol and Interfaces - IPv4, IPv6, X.25 Protocol, X.75 ProtocolProtocol and Interfaces - IPv4, IPv6, X.25 Protocol, X.75 Protocol
Protocol and Interfaces - IPv4, IPv6, X.25 Protocol, X.75 ProtocolPradnya Saval
 
Protocols and Interfaces - IPv4, IPv6, X.25, X.75
Protocols and Interfaces - IPv4, IPv6, X.25, X.75Protocols and Interfaces - IPv4, IPv6, X.25, X.75
Protocols and Interfaces - IPv4, IPv6, X.25, X.75Pradnya Saval
 
Computer Networking
Computer NetworkingComputer Networking
Computer NetworkingRanjan K.M.
 

Similaire à AOS Lab 12: Network Communication (20)

Networkprotocolstructurescope 130719081246-phpapp01
Networkprotocolstructurescope 130719081246-phpapp01Networkprotocolstructurescope 130719081246-phpapp01
Networkprotocolstructurescope 130719081246-phpapp01
 
Network protocol structure scope
Network protocol structure scopeNetwork protocol structure scope
Network protocol structure scope
 
Networking and Internetworking Devices
Networking and Internetworking DevicesNetworking and Internetworking Devices
Networking and Internetworking Devices
 
windows server installation procedure or
windows server installation procedure orwindows server installation procedure or
windows server installation procedure or
 
Network architecure (3).pptx
Network architecure (3).pptxNetwork architecure (3).pptx
Network architecure (3).pptx
 
06 - OSI Model.ppt
06 - OSI Model.ppt06 - OSI Model.ppt
06 - OSI Model.ppt
 
06 - OSI Model.ppt
06 - OSI Model.ppt06 - OSI Model.ppt
06 - OSI Model.ppt
 
09 Systems Software Programming-Network Programming.pptx
09 Systems Software Programming-Network Programming.pptx09 Systems Software Programming-Network Programming.pptx
09 Systems Software Programming-Network Programming.pptx
 
Unit 2 ppt-idc
Unit 2 ppt-idcUnit 2 ppt-idc
Unit 2 ppt-idc
 
98 366 mva slides lesson 7
98 366 mva slides lesson 798 366 mva slides lesson 7
98 366 mva slides lesson 7
 
MVA slides lesson 7
MVA slides lesson 7MVA slides lesson 7
MVA slides lesson 7
 
Cisco Networking (Routing and Switching)
Cisco Networking (Routing and Switching)Cisco Networking (Routing and Switching)
Cisco Networking (Routing and Switching)
 
campus_design_eng1.ppt
campus_design_eng1.pptcampus_design_eng1.ppt
campus_design_eng1.ppt
 
Unit2.2
Unit2.2Unit2.2
Unit2.2
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Protocol and Interfaces - IPv4, IPv6, X.25 Protocol, X.75 Protocol
Protocol and Interfaces - IPv4, IPv6, X.25 Protocol, X.75 ProtocolProtocol and Interfaces - IPv4, IPv6, X.25 Protocol, X.75 Protocol
Protocol and Interfaces - IPv4, IPv6, X.25 Protocol, X.75 Protocol
 
Protocols and Interfaces - IPv4, IPv6, X.25, X.75
Protocols and Interfaces - IPv4, IPv6, X.25, X.75Protocols and Interfaces - IPv4, IPv6, X.25, X.75
Protocols and Interfaces - IPv4, IPv6, X.25, X.75
 
MVA slides lesson 1
MVA slides lesson 1MVA slides lesson 1
MVA slides lesson 1
 
MVA slides lesson 2
MVA slides lesson 2MVA slides lesson 2
MVA slides lesson 2
 
Computer Networking
Computer NetworkingComputer Networking
Computer Networking
 

Plus de Zubair Nabi

AOS Lab 11: Virtualization
AOS Lab 11: VirtualizationAOS Lab 11: Virtualization
AOS Lab 11: VirtualizationZubair Nabi
 
AOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device DriversAOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device DriversZubair Nabi
 
AOS Lab 6: Scheduling
AOS Lab 6: SchedulingAOS Lab 6: Scheduling
AOS Lab 6: SchedulingZubair Nabi
 
AOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on itAOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on itZubair Nabi
 
AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!Zubair Nabi
 
The Big Data Stack
The Big Data StackThe Big Data Stack
The Big Data StackZubair Nabi
 
Raabta: Low-cost Video Conferencing for the Developing World
Raabta: Low-cost Video Conferencing for the Developing WorldRaabta: Low-cost Video Conferencing for the Developing World
Raabta: Low-cost Video Conferencing for the Developing WorldZubair Nabi
 
The Anatomy of Web Censorship in Pakistan
The Anatomy of Web Censorship in PakistanThe Anatomy of Web Censorship in Pakistan
The Anatomy of Web Censorship in PakistanZubair Nabi
 
MapReduce and DBMS Hybrids
MapReduce and DBMS HybridsMapReduce and DBMS Hybrids
MapReduce and DBMS HybridsZubair Nabi
 
MapReduce Application Scripting
MapReduce Application ScriptingMapReduce Application Scripting
MapReduce Application ScriptingZubair Nabi
 
Topic 15: Datacenter Design and Networking
Topic 15: Datacenter Design and NetworkingTopic 15: Datacenter Design and Networking
Topic 15: Datacenter Design and NetworkingZubair Nabi
 
Topic 14: Operating Systems and Virtualization
Topic 14: Operating Systems and VirtualizationTopic 14: Operating Systems and Virtualization
Topic 14: Operating Systems and VirtualizationZubair Nabi
 
Topic 13: Cloud Stacks
Topic 13: Cloud StacksTopic 13: Cloud Stacks
Topic 13: Cloud StacksZubair Nabi
 
Lab 5: Interconnecting a Datacenter using Mininet
Lab 5: Interconnecting a Datacenter using MininetLab 5: Interconnecting a Datacenter using Mininet
Lab 5: Interconnecting a Datacenter using MininetZubair Nabi
 
Topic 12: NoSQL in Action
Topic 12: NoSQL in ActionTopic 12: NoSQL in Action
Topic 12: NoSQL in ActionZubair Nabi
 
Lab 4: Interfacing with Cassandra
Lab 4: Interfacing with CassandraLab 4: Interfacing with Cassandra
Lab 4: Interfacing with CassandraZubair Nabi
 
Topic 10: Taxonomy of Data and Storage
Topic 10: Taxonomy of Data and StorageTopic 10: Taxonomy of Data and Storage
Topic 10: Taxonomy of Data and StorageZubair Nabi
 
Topic 11: Google Filesystem
Topic 11: Google FilesystemTopic 11: Google Filesystem
Topic 11: Google FilesystemZubair Nabi
 
Lab 3: Writing a Naiad Application
Lab 3: Writing a Naiad ApplicationLab 3: Writing a Naiad Application
Lab 3: Writing a Naiad ApplicationZubair Nabi
 

Plus de Zubair Nabi (20)

AOS Lab 11: Virtualization
AOS Lab 11: VirtualizationAOS Lab 11: Virtualization
AOS Lab 11: Virtualization
 
AOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device DriversAOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device Drivers
 
AOS Lab 6: Scheduling
AOS Lab 6: SchedulingAOS Lab 6: Scheduling
AOS Lab 6: Scheduling
 
AOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on itAOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on it
 
AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!
 
The Big Data Stack
The Big Data StackThe Big Data Stack
The Big Data Stack
 
Raabta: Low-cost Video Conferencing for the Developing World
Raabta: Low-cost Video Conferencing for the Developing WorldRaabta: Low-cost Video Conferencing for the Developing World
Raabta: Low-cost Video Conferencing for the Developing World
 
The Anatomy of Web Censorship in Pakistan
The Anatomy of Web Censorship in PakistanThe Anatomy of Web Censorship in Pakistan
The Anatomy of Web Censorship in Pakistan
 
MapReduce and DBMS Hybrids
MapReduce and DBMS HybridsMapReduce and DBMS Hybrids
MapReduce and DBMS Hybrids
 
MapReduce Application Scripting
MapReduce Application ScriptingMapReduce Application Scripting
MapReduce Application Scripting
 
Topic 15: Datacenter Design and Networking
Topic 15: Datacenter Design and NetworkingTopic 15: Datacenter Design and Networking
Topic 15: Datacenter Design and Networking
 
Topic 14: Operating Systems and Virtualization
Topic 14: Operating Systems and VirtualizationTopic 14: Operating Systems and Virtualization
Topic 14: Operating Systems and Virtualization
 
Topic 13: Cloud Stacks
Topic 13: Cloud StacksTopic 13: Cloud Stacks
Topic 13: Cloud Stacks
 
Lab 5: Interconnecting a Datacenter using Mininet
Lab 5: Interconnecting a Datacenter using MininetLab 5: Interconnecting a Datacenter using Mininet
Lab 5: Interconnecting a Datacenter using Mininet
 
Topic 12: NoSQL in Action
Topic 12: NoSQL in ActionTopic 12: NoSQL in Action
Topic 12: NoSQL in Action
 
Lab 4: Interfacing with Cassandra
Lab 4: Interfacing with CassandraLab 4: Interfacing with Cassandra
Lab 4: Interfacing with Cassandra
 
Topic 10: Taxonomy of Data and Storage
Topic 10: Taxonomy of Data and StorageTopic 10: Taxonomy of Data and Storage
Topic 10: Taxonomy of Data and Storage
 
Topic 11: Google Filesystem
Topic 11: Google FilesystemTopic 11: Google Filesystem
Topic 11: Google Filesystem
 
Lab 3: Writing a Naiad Application
Lab 3: Writing a Naiad ApplicationLab 3: Writing a Naiad Application
Lab 3: Writing a Naiad Application
 
Topic 9: MR+
Topic 9: MR+Topic 9: MR+
Topic 9: MR+
 

Dernier

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Dernier (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

AOS Lab 12: Network Communication

  • 1. Lab 12: Network Communication Advanced Operating Systems Zubair Nabi zubair.nabi@itu.edu.pk April 24, 2013
  • 2. Introduction • In *nix systems, the networking infrastructure abstracts away many network architectures
  • 3. Introduction • In *nix systems, the networking infrastructure abstracts away many network architectures • Each network architecture consists of • Network-communication protocols
  • 4. Introduction • In *nix systems, the networking infrastructure abstracts away many network architectures • Each network architecture consists of • Network-communication protocols • The protocol family
  • 5. Introduction • In *nix systems, the networking infrastructure abstracts away many network architectures • Each network architecture consists of • Network-communication protocols • The protocol family • Conventions of naming end-points
  • 6. Introduction • In *nix systems, the networking infrastructure abstracts away many network architectures • Each network architecture consists of • • • • Network-communication protocols The protocol family Conventions of naming end-points The address family or address format
  • 7. Introduction • In *nix systems, the networking infrastructure abstracts away many network architectures • Each network architecture consists of • • • • • Network-communication protocols The protocol family Conventions of naming end-points The address family or address format Additional facilities
  • 8. Introduction • In *nix systems, the networking infrastructure abstracts away many network architectures • Each network architecture consists of • • • • • Network-communication protocols The protocol family Conventions of naming end-points The address family or address format Additional facilities • Network facilities are accessed through the socket abstraction
  • 9. Network Subsystem Consists of three layers: 1 Transport layer: In charge of sockets-amenable addressing structure and protocol mechanisms, such as ordering, reliability, etc.
  • 10. Network Subsystem Consists of three layers: 1 Transport layer: In charge of sockets-amenable addressing structure and protocol mechanisms, such as ordering, reliability, etc. 2 Network layer: Responsible for delivery of data across the network (must maintain a routing database)
  • 11. Network Subsystem Consists of three layers: 1 Transport layer: In charge of sockets-amenable addressing structure and protocol mechanisms, such as ordering, reliability, etc. 2 Network layer: Responsible for delivery of data across the network (must maintain a routing database) 3 Link layer: Responsible for shipping messages between hosts connected to a common transmission medium
  • 12. Network Subsystem (2) • The layering is just logical layering
  • 13. Network Subsystem (2) • The layering is just logical layering • The network service itself might choose to use more or fewer layers based on its requirements
  • 14. Network Subsystem (2) • The layering is just logical layering • The network service itself might choose to use more or fewer layers based on its requirements • For instance, raw sockets use a null implementation at one or more layers
  • 15. Network Subsystem (2) • The layering is just logical layering • The network service itself might choose to use more or fewer layers based on its requirements • For instance, raw sockets use a null implementation at one or more layers • Similarly, tunneling of one protocol through another requires additional implementations of multiple layers
  • 16. Memory Management • Memory management for communication protocols is different than regular entities as memory is required in widely varying sizes
  • 17. Memory Management • Memory management for communication protocols is different than regular entities as memory is required in widely varying sizes • A special-purpose memory-management facility exists for IPC and networking systems
  • 18. Memory Management • Memory management for communication protocols is different than regular entities as memory is required in widely varying sizes • A special-purpose memory-management facility exists for IPC and networking systems • The unit of allocation is an mbuf (skbuff in Linux), which is 128 bytes long with 100 or 108 bytes reserved for data
  • 19. Memory Management • Memory management for communication protocols is different than regular entities as memory is required in widely varying sizes • A special-purpose memory-management facility exists for IPC and networking systems • The unit of allocation is an mbuf (skbuff in Linux), which is 128 bytes long with 100 or 108 bytes reserved for data • A chain of mbufs can be linked together (m_next) to hold an arbitrary quantity of data
  • 20. Memory Management • Memory management for communication protocols is different than regular entities as memory is required in widely varying sizes • A special-purpose memory-management facility exists for IPC and networking systems • The unit of allocation is an mbuf (skbuff in Linux), which is 128 bytes long with 100 or 108 bytes reserved for data • A chain of mbufs can be linked together (m_next) to hold an arbitrary quantity of data • For instance, a chain of mbufs is used to represent packets by network protocols
  • 21. mbuf
  • 22. Data Flow • Socket-to-network-subsystem • Calls the transport-layer modules that support the socket abstraction
  • 23. Data Flow • Socket-to-network-subsystem • Calls the transport-layer modules that support the socket abstraction • Typically started by system calls
  • 24. Data Flow • Socket-to-network-subsystem • Calls the transport-layer modules that support the socket abstraction • Typically started by system calls • Network-subsystem-to-socket • Flows up the stack and is placed in the receive queue of the destination socket
  • 25. Data Flow • Socket-to-network-subsystem • Calls the transport-layer modules that support the socket abstraction • Typically started by system calls • Network-subsystem-to-socket • Flows up the stack and is placed in the receive queue of the destination socket • Asynchronously received and added to the per-protocol input message queue
  • 27. Network Protocols • Defined by a set of conventions, including packet formats, states, and state transitions
  • 28. Network Protocols • Defined by a set of conventions, including packet formats, states, and state transitions • Each communication-protocol module implements a particular protocol and is made up of a collection of procedures and private data structures
  • 29. Network Protocols • Defined by a set of conventions, including packet formats, states, and state transitions • Each communication-protocol module implements a particular protocol and is made up of a collection of procedures and private data structures • The external interface of a module is described by a protocol-switch structure
  • 30. Network Protocols • Defined by a set of conventions, including packet formats, states, and state transitions • Each communication-protocol module implements a particular protocol and is made up of a collection of procedures and private data structures • The external interface of a module is described by a protocol-switch structure • This interface is used by the socket layer for all interaction
  • 31. Network Protocols • Defined by a set of conventions, including packet formats, states, and state transitions • Each communication-protocol module implements a particular protocol and is made up of a collection of procedures and private data structures • The external interface of a module is described by a protocol-switch structure • This interface is used by the socket layer for all interaction • The address of this structure is present within the socket’s so_proto field
  • 32. Network Protocols • Defined by a set of conventions, including packet formats, states, and state transitions • Each communication-protocol module implements a particular protocol and is made up of a collection of procedures and private data structures • The external interface of a module is described by a protocol-switch structure • This interface is used by the socket layer for all interaction • The address of this structure is present within the socket’s so_proto field • Each time a socket is created the protocol is selected based on the type of socket (pr_type)
  • 33. Network Protocols • Defined by a set of conventions, including packet formats, states, and state transitions • Each communication-protocol module implements a particular protocol and is made up of a collection of procedures and private data structures • The external interface of a module is described by a protocol-switch structure • This interface is used by the socket layer for all interaction • The address of this structure is present within the socket’s so_proto field • Each time a socket is created the protocol is selected based on the type of socket (pr_type) • Also in charge of mbuf storage management
  • 34. Network Interfaces • Each interface defines a link-layer path through which messages can be sent and received
  • 35. Network Interfaces • Each interface defines a link-layer path through which messages can be sent and received • Typically, a hardware device is represented by this interface
  • 36. Network Interfaces • Each interface defines a link-layer path through which messages can be sent and received • Typically, a hardware device is represented by this interface • The loopback interface is in software which is used to route traffic to local sockets
  • 37. Network Interfaces • Each interface defines a link-layer path through which messages can be sent and received • Typically, a hardware device is represented by this interface • The loopback interface is in software which is used to route traffic to local sockets • Also in charge of encapsulation and decapsulation of link-layer protocol headers
  • 38. Network Interfaces • Each interface defines a link-layer path through which messages can be sent and received • Typically, a hardware device is represented by this interface • The loopback interface is in software which is used to route traffic to local sockets • Also in charge of encapsulation and decapsulation of link-layer protocol headers • Typically implemented as a separate layer that is shared by various hardware drivers
  • 39. Network Interfaces • Each interface defines a link-layer path through which messages can be sent and received • Typically, a hardware device is represented by this interface • The loopback interface is in software which is used to route traffic to local sockets • Also in charge of encapsulation and decapsulation of link-layer protocol headers • Typically implemented as a separate layer that is shared by various hardware drivers • The selection of the interface is taken care of by the network-layer protocol
  • 40. Network Interfaces • Each interface defines a link-layer path through which messages can be sent and received • Typically, a hardware device is represented by this interface • The loopback interface is in software which is used to route traffic to local sockets • Also in charge of encapsulation and decapsulation of link-layer protocol headers • Typically implemented as a separate layer that is shared by various hardware drivers • The selection of the interface is taken care of by the network-layer protocol • Represented by an ifnet structure
  • 41. Socket-to-Protocol Interface • Enabled by two routines: 1) User request, pr_usrreq() and 2) Control output, pr_ctloutput()
  • 42. Socket-to-Protocol Interface • Enabled by two routines: 1) User request, pr_usrreq() and 2) Control output, pr_ctloutput() • These methods are present in the protocol-switch table for each protocol
  • 43. Socket-to-Protocol Interface • Enabled by two routines: 1) User request, pr_usrreq() and 2) Control output, pr_ctloutput() • These methods are present in the protocol-switch table for each protocol • Control-output: Implements getsockopt and setsockopt system calls
  • 44. Socket-to-Protocol Interface • Enabled by two routines: 1) User request, pr_usrreq() and 2) Control output, pr_ctloutput() • These methods are present in the protocol-switch table for each protocol • Control-output: Implements getsockopt and setsockopt system calls • User-request: Implements all other operations
  • 45. Protocol-to-Network-Interface Interface • Lowest layer in the protocol family must interact with one or more interfaces to send and receive packets
  • 46. Protocol-to-Network-Interface Interface • Lowest layer in the protocol family must interact with one or more interfaces to send and receive packets • Obviously a routing decision must have already chosen the outgoing interface
  • 47. Code: Packet Sending error = (*ifp->if_output)(ifp, m, dst, rt); struct struct struct struct ifnet *ifp; mbuf *m; sockaddr *dst; rtentry *rt;
  • 48. Packet Sending • Packet m is transmitted to destination dst via interface ifp
  • 49. Packet Sending • Packet m is transmitted to destination dst via interface ifp • Steps: • Validation of the destination address
  • 50. Packet Sending • Packet m is transmitted to destination dst via interface ifp • Steps: • Validation of the destination address • Queuing of the packet on the send queue
  • 51. Packet Sending • Packet m is transmitted to destination dst via interface ifp • Steps: • Validation of the destination address • Queuing of the packet on the send queue • If the interface is not busy, using an interrupt-driven routine to transmit the packet
  • 52. Packet Sending • Packet m is transmitted to destination dst via interface ifp • Steps: • Validation of the destination address • Queuing of the packet on the send queue • If the interface is not busy, using an interrupt-driven routine to transmit the packet • The link-layer address is chosen by ARP in case of Ethernet
  • 53. Packet Receiving • Incoming packets are queued in the corresponding protocol’s input packet queue
  • 54. Packet Receiving • Incoming packets are queued in the corresponding protocol’s input packet queue • A software interrupt is posted to initiate network-layer processing
  • 55. Code: Packet Receiving if (IF_QFULL(&ipintrq)) { IF_DROP(&ipintrq); ifp->if_iqdrops++; m_freem(m); } else { schednetisr(NETISR_IP); IF_ENQUEUE(&ipintrq, m) }
  • 56. Routing • The routing system has two components; one within the kernel and one in user-space
  • 57. Routing • The routing system has two components; one within the kernel and one in user-space • The routing mechanism is present within the kernel while routing policies are defined in user-space
  • 58. Routing • The routing system has two components; one within the kernel and one in user-space • The routing mechanism is present within the kernel while routing policies are defined in user-space • The routing mechanism involves a table lookup to get a first-hop for a given destination
  • 59. Routing • The routing system has two components; one within the kernel and one in user-space • The routing mechanism is present within the kernel while routing policies are defined in user-space • The routing mechanism involves a table lookup to get a first-hop for a given destination • Routing policies include components that help in choosing first-hop routes
  • 60. Kernel Routing Mechanism • Implements a routing table for first/next hop lookup
  • 61. Kernel Routing Mechanism • Implements a routing table for first/next hop lookup • Two distinct portions: 1 A data structure with routing entries, one per specific route
  • 62. Kernel Routing Mechanism • Implements a routing table for first/next hop lookup • Two distinct portions: 1 2 A data structure with routing entries, one per specific route A lookup algorithm to locate the correct route for each possible destination
  • 63. Kernel Routing Mechanism • Implements a routing table for first/next hop lookup • Two distinct portions: 1 2 A data structure with routing entries, one per specific route A lookup algorithm to locate the correct route for each possible destination • Each destination is represented by a sockaddr structure
  • 64. Kernel Routing Mechanism • Implements a routing table for first/next hop lookup • Two distinct portions: 1 2 A data structure with routing entries, one per specific route A lookup algorithm to locate the correct route for each possible destination • Each destination is represented by a sockaddr structure • Routes are either: 1 Host or network
  • 65. Kernel Routing Mechanism • Implements a routing table for first/next hop lookup • Two distinct portions: 1 2 A data structure with routing entries, one per specific route A lookup algorithm to locate the correct route for each possible destination • Each destination is represented by a sockaddr structure • Routes are either: 1 2 Host or network Direct or indirect
  • 66. User-space Routing Policies • Policies add, delete, or modify kernel routing table entries
  • 67. User-space Routing Policies • Policies add, delete, or modify kernel routing table entries • A number of routing policies exist, including the Routing Information Protocol (RIP)
  • 68. Protocol Control Blocks • For each TCP or UDP socket, an Internet protocol control block (inpcb) is created to hold address, ports, routing information, and pointers to any additional data structures
  • 69. Protocol Control Blocks • For each TCP or UDP socket, an Internet protocol control block (inpcb) is created to hold address, ports, routing information, and pointers to any additional data structures • TCP in addition creates a TCP control block (tcpcb) to hold implementation-specific information
  • 70. Protocol Control Blocks • For each TCP or UDP socket, an Internet protocol control block (inpcb) is created to hold address, ports, routing information, and pointers to any additional data structures • TCP in addition creates a TCP control block (tcpcb) to hold implementation-specific information • TCP and UDP protocol modules each have a private doubly linked list of inpcbs
  • 71. Protocol Control Blocks • For each TCP or UDP socket, an Internet protocol control block (inpcb) is created to hold address, ports, routing information, and pointers to any additional data structures • TCP in addition creates a TCP control block (tcpcb) to hold implementation-specific information • TCP and UDP protocol modules each have a private doubly linked list of inpcbs • Common routines are used by the modules to manipulate these lists
  • 72. Protocol Control Blocks • For each TCP or UDP socket, an Internet protocol control block (inpcb) is created to hold address, ports, routing information, and pointers to any additional data structures • TCP in addition creates a TCP control block (tcpcb) to hold implementation-specific information • TCP and UDP protocol modules each have a private doubly linked list of inpcbs • Common routines are used by the modules to manipulate these lists • Traffic is multiplexed by the IP layer on the basis of the protocol identifier in the protocol and passed on to the individual transport protocol
  • 73. Protocol Control Blocks • For each TCP or UDP socket, an Internet protocol control block (inpcb) is created to hold address, ports, routing information, and pointers to any additional data structures • TCP in addition creates a TCP control block (tcpcb) to hold implementation-specific information • TCP and UDP protocol modules each have a private doubly linked list of inpcbs • Common routines are used by the modules to manipulate these lists • Traffic is multiplexed by the IP layer on the basis of the protocol identifier in the protocol and passed on to the individual transport protocol • Each protocol is then responsible for passing a direct message to the appropriate socket
  • 74. Today’s task • Design a network subsystem for xv6
  • 75. Reading(s) • Chapter 12 and 13 from “The Design and Implementation of the 4.4BSD Operating System” by Marshall Kirk McKusick, Keith Bostic, Michael J. Karels, and John S. Quarterman.