The Linux Network Subsystem
|
|
- Jeffry Austin
- 5 years ago
- Views:
Transcription
1 The Linux Network Subsystem Unable to handle kernel paging request at virtual address 4d1b65e8 Unable Covers to handle Linux kernel paging version request at virtual address 4d1b65e8 pgd = c pgd = c Version 1.1 <1>[4d1b65e8] *pgd= [4d1b65e8] *pgd= Internal error: Oops: f5 [#1] Internal error: Oops: f5 [#1] Modules linked in:modules linked in: hx4700_udc hx4700_udc asic3_base asic3_base CPU: 0 CPU: 0 PC is at set_pxa_fb_info+0x2c/0x44 PC is at set_pxa_fb_info+0x2c/0x44 LR is at hx4700_udc_init+0x1c/0x38 [hx4700_udc] LR is at hx4700_udc_init+0x1c/0x38 [hx4700_udc] pc : [<c00116c8>] lr : [<bf00901c>] Not tainted sp : c076df78 ip : fp : c076df84 pc : [<c00116c8>] lr : [<bf00901c>] Not tainted 1
2 Rights to copy Attribution ShareAlike 2.0 You are free to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. License text: sa/2.0/legalcode This kit contains work by the following authors: Copyright Michael Opdenacker michael@free electrons.com electrons.com Copyright Oron Peled oron@actcom.co.il Copyright Codefidence ltd. info@codefidence.com 2
3 What is Linux? Linux is a kernel that implements the POSIX and Single Unix Specification standards which is developed as an Open Source project. When one talks of installing Linux, one is referring to a Linux Distribution: a combination of Linux and other programs and library that form an operating system. Linux runs on 24 main platforms and supports applications ranging from ccnuma super clusters to cellular phones and micro controllers. Linux is 15 years old, but is based on the 40 years old Unix design philosophy 3
4 Layers in a Linux system Kernel Kernel Modules User programs C library System libraries Application libraries User programs Kernel C library 4
5 Kernel architecture App1 App2... C library User space System call interface Process management Memory management Filesystem support Filesystem types Device control Networking Kernel space CPU support code CPU / MMU support code Storage drivers Character device drivers Network device drivers Hardware CPU RAM Storage 5
6 Kernel Mode vs. User Mode All modern CPUs support a dual mode of operation: User mode, for regular tasks. Supervisor (or privileged) mode, for the kernel. The mode the CPU is in determines which instructions the CPU is willing to execute: Sensitive instructions will not be executed when the CPU is in user mode. The CPU mode is determined by one of the CPU registers, which stores the current Ring Level 0 for supervisor mode, 3 for user mode, 1 2 unused by Linux. 6
7 The System Call Interface When a user space tasks needs to use a kernel service, it will make a System Call. The C library places parameters and number of system call in registers and then issues a special trap instruction. The trap atomically changes the ring level to supervisor mode and the sets the instruction pointer to the kernel. The kernel will find the required system called via the system call table and execute it. Returning from the system call does not require a special instruction, since in supervisor mode the ring level can be changed directly. 7
8 Linux System Call Path Kernel do_name() sys_name() Function call Trap entry.s Task Glibc Task 8
9 Linux networking Subsystem Overview Stack <> App App 1 App2 App3 Socket Layer UDP TCP ICMP Networking Stack Driver <> Stack Driver <> Hardware IP Stack Driver Interface Driver Bridge 9
10 Network Device Driver Hardware Interface packet packet packet packet packet Tx Rx Send Free Send Free Send RcvOk SentOK RcvErr SendErr RecvCRC Free RcvOK Memory Access Memory mapped registers access Driver Interrupts packet packet packet packet Driver allocates Ring Buffers. Driver resets descriptors to initial state. Driver puts packet to be sent in Tx buffers. Device puts received packet in Rx buffers. Driver/Device update descriptors to indicate state. Device indicates Rx and end of Tx with interrupt, unless interrupt mitigation techniques are applied. DMA 10
11 Network Device Registration Each network device is represented by a struct net_device These are allocated using: struct net_device *alloc_netdev(size, mask, setup_func); size size of our priv data part mask a naming pattern (e.g. eth%d ) setup_func A functionthat set ups the rest of net_device. And is registered via a call to: int register_netdev(struct net_device *dev); 11
12 Network Device Initialization The net_device structure is initalized with numerous methods and flags by the setup function: open request resources, register interrupts, start queues. stop deallocates resources, unregister irq, stop queue. get_stats report statistics set_multicast_list configure device for multicast hard_start_xmit called by the stack to initiate Tx. IFF_MULTICAST Device support multicast IFF_NOARP Device does not support ARP protocol 12
13 Packet Representation We need to manipulate packets through the stack This manipulation involves efficiently: Adding protocol headers/trailers down the stack. Removing protocol headers/trailers up the stack. Packets can be chained together. Each protocol should have convenient access to header fields. To do all this the kernel uses the sk_buff structure. 13
14 Socket Buffers The sk_buff structure represents a single packet. This structure is passed through the protocol stack. It holds pointers to a buffers with the packet data. It holds many type of other information: Data size. Incoming device. Priority. Security... 14
15 struct sk_buff next: Next buffer in list prev: Previous buffer in list sk: Socket we are owned by tstamp: Time we arrived dev: Device we arrived on/are leaving by input_dev: Device we arrived on h: Transport layer header nh: Network layer header mac: Link layer header dst: Destination route cache entry sp: Security path, used for xfrm cb: Control buffer. Private data. len: Length of actual data data_len: Data length mac_len: Length of link layer header csum: Checksum local_df: Allow local fragmentation flag cloned: Head may be cloned (see refcnt) nohdr: Payload reference only flag pkt_type: Packet class fclone: Clone status ip_summed: Driver fed us an IP checksum priority: Packet queuing priority users: User count see {datagram,tcp}.c protocol: Packet protocol from driver truesize: Buffer size head: Head of buffer data: Data head pointer tail: Tail pointer end: End pointer destructor: Destruct function nfmark: Netfilter hooks private data nfct: Associated connection, if any ipvs_property: skbuff is owned by ipvs nfctinfo: Connection tracking info. nfct_reasm: Netfilter conntrack re assembly pointer nf_bridge: Saved data about a bridged frame tc_index: Traffic control index tc_verd: Traffic control verdict dma_cookie: DMA operation cookie secmark: Security marking for LSM 15
16 Socket Buffer Diagram headroom frag1 Note len... head data tail end... dev Ethernet IP TCP Payload Padding struct sk_shared_info frag2 frag3 Network chip must support Scatter/Gather to use of frags. Otherwise kernel must copy buffers before send! struct sk_buff 16
17 Socket Buffer Operations skb_put: add data to a buffer. skb_push: add data to the start of a buffer. skb_pull: remove data from the start of a buffer. skb_headroom: returns free bytes at buffer head. skb_tailroom: returns free bytes at buffer end. skb_reserve: adjust headroom. skb_trim: remove end from a buffer. 17
18 Operation Example: skb_put unsigned char *skb_put (struct sk_buff * skb, unsigned int len) Adds data to a buffer: skb: buffer to use len: amount of data to add This function extends the used data area of the buffer. If this would exceed the total buffer size the kernel will panic. A pointer to the first byte of the extra data is returned. 18
19 Socket Buffer Alignment CPUs often take a performance hit when accessing unaligned memory locations. Since an Ethernet header is 14 bytes network drivers often end up with the IP header at an unaligned offset. The IP header can be aligned by shifting the start of the packet by 2 bytes. Drivers should do this with: skb_reserve(net_ip_align); The downside is that the DMA is now unaligned. On some architectures the cost of an unaligned DMA outweighs the gains so NET_IP_ALIGN is set on a per arch basis. 19
20 Socket Buffer Padding The networking layer reserves some headroom in skb data. This is used to avoid having to reallocate skb data when the header has to grow. In the default case, if the header has to grow 16 bytes or less we avoid the reallocation. Unfortunately, this headroom changes the DMA alignment of the resulting network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive on some architectures. Therefore architecture can override this value, as long as at least 16 bytes of free headroom are there. 20
21 Socket Buffer Allocations dev_alloc_skb: allocate an skbuff for Rx netdev_alloc_skb: allocate an skbuff for Rx, on a specific device. Allocate a new sk_buff and assign it a usage count of one. The buffer has unspecified headroom built in. Users should allocate the headroom they think they need without accounting for the built in space. The built in space is used for optimizations NULL is returned if there is no free memory. Although these functions allocates memory it can be called from an interrupt. 21
22 sk_buff Allocation Example Immediately after allocation, we should reserve the needed headroom: struct sk_buff*skb; skb = dev_alloc_skb(1500); if(unlikely(!skb)) break; /* Mark as being used by this device */ skb >dev = dev; /* Align IP on 16 byte boundaries */ skb_reserve(skb, NET_IP_ALIGN); 22
23 Softnet Network stack is implemented as a pair of softirqs for parallelize packet handling on SMP machines: NET_TX_SOFTIRQ Feeds packets from network stack to driver. NET_RX_SOFTIRQ Feeds packets from driver to network stack. Like any other softirq, these are called on return from interrupt or via the low priority ksoftirqd kernel thread. Transmit/receive queues are stored in per cpu softnet_data. 23
24 Linux Contexts Interrupt Handlers Interrupt Context Hi prio tasklets SoftIRQs Net Stack Timers... Regular tasklets Kernel Space Network Interface Device Driver User Context User Space Process Thread Kernel Thread 24
25 Packet Reception The driver allocates an skb and sets up a descriptor in the ring buffers for the hardware. The driver Rx interrupt handler calls netif_rx(skb). netif_rx deposits the sk_buff in the per cpu input queue. and marks the NET_RX_SOFTIRQ to run. At SoftIRQ processing time, net_rx_action() is called by NET_RX_SOFTIRQ, which calls the driver poll() method to feed the packet up. Normally poll() is set to proccess_backlog() by net_dev_init(). 25
26 Packet Rx Overview 26
27 Packet Transmission Each network device defines a method: int (*hard_start_xmit) (struct sk_buff *skb, struct net_device *dev); This function is indirectly called from the NET_TX_SOFTIRQ Call are serialized via the lock dev >xmit_lock_owner The driver manages the transmit queue during interface up and downs or to signal back pressure using the following functions: void netif_start_queue(struct net_device *net); void netif_stop_queue(struct net_device *net); void netif_wake_queue(struct net_device *net); 27
28 Packet Tx Overview 28
29 NAPI Network New API Provides interrupt mitigation Requirements: A DMA ring buffer. Ability to turn off receive interrupts or events. It is used by defining a new method: int (*poll) (struct net_device *dev, int * budget); which is called by the network stack periodically when signaled by the driver to do so. 29
30 NAPI (cont.) When a receive interrupt occurs, driver: Turns off receive interrupts. Calls netif_rx_schedule(dev) to get stack to start calling it's poll method. The Poll method Scans receive ring buffers, feeding packets to the stack via: netif_receive_skb(skb). If work finished within budget parameter, re enables interrupts and calls netif_rx_complete(dev) Else, stack will call poll method again. 30
31 Routing After the socket buffer is delivered to a protocol handler the handler may decide to route the packet. The default routing uses the normal destination based routing with single table and a FIB destination cache. For each packet the routintg destination is looked up in the FIB cache. If found, the packet is sent to that interface driver. Otherwise a more costly routing decision based on rules occurs and the result is stored in the FIB. 31
32 What is Netfilter? Netfilter is a framework for packet mangling Each protocol defines "hooks" (IPv4 defines 5) which are well defined points in a packet's traversal of that protocol stack. At each of these points, the protocol will call the netfilter framework with the packet and the hook number. Parts of the kernel can register to listen to the different hooks for each protocol. When a packet is passed to the netfilter framework, it will call all registered callbacks for that hook and protocol. 32
33 Netfilter Architecture Ingres Pre Routing Route Forward Post Routing Egres Route Local In Local Out Local Sockets 33
34 Netfilter Hook Kernel code can register a call back function to be called when a packet arrives at each hook. and are free to manipulate the packet. The callback can then tell netfilter to do one of five things: NF_ACCEPT: continue traversal as normal. NF_DROP: drop the packet; don't continue traversal. NF_STOLEN: I've taken over the packet; stop traversal. NF_QUEUE: queue the packet (usually for userspace handling). NF_REPEAT: call this hook again. 34
35 IP Tables A packet selection system called IP Tables has been built over the netfilter framework. It is a direct descendant of ipchains (that came from ipfwadm, that came from BSD's ipfw IIRC), with extensibility. Kernel modules can register a new table, and ask for a packet to traverse a given table. This packet selection method is used for packet filtering (the `filter' table), Network Address Translation (the `nat' table) and general pre route packet mangling (the `mangle' table). 35
36 IP Tables and Netfilter Hooks Ingres Pre Routing Route Forward Post Routing Egres Conntrack Mangle Destination NAT Mangle Filter Route Conntrack Mangle Source NAT Filter Conntrack Mangle Local In Local Out Conntrack Mangle Destination NAT Filter Local Sockets 36
37 BSD Sockets Interface User space network interface: socket() / bind() / accept() / listen() Initalization, addressing and hand shaking select() / poll() / epoll() Waiting for events send() / recv() Stream oriented (e.g. TCP) Rx / Tx sendto() / recvfrom() Datagram oriented (e.g. UDP) Rx / TX 37
38 Simple Client/Server Clients socket s; char buf[256]; s =socket() connect(s, IP:port) while(ret!=0) ret = recv(s, buf) Server socket s 1, s 2... s n ; char buf[256]; s =socket() bind(s 1, IP:port) listen(s 1 ) while { select(s 1,s 2... s n ) if(s1) s n = accept(s 1 ) else while(ret!=0) ret = send(s n, buf) } 38
39 Simple Client/Server Copies Kernel Client Rx Tx Server Kernel Copy to user Copy from user... ret = recv(s, buf) ret = send(s, buf)... User space Application User space Application 39
40 BSD Sockets Interface Properties Originally developed by UC Berkeley research at the dawn of time Used by 90% of network oriented programs Context switch for every Rx/Tx Buffer copied from/to user space to/from kernel Standart interface across operating systems Simple, well understood by programmers 40
41 Zero Copy In kernel buffer that the user has control over. The buffer is implemented as a set of reference counted pointers which the kernel copies around without actually copying the data. splice() moves data to/from the buffer from/to an arbitrary file descriptor tee() Moves data to/from one buffer to another vmsplice() does the same than splice(), but instead of splicing from fd to fd as splice() does, it splices from a user address range into a file. Can be used anywhere where a process needs to send something from one end to another, but it doesn't need to touch or even look at the data, just forward it. 41
42 Zero Copy of Example 1 Splice() * User space Only pointer is copied File Pointer to page cache page Data Socket Buf Pointer to page as part of frag list Kernel Memory HD Controller Copy (using DMA) Network Chip Hardware * In relaity you have to do two splice calls: one from the file to an intermediate pipe and one from the pipe to the socket buffers. 42
43 Zero Copy of Example 2 Mem write VMSplice() * User space Proccess page tables Only pointer is copied skb Pointer to page as part of frag list Kernel Memory Data Copy (using DMA) Network Chip Hardware * In relaity you have to do two vmsplice to an intermediate pipe and one splice from the pipe to the socket buffers. 43
44 Hardware Offloading Large receive offload supported (in software) TCP / Large Segment Offload supported (e.g. e1000 driver) No TCP Offload Engine support Security updates Point in time solution Different network behavior Hardware specific limits and resource based denial of service attacks foundation.org/en/net:toe 44
45 More Information Linux Foundation Net:Kernel Flow Zero Copy I: User Mode Perspective Understanding Linux Network Internals, O'Reilly Media 45
46 Use the Source, Luke! Many resources and tricks on the Internet find you will, but solutions to all technical issues only in the Source lie. Thanks to LucasArts 46
47 Copyrights and Trademarks Copyright Codefidence Ltd. Tux Image Copyright: 1996 Larry Ewing Linux is a registered trademark of Linus Torvalds. All other trademarks are property of their respective owners. Used and distributed under a 47
Operating Systems. 17. Sockets. Paul Krzyzanowski. Rutgers University. Spring /6/ Paul Krzyzanowski
Operating Systems 17. Sockets Paul Krzyzanowski Rutgers University Spring 2015 1 Sockets Dominant API for transport layer connectivity Created at UC Berkeley for 4.2BSD Unix (1983) Design goals Communication
More informationLinux IP Networking. Antonio Salueña
Linux IP Networking Antonio Salueña Preface We will study linux networking for the following case: Intel x86 architecture IP packets Recent stable linux kernel series 2.4.x 2 Overview
More informationNetworking Subsystem in Linux. Manoj Naik IBM Almaden Research Center
Networking Subsystem in Linux Manoj Naik IBM Almaden Research Center Scope of the talk Linux TCP/IP networking layers Socket interfaces and structures Creating and using INET sockets Linux IP layer Socket
More informationjelly-near jelly-far
sudo./run Two interfaces created: os0, os1 Two networks created: (add to /etc/networks) peanut where os0 will connect 192.168.0.0 grape where os1 will connect 192.168.1.0 Two IP addresses in peanut: (add
More informationWhat is Netfilter. Netfilter. Topics
Netfilter By V.R.Sundar & Karthik Dantu What is Netfilter netfilter is a framework for packet mangling, outside the normal Berkeley socket interface. Using this framework various modules have been written
More informationNetwork Implementation
CS 256/456: Operating Systems Network Implementation John Criswell! University of Rochester 1 Networking Overview 2 Networking Layers Application Layer Format of Application Data Transport Layer Which
More informationChapter 10: I/O Subsystems (2)
ADRIAN PERRIG & TORSTEN HOEFLER ( 252-0062-00 ) Networks and Operating Systems Chapter 10: I/O Subsystems (2) BE CAREFUL WITH I/O DEVICES! Our Small Quiz True or false (raise hand) Open files are part
More informationWhat is a Linux Device Driver? Kevin Dankwardt, Ph.D. VP Technology Open Source Careers
What is a Linux Device Driver? Kevin Dankwardt, Ph.D. VP Technology Open Source Careers kdankwardt@oscareers.com What does a driver do? Provides a more convenient interface to user-space for the hardware.
More informationChapter 10: I/O Subsystems (2)
ADRIAN PERRIG & TORSTEN HOEFLER ( 252-0062-00 ) Networks and Operating Systems Chapter 10: I/O Subsystems (2) BE CAREFUL WITH I/O DEVICES! Our Small Quiz True or false (raise hand) Open files are part
More informationLight & NOS. Dan Li Tsinghua University
Light & NOS Dan Li Tsinghua University Performance gain The Power of DPDK As claimed: 80 CPU cycles per packet Significant gain compared with Kernel! What we care more How to leverage the performance gain
More information19: Networking. Networking Hardware. Mark Handley
19: Networking Mark Handley Networking Hardware Lots of different hardware: Modem byte at a time, FDDI, SONET packet at a time ATM (including some DSL) 53-byte cell at a time Reality is that most networking
More informationNetworks and Operating Systems ( ) Chapter 10: I/O Subsystems (2)
ADRIAN PERRIG & TORSTEN HOEFLER Networks and Operating Systems (252-0062-00) Chapter 10: I/O Subsystems (2) BE CAREFUL WITH I/O DEVICES! Administrivia If you re an exchange student and very far away from
More informationTutorial 2. Linux networking, sk_buff and stateless packet filtering. Roei Ben-Harush Check Point Software Technologies Ltd.
Tutorial 2 Linux networking, sk_buff and stateless packet filtering Agenda 1 Linux file system - networking 2 3 4 sk_buff Stateless packet filtering About next assignment 2 Agenda 1 Linux file system -
More informationOur Small Quiz. Chapter 9: I/O Subsystems (2) Generic I/O functionality. The I/O subsystem. The I/O Subsystem.
ADRIAN PERRIG & TORSTEN HOEFLER ( 252-0062-00 ) s and Operating Systems Chapter 9: I/O Subsystems (2) Our Small Quiz True or false (raise hand) Open files are part of the process address-space Unified
More informationCSCI-GA Operating Systems. Networking. Hubertus Franke
CSCI-GA.2250-001 Operating Systems Networking Hubertus Franke frankeh@cs.nyu.edu Source: Ganesh Sittampalam NYU TCP/IP protocol family IP : Internet Protocol UDP : User Datagram Protocol RTP, traceroute
More informationOur Small Quiz. Chapter 10: I/O Subsystems (2) Generic I/O functionality. The I/O subsystem. The I/O Subsystem. The I/O Subsystem
ADRIAN PERRIG & TORSTEN HOEFLER ( 252-0062-00 ) s and Operating Systems Chapter 10: I/O Subsystems (2) BE CAREFUL WITH I/O DEVICES! Our Small Quiz True or false (raise hand) Open files are part of the
More informationlibnetfilter_log Reference Manual
libnetfilter_log Reference Manual x.y Generated by Doxygen 1.4.6 Tue Mar 21 13:47:12 2006 CONTENTS 1 Contents 1 libnetfilter_log File Index 1 2 libnetfilter_log File Documentation 1 1 libnetfilter_log
More information- Knowledge of basic computer architecture and organization, ECE 445
ECE 446: Device Driver Development Fall 2014 Wednesdays 7:20-10 PM Office hours: Wednesdays 6:15-7:15 PM or by appointment, Adjunct office Engineering Building room 3707/3708 Last updated: 8/24/14 Instructor:
More informationUsing Time Division Multiplexing to support Real-time Networking on Ethernet
Using Time Division Multiplexing to support Real-time Networking on Ethernet Hariprasad Sampathkumar 25 th January 2005 Master s Thesis Defense Committee Dr. Douglas Niehaus, Chair Dr. Jeremiah James,
More informationADRIAN PERRIG & TORSTEN HOEFLER ( ) 10: I/O
ADRIAN PERRIG & TORSTEN HOEFLER s and Operating Systems (252-0062-00) Chapter 10: I/O Subsystems (2) Administrivia If you re an exchange student and very far away from Zurich during the exam period and
More informationWhat is an L3 Master Device?
What is an L3 Master Device? David Ahern Cumulus Networks Mountain View, CA, USA dsa@cumulusnetworks.com Abstract The L3 Master Device (l3mdev) concept was introduced to the Linux networking stack in v4.4.
More informationSpiNNaker Application Programming Interface (API)
SpiNNaker Application Programming Interface (API) Version 2.0.0 10 March 2016 Application programming interface (API) Event-driven programming model The SpiNNaker API programming model is a simple, event-driven
More informationIntroduction to Oracle VM (Xen) Networking
Introduction to Oracle VM (Xen) Networking Dongli Zhang Oracle Asia Research and Development Centers (Beijing) dongli.zhang@oracle.com May 30, 2017 Dongli Zhang (Oracle) Introduction to Oracle VM (Xen)
More informationAdvanced Computer Networks. End Host Optimization
Oriana Riva, Department of Computer Science ETH Zürich 263 3501 00 End Host Optimization Patrick Stuedi Spring Semester 2017 1 Today End-host optimizations: NUMA-aware networking Kernel-bypass Remote Direct
More informationLecture 8. Network Layer (cont d) Network Layer 1-1
Lecture 8 Network Layer (cont d) Network Layer 1-1 Agenda The Network Layer (cont d) What is inside a router Internet Protocol (IP) IPv4 fragmentation and addressing IP Address Classes and Subnets Network
More informationInterprocess Communication Mechanisms
Interprocess Communication 1 Interprocess Communication Mechanisms shared storage These mechanisms have already been covered. examples: shared virtual memory shared files processes must agree on a name
More informationshared storage These mechanisms have already been covered. examples: shared virtual memory message based signals
Interprocess Communication 1 Interprocess Communication Mechanisms shared storage These mechanisms have already been covered. examples: shared virtual memory shared files processes must agree on a name
More informationECE 650 Systems Programming & Engineering. Spring 2018
ECE 650 Systems Programming & Engineering Spring 2018 Networking Transport Layer Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) TCP/IP Model 2 Transport Layer Problem solved:
More informationLecture 8: Other IPC Mechanisms. CSC 469H1F Fall 2006 Angela Demke Brown
Lecture 8: Other IPC Mechanisms CSC 469H1F Fall 2006 Angela Demke Brown Topics Messages through sockets / pipes Receiving notification of activity Generalizing the event notification mechanism Kqueue Semaphores
More informationTopics. Lecture 8: Other IPC Mechanisms. Socket IPC. Unix Communication
Topics Lecture 8: Other IPC Mechanisms CSC 469H1F Fall 2006 Angela Demke Brown Messages through sockets / pipes Receiving notification of activity Generalizing the event notification mechanism Kqueue Semaphores
More informationA Client-Server Exchange
Socket programming A Client-Server Exchange A server process and one or more client processes Server manages some resource. Server provides service by manipulating resource for clients. 1. Client sends
More informationReview: Hardware user/kernel boundary
Review: Hardware user/kernel boundary applic. applic. applic. user lib lib lib kernel syscall pg fault syscall FS VM sockets disk disk NIC context switch TCP retransmits,... device interrupts Processor
More informationNetwork device drivers in Linux
Network device drivers in Linux Aapo Kalliola Aalto University School of Science Otakaari 1 Espoo, Finland aapo.kalliola@aalto.fi ABSTRACT In this paper we analyze the interfaces, functionality and implementation
More informationRef: A. Leon Garcia and I. Widjaja, Communication Networks, 2 nd Ed. McGraw Hill, 2006 Latest update of this lecture was on
IP Version 4 (IPv4) Header (Continued) Identification (16 bits): One of the parameters of any network is the maximum transmission unit (MTU) parameter. This parameter specifies the maximum size of the
More informationAsynchronous Events on Linux
Asynchronous Events on Linux Frederic.Rossi@Ericsson.CA Open System Lab Systems Research June 25, 2002 Ericsson Research Canada Introduction Linux performs well as a general purpose OS but doesn t satisfy
More informationPacket Sniffing and Spoofing
Some of the slides borrowed from the book Computer Security: A Hands on Approach by Wenliang Du Packet Sniffing and Spoofing Chester Rebeiro IIT Madras Shared Networks Every network packet reaches every
More informationXen Network I/O Performance Analysis and Opportunities for Improvement
Xen Network I/O Performance Analysis and Opportunities for Improvement J. Renato Santos G. (John) Janakiraman Yoshio Turner HP Labs Xen Summit April 17-18, 27 23 Hewlett-Packard Development Company, L.P.
More informationTolerating Malicious Drivers in Linux. Silas Boyd-Wickizer and Nickolai Zeldovich
XXX Tolerating Malicious Drivers in Linux Silas Boyd-Wickizer and Nickolai Zeldovich How could a device driver be malicious? Today's device drivers are highly privileged Write kernel memory, allocate memory,...
More information440GX Application Note
Overview of TCP/IP Acceleration Hardware January 22, 2008 Introduction Modern interconnect technology offers Gigabit/second (Gb/s) speed that has shifted the bottleneck in communication from the physical
More informationNetfilter & Packet Dropping
Netfilter & Packet Dropping Netfilter provides a set of hooks is several points of the kernel network stack. The hooks can be exploited to define custom functions for manipulating IP packets Dropping Manipulation
More informationMotivation of VPN! Overview! VPN addressing and routing! Two basic techniques for VPN! ! How to guarantee privacy of network traffic?!
Overview!! Last Lecture!! Daemon processes and advanced I/O functions!! This Lecture!! VPN, NAT, DHCP!! Source: Chapters 19&22 of Comer s book!! Unix domain protocols and non-blocking I/O!! Source: Chapters
More informationUNIX Sockets. Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E.
UNIX Sockets Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E. Socket and Process Communication application layer User Process Socket transport layer (TCP/UDP) network layer (IP)
More informationQuestion Score 1 / 19 2 / 19 3 / 16 4 / 29 5 / 17 Total / 100
NAME: Login name: Computer Science 461 Midterm Exam March 10, 2010 3:00-4:20pm This test has five (5) questions. Put your name on every page, and write out and sign the Honor Code pledge before turning
More informationMessage Passing Architecture in Intra-Cluster Communication
CS213 Message Passing Architecture in Intra-Cluster Communication Xiao Zhang Lamxi Bhuyan @cs.ucr.edu February 8, 2004 UC Riverside Slide 1 CS213 Outline 1 Kernel-based Message Passing
More informationHybrid of client-server and P2P. Pure P2P Architecture. App-layer Protocols. Communicating Processes. Transport Service Requirements
Announcements CS 5565 Network Architecture and Protocols Lecture 5 Godmar Back Problem Set 1 due Feb 17 Project 1 handed out shortly 2 Layer The Layer Let s look at some s (in keeping with top-down) architectures:
More informationMemory-Mapped Files. generic interface: vaddr mmap(file descriptor,fileoffset,length) munmap(vaddr,length)
File Systems 38 Memory-Mapped Files generic interface: vaddr mmap(file descriptor,fileoffset,length) munmap(vaddr,length) mmap call returns the virtual address to which the file is mapped munmap call unmaps
More informationOutline. 1) Introduction to Linux Kernel 2) How system calls work 3) Kernel-space programming 4) Networking in kernel 2/34
Titolo presentazione Piattaforme Software per la Rete sottotitolo Programmazione Milano, in kernel-space XX mese 20XX A.A. 2016/17 Federico Reghenzani Outline 1) Introduction to Linux Kernel 2) How system
More informationSome of the slides borrowed from the book Computer Security: A Hands on Approach by Wenliang Du. Firewalls. Chester Rebeiro IIT Madras
Some of the slides borrowed from the book Computer Security: A Hands on Approach by Wenliang Du Firewalls Chester Rebeiro IIT Madras Firewall Block unauthorized traffic flowing from one network to another
More informationCSC 474/574 Information Systems Security
CSC 474/574 Information Systems Security Topic 7.4 Firewalls CSC 474/574 Dr. Peng Ning 1 Outline What are firewalls? Types Filtering Packet filtering Session filtering Proxy Circuit Level Application Level
More informationOverview. Last Lecture. This Lecture. Daemon processes and advanced I/O functions
Overview Last Lecture Daemon processes and advanced I/O functions This Lecture Unix domain protocols and non-blocking I/O Source: Chapters 15&16&17 of Stevens book Unix domain sockets A way of performing
More informationSupport for Smart NICs. Ian Pratt
Support for Smart NICs Ian Pratt Outline Xen I/O Overview Why network I/O is harder than block Smart NIC taxonomy How Xen can exploit them Enhancing Network device channel NetChannel2 proposal I/O Architecture
More informationTCP/IP Stack Introduction: Looking Under the Hood!
TCP/IP Stack Introduction: Looking Under the Hood! Shiv Kalyanaraman shivkuma@ecse.rpi.edu http://www.ecse.rpi.edu/homepages/shivkuma 1 Example program 1. Create UDP datagram socket; fill in server address
More informationReal-Time Networking for Quality of Service on TDM based Ethernet
Real-Time Networking for Quality of Service on TDM based Ethernet Badri Prasad Subramanyan Master s Thesis Defense 26 th Jan 2005 Committee: Dr. Douglas Niehaus Dr. David Andrews Dr. Jerry James Presentation
More informationOral. Total. Dated Sign (2) (5) (3) (2)
R N Oral Total Dated Sign (2) (5) (3) (2) Assignment Group- A_07 Problem Definition Write a program using TCP socket for wired network for following Say Hello to Each other ( For all students) File transfer
More informationCSE 153 Design of Operating Systems
CSE 153 Design of Operating Systems Winter 19 Lecture 3: OS model and Architectural Support Last time/today Historic evolution of Operating Systems (and computing!) Today: We start our journey in exploring
More informationOverview. This Lecture. Interrupts and exceptions Source: ULK ch 4, ELDD ch1, ch2 & ch4. COSC440 Lecture 3: Interrupts 1
This Lecture Overview Interrupts and exceptions Source: ULK ch 4, ELDD ch1, ch2 & ch4 COSC440 Lecture 3: Interrupts 1 Three reasons for interrupts System calls Program/hardware faults External device interrupts
More informationECE4110 Internetwork Programming. Introduction and Overview
ECE4110 Internetwork Programming Introduction and Overview 1 EXAMPLE GENERAL NETWORK ALGORITHM Listen to wire Are signals detected Detect a preamble Yes Read Destination Address No data carrying or noise?
More informationNetworking in a Vertically Scaled World
Networking in a Vertically Scaled World David S. Miller Red Hat Inc. LinuxTAG, Berlin, 2008 OUTLINE NETWORK PRINCIPLES MICROPROCESSOR HISTORY IMPLICATIONS FOR NETWORKING LINUX KERNEL HORIZONTAL NETWORK
More informationImplementing the Wireless Token Ring Protocol As a Linux Kernel Module
Implementing the Wireless Token Ring Protocol As a Linux Kernel Module Ruchira Datta Web Over Wireless Group University of California Berkeley, California September 28, 2001 1 Preliminary Groundwork: Fake
More informationCS 351 Week 15. Course Review
CS 351 Week 15 Course Review Objectives: 1. To review the contents from different weeks. 2. To have a complete understanding of important concepts from different weeks. Concepts: 1. Important Concepts
More informationLinux Kernel Application Interface
Linux Kernel Application Interface Arseny Kurnikov Aalto University School of Electrical Engineering PO Box 13000, FI-00076 Aalto Espoo, Finland arseny.kurnikov@aalto.fi ABSTRACT This paper describes different
More informationThe Network Stack. Chapter Network stack functions 216 CHAPTER 21. THE NETWORK STACK
216 CHAPTER 21. THE NETWORK STACK 21.1 Network stack functions Chapter 21 The Network Stack In comparison with some other parts of OS design, networking has very little (if any) basis in formalism or algorithms
More informationWhat s an API? Do we need standardization?
Network Interface z The network protocol stack is a part of the OS z Need an API to interface applications to the protocol stack. What s an API? Do we need standardization? z The socket interface is the
More informationDistributed Real-Time Control Systems. Module 26 Sockets
Distributed Real-Time Control Systems Module 26 Sockets 1 Network Programming with Sockets Sockets are probably the most widely used objects in programming networked communications. What is a socket? To
More informationGroup-A Assignment No. 6
Group-A Assignment No. 6 R N Oral Total Dated Sign (2) (5) (3) (10) Title : File Transfer using TCP Socket Problem Definition: Use Python for Socket Programming to connect two or more PCs to share a text
More informationNETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science
NETWORK PROGRAMMING CSC- 341 25 Instructor: Junaid Tariq, Lecturer, Department of Computer Science 26 9 Lecture Sockets as means for inter-process communication (IPC) application layer Client Process Socket
More informationTransport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol
Transport Layer Transport Layer The transport layer is responsible for the delivery of a message from one process to another Types of Data Deliveries Client/Server Paradigm An application program on the
More informationChapter 5.6 Network and Multiplayer
Chapter 5.6 Network and Multiplayer Multiplayer Modes: Event Timing Turn-Based Easy to implement Any connection type Real-Time Difficult to implement Latency sensitive 2 Multiplayer Modes: Shared I/O Input
More informationChapter 13: I/O Systems
COP 4610: Introduction to Operating Systems (Spring 2015) Chapter 13: I/O Systems Zhi Wang Florida State University Content I/O hardware Application I/O interface Kernel I/O subsystem I/O performance Objectives
More informationLecture 3. The Network Layer (cont d) Network Layer 1-1
Lecture 3 The Network Layer (cont d) Network Layer 1-1 Agenda The Network Layer (cont d) What is inside a router? Internet Protocol (IP) IPv4 fragmentation and addressing IP Address Classes and Subnets
More informationrx hardening & udp gso willem de bruijn
rx hardening & udp gso willem de bruijn Network rx stack hardening PoD [redacted (3x)] Local Priv CVE-2017-1000112: ufo overwrite skb_shared_info CVE-2017-1000111: packet_reserve use-after-free user namespaces
More informationIntroduction to Internetworking
Introduction to Internetworking Stefano Vissicchio UCL Computer Science COMP0023 Internetworking Goal: Connect many networks together into one Internet. Any computer can send to any other computer on any
More informationI/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)
I/O Systems Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) I/O Systems 1393/9/15 1 / 57 Motivation Amir H. Payberah (Tehran
More informationChapter 13: I/O Systems
Chapter 13: I/O Systems DM510-14 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations STREAMS Performance 13.2 Objectives
More informationDesign Overview of the FreeBSD Kernel CIS 657
Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler (2%
More informationOperating Systems Design Exam 3 Review: Spring 2011
Operating Systems Design Exam 3 Review: Spring 2011 Paul Krzyzanowski pxk@cs.rutgers.edu 1 1. Why does an IP driver need to use ARP, the address resolution protocol? IP is a logical network. An IP address
More informationDesign Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?
Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler
More informationLinux Operating System
Linux Operating System Dept. of Computer Science & Engineering 1 History Linux is a modern, free operating system based on UNIX standards. First developed as a small but self-contained kernel in 1991 by
More information6.9. Communicating to the Outside World: Cluster Networking
6.9 Communicating to the Outside World: Cluster Networking This online section describes the networking hardware and software used to connect the nodes of cluster together. As there are whole books and
More informationEVASIVE INTERNET PROTOCOL: END TO END PERFORMANCE
EVASIVE INTERNET PROTOCOL: END TO END PERFORMANCE By Maaz Khan Submitted in partial fulfillment of the requirements for the Degree of Master of Science Thesis Advisor: Prof. Michael Rabinovich Department
More informationMuch Faster Networking
Much Faster Networking David Riddoch driddoch@solarflare.com Copyright 2016 Solarflare Communications, Inc. All rights reserved. What is kernel bypass? The standard receive path The standard receive path
More informationnetfilters connection tracking subsystem
netfilters connection tracking subsystem Florian Westphal 4096R/AD5FF600 fw@strlen.de 80A9 20C5 B203 E069 F586 AE9F 7091 A8D9 AD5F F600 Red Hat netdev 2.1, Montreal, April 2017 connection tracking flow
More informationSystem Interconnect Software Programming Interface
System Interconnect Software Programming Interface Overview By Steve Shih and Alex Chang This document describes the programming interface of the system interconnect software components. Specifically,
More informationPacket Aggregation in Linux
Computer science Jonas Brolin Mikael Hedegren Packet Aggregation in Linux Computer science C-level thesis 15p Date/Term: 08-06-03 Supervisor: Examiner: Andreas Kassler Martin Blom Serial Number: C2008:04
More informationCS 326: Operating Systems. Networking. Lecture 17
CS 326: Operating Systems Networking Lecture 17 Today s Schedule Project 3 Overview, Q&A Networking Basics Messaging 4/23/18 CS 326: Operating Systems 2 Today s Schedule Project 3 Overview, Q&A Networking
More informationChapter 12: I/O Systems
Chapter 12: I/O Systems Chapter 12: I/O Systems I/O Hardware! Application I/O Interface! Kernel I/O Subsystem! Transforming I/O Requests to Hardware Operations! STREAMS! Performance! Silberschatz, Galvin
More informationChapter 13: I/O Systems
Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations STREAMS Performance Silberschatz, Galvin and
More informationChapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition
Chapter 12: I/O Systems Silberschatz, Galvin and Gagne 2011 Chapter 12: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations STREAMS
More informationConcurrent Architectures - Unix: Sockets, Select & Signals
Concurrent Architectures - Unix: Sockets, Select & Signals Assignment 1: Drop In Labs reminder check compiles in CS labs & you have submitted all your files in StReAMS! formatting your work: why to 80
More informationIPv4 and ipv6 INTEROPERABILITY
IT2351-NPM/UNIT-4/ 1 IPv4 and ipv6 INTEROPERABILITY Till the time, IPv6 is established all over the world, there is a need for one to host dual stacks that is both IPv4 and IPv6 are running concurrently
More informationMemory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts
Memory management Last modified: 26.04.2016 1 Contents Background Logical and physical address spaces; address binding Overlaying, swapping Contiguous Memory Allocation Segmentation Paging Structure of
More informationA practical introduction to XDP
A practical introduction to XDP Jesper Dangaard Brouer (Red Hat) Andy Gospodarek (Broadcom) Linux Plumbers Conference (LPC) Vancouver, Nov 2018 1 What will you learn? Introduction to XDP and relationship
More informationSilberschatz and Galvin Chapter 12
Silberschatz and Galvin Chapter 12 I/O Systems CPSC 410--Richard Furuta 3/19/99 1 Topic overview I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O requests to hardware operations
More information1-1. Switching Networks (Fall 2010) EE 586 Communication and. October 25, Lecture 24
EE 586 Communication and Switching Networks (Fall 2010) Lecture 24 October 25, 2010 1-1 Announcements Midterm 1: Mean = 92.2 Stdev = 8 Still grading your programs (sorry about the delay) Network Layer
More informationOperating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester
Operating System: Chap13 I/O Systems National Tsing-Hua University 2016, Fall Semester Outline Overview I/O Hardware I/O Methods Kernel I/O Subsystem Performance Application Interface Operating System
More informationIPtables and Netfilter
in tables rely on IPtables and Netfilter Comp Sci 3600 Security Outline in tables rely on 1 2 in tables rely on 3 Linux firewall: IPtables in tables rely on Iptables is the userspace module, the bit that
More informationOpen Source Traffic Analyzer
Open Source Traffic Analyzer Daniel Turull June 2010 Outline 1 Introduction 2 Background study 3 Design 4 Implementation 5 Evaluation 6 Conclusions 7 Demo Outline 1 Introduction 2 Background study 3 Design
More informationCS 5460/6460 Operating Systems
CS 5460/6460 Operating Systems Fall 2009 Instructor: Matthew Flatt Lecturer: Kevin Tew TAs: Bigyan Mukherjee, Amrish Kapoor 1 Join the Mailing List! Reminders Make sure you can log into the CADE machines
More informationNetwork and Security: Introduction
Network and Security: Introduction Seungwon Shin KAIST Some slides are from Dr. Srinivasan Seshan Some slides are from Dr. Nick Mckeown Network Overview Computer Network Definition A computer network or
More informationLecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter
Lecture Topics Today: Operating System Overview (Stallings, chapter 2.1-2.4, 2.8-2.10) Next: Processes (Stallings, chapter 3.1-3.6) 1 Announcements Consulting hours posted Self-Study Exercise #3 posted
More information