1 ioctl Function ioctl function get_ifi_info function ARP cache operations: eg. Print H/W addresses.

Slides:



Advertisements
Similar presentations
Introduction to Sockets Jan Why do we need sockets? Provides an abstraction for interprocess communication.
Advertisements

The subnet /28 has been selected to be further subnetted to support point-to-point serial links. What is the maximum number of serial links.
Ipv4 Socket Address Structure struct in_addr { in_addr_t s_addr; /* 32-bit IPv4 address */ /* network byte ordered */ }; struct sockaddr_in { uint8_t sin_len;
Programming with UDP – I Covered Subjects: IPv4 Socket Address Structure Byte Ordering Functions Address Access/Conversion Functions Functions: 1.socket()
1 Address Resolution Protocol (ARP) Relates to Lab 2. This module is about the address resolution protocol.
Recitation 6 Midterm 1’s solution Project 2 IP Forwarding CIDR.
I/O Models Satish Krishnan. I/O Models Blocking I/O Non-blocking I/O I/O Multiplexing Signal driven I/O Asynchronous I/O.
Elementary TCP Sockets© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer.
Module 10: Routing Fundamentals and Subnets Small Router Purchase Subnetting Example a Basic Subnetting b Subnetting a Class A Network.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 BOOTP and DHCP Shivkumar Kalyanaraman Rensselaer Polytechnic Institute
BOOTP and DHCP Shivkumar Kalyanaraman Rensselaer Polytechnic Institute
1 Nonblocking I/O Nonblocking reads and writes Buffers enabling overlapped nonblocking I/O Nonblocking connect.
1 ioctl Operations Computer Network Programming. 2 Use of ioctl() It is the system interface to set and get attributes of devices, sockets, files, interfaces.
© N. Ganesan, All rights reserved. Chapter IP Routing.
Introduction to Linux Network 劉德懿
UNIX Sockets COS 461 Precept 1.
Broadcast and Multicast. Unicast Host 2Host 1 Broadcast Packet received by every host on network (including the sender!)
Fall 2000Datacom 11 Socket Programming Review Examples: Client and Server-Diagnostics UDP versus TCP Echo.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Network Layer – Subnetting and Control Protocols Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing,
Fall 2000Datacom 11 Lecture 4 Socket Interface Programming: Service Interface between Applications and TCP.
Elementary TCP Sockets
Computer Networks. IP Addresses Before we communicate with a computer on the network we have to be able to identify it. Every computer on a network must.
Signal-Driven I/O Concepts and steps for using signal-driven I/O
1 IP: putting it all together Part 1 G53ACC Chris Greenhalgh.
Sublayers Under the Network Layer: BOOTP & DHCP
 Wind River Systems, Inc Chapter - 13 Network Programming.
CSE3153 Semester Case Study 2 V1.0 The Concept of IP Subnetting Tutor keeps this front sheet as record of completion Student Name: __________________________________________.
UNIX Network Programming1 Chapter 16. ioctl Operations.
CS4550 Computer Networks II IP : internet protocol, part 2 : packet formats, routing, routing tables, ICMP read feit chapter 6.
Review: How to create a TCP end point? What is the right format for sin_port and sin_addr in the sockaddr_in data structure? How many different ways we.
Network Programming Eddie Aronovich mail:
Basic IP Protocol Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
TELE 402 Lecture 10: Unix domain … 1 Overview Last Lecture –Daemon processes and advanced I/O functions This Lecture –Unix domain protocols and non-blocking.
Understand IPv4 Addressing. IPv4: originally Classfull Addressing  Special address  Host ID = 0: network address  Network ID = 0, host ID = 0  i.e.
1 CSE3153 Semester Case Study 1 V1.0 The Concept of an IP Network Due Date: By end of the Lab Session Student Name: __________________________________________.
1 Swinburne University of Technology Faculty of Information and Communication Technology HIT2125 Data Communications and Computer Networks Network Case.
Advanced Sockets API-II Vinayak Jagtap
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.
UNIX Sockets COS 461 Precept 1. Socket and Process Communication The interface that the OS provides to its networking subsystem application layer transport.
Threads and Locking Ioctl operations. Threads Lightweight processes What’s wrong with processes? –fork() is expensive – 10 to 100 times slower –Inter.
Client/Server Socket Programming Project
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: HsinYu Ha.
1 Socket Options getsockopt and setsockopt functions Check options and obtain default values Generic socket options IPv4 socket options IPv6 socket options.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Ethernet switch Hosts Can talk using Ethernet addresses only.
Address Resolution Protocol (ARP). Internet and Data Link Layer Addresses Each host and router on a subnet needs a data link layer address to specify.
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
UNIX Sockets Outline UNIX sockets CS 640.
Ioctl Operations. ioctl Function Interface Configuration  Netstat, ifconfig command 에서 사용.
UDP : User Datagram Protocol 백 일 우
© Jörg Liebeherr (modified by M. Veeraraghavan) 1 Point-to-Point Protocol Data Link Layer Loopback ARP and RARP.
1 4 ARP : Address Resolution Protocol. 2 4 Introduction - Problem Successful Mapping of an IP Address to a Hardware Address Ethernet uses MAC-address.
Swinburne University of Technology Faculty of Information and Communication Technologies HIT2125 Data Communications and Computer Networks Network Case.
TCP/IP PROTOCOL UNIT 6. Overview of TCP/IP Application FTP, Telnet, SMTP, HTTP.. Presentation Session TransportHost-to-HostTCP, UDP NetworkInternetIP,
1 Socket Interface. 2 Client-Server Architecture The client is the one who speaks first Typical client-server situations  Client and server on the same.
1 K. Salah Module 5.1: Internet Protocol TCP/IP Suite IP Addressing ARP RARP DHCP.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
If we don’t subnet and use as our subnet mask then we use all of our IP addresses on one network. This is not an efficient use of our Class.
Sockets API Developing Applications using the Sockets API.
TRANSPARENT BRIDGING Router 1 Router 2 PC 2 PC / /24.
UNIX Sockets COS 461 Precept 1.
Chapter 6 – Routing.
Advanced Computer Networks
An NP-Based Router for the Open Network Lab Overview by JST
Wide Area Networks and Internet CT1403
TCP Sockets Programming
Advanced Network Programming spring 2007
Chapter 06. UDP Server/Client.
Review of Internet Protocols Network Layer
Presentation transcript:

1 ioctl Function ioctl function get_ifi_info function ARP cache operations: eg. Print H/W addresses

2 ioctl Function #include int ioctl (int fd, int request, … /* void *arg */ ); returns: 0 if OK, -1 on error type of *arg depends on request CategoryrequestDescription socketSIOCATMARKat out-of-band mark ? SIOCSPGRPset process ID or process group ID of socket SIOCGPGRPget process ID or process group ID of socket fileFIONBIOset/clear nonblocking flag FIOASYNCset/cleat asynchronous i/o flag FIONREADget # bytes in receive buffer FIOSETOWNset process ID or process group ID of socket FIOGETOWNget process ID or process group ID of socket ARPSIOCSARPcreate/modify ARP entry SIOCGARPget ARP entry SIOCDARPdelete ARP entry

3 ioctl Function (Cont.) CategoryrequestDescription interfaceSIOCGIFCONFget list of all interfaces SIOCSIFADDRset interface address SIOCGIFADDRget interface address SIOCSIFFLAGSset interface flags SIOCGIFFLAGSget interface flags SIOCSIFDSTADDRset point-to-point address SIOCGIFDSTADDRget point-to-point address SIOCGIFBRDADDRget broadcast address SIOCSIFBRDADDRget broadcast address SIOCGIFNETMASKget subnet mask SIOCSIFNETMASKset subnet mask SIOCGIFMETRICget interface metric SIOCSIFMETRICset interface metric SIOC…(many more; implementation dependent) routingSIOCADDRTadd route SIOCDELRTdelete router

4 get_ifi_info Function returns a linked list of ifconf structures Create a TCP or UDP socket Issue SIOCGIFCONF request in ioctl in a loop Initialize linked list pointers Step to next socket address structure Handle aliases Fetch interface flags Allocate and initialize ifi_info structure

5 ARP Cache Operations e.g. print hardware addresses of host Get list of addresses and loop through each Print IP address Issue ioctl and print hardware address #include struct arpreq { struct sockaddr arp_pa; /* protocol address */ struct sockaddr arp_ha; /* hardware address */ int arp_flags; /* flags */ }; #define ATF_INUSE 0x01 /* entry in use */ #define ATF_COM 0x02 /* completed entry (hardware addr valid */ #define ATF_PERM 0x04 /* permanent entry */ #define ATF_PUBL 0x08 /* published entry (respond for other host */