Additional API functions and data-structures A look at how some information from lower-layers of the TCP/IP protocol stack could be accessed.

Slides:



Advertisements
Similar presentations
Florida State UniversityCOP Advanced Unix Programming Raw Sockets Datalink Access Chapters 25, 26.
Advertisements

TCP/IP Protocol Suite 1 Chapter 27 Upon completion you will be able to: Next Generation: IPv6 and ICMPv6 Understand the shortcomings of IPv4 Know the IPv6.
Internet Control Protocols Savera Tanwir. Internet Control Protocols ICMP ARP RARP DHCP.
Vitor Vaz da Silva Redes de Comunicação de DadosTCP/IP - ICMP 1 ICMP - Internet Control Message Protocol MECANISMO PARA: INFORMAR SOBRE ERROS DETECTAR.
CSCI 4550/8556 Computer Networks Comer, Chapter 23: An Error Reporting Mechanism (ICMP)
An IP-header’s TOS field On setting and inspecting the ‘Type-of-Service’ field for outgoing or incoming datagrams.
Internet Control Message Protocol (ICMP)
1 TDC TDC 365 Network Interconnections Technologies Lecture #4 Notes Spring, 2009.
1 Internet Networking Spring 2002 Tutorial 4 ICMP (Internet Control Message Protocol)
The Network Layer Chapter 5. The IP Protocol The IPv4 (Internet Protocol) header.
Internet Control Message Protocol (ICMP). Introduction The Internet Protocol (IP) is used for host-to-host datagram service in a system of interconnected.
Chapter 5 The Network Layer.
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 Internet Control Message Protocol (ICMP) Shivkumar Kalyanaraman Rensselaer Polytechnic Institute.
On receiving ancillary data We use the ‘recvmsg()’ function to obtain a datagram’s arrival-time as a UDP socket option.
Internet Command Message Protocol (ICMP) CS-431 Dick Steflik.
1 K. Salah Module 5.3: Internet Control Message Protocol Why need ICMP? IP and ICMP ICMP Message Format ICMP Error Reporting messages ICMP Query messages.
1 Internet Control Message Protocol (ICMP) RIZWAN REHMAN CCS, DU.
TCP/IP Protocol Suite 1 Chapter 9 Upon completion you will be able to: Internet Control Message Protocol Be familiar with the ICMP message format Know.
4: Network Layer4a-1 IP datagram format ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier Internet checksum time.
Internet Control Message Protocol ICMP. ICMP has two major purposes: –To report erroneous conditions –To diagnose network problems ICMP has two major.
Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES Internet Control Message Protocol ICMP author -- J. Postel, September The purpose.
ICMP (Internet Control Message Protocol) Computer Networks By: Saeedeh Zahmatkesh spring.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Network Layer ICMP and fragmentation.
1 Introduction to Raw Sockets 2 IP address Port address MAC address TCP/IP Stack 67 Bootp DHCP OSPF protocol frame type UDP Port # TCP Port.
ICMP : Internet Control Message Protocol. Introduction ICMP is often considered part of the IP layer. It communicates error messages and other conditions.
1 Version 3.1 modified by Brierley Module 8 TCP/IP Suite Error and Control Messages.
Internet Control Message Protocol (ICMP). Objective l IP and ICMP l Why need ICMP? l ICMP Message Format l ICMP fields l Examples: »Ping »Traceroute.
TCP/IP Illustracted Vol1. 제목 : IP Routing ( 수 ) 한 민 규
Fall 2005Computer Networks20-1 Chapter 20. Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv ARP 20.2 IP 20.3 ICMP 20.4 IPv6.
© Jörg Liebeherr (modified by M. Veeraraghavan) 1 ICMP: A helper protocol to IP The Internet Control Message Protocol (ICMP) is the protocol used for error.
1 Internet Control Message Protocol (ICMP) Used to send error and control messages. It is a necessary part of the TCP/IP suite. It is above the IP module.
Internet Protocols. Address Resolution IP Addresses are not recognized by hardware. If we know the IP address of a host, how do we find out the hardware.
Advanced Sockets API-II Vinayak Jagtap
Error and Control An IP datagram travels from node to node on the way to its destination Each router operates autonomously Failures or problems may occur.
Chapter 23 Internet Control Message Protocol used to report information and errors IP uses ICMP when it sends an error message ICMP uses IP to transport.
1 An Error Reporting Mechanism (ICMP). 2 IP Semantics IP is best-effort Datagrams can be –Lost –Delayed –Duplicated –Delivered out of order –Corrupted.
1 Kyung Hee University Chapter 9 ICMP. 2 Kyung Hee University Introduction to Internet Control Message Protocol (ICMP)  IP protocol has no error-reporting.
ICMPv6 Error Message Types Informational Message Types.
INTERNET CONTROL MESSAGE PROTCOL. ICMP n allows router to send error or control messages to another router or host n provides communication between IP.
TCP/IP Illustrated, Volume 1: The Protocols Chapter 6. ICMP: Internet Control Message Protocol ( 월 ) 김 철 환
IP Protocol CSE TCP/IP Concepts Connectionless Operation Internetworking involves connectionless operation at the level of the Internet Protocol.
Packet Switch Network Server client IP Ether IPTCPData.
Module 8 JEOPARDY CCNA2 v3 Module 8 RouterModesWANEncapsulationWANServicesRouterBasicsRouterCommands RouterModesWANEncapsulationWANServicesRouterBasicsRouterCommands.
1 Kyung Hee University Prof. Choong Seon HONG Chapter 9 ICMP.
1 Kyung Hee University Chapter 9 ICMP. 2 Kyung Hee University 9.1 Introduction  IP protocol has no error-reporting or error-correcting mechanism When.
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP)
ICMP The IP provides unreliable and connectionless datagram delivery. The IP protocol has no error-reporting or error-correcting mechanism. The IP protocol.
Internet Control Message Protocol (ICMP)
21-2 ICMP(Internet control message protocol)
CCNA 2 v3 JEOPARDY Module 8 CCNA2 v3 Module 8 K. Martin.
Chapter 9 ICMP.
Internet Control Message Protocol
Error and Control Messages in the Internet Protocol
8 Network Layer Part V Computer Networks Tutun Juhana
Byungchul Park ICMP & ICMPv DPNM Lab. Byungchul Park
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol Version 4 (ICMPv4)
Internet Control Message Protocol
Internet Control Message Protocol
Advanced I/O Functions
Fred Kuhns Applied Research Laboratory
32 bit destination IP address
TCP/IP Protocol Suite 1 Chapter 9 Upon completion you will be able to: Internet Control Message Protocol Be familiar with the ICMP message format Know.
Presentation transcript:

Additional API functions and data-structures A look at how some information from lower-layers of the TCP/IP protocol stack could be accessed

Two more socket functions Besides the ‘sendto()’ and ‘recvfrom()’ socket-functions (or ‘send()’ and ‘recv()’), there are two further functions which will be essential to make use of in particular programming situations ssize_t sendmsg( int sock, struct msghdr *msghdr, int flags ); ssize_t recvmsg( int sock, struct msghdr *msghdr, int flags );

More data-structures… The ‘sendmsg()’ and ‘recvmsg()’ functions make use of a special data-structure that collects a group of parameters into a neat package, called a ‘message header’, and supports use of ‘scatter-gather’ operations by using an array of ‘I/O-vector’ objects struct iovec { void *iov_base; size_t iov_len; } Each I/O-vector describes a memory-buffer, giving its address and its length

Message-header struct msghdr { void*msg_name;// optional address socklen_tmsg_namelen;// size of address struct iovec*msg_iov;// scatter/gather array intmsg_iovlen;// no. of members void*msg_control;// ancillary data buffer intmsg_controllen;// ancillary buffer length intflags;// flags on received message }; This structure is used as a value-result parameter in the ‘recvmsg()’ function, and is used as a value-only parameter in the ‘sendmsg()’ function.

Idea for a ‘scatter’ example If most of your application’s messages are short ones, but sometimes there could be a larger one, then you could allocate one oversized buffer to handle the occasional ‘overflow’ from your small-size buffers charsmallbuf[ 128 ], largebuf[ 1400 ]; struct iovecmyiovec[ 2 ] = { { smallbuf, 128 }, { largebuf, 1400 } }; Data scattering: The arriving data will be accumulated in the small buffer until it is filled, then any overflow will be accumulated in the large buffer.

‘Ancillary’ data Our main interest in using the ‘recvmsg()’ socket-function will be to obtain ancillary information – specifically, we want to see details about ‘message-delivery’ failures which normally are not available outside the Linux kernel’s networking subsystem Some ‘socket options’ will make the extra information available to an application

ICMP The Internet Control Message Protocol is used for relaying information between the code-modules at the ‘network’ level of the TCP/IP protocol stack (e.g., for reporting errors and for various system queries) Application Layer Transport Layer Network Layer Link Layer Physical Layer Application Layer Transport Layer Network Layer Link Layer Physical Layer

ICMP packet-format Ethernet Header Internet Protocol Header ICMP Header Data Rest of the ICMP Header (layout varies with the Type) ChecksumCodeType 32 bits

ICMP messages Echo request or reply Timestamp request and reply Address Mask request and reply Router solicitation and advertisement Source quench Destination unreachable Time exceeded Parameter problem Redirection or 9 17 or or 14 8 or 0 Type Message ICMP Query messages ICMP Error reporting messages

Type 3: Destination unreachable The network is unreachable The host is unreachable The protocol is unreachable The port is unreachable Fragmentation needed (but DF is set) Source routing cannot be accomplished Destination network is unknown Destination host is unknown Several additional code-values can occur for Type 3 CodeReason

Our msgserver and msgclient We posted a new client-and-server demo in which exchanges of network messages is accomplished by using the ‘sendmsg()’ and the ‘recvmsg()’ socket functions and accompanying ‘message-header’ objects With ‘nicwatch’ we can use these demos to illustrate the ICMP protocol in action

ICMP protocol Type 0: Echo Reply Type 8: Echo Request

UDP protocol ICMP protocol Type 11: Time exceeded Code 0: (always zero for Type 11)

UDP protocol ICMP protocol Type 3: Destination unreachable Code 3: The port is unreachable