fall 2004fsu cis 5930 internet protocols1 architecture of network implementation reading: chapters 3...

21
Fall 2004 FSU CIS 5930 Internet Protocols 1 Architecture of Network Implementation Reading: Chapters 3 and 4

Upload: shannon-banks

Post on 12-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 1

Architecture of Network Implementation

Reading: Chapters 3 and 4

Page 2: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 2

Layer-Based Communication Models

AnwendungAnwendung

Instance (N)Instance (N)

Instance (N-1)Instance (N-1)

ApplicationApplication

Instance (N+1)

Instance (N+1)

Instance (N+1)

Instance (N+1)

AnwendungAnwendungApplicationApplication

(N+1)-Protocols

(N)-protocol

(N)-protocol

Instance (N+1)

Instance (N+1)

Instance (N)Instance (N)

Instance (N-1)Instance (N-1)

Instance (N+1)

Instance (N+1)

Transmission medium Transmission medium

Intermediate system End systemsEnd systems

Layer (N-1)

Layer (N)

Layer (N+1)

Page 3: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 3

Two Important Concepts in the Layered Model

• Protocols – Rules that two parties talk and understand

each other– Horizontal

• Services– Functions provided by a lower layer to the

neighboring upper layer– Vertical– Service interface (function calls)

Page 4: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 4

ISO/OSI Reference ModelISO/OSI Reference model

ApplicationApplication

PresentationPresentation

SessionSession

TransportTransport

NetworkNetwork

Data linkData link

PhysicalPhysical

Page 5: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 5

ISO/OSI Model• Physical layer

– Media types, coding methods, bit sequences vs. physical signals

• Data link layer– Moving data between two directly connected stations. Flow

control, error detection, etc. Shared medium: access control. LLC/MAC

• Network layer– Connectivity of networks. Packet routing/forwarding

• Transport layer– Concerning end-to-end functions between applications. Flow

control, packet ordering, etc.

• Session layer– Handling structured message exchange

• Presentation layer– Regulating data presentation (format)

• Application layer– Protocols for different applications, HTTP, SMTP, FTP, etc

Page 6: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 6

TCP/IP Reference ModelISO/OSI reference model Internet reference mode

ApplicationApplication

PresentationPresentation Application (HTTP, SMTP, SSH)

Application (HTTP, SMTP, SSH)

7

6

5

4

3

2

1

Transport (TCP/UDP)Transport (TCP/UDP)

Internet (IPv4/v6)Internet (IPv4/v6)

Data link(802.x, PPP, SLIP)

Data link(802.x, PPP, SLIP)

SessionSession

TransportTransport

NetworkNetwork

Data linkData link

Physical Physical

Page 7: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 7

Interplay of Layers, Instances, and Protocols

(N)-PCI(N)-PCI (N)-SDU(N)-SDU

(N-1)-Layer

(N+1)-Layer

(N)-IDU(N)-IDU

(N)-ICI(N)-ICI(N)-SDU(N)-SDU(N)-PCI(N)-PCI

(N)-Layer

(N-1)-ICI(N-1)-ICI

(N-1)-IDU(N-1)-IDU

(N-1)-SDU(N-1)-SDU

(N)-PDU

(N-1)-ICI(N-1)-ICI

Page 8: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 8

PDU/PCI/SDU/ICI/IDU

• PDU: protocol data unit– Elements exchanged between two protocol

instances– PCI (protocol control information or packet

header) + SDU (service data unit)

• ICI: interface control information– Passed from layer N to layer N-1 together with

layer N PDU

• IDU: interface data unit– ICI + PDU

Page 9: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 9

Managing Network Packets in Kernel

• Socket buffers– Where packets are stored,

manipulated.

• Socket buffer queues– Linked list of socket buffers

Page 10: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 10

Socket Buffers (skb)

nextnext

prevprev

listlist

stampstamp

sk_buff

devdev

hh

nhnh

macmac

dstdst

lenlen

......

headhead

datadata

tailtail

endend

Packet data storage

datarefp: 1datarefp: 1

UDP-Data

UDP-Header

IP-Header

MAC-Header

net_devicenet_device

sk_buffsk_buff

sk_buff_headsk_buff_head

Page 11: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 11

Some important fields of skb• prev, next, list

– Queue’s linked list• sk

– Socket owning the packet• dev

– Device receiving/sending packet• h, nh, mac

– Pointers to the transport/network/MAC layer headers• len

– Size of the packet• data, head, tail, end

– Pointers associated with data packet field• datarefp

– A counter indicating how many skb_buff points to the packet– Not really a field of sbk_buff

Page 12: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 12

Updates of skb_buff as packet passing different

layersnextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Packet data storage

datarefp: 1datarefp: 1

UDP-Data

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Packet data storage

UDP-Data

UDP-Header

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Packet data storage

UDP-Data

UDP-Header

IP-Header

datarefp: 1datarefp: 1 datarefp: 1datarefp: 1

Page 13: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 13

Operations on socket buffers

• Three types of operations– Creating and releasing socket buffers

• alloc_skb(), dev_alloc_skb(), skb_clone(), kfree_skb(), dev_kfree_skb()

– Manipulating fields of socket buffers• skb_put(), skb_push(), skb_pull(),

skb_reserve()

– Managing socket buffer queues• skb_queue_head(),etc

Page 14: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 14

Creating/releasing skb

• alloc_skb(size, gpf_mask)• dev_alloc_skb(length)• kfree_skb(skb)• dev_kfree_skb(skb)

•skb_clone(skb,gpf_mask)•skb_copy(skb,gpf_mask)

Page 15: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 15

Skb_clone()

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Packet data storage

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

UDP-Data

UDP-Header

IP-Header

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Packet data storage

UDP-Data

UDP-Header

IP-Header

skb_clone

datarefp: 1datarefp: 1 datarefp: 2datarefp: 2

Page 16: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 16

skb_copy()

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Paketdatenbereich

UDP-Data

UDP-Header

IP-Header

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Paketdatenbereich

UDP-Data

UDP-Header

IP-Header

skb_copy

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Paketdatenbereich

UDP-Data

UDP-Header

IP-Header

datarefp: 1datarefp: 1datarefp: 1datarefp: 1 datarefp: 1datarefp: 1

Page 17: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 17

Manipulating skb fields

• skb_put(skb,len)• skb_push(skb,len)• skb_pull(skb,len)• skb_reserve(skb,len)

After alloc_skb()

After skb_put()

An skb_buff containing data

After skb_reserve()

After skb_push()

Page 18: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 18

Socket buffer queue

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Packet data

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Packet data

nextnext

prevprev

......

headhead

sk_buff

datadata

tailtail

endend

Packet data

nextnext

prevprev

qlen: 3qlen: 3

sk_buff_head

Page 19: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 19

Operations on socket buffer queues

• Managing queue structures– skb_queue_head_init(list)– skb_queue_empty(list)– skb_queue_len(list)

• Managing socket buffers in queues– skb_queue_head(),

skb_queue_tail(),etc

Page 20: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 20

Managing skb in queues

• skb_queue_head(list, skb)• skb_queue_tail(list, skb)• skb_dequeue(list)• skb_dequeue_tail(list)• skb_insert(oldskb,newskb)• skb_append(oldskb,newskb)• skb_peek(list)• skb_peek_tail(list)

Page 21: Fall 2004FSU CIS 5930 Internet Protocols1 Architecture of Network Implementation Reading: Chapters 3 and 4

Fall 2004 FSU CIS 5930 Internet Protocols 21

Next time …

• Chapter 5: network devices