Hardware-address filtering How can we send packets to just one node on our ‘anchor’ cluster?

Slides:



Advertisements
Similar presentations
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
Advertisements

Hardware ‘flow control’ How we can activate our NIC’s ability to avoid overwhelming the capacities of its ‘link partner’
Fixing some driver problems Most software is discovered to have some ‘design-flaws’ after it has been put into use for awhile.
1 Version 3 Module 8 Ethernet Switching. 2 Version 3 Ethernet Switching Ethernet is a shared media –One node can transmit data at a time More nodes increases.
Virtual Local Area Networks A look at how the Intel 82573L nic supports IEEE standard 802.1q for ethernet VLANs.
1 Fall 2005 Hardware Addressing and Frame Identification Qutaibah Malluhi CSE Department Qatar University.
Hardware-address filtering How can we send packets to just one node on our ‘anchor’ cluster?
The RealTek interface Introduction to the RTL-8139 network controller registers.
Computer Network 實踐資管 Wang-Jiunn Cheng 2004 PART IV-2 Local Area Networks (LANs) Frame.
Examining network packets Information about the RTL8139 needed for understanding our ‘watch235.c’ pseudo driver.
1 Version 3 Module 8 Ethernet Switching. 2 Version 3 Ethernet Switching Ethernet is a shared media –One node can transmit data at a time More nodes increases.
Oct 21, 2004CS573: Network Protocols and Standards1 IP: Addressing, ARP, Routing Network Protocols and Standards Autumn
The hardware ringbuffer Understanding the RTL-8139 mechanism for packet reception.
ECE Department: University of Massachusetts, Amherst ECE 354 Spring 2009 Lab 3: Transmitting and Receiving Ethernet Packets.
Our ‘nic.c’ module We create a ‘character-mode’ device-driver for the 82573L NIC to use in futrure experiments.
Our ‘nic.c’ module We create a ‘character-mode’ device-driver for the 82573L NIC to use in future experiments.
Adjusting out device-driver Here we complete the job of modifying our ‘nicf.c’ Linux driver to support ‘raw’ packet-transfers.
Distributed systems Module 1 -Basic networking Teaching unit 1 – LAN standards Ernesto Damiani University of Bozen-Bolzano Lesson 4 – Ethernet frame.
What’s needed to transmit? A look at the minimum steps required for programming our anchor nic’s to send packets.
CS335 Networking & Network Administration Tuesday, April 13, 2010.
Detection of Promiscuous nodes Using Arp Packets By Engin Arslan.
© 2002, Cisco Systems, Inc. All rights reserved..
1 K. Salah Module 4.3: Repeaters, Bridges, & Switches Repeater Hub NIC Bridges Switches VLANs GbE.
Layer 2 Switch  Layer 2 Switching is hardware based.  Uses the host's Media Access Control (MAC) address.  Uses Application Specific Integrated Circuits.
Protocol Headers Pre DA SA 0800h … version H L 6 TCP Header Data FCS
Semester 1 Module 8 Ethernet Switching Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
Lecture 9: Ethernet and Token Ring Networks
Raw Sockets Vivek Ramachandran. A day in the life of Network Packet.
Hyung-Min Lee ©Networking Lab., 2001 Chapter 8 ARP and RARP.
Ethernet Driver Changes for NET+OS V5.1. Design Changes Resides in bsp\devices\ethernet directory. Source code broken into more C files. Native driver.
Local-Area-Network (LAN) Architecture Department of Computer Science Southern Illinois University Edwardsville Fall, 2013 Dr. Hiroshi Fujinoki
Cisco 3 – Switching Concepts Perrine. J Page 16/1/2016 Module 4 The use of bridges and switches for segmentation results in ____? 1.Multiple broadcast.
1 Network Administration Module 3 ARP/RARP. 2 Address Resolution The problem Physical networks use physical addresses, not IP addresses Need the physical.
IP1 The Underlying Technologies. What is inside the Internet? Or What are the key underlying technologies that make it work so successfully? –Packet Switching.
Queues, Pipes and Sockets. QUEUE A structure with a series of data elements with the first element waiting for an operation Used when an element is not.
Sem1 - Module 8 Ethernet Switching. Shared media environments Shared media environment: –Occurs when multiple hosts have access to the same medium. –For.
Chapter 9 Hardware Address & Frame Type Identification Hardware address of frame Addressing schemes Ethernet Frame header format.
Chapter 9 Hardware Addressing and Frame Type Identification 1.Delivering and sending packets 2.Hardware addressing: specifying a destination 3. Broadcasting.
1 Ch 9 Hardware Addressing and Frame Type Identification.
1 Kyung Hee University Chapter 8 ARP(Address Resolution Protocol)
LAN Switching Concepts. Overview Ethernet networks used to be built using repeaters. When the performance of these networks began to suffer because too.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Connecting Devices CORPORATE INSTITUTE OF SCIENCE & TECHNOLOGY, BHOPAL Department of Electronics and.
Chapter 3.  Upon completion of this chapter, you should be able to:  Select and install network cards to meet network connection requirements  Connect.
Promiscuous node detection using ARP packets
Mapping IP Addresses to Hardware Addresses Chapter 5.
1 Hardware Addressing and Frame Type Identification.
FILES IN C. File Operations  Creation of a new file  Opening an existing file  Reading from a file  Writing to a file  Moving to a specific location.
CCNA3 v3 Module 4 v3 CCNA 3 Module 4 JEOPARDY K. Martin.
+ Lecture#2: Ethernet Asma ALOsaimi. + Objectives In this chapter, you will learn to: Describe the operation of the Ethernet sublayers. Identify the major.
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
ADDRESS MAPPING ADDRESS MAPPING The delivery of a packet to a host or a router requires two levels of addressing: logical and physical. We need to be able.
Address Resolution Protocol Yasir Jan 20 th March 2008 Future Internet.
Local Area Networks: Topologies. 2 Packet Identification & MAC Addresses Each packet specifies an intended recipient with an identifier. – Demultiplexing.
Introduction to Networks v6.0
Address Resolution Protocol (ARP)
IP: Addressing, ARP, Routing
Instructor Materials Chapter 5: Ethernet
Chapter 8 ARP(Address Resolution Protocol)
Local Area Networks: Topologies
Chapter 22 – part a Stream refer to any source of input or any destination for output. Many small programs, obtain all their input from one stream usually.
COMPUTER NETWORKS CS610 Lecture-9 Hammad Khalid Khan.
ARP and RARP Objectives Chapter 7 Upon completion you will be able to:
Hardware Addressing and Frame Type Identification
Introduction to Networking
Net 323: NETWORK Protocols
Ethernet : Framing and Addressing
Address Resolution Protocol (ARP)
COMPUTER NETWORKS CS610 Lecture-10 Hammad Khalid Khan.
Ch 17 - Binding Protocol Addresses
Presentation transcript:

Hardware-address filtering How can we send packets to just one node on our ‘anchor’ cluster?

Privacy, please! Our ‘nic.c’ device-driver transmits all of its packets to every node on the segment -- and it receives every packet sent out by any of the other nodes on that segment! Is this what we really want to happen? anchor01 anchor02 anchor03 anchor04 anchor05 anchor06 anchor07 anchor16 …

Receive-address filtering Nowadays any network interface controller has a “filtering” capability which allows any packet NOT to be received by nodes that the packet’s sender didn’t intend it to go to Receive buffer Host memory Transmit FIFO Receive FIFO Network Interface Controller to/from LAN filtering engine

Our new ‘nicf.c’ module This device-driver combines the ‘write()’ and ‘read()’ methods from our character- mode device-driver ‘nic.c’, but it adds an ‘ioctl()’ method that lets applications setup any ethernet-packet’s destination-address, as is illustrated in our companion program (named ‘sendto.cpp’) which finds a node’s hardware-address in our ‘ethers’ database

The ‘sendto’ algorithm Here are the steps which our ‘sendto.cpp’ demo-program performs: Find the destination’s node-name on the command-line Search our ‘ethers’ file for a line with that node’s name Convert that node’s MAC-address from ascii to numeric Open the ‘/dev/nic’ device-file Call our driver’s ‘ioctl()’ method to setup packets’ destination Write our application’s test-message to the ‘/dev/nic’ device-file Print a message confirming this destination and bytes written

Notes on library functions Use ‘fopen()’ to open the ‘ethers’ textfile, so you can use the ‘fgets()’ function to read in its contents one-line-at-a-time: #include // for fopen(), fgets(), puts() #include // for strstr() int main( int argc, char *argv[ ] ) { if ( argc == 1 ) exit(1);// command-line argument is absent FILE*fd = fopen( “ethers”, “ro” ); if ( fd == NULL ) exit(1);// file not present in current directory charline[ 80 ]; while ( fgets( line, 80, fd ) ) if ( strstr( line, argv[1] ) puts( line ); /* additional processing goes here */ }

‘ascii-to-numeric’ Use ‘strstr( string, substring )’ to find line in ‘ethers’ file with name of specified node Use ‘strtol( string, NULL, 16 )’ to convert a hexadecimal digit-string to a numeric value unsigned chardst[ 6 ]; // storage for 6-byte MAC-address // loop converts colon-formatted hex-string to array of numbers for (int i = 0; i < 6; i++) dst[ i ] = strtol( line+3*i, NULL, 16 );

Our ‘ioctl()’ function Our ‘nicf.c’ driver implements an ‘ioctl()’ service allowing a user-program to setup the network hardware-address that will be used in the destination-field of any packet that the driver’s ‘write()’ function transmits // open the network interface controller’s device-file intfp = open( “/dev/nic”, O_RDWR ); if ( fp < 0 ) { perror( “/dev/nic” ); exit(1); } // setup packet-destination to be used when transmittting if ( ioctl( fp, 1, dst ) < 0 ) { perror( “ioctl” ); exit(1); } ID-number for the ioctl-request

Driver’s ‘ioctl()’ function char mac[ 6 ];// packet source-address gets filled in by ‘module_init()’ char dst [ 6 ];// packet destination-address gets filled in by our ‘ioctl()’ int my_ioctl( struct inode *, struct file*, unsigned int cmd, unsigned long address ) { unsigned char*addr = (unsigned char *)address; switch ( cmd ) { case 0:// get the driver’s ethernet-packet destination-address if ( copy_to_user( addr, dst, 6 ) ) return –EFAULT; return 0; //SUCCESS case 1:// set the driver’s ethernet-packet destination-address if ( copy_from_user( dst, addr, 6 ) ) return –EFAULT; return 0; //SUCCESS } return –EINVAL; // the requested command is not implemented }

Change in ‘init()’ To prevent reception of Ethernet packets whose destination-address doesn’t match our device’s address, we need to alter the way we program our nic’s RCTL register: RCTL (0x0100) FLEXBUF BAM (Broadcast Accept Mode) SECRC (Strip Ethernet CRC) MPE (Multicast Promiscuous Enable) UPE (Unicast Promiscuous Enable) SBP (Store Bad Packets) EN (Enable receive engine) DPF (Discard Pause Frames) RDMTS (Rx-Desc Min Thresh Size)

Is 00:00:00:00:00:00 legal? If you comment out all the lines of code in our ‘sendto.cpp’ application that precede the ‘open()’ statement, then our driver’s ‘dstn[ 6 ]’ array will remain all zeros, and hence packets will be sent with a ‘zero’ destination-address (normally not legal) EXERCISE: Try this out and see if your test-message gets received any nodes

Receive-filter Array Filter-address 0 Filter-address 1 Filter-address 2 Filter-address 3 Filter-address 4 Filter-address 5 Filter-address 6 Filter-address 7 0x5400 0x5408 0x5410 0x5418 0x5420 0x5428 0x5430 0x5438 quadword (64-bits) ‘valid’-bit (1=yes, 0=no) The NIC’s own unique hardware-address gets programmed into this initial array-entry during initialization Other addresses may be added later by driver software …

In-class exercise #1 Apply your knowledge of the Intel 82573L ‘Receive-filter Array’ to add the quadword 0x at offset 0x5408 in the NIC’s i/o-memory space Then test your modified ‘sendto.cpp’ code to see if you can ‘receive’ a packet which has ‘zero’ as its destination MAC-address

Multicast MAC-addresses Recall that there is a multicast IP-address (namely ) which all the systems on a local subnet are expected to listen to The corresponding hardware multicast address would be: 01:00:5E:00:00:01 Does our ‘nicf.c’ device-driver allow a nic to ‘hear’ messages sent to this address?

In-class exercise #2 Add the quadword 0x E0001 to your nic’s ‘Receive-filter Array’ at offset 0x5410 in its i/o-memory space, and then modify the initialization the ‘dst[ 6 ]’ array in your ‘sendto.cpp’ application, like this: unsigned char dst[ 6 ] = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x01 }; Is your nic now able to receive a packet sent to this hardware ‘multicast’ address?