INTERNET PROTOCOL IP - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

INTERNET PROTOCOL IP

Description:

INTERNET PROTOCOL (IP) ARUNA THAKUR. aruna_at_jack.see.plymouth.ac.uk. INTERNET ARCHITECTURE. ... Network device is the lowest layer in the protocol stack. ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 27
Provided by: aru492
Category:

less

Transcript and Presenter's Notes

Title: INTERNET PROTOCOL IP


1
INTERNET PROTOCOL (IP)
  • ARUNA THAKUR
  • aruna_at_jack.see.plymouth.ac.uk

2
INTERNET ARCHITECTURE.
3
THE PROTOCOL STACK
  • Network device is the lowest layer in the
    protocol stack.
  • They use the link layer (usually) Ethernet
  • to communicate with other devices.
  • to receive and communicate with other computer
    and devices.
  • Network layer.
  • Transport layer.

4
INTERNET PROTOCOL (IP)
  • IP is the standard network layer protocol
  • It checks to see if the incoming packet is for
    the host computer or they need to be forwarded.
  • Fragments/de-fragments the packets if required.
  • It maintains a database of routes for outgoing
    packets.
  • It address and fragments packets before sending
    them down to the link layer.
  • It resides on the third layer of the protocol
    stack.

5
IP Packet Format
6
REAL TIME TRANSPORT PROTOCOL (RTP) - HEADER
7
H.261/RTP HEADER
8
EFFECT OF CHANGING PACKET HEADER IN H261/RTP
9
SOCKET BUFFER (sk_buff)
  • sk_buff provides a mechanism for adding and
    removing protocol headers and tails.
  • sk_buff - Advantages of using a common packet
    data structure is that
  • The payload data of a packet is copied only
    twice.
  • Once from the user to the kernel space.
  • Second time from kernel space to the output
    medium.
  • It contains pointer and length fields that allow
    each protocol layer to manipulate the application
    data via standard functions or "methods".
  • The skbuff files can be found
  • /usr/src/linux-2.6.5-1.358/include/linux/skbuff.h
  • /sur/src/linux-2.6.5-1.358/net/core/skbuff.c

10
SK_BUFF PACKET STRUCTURE
11
SOCKET BUFFER (sk_buff)
  • All the network layers uses sk_buff.
  • sk_buffs are the buffers in which the linux
    kernel handles network packets in an efficient
    way.
  • The packet is received by the network card
  • Packets are put into a sk_buff
  • and then passed to the network stack which uses
    the sk_buff till the time packet reaches the
    right place in the protocol stack.

12
JOURNEY OF NETWORK PACKETS THROUGH LINUX KERNEL
  • An application generates packets.
  • Packets are sent through socket to
  • Transport layer (TCP/UCP).
  • Network layer (IP).
  • In the network layer
  • Kernel looks for the host destination in routing
    cache or Forward Information Base (FIB).
  • When the kernel finds that the packet is for
    another computer it addresses it
  • and sends to the link layer output interface
    (Ethernet Device).
  • link layer finally sends the packet to the
    physical medium.

13
JOURNEY OF NETWORK PACKETS THROUGH LINUX KERNEL
14
SENDING A PACKET USING IP
15
SENDING A PACKET USING IP APPLICATION LAYER
16
SENDING A PACKET USING IP APPLICATION LAYER
  • /usr/src/linx-2.6.5-1.358/net/socket.c
  • This is an implementation of the socket network
    access protocol.
  • Writes data to a socket
  • sock_write() static ssize_t_aio_write() line
    649
  • Calls socki_lookup() in order to associate socket
    with the fd/file inode.
  • Creates and fills message header with data size
    and adreesses
  • return sock_sendmsg
  • sock_sendmsg() Used to send the message
  • inet_sendmsg() Present in /usr/src/linux/2.6.5-1
    .358/net/ipv4/af_inet.c
  • af_inet.c This file deals with an
    implementation of TCP/IP protocol suite for
    LINUX.

17
SENDING A PACKET USING IP TRANSPORT LAYER
18
SENDING A PACKET USING IP TRANSPORT LAYER
  • tcp_do_sendmsg() Function found in the file
  • /usr/src/linux-2.6.5-1.358/net/ip4/tcp.c
  • It waits for a connection.
  • If ok then starts sending message.
  • Add data to the packet.
  • Allocates memory space for skb.
  • Copies the packet and do checksum.
  • Finally calls a function tcp_send_skb().
  • Tcp_send_skb() -
  • It call function skb_queue_tail() to add packet
    into the queue.
  • Calls tcp_transmitskb().

19
SENDING A PACKET USING IP TRANSPORT LAYER -CONT
  • tcp_transmit_skb()
  • Found in the file /usr/src/linux-2.6.5-1.358/net/i
    pv4
  • It builds TCP header and adds checksum.
  • It check ACK and SYN
  • tcp_v4_sendmsg()
  • Found in the file /usr/src/linux-2.6.5-1.358/net/i
    pv4
  • Checks for IP address type.
  • Opens a connection.
  • Port etc.
  • udp_get_frag() net/ipv4/udp.c
  • Copies and checksums a buffer.
  • udp_sendmsg()
  • It checks length, flag, etc.
  • Sets UDP header.
  • Etc.

20
SENDING A PACKET USING IP NETWORK LAYER
21
SENDING A PACKET USING IP NETWORK LAYER - CONT
  • ip_build_xmit - /net/ipv4/ip_output.c
  • Creates memory for skb().
  • Sets skb header.
  • Ip_queue_xmit() net/ipv4/ip_output.c
  • Looks up for a route for the IP packet.
  • Builds IP header.
  • Fragments the packet if required.
  • Adds checksum.

22
RECEIVING A PACKET USING IP
23
RECEIVING A PACKET USING IP - CONT
  • An interrupt is issued to tell the device that an
    incoming message is ready.
  • The device then allocates space for the incoming
    message.
  • The packet is then passed to the link layer
  • This layer puts the packet into the backlog
    queue.
  • And marks the network flag for the next
    bottom-half run.
  • Then packets are taken out the backlog queue,
    matches them to a known protocol (typically IP)
    passes them to the protocol receive function.
  • IP layers checks for any packet error and routes
    (packet will traverse internally or externally).
  • Checks for the socket associated with the port
    specified in the packet.
  • Finally puts the packet at the end of the socket
    receive queue.

24
SOME IMPORTANT FILES AND FUNCTIONS USED TO
RECEIVE PACKET
  • DEVICE_rx device dependent drivers/net/DEVICE.
    c
  • Calls dev_alloc_skb to reserve space for the
    packet.
  • Calls eth_type_trans() to find the protocol.
  • inet_recvmsg() net/ipv4/af_inet.c
  • Checks the socket to check if it is accepting.
  • Verifies the protocol pointer.

25
SOME IMPORTANT FILES AND FUNCTIONS USED TO
RECEIVE PACKET
  • ip_rcv() net/ipv4/ip_input.c
  • It examines packet for error
  • Invalid length too short or long.
  • Incorrect version.
  • Invalid checksum.
  • It de-fragments the packet.
  • Calls ip_route_input() Routes the packet.
  • Sock_queue_rcv_skb() include/net/sock.h
  • Calls skb_queue_tail() to put packet in the
    socket to receive queue.

26
LINKS FOR FURTHER READING
  • http//kernelnewbies.org/documents/ipnetworking/li
    nuxipnetworking.html
Write a Comment
User Comments (0)
About PowerShow.com