January 9, 2001 Router Plugins (Crossbow) 1 Washington WASHINGTON UNIVERSITY IN ST LOUIS NetBSD Kernel Topics: IP Processing mbuf structure Loadable Kernel.

Slides:



Advertisements
Similar presentations
20.1 Chapter 20 Network Layer: Internet Protocol Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Advertisements

Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 TCP/IP Stack Introduction: Looking Under the Hood! Shiv Kalyanaraman Rensselaer Polytechnic Institute.
What's inside a router? We have yet to consider the switching function of a router - the actual transfer of datagrams from a router's incoming links to.
TCP/IP Protocol Suite 1 Chapter 7 Upon completion you will be able to: ARP and RARP Understand the need for ARP Understand the cases in which ARP is used.
1 Link Layer & Network Layer Some slides are from lectures by Nick Mckeown, Ion Stoica, Frans Kaashoek, Hari Balakrishnan, and Sam Madden Prof. Dina Katabi.
TCP/IP Protocol Suite 1 Chapter 11 Upon completion you will be able to: User Datagram Protocol Be able to explain process-to-process communication Know.
Spring Routing & Switching Umar Kalim Dept. of Communication Systems Engineering 03/04/2007.
Chapter 3 Review of Protocols And Packet Formats
IP-UDP-RTP Computer Networking (In Chap 3, 4, 7) 건국대학교 인터넷미디어공학부 임 창 훈.
Linux TCP/IP Stack.
ICMP (Internet Control Message Protocol) Computer Networks By: Saeedeh Zahmatkesh spring.
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
Washington WASHINGTON UNIVERSITY IN ST LOUIS January 7, MSR Tutorial John DeHart Washington University, Applied Research Lab
LWIP TCP/IP Stack 김백규.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
LWIP TCP/IP Stack 김백규.
TCP/IP Illustracted Vol1. 제목 : IP Routing ( 수 ) 한 민 규
TCP/IP Protocol Suite 1 Chapter 7 Upon completion you will be able to: ARP and RARP Understand the need for ARP Understand the cases in which ARP is used.
Washington WASHINGTON UNIVERSITY IN ST LOUIS The New MSR Plugin Download Environment.
Washington WASHINGTON UNIVERSITY IN ST LOUIS Packet Routing Within MSR Fred Kuhns
Washington WASHINGTON UNIVERSITY IN ST LOUIS The New MSR Plugin Download Environment.
1 The Internet and Networked Multimedia. 2 Layering  Internet protocols are designed to work in layers, with each layer building on the facilities provided.
Chapter 22 Q and A Victor Norman CS 332 Spring 2014.
January 9, 2001 Router Plugins (Crossbow) 1 Washington WASHINGTON UNIVERSITY IN ST LOUIS Router Plugins (Formerly Crossbow) A Software Architecture for.
Hyung-Min Lee ©Networking Lab., 2001 Chapter 8 ARP and RARP.
Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson.
Internetworking Internet: A network among networks, or a network of networks Allows accommodation of multiple network technologies Universal Service Routers.
CS4550 Computer Networks II IP : internet protocol, part 2 : packet formats, routing, routing tables, ICMP read feit chapter 6.
Internetworking Internet: A network among networks, or a network of networks Allows accommodation of multiple network technologies Universal Service Routers.
Networks and Protocols CE Week 7b. Routing an Overview.
January 10, Kits Workshop 1 Washington WASHINGTON UNIVERSITY IN ST LOUIS A Smart Port Card Tutorial --- Software John DeHart Washington University.
Monitor- ing, Basic IP Header Proc., Packet Classi- fication and Routing APIC Driver Rcv Side APIC Plugin Ctl. Unit... Resource Controller... Rcv Input.
Washington WASHINGTON UNIVERSITY IN ST LOUIS Fred Kuhns Applied Research Laboratory NSP packet Formats.
June 2000 MSR Design 1 Washington WASHINGTON UNIVERSITY IN ST LOUIS The Washington University Active Network Software Framework John DeHart Washington.
Transport Layer3-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
TCP/IP Protocol Suite 1 Chapter 10 Upon completion you will be able to: Internet Group Management Protocol Know the purpose of IGMP Know the types of IGMP.
19.1 Chapter 19 Network Layer: Logical Addressing Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Network Layer by peterl. forwarding table routing protocols path selection RIP, OSPF, BGP IP protocol addressing conventions datagram format packet handling.
1 12-Jan-16 OSI network layer CCNA Exploration Semester 1 Chapter 5.
1 CSE 5346 Spring Network Simulator Project.
Network Layer by peterl. forwarding table routing protocols path selection RIP, OSPF, BGP IP protocol addressing conventions datagram format packet handling.
January 9, 2001 Router Plugins (Crossbow) 1 Washington WASHINGTON UNIVERSITY IN ST LOUIS Exercises.
UDP : User Datagram Protocol 백 일 우
1 Kyung Hee University Chapter 11 User Datagram Protocol.
UDP: User Datagram Protocol Chapter 12. Introduction Multiple application programs can execute simultaneously on a given computer and can send and receive.
TCP/IP Protocol Suite 1 Chapter 7 Upon completion you will be able to: ARP ( and ARP ( RFC-826) and RARP ( RARP ( RFC-903) Understand the need for ARP.
NT1210 Introduction to Networking
IP Fragmentation. Network layer transport segment from sending to receiving host on sending side encapsulates segments into datagrams on rcving side,
Introduction to Networks
Chapter 11 User Datagram Protocol
LWIP TCP/IP Stack 김백규.
Chapter 8 ARP(Address Resolution Protocol)
ARP and RARP Objectives Chapter 7 Upon completion you will be able to:
TCP Transport layer Er. Vikram Dhiman LPU.
Net431:advanced net services
Internet Control Message Protocol (ICMP)
CS 457 – Lecture 10 Internetworking and IP
Internet Control Message Protocol (ICMP)
IP : Internet Protocol Surasak Sanguanpong
Chapter 20 Network Layer: Internet Protocol
Network Core and QoS.
Wide Area Networks and Internet CT1403
Code Review for IPv4 Metarouter Header Format
Code Review for IPv4 Metarouter Header Format
Net 323 D: Networks Protocols
The Router Plugins system architecture
Internet Control Message Protocol
CSE 313 Data Communication
Network Core and QoS.
Chapter 4: outline 4.1 Overview of Network layer data plane
Presentation transcript:

January 9, 2001 Router Plugins (Crossbow) 1 Washington WASHINGTON UNIVERSITY IN ST LOUIS NetBSD Kernel Topics: IP Processing mbuf structure Loadable Kernel Modules Interrupts Miscellaneous

January 9, 2001 Router Plugins (Crossbow) 2 Washington WASHINGTON UNIVERSITY IN ST LOUIS Goals IP –Understand the structure of IP processing in NetBSD –Understand the IP packet format –Become familiar with IP packet field access »accessing src and dst addresses, etc… mbufs –Understand the mbuf structure –Become familiar with mbuf access routines »packet size »data location Stevens TCP/IP books –impress upon you the importance of these ref. books

January 9, 2001 Router Plugins (Crossbow) 3 Washington WASHINGTON UNIVERSITY IN ST LOUIS What we are NOT going to talk about IPv6 –Everything we talk about will be in terms of IPv4 –Router Plugins also supports IPv6 –The code can be confusing »use IPv6 structures since they are superset of IPv4 IP Options Fast Forward Path Details of interaction between device drivers and IP –actually, we’ll talk about some of this… Packet Scheduler Routing protocols daemons: routed, rsvpd, …

January 9, 2001 Router Plugins (Crossbow) 4 Washington WASHINGTON UNIVERSITY IN ST LOUIS NetBSD Kernel Topics: IP Processing mbuf structure Loadable Kernel Modules Interrupts Miscellaneous

January 9, 2001 Router Plugins (Crossbow) 5 Washington WASHINGTON UNIVERSITY IN ST LOUIS Vocabulary: Terms Used in Stevens message: Transport protocol data given to IP datagram: message + IP header fragment: if datagram is too large for network: IP splits it. Each fragment contains its own IP header packet: fragment or datagram small enough for network frame: packet + data-link layer header

January 9, 2001 Router Plugins (Crossbow) 6 Washington WASHINGTON UNIVERSITY IN ST LOUIS Protocol messages, IP Packets, Fragments, … Derived from Figure 8.7 from Wright/Stevens, Vol. 2 fragment 1 fragment 2fragment 3 IPUDP application data Application data IP Application data IP packet IPUDP application data link Application data IP Application data IP frame IP datagram UDPApplication data message

January 9, 2001 Router Plugins (Crossbow) 7 Washington WASHINGTON UNIVERSITY IN ST LOUIS IP Packet Format IP Header (with no Options fields) Transport Protocol (e.g. TCP, UDP) Header VersHLenTOS IDFragment Offset Source Address Destination Address Total length Flags TTL Protocol Header Checksum Source Port... Destination Port Packet Payload

January 9, 2001 Router Plugins (Crossbow) 8 Washington WASHINGTON UNIVERSITY IN ST LOUIS IPv4 Forwarding in the NetBSD Kernel (APIC) ipintrq: ipintr ip_forwardip_output ip6_forwardip6_output atmc_input apic_israpic_intr ip6_input atmc_output input packetsinterruptsoutput packets tcp/udp_inputtcp/udp_output socket layer apic_devoutput LINKLINK DATADATA NETWORKNETWORK UPPERUPPER LOWERLOWER apic_start packet_scheduler PS_Q TRANSPORTTRANSPORT

January 9, 2001 Router Plugins (Crossbow) 9 Washington WASHINGTON UNIVERSITY IN ST LOUIS User IP in the NetBSD Kernel ipintrq: ipintr ip_forwardip_output atmc_input apic_israpic_intr atmc_output input packetsinterruptsoutput packets tcp/udp_inputtcp/udp_output socket layer apic_devoutput LINKLINK DATADATA NETWORKNETWORK UPPERUPPER LOWERLOWER User Program Software Interrupt Waits in Socket Buffer for User Program to pick up apic_start packet_scheduler PS_Q TRANSPORTTRANSPORT

January 9, 2001 Router Plugins (Crossbow) 10 Washington WASHINGTON UNIVERSITY IN ST LOUIS TRANSPORTTRANSPORT SW Interrupt HW Interrupt ipintrq: ipintr ip_forwardip_output ip6_forwardip6_output atmc_input apic_israpic_intr ip6_input atmc_output input packetsinterruptsoutput packets User Space Kernel tcp/udp_inputtcp/udp_output socket layer apic_devoutput IP Packet Handling in the CB Kernel LINKLINK DATADATA NETWORKNETWORK UPPERUPPER LOWERLOWER apic_start packet_scheduler PS_Q Where are the gates? sgate dgate This is the gate that you will use. Here are the rest of the gates? Where is the route lookup done?

January 9, 2001 Router Plugins (Crossbow) 11 Washington WASHINGTON UNIVERSITY IN ST LOUIS Important Source Files (usr/src/sys/netinet/ip*) ip.h –struct ip { } –#define’s ip_input.c –ipintr() (This is ip_input routine) –ip_forward() ip_output.c –ip_output()

January 9, 2001 Router Plugins (Crossbow) 12 Washington WASHINGTON UNIVERSITY IN ST LOUIS IP Packet Handling in CB Kernel with APIC Device Driver -- Device Dependent –apic_intr() »read INTR_ACK: 0 => not for us, return »apic_isr() –apic_isr() »read NOTIFY_LIST, next rcv channel needing attention Process descriptors for RCV channel –swap words in each received mbuf (APIC BUG) –link mbufs until we find end of frame –verify CRC (just check flag set by APIC) –atmc_input(packet) –repeat repeat ipintrq: ipintr ip_forwardip_output atmc_input apic_israpic_intr atmc_output apic_devoutput

January 9, 2001 Router Plugins (Crossbow) 13 Washington WASHINGTON UNIVERSITY IN ST LOUIS IP Packet Handling in CB Kernel (continued) Device Driver - Dev. Independent atmc_input(): –LLC/SNAP processing (if needed) »extract type (IP/RATM/…) –AAL5 processing »extract length »strip trailer –aiu_getafix(packet) (flow table will be discussed later) »aiu_getafix stores a ptr to FTE in packet –Enqueue in IP Queue ipintrq: ipintr ip_forwardip_output atmc_input apic_israpic_intr atmc_output apic_devoutput

January 9, 2001 Router Plugins (Crossbow) 14 Washington WASHINGTON UNIVERSITY IN ST LOUIS IP Packet Handling in CB Kernel (continued) IP Input -- ipintr(): –Get next packet from IP Queue –Do some basic checks, header, length, checksum… –process IP options –aiu_dgate(&m,2) Router Plugins Dynamic Gate #2 –if packet is not for us and we can forward it: »forward packet ip_forward() -- upcoming slide... »return –aiu_dgate(&m,4) Router Plugins Dynamic Gate #4 –protocol specific input routine e.g. tcp_input() ipintrq: ipintr ip_forwardip_output atmc_input apic_israpic_intr atmc_output apic_devoutput

January 9, 2001 Router Plugins (Crossbow) 15 Washington WASHINGTON UNIVERSITY IN ST LOUIS IP Packet Handling in CB Kernel (continued) IP Forwarding -- ip_forward(): –decide if we need to send any redirects to sender –aiu_dgate(&m,5) Router Plugins Dynamic Gate #5 –route lookup –ip_output() ipintrq: ipintr ip_forwardip_output atmc_input apic_israpic_intr atmc_output apic_devoutput Update for Fred’s new Gate also check details of if/when route lookup is done

January 9, 2001 Router Plugins (Crossbow) 16 Washington WASHINGTON UNIVERSITY IN ST LOUIS IP Packet Handling in CB Kernel (continued) IP Output -- ip_output() –aiu_dgate(&m,3) Router Plugins Dynamic Gate #3 –if (no route yet) »get route –check for special processing »ANEP Options anep_output() –if DAN then afd_handle_dan_packet() :ACTIVE PROCESSING –send on interface ipintrq: ipintr ip_forwardip_output atmc_input apic_israpic_intr atmc_output apic_devoutput

January 9, 2001 Router Plugins (Crossbow) 17 Washington WASHINGTON UNIVERSITY IN ST LOUIS IP Packet Handling in CB Kernel (continued) Device Driver Device Indep.-- atmc_output(): –LLC/SNAP processing –AAL5 processing (if needed) –if packet_scheduling: enqueue for PS –if !packet_scheduling: send to devoutput() Device Driver Device Dep. -- apic_devoutput() –configure an APIC descriptor for each mbuf in packet –Resume APIC TX channel ipintrq: ipintr ip_forwardip_output atmc_input apic_israpic_intr atmc_output apic_devoutput

January 9, 2001 Router Plugins (Crossbow) 18 Washington WASHINGTON UNIVERSITY IN ST LOUIS Note about Addresses The address structures in the Crossbow Kernel are IPv6 –IPv6 address structures are a superset of IPv4 –IPv6 address are 128 bits We will be using IPv4 addresses –e.g –IPv4 addresses are 32 bits Notation for using IPv4 address in IPv6: –Use double colon before address: :: –Double colon tells the utilities to set everything to the left to 0’s

January 9, 2001 Router Plugins (Crossbow) 19 Washington WASHINGTON UNIVERSITY IN ST LOUIS NetBSD Kernel Topics IP Processing mbuf structure Loadable Kernel Modules Interrupts Miscellaneous

January 9, 2001 Router Plugins (Crossbow) 20 Washington WASHINGTON UNIVERSITY IN ST LOUIS The mbuf Data Structure mbuf{} m_next m_nextpkt m_len m_data m_type m_flags MT_xxx 0 mbuf{} MT_xxx M_PKTHDR 2048-byte cluster mbuf{} MT_xxx M_EXT byte cluster mbuf{} m_pkthdr.len m_pkthdr.rcvif m_ext.ext_buf m_ext.ext_free m_ext.ext_size MT_xxx M_PKTHDR | M_EXT 2048 Normal mbuf Normal mbuf with Packet Hdr Cluster mbuf Cluster mbuf with Packet Hdr

January 9, 2001 Router Plugins (Crossbow) 21 Washington WASHINGTON UNIVERSITY IN ST LOUIS Highlight: (add Stevens’ like figures…) –m_next vs m_nextpkt (figure 2.2 page 35) »m_next: points to next mbuf in THIS packet »m_nextpkt: points to the first mbuf of the NEXT packet –m_len vs. m_pkthdr.len –m_ext.ext_buf vs. m_data –Which mbuf structure we use with APIC Example: –do m_pullup –get data pointer –print out src addr, dst addr and protocol fields –get Transport header pointer –print out dst port Sorry: This was just one of my notes slides that should have been removed before printing

January 9, 2001 Router Plugins (Crossbow) 22 Washington WASHINGTON UNIVERSITY IN ST LOUIS The mbuf Data Structure mbuf{} m_next m_nextpkt m_len m_data m_type m_flags MT_DATA 0 mbuf{} MT_xxx M_PKTHDR 2048-byte cluster mbuf{} MT_xxx M_EXT byte cluster mbuf{} m_pkthdr.len m_pkthdr.rcvif m_ext.ext_buf m_ext.ext_free m_ext.ext_size MT_xxx M_PKTHDR | M_EXT 2048 Sorry: This was just one of my notes slides that should have been removed before printing

January 9, 2001 Router Plugins (Crossbow) 23 Washington WASHINGTON UNIVERSITY IN ST LOUIS The mbuf Data Structure (example) mbuf{} m_next m_nextpkt m_len m_data m_type m_flags MT_DATA m_pkthdr.len m_pkthdr.rcvif 100 bytes of data NULL mbuf{} m_next m_nextpkt m_len m_data m_type m_flags MT_DATA 50 bytes of data 0 50 NULL next mbuf in chain next packet in queue mbuf{} m_next m_nextpkt m_len m_data m_type m_flags MT_DATA m_pkthdr.len m_pkthdr.rcvif Ethernet header, IP header, UDP header M_PKTHDR 192 NULL 42 mbuf packet header head of queue tail of queue

January 9, 2001 Router Plugins (Crossbow) 24 Washington WASHINGTON UNIVERSITY IN ST LOUIS The mbuf Data Structure (example, continued) mbuf{} m_next m_nextpkt m_len m_data m_type m_flags MT_HEADER m_pkthdr.len m_pkthdr.rcvif M_PKTHDR 1514 NULL 54 mbuf{} m_next m_nextpkt m_len m_data m_type m_flags MT_DATA m_pkthdr.len m_pkthdr.rcvif M_EXT 1460 NULL Ethernet header, IP header, TCP header NULL 2048–byte cluster 1460 bytes of data m_ext.ext_buf m_ext.ext_free m_ext.ext_size 2048 next mbuf in chain mbuf packet header tail of queue

January 9, 2001 Router Plugins (Crossbow) 25 Washington WASHINGTON UNIVERSITY IN ST LOUIS NetBSD Kernel Topics IP Processing mbuf structure Loadable Kernel Modules Interrupts Miscellaneous

January 9, 2001 Router Plugins (Crossbow) 26 Washington WASHINGTON UNIVERSITY IN ST LOUIS Loadable Kernel Modules Mechanism in NetBSD to dynamically load code into running kernel NetBSD System Utilities: –modload(8) –modunload(8) –modstat(8) Module Types supported: –System Call modules »When unloaded, returns to original system call »Any system call can be replace »Take care when replacing ioctl(2) since LKM uses it to load/unload modules!! –Virtual File System modules –Device Driver modules: Block and character device drivers –Execution Interpreters: For binaries not normally usable by OS –Miscellaneous modules »No defined interfaces »Up to user/developer to provide hooks to get to the code »This is what Router Plugins uses

January 9, 2001 Router Plugins (Crossbow) 27 Washington WASHINGTON UNIVERSITY IN ST LOUIS Loadable Kernel Modules: modload Open /dev/lkm –ioctl’s will be performed on the open file descriptor Prelink module, open it and calculate size info –system(“ld -A /netbsd -e _ -o -T ”); Reserve Kernel memory: –ioctl(lkm_fd, LMRESERV, size_info) –returns kernel load address Relink at kernel load address Open relinked module and load it into kernel –ioctl(lkm_fd, LMLOADBUF,...) Adjusting symbol table entry pointers and load it. sync(); Call the module’s entry function to test it. Post-install if called for... –ioctl(lkm_fd, LMSTAT,...)

January 9, 2001 Router Plugins (Crossbow) 28 Washington WASHINGTON UNIVERSITY IN ST LOUIS NetBSD Kernel Topics IP Processing mbuf structure Loadable Kernel Modules Interrupts Miscellaneous

January 9, 2001 Router Plugins (Crossbow) 29 Washington WASHINGTON UNIVERSITY IN ST LOUIS Interrupts 8 levels –spl0normal –splsoftclocklow-priority clock processing –splnetnetwork protocol processing –splttyterminal I/O –splbiodisk and tape I/O –splimp network device I/O –splclockhigh-priority clock processing –splhigh all interrupts blocked Typical usage: int i; i = splimp(); [do something at device I/O level] splx(i);

January 9, 2001 Router Plugins (Crossbow) 30 Washington WASHINGTON UNIVERSITY IN ST LOUIS NetBSD Kernel Topics IP Processing mbuf structure Loadable Kernel Modules Interrupts Miscellaneous

January 9, 2001 Router Plugins (Crossbow) 31 Washington WASHINGTON UNIVERSITY IN ST LOUIS Other kernel details you must know No floating point No #include in header files More caveats and info from Fred later…