Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (44 commits)
[NETLINK]: Fix unicast timeouts
[INET]: Remove per bucket rwlock in tcp/dccp ehash table.
[IPVS]: Synchronize closing of Connections
[IPVS]: Bind connections on stanby if the destination exists
[NET]: Remove Documentation/networking/pt.txt
[NET]: Remove Documentation/networking/routing.txt
[NET]: Remove Documentation/networking/ncsa-telnet
[NET]: Remove comx driver docs.
[NET]: Remove Documentation/networking/Configurable
[NET]: Clean proto_(un)register from in-code ifdefs
[IPSEC]: Fix crypto_alloc_comp error checking
[VLAN]: Fix SET_VLAN_INGRESS_PRIORITY_CMD ioctl
[NETNS]: Fix compiler error in net_namespace.c
[TTY]: Use tty_mode_ioctl() in network drivers.
[TTY]: Fix network driver interactions with TCGET/SET calls.
[PKT_SCHED] CLS_U32: Fix endianness problem with u32 classifier hash masks.
[NET]: Removing duplicit #includes
[NET]: Let USB_USBNET always select MII.
[RRUNNER]: Do not muck with sysctl_{r,w}mem_max
[DLM] lowcomms: Do not muck with sysctl_rmem_max.
...

+777 -1724
-10
Documentation/networking/00-INDEX
··· 4 4 - information on the 3Com EtherLink Plus (3c505) driver. 5 5 6pack.txt 6 6 - info on the 6pack protocol, an alternative to KISS for AX.25 7 - Configurable 8 - - info on some of the configurable network parameters 9 7 DLINK.txt 10 8 - info on the D-Link DE-600/DE-620 parallel port pocket adapters 11 9 PLIP.txt ··· 24 26 - info on the driver for Baycom style amateur radio modems 25 27 bridge.txt 26 28 - where to get user space programs for ethernet bridging with Linux. 27 - comx.txt 28 - - info on drivers for COMX line of synchronous serial adapters. 29 29 cops.txt 30 30 - info on the COPS LocalTalk Linux driver 31 31 cs89x0.txt ··· 74 78 - the Apple or Farallon LocalTalk PC card driver 75 79 multicast.txt 76 80 - Behaviour of cards under Multicast 77 - ncsa-telnet 78 - - notes on how NCSA telnet (DOS) breaks with MTU discovery enabled. 79 81 netdevices.txt 80 82 - info on network device driver functions exported to the kernel. 81 83 olympic.txt 82 84 - IBM PCI Pit/Pit-Phy/Olympic Token Ring driver info. 83 85 policy-routing.txt 84 86 - IP policy-based routing 85 - pt.txt 86 - - the Gracilis Packetwin AX.25 device driver 87 87 ray_cs.txt 88 88 - Raylink Wireless LAN card driver info. 89 - routing.txt 90 - - the new routing mechanism 91 89 shaper.txt 92 90 - info on the module that can shape/limit transmitted traffic. 93 91 sk98lin.txt
-34
Documentation/networking/Configurable
··· 1 - 2 - There are a few network parameters that can be tuned to better match 3 - the kernel to your system hardware and intended usage. The defaults 4 - are usually a good choice for 99% of the people 99% of the time, but 5 - you should be aware they do exist and can be changed. 6 - 7 - The current list of parameters can be found in the files: 8 - 9 - linux/net/TUNABLE 10 - Documentation/networking/ip-sysctl.txt 11 - 12 - Some of these are accessible via the sysctl interface, and many more are 13 - scheduled to be added in this way. For example, some parameters related 14 - to Address Resolution Protocol (ARP) are very easily viewed and altered. 15 - 16 - # cat /proc/sys/net/ipv4/arp_timeout 17 - 6000 18 - # echo 7000 > /proc/sys/net/ipv4/arp_timeout 19 - # cat /proc/sys/net/ipv4/arp_timeout 20 - 7000 21 - 22 - Others are already accessible via the related user space programs. 23 - For example, MAX_WINDOW has a default of 32 k which is a good choice for 24 - modern hardware, but if you have a slow (8 bit) Ethernet card and/or a slow 25 - machine, then this will be far too big for the card to keep up with fast 26 - machines transmitting on the same net, resulting in overruns and receive errors. 27 - A value of about 4 k would be more appropriate, which can be set via: 28 - 29 - # route add -net 192.168.3.0 window 4096 30 - 31 - The remainder of these can only be presently changed by altering a #define 32 - in the related header file. This means an edit and recompile cycle. 33 - 34 - Paul Gortmaker 06/96
-248
Documentation/networking/comx.txt
··· 1 - 2 - COMX drivers for the 2.2 kernel 3 - 4 - Originally written by: Tivadar Szemethy, <tiv@itc.hu> 5 - Currently maintained by: Gergely Madarasz <gorgo@itc.hu> 6 - 7 - Last change: 21/06/1999. 8 - 9 - INTRODUCTION 10 - 11 - This document describes the software drivers and their use for the 12 - COMX line of synchronous serial adapters for Linux version 2.2.0 and 13 - above. 14 - The cards are produced and sold by ITC-Pro Ltd. Budapest, Hungary 15 - For further info contact <info@itc.hu> 16 - or http://www.itc.hu (mostly in Hungarian). 17 - The firmware files and software are available from ftp://ftp.itc.hu 18 - 19 - Currently, the drivers support the following cards and protocols: 20 - 21 - COMX (2x64 kbps intelligent board) 22 - CMX (1x256 + 1x128 kbps intelligent board) 23 - HiCOMX (2x2Mbps intelligent board) 24 - LoCOMX (1x512 kbps passive board) 25 - MixCOM (1x512 or 2x512kbps passive board with a hardware watchdog an 26 - optional BRI interface and optional flashROM (1-32M)) 27 - SliceCOM (1x2Mbps channelized E1 board) 28 - PciCOM (X21) 29 - 30 - At the moment of writing this document, the (Cisco)-HDLC, LAPB, SyncPPP and 31 - Frame Relay (DTE, rfc1294 IP encapsulation with partially implemented Q933a 32 - LMI) protocols are available as link-level protocol. 33 - X.25 support is being worked on. 34 - 35 - USAGE 36 - 37 - Load the comx.o module and the hardware-specific and protocol-specific 38 - modules you'll need into the running kernel using the insmod utility. 39 - This creates the /proc/comx directory. 40 - See the example scripts in the 'etc' directory. 41 - 42 - /proc INTERFACE INTRO 43 - 44 - The COMX driver set has a new type of user interface based on the /proc 45 - filesystem which eliminates the need for external user-land software doing 46 - IOCTL calls. 47 - Each network interface or device (i.e. those ones you configure with 'ifconfig' 48 - and 'route' etc.) has a corresponding directory under /proc/comx. You can 49 - dynamically create a new interface by saying 'mkdir /proc/comx/comx0' (or you 50 - can name it whatever you want up to 8 characters long, comx[n] is just a 51 - convention). 52 - Generally the files contained in these directories are text files, which can 53 - be viewed by 'cat filename' and you can write a string to such a file by 54 - saying 'echo _string_ >filename'. This is very similar to the sysctl interface. 55 - Don't use a text editor to edit these files, always use 'echo' (or 'cat' 56 - where appropriate). 57 - When you've created the comx[n] directory, two files are created automagically 58 - in it: 'boardtype' and 'protocol'. You have to fill in these files correctly 59 - for your board and protocol you intend to use (see the board and protocol 60 - descriptions in this file below or the example scripts in the 'etc' directory). 61 - After filling in these files, other files will appear in the directory for 62 - setting the various hardware- and protocol-related informations (for example 63 - irq and io addresses, keepalive values etc.) These files are set to default 64 - values upon creation, so you don't necessarily have to change all of them. 65 - 66 - When you're ready with filling in the files in the comx[n] directory, you can 67 - configure the corresponding network interface with the standard network 68 - configuration utilities. If you're unable to bring the interfaces up, look up 69 - the various kernel log files on your system, and consult the messages for 70 - a probable reason. 71 - 72 - EXAMPLE 73 - 74 - To create the interface 'comx0' which is the first channel of a COMX card: 75 - 76 - insmod comx 77 - # insmod comx-hw-comx ; insmod comx-proto-ppp (these are usually 78 - autoloaded if you use the kernel module loader) 79 - 80 - mkdir /proc/comx/comx0 81 - echo comx >/proc/comx/comx0/boardtype 82 - echo 0x360 >/proc/comx/comx0/io <- jumper-selectable I/O port 83 - echo 0x0a >/proc/comx/comx0/irq <- jumper-selectable IRQ line 84 - echo 0xd000 >/proc/comx/comx0/memaddr <- software-configurable memory 85 - address. COMX uses 64 KB, and this 86 - can be: 0xa000, 0xb000, 0xc000, 87 - 0xd000, 0xe000. Avoid conflicts 88 - with other hardware. 89 - cat </etc/siol1.rom >/proc/comx/comx0/firmware <- the firmware for the card 90 - echo HDLC >/proc/comx/comx0/protocol <- the data-link protocol 91 - echo 10 >/proc/comx/comx0/keepalive <- the keepalive for the protocol 92 - ifconfig comx0 1.2.3.4 pointopoint 5.6.7.8 netmask 255.255.255.255 <- 93 - finally configure it with ifconfig 94 - Check its status: 95 - cat /proc/comx/comx0/status 96 - 97 - If you want to use the second channel of this board: 98 - 99 - mkdir /proc/comx/comx1 100 - echo comx >/proc/comx/comx1/boardtype 101 - echo 0x360 >/proc/comx/comx1/io 102 - echo 10 >/proc/comx/comx1/irq 103 - echo 0xd000 >/proc/comx/comx1/memaddr 104 - echo 1 >/proc/comx/comx1/channel <- channels are numbered 105 - as 0 (default) and 1 106 - 107 - Now, check if the driver recognized that you're going to use the other 108 - channel of the same adapter: 109 - 110 - cat /proc/comx/comx0/twin 111 - comx1 112 - cat /proc/comx/comx1/twin 113 - comx0 114 - 115 - You don't have to load the firmware twice, if you use both channels of 116 - an adapter, just write it into the channel 0's /proc firmware file. 117 - 118 - Default values: io 0x360 for COMX, 0x320 (HICOMX), irq 10, memaddr 0xd0000 119 - 120 - THE LOCOMX HARDWARE DRIVER 121 - 122 - The LoCOMX driver doesn't require firmware, and it doesn't use memory either, 123 - but it uses DMA channels 1 and 3. You can set the clock rate (if enabled by 124 - jumpers on the board) by writing the kbps value into the file named 'clock'. 125 - Set it to 'external' (it is the default) if you have external clock source. 126 - 127 - (Note: currently the LoCOMX driver does not support the internal clock) 128 - 129 - THE COMX, CMX AND HICOMX DRIVERS 130 - 131 - On the HICOMX, COMX and CMX, you have to load the firmware (it is different for 132 - the three cards!). All these adapters can share the same memory 133 - address (we usually use 0xd0000). On the CMX you can set the internal 134 - clock rate (if enabled by jumpers on the small adapter boards) by writing 135 - the kbps value into the 'clock' file. You have to do this before initializing 136 - the card. If you use both HICOMX and CMX/COMX cards, initialize the HICOMX 137 - first. The I/O address of the HICOMX board is not configurable by any 138 - method available to the user: it is hardwired to 0x320, and if you have to 139 - change it, consult ITC-Pro Ltd. 140 - 141 - THE MIXCOM DRIVER 142 - 143 - The MixCOM board doesn't require firmware, the driver communicates with 144 - it through I/O ports. You can have three of these cards in one machine. 145 - 146 - THE SLICECOM DRIVER 147 - 148 - The SliceCOM board doesn't require firmware. You can have 4 of these cards 149 - in one machine. The driver doesn't (yet) support shared interrupts, so 150 - you will need a separate IRQ line for every board. 151 - Read Documentation/networking/slicecom.txt for help on configuring 152 - this adapter. 153 - 154 - THE HDLC/PPP LINE PROTOCOL DRIVER 155 - 156 - The HDLC/SyncPPP line protocol driver uses the kernel's built-in syncppp 157 - driver (syncppp.o). You don't have to manually select syncppp.o when building 158 - the kernel, the dependencies compile it in automatically. 159 - 160 - 161 - 162 - 163 - EXAMPLE 164 - (setting up hw parameters, see above) 165 - 166 - # using HDLC: 167 - echo hdlc >/proc/comx/comx0/protocol 168 - echo 10 >/proc/comx/comx0/keepalive <- not necessary, 10 is the default 169 - ifconfig comx0 1.2.3.4 pointopoint 5.6.7.8 netmask 255.255.255.255 170 - 171 - (setting up hw parameters, see above) 172 - 173 - # using PPP: 174 - echo ppp >/proc/comx/comx0/protocol 175 - ifconfig comx0 up 176 - ifconfig comx0 1.2.3.4 pointopoint 5.6.7.8 netmask 255.255.255.255 177 - 178 - 179 - THE LAPB LINE PROTOCOL DRIVER 180 - 181 - For this, you'll need to configure LAPB support (See 'LAPB Data Link Driver' in 182 - 'Network options' section) into your kernel (thanks to Jonathan Naylor for his 183 - excellent implementation). 184 - comx-proto-lapb.o provides the following files in the appropriate directory 185 - (the default values in parens): t1 (5), t2 (1), n2 (20), mode (DTE, STD) and 186 - window (7). Agree with the administrator of your peer router on these 187 - settings (most people use defaults, but you have to know if you are DTE or 188 - DCE). 189 - 190 - EXAMPLE 191 - 192 - (setting up hw parameters, see above) 193 - echo lapb >/proc/comx/comx0/protocol 194 - echo dce >/proc/comx/comx0/mode <- DCE interface in this example 195 - ifconfig comx0 1.2.3.4 pointopoint 5.6.7.8 netmask 255.255.255.255 196 - 197 - 198 - THE FRAME RELAY PROTOCOL DRIVER 199 - 200 - You DON'T need any other frame relay related modules from the kernel to use 201 - COMX-Frame Relay. This protocol is a bit more complicated than the others, 202 - because it allows to use 'subinterfaces' or DLCIs within one physical device. 203 - First you have to create the 'master' device (the actual physical interface) 204 - as you would do for other protocols. Specify 'frad' as protocol type. 205 - Now you can bring this interface up by saying 'ifconfig comx0 up' (or whatever 206 - you've named the interface). Do not assign any IP address to this interface 207 - and do not set any routes through it. 208 - Then, set up your DLCIs the following way: create a comx interface for each 209 - DLCI you intend to use (with mkdir), and write 'dlci' to the 'boardtype' file, 210 - and 'ietf-ip' to the 'protocol' file. Currently, the only supported 211 - encapsulation type is this (also called as RFC1294/1490 IP encapsulation). 212 - Write the DLCI number to the 'dlci' file, and write the name of the physical 213 - COMX device to the file called 'master'. 214 - Now you can assign an IP address to this interface and set routes using it. 215 - See the example file for further info and example config script. 216 - Notes: this driver implements a DTE interface with partially implemented 217 - Q933a LMI. 218 - You can find an extensively commented example in the 'etc' directory. 219 - 220 - FURTHER /proc FILES 221 - 222 - boardtype: 223 - Type of the hardware. Valid values are: 224 - 'comx', 'hicomx', 'locomx', 'cmx', 'slicecom'. 225 - 226 - protocol: 227 - Data-link protocol on this channel. Can be: HDLC, LAPB, PPP, FRAD 228 - 229 - status: 230 - You can read the channel's actual status from the 'status' file, for example 231 - 'cat /proc/comx/comx3/status'. 232 - 233 - lineup_delay: 234 - Interpreted in seconds (default is 1). Used to avoid line jitter: the system 235 - will consider the line status 'UP' only if it is up for at least this number 236 - of seconds. 237 - 238 - debug: 239 - You can set various debug options through this file. Valid options are: 240 - 'comx_events', 'comx_tx', 'comx_rx', 'hw_events', 'hw_tx', 'hw_rx'. 241 - You can enable a debug options by writing its name prepended by a '+' into 242 - the debug file, for example 'echo +comx_rx >comx0/debug'. 243 - Disabling an option happens similarly, use the '-' prefix 244 - (e.g. 'echo -hw_rx >debug'). 245 - Debug results can be read from the debug file, for example: 246 - tail -f /proc/comx/comx2/debug 247 - 248 -
-16
Documentation/networking/ncsa-telnet
··· 1 - NCSA telnet doesn't work with path MTU discovery enabled. This is due to a 2 - bug in NCSA that also stops it working with other modern networking code 3 - such as Solaris. 4 - 5 - The following information is courtesy of 6 - Marek <marekm@i17linuxb.ists.pwr.wroc.pl> 7 - 8 - There is a fixed version somewhere on ftp.upe.ac.za (sorry, I don't 9 - remember the exact pathname, and this site is very slow from here). 10 - It may or may not be faster for you to get it from 11 - ftp://ftp.ists.pwr.wroc.pl/pub/msdos/telnet/ncsa_upe/tel23074.zip 12 - (source is in v230704s.zip). I have tested it with 1.3.79 (with 13 - path mtu discovery enabled - ncsa 2.3.08 didn't work) and it seems 14 - to work. I don't know if anyone is working on this code - this 15 - version is over a year old. Too bad - it's faster and often more 16 - stable than these windoze telnets, and runs on almost anything...
-58
Documentation/networking/pt.txt
··· 1 - This is the README for the Gracilis Packetwin device driver, version 0.5 2 - ALPHA for Linux 1.3.43. 3 - 4 - These files will allow you to talk to the PackeTwin (now know as PT) and 5 - connect through it just like a pair of TNCs. To do this you will also 6 - require the AX.25 code in the kernel enabled. 7 - 8 - There are four files in this archive; this readme, a patch file, a .c file 9 - and finally a .h file. The two program files need to be put into the 10 - drivers/net directory in the Linux source tree, for me this is the 11 - directory /usr/src/linux/drivers/net. The patch file needs to be patched in 12 - at the top of the Linux source tree (/usr/src/linux in my case). 13 - 14 - You will most probably have to edit the pt.c file to suit your own setup, 15 - this should just involve changing some of the defines at the top of the file. 16 - Please note that if you run an external modem you must specify a speed of 0. 17 - 18 - The program is currently setup to run a 4800 baud external modem on port A 19 - and a Kantronics DE-9600 daughter board on port B so if you have this (or 20 - something similar) then you're right. 21 - 22 - To compile in the driver, put the files in the correct place and patch in 23 - the diff. You will have to re-configure the kernel again before you 24 - recompile it. 25 - 26 - The driver is not real good at the moment for finding the card. You can 27 - 'help' it by changing the order of the potential addresses in the structure 28 - found in the pt_init() function so the address of where the card is is put 29 - first. 30 - 31 - After compiling, you have to get them going, they are pretty well like any 32 - other net device and just need ifconfig to get them going. 33 - As an example, here is my /etc/rc.net 34 - -------------------------- 35 - 36 - # 37 - # Configure the PackeTwin, port A. 38 - /sbin/ifconfig pt0a 44.136.8.87 hw ax25 vk2xlz mtu 512 39 - /sbin/ifconfig pt0a 44.136.8.87 broadcast 44.136.8.255 netmask 255.255.255.0 40 - /sbin/route add -net 44.136.8.0 netmask 255.255.255.0 dev pt0a 41 - /sbin/route add -net 44.0.0.0 netmask 255.0.0.0 gw 44.136.8.68 dev pt0a 42 - /sbin/route add -net 138.25.16.0 netmask 255.255.240.0 dev pt0a 43 - /sbin/route add -host 44.136.8.255 dev pt0a 44 - # 45 - # Configure the PackeTwin, port B. 46 - /sbin/ifconfig pt0b 44.136.8.87 hw ax25 vk2xlz-1 mtu 512 47 - /sbin/ifconfig pt0b 44.136.8.87 broadcast 44.255.255.255 netmask 255.0.0.0 48 - /sbin/route add -host 44.136.8.216 dev pt0b 49 - /sbin/route add -host 44.136.8.95 dev pt0b 50 - /sbin/route add -host 44.255.255.255 dev pt0b 51 - 52 - This version of the driver comes under the GNU GPL. If you have one of my 53 - previous (non-GPL) versions of the driver, please update to this one. 54 - 55 - I hope that this all works well for you. I would be pleased to hear how 56 - many people use the driver and if it does its job. 57 - 58 - - Craig vk2xlz <csmall@small.dropbear.id.au>
-46
Documentation/networking/routing.txt
··· 1 - The directory ftp.inr.ac.ru:/ip-routing contains: 2 - 3 - - iproute.c - "professional" routing table maintenance utility. 4 - 5 - - rdisc.tar.gz - rdisc daemon, ported from Sun. 6 - STRONGLY RECOMMENDED FOR ALL HOSTS. 7 - 8 - - routing.tgz - original Mike McLagan's route by source patch. 9 - Currently it is obsolete. 10 - 11 - - gated.dif-ss<NEWEST>.gz - gated-R3_6Alpha_2 fixes. 12 - Look at README.gated 13 - 14 - - mrouted-3.8.dif.gz - mrouted-3.8 fixes. 15 - 16 - - rtmon.c - trivial debugging utility: reads and stores netlink. 17 - 18 - 19 - NEWS for user. 20 - 21 - - Policy based routing. Routing decisions are made on the basis 22 - not only of destination address, but also source address, 23 - TOS and incoming interface. 24 - - Complete set of IP level control messages. 25 - Now Linux is the only OS in the world complying to RFC requirements. 26 - Great win 8) 27 - - New interface addressing paradigm. 28 - Assignment of address ranges to interface, 29 - multiple prefixes etc. etc. 30 - Do not bother, it is compatible with the old one. Moreover: 31 - - You don't need to do "route add aaa.bbb.ccc... eth0" anymore, 32 - it is done automatically. 33 - - "Abstract" UNIX sockets and security enhancements. 34 - This is necessary to use TIRPC and TLI emulation library. 35 - 36 - NEWS for hacker. 37 - 38 - - New destination cache. Flexible, robust and just beautiful. 39 - - Network stack is reordered, simplified, optimized, a lot of bugs fixed. 40 - (well, and new bugs were introduced, but I haven't seen them yet 8)) 41 - It is difficult to describe all the changes, look into source. 42 - 43 - If you see this file, then this patch works 8) 44 - 45 - Alexey Kuznetsov. 46 - kuznet@ms2.inr.ac.ru
-371
Documentation/networking/slicecom.hun
··· 1 - 2 - SliceCOM adapter felhasznaloi dokumentacioja - 0.51 verziohoz 3 - 4 - Bartók István <bartoki@itc.hu> 5 - Utolso modositas: Wed Aug 29 17:26:58 CEST 2001 6 - 7 - ----------------------------------------------------------------- 8 - 9 - Hasznalata: 10 - 11 - Forditas: 12 - 13 - Code maturity level options 14 - [*] Prompt for development and/or incomplete code/drivers 15 - 16 - Network device support 17 - Wan interfaces 18 - <M> MultiGate (COMX) synchronous 19 - <M> Support for MUNICH based boards: SliceCOM, PCICOM (NEW) 20 - <M> Support for HDLC and syncPPP... 21 - 22 - 23 - A modulok betoltese: 24 - 25 - modprobe comx 26 - 27 - modprobe comx-proto-ppp # a Cisco-HDLC es a SyncPPP protokollt is 28 - # ez a modul adja 29 - 30 - modprobe comx-hw-munich # a modul betoltodeskor azonnal jelent a 31 - # syslogba a detektalt kartyakrol 32 - 33 - 34 - Konfiguralas: 35 - 36 - # Ezen az interfeszen Cisco-HDLC vonali protokoll fog futni 37 - # Az interfeszhez rendelt idoszeletek: 1,2 (128 kbit/sec-es vonal) 38 - # (a G.703 keretben az elso adatot vivo idoszelet az 1-es) 39 - # 40 - mkdir /proc/comx/comx0.1/ 41 - echo slicecom >/proc/comx/comx0.1/boardtype 42 - echo hdlc >/proc/comx/comx0.1/protocol 43 - echo 1 2 >/proc/comx/comx0.1/timeslots 44 - 45 - 46 - # Ezen az interfeszen SyncPPP vonali protokoll fog futni 47 - # Az interfeszhez rendelt idoszelet: 3 (64 kbit/sec-es vonal) 48 - # 49 - mkdir /proc/comx/comx0.2/ 50 - echo slicecom >/proc/comx/comx0.2/boardtype 51 - echo ppp >/proc/comx/comx0.2/protocol 52 - echo 3 >/proc/comx/comx0.2/timeslots 53 - 54 - ... 55 - 56 - ifconfig comx0.1 up 57 - ifconfig comx0.2 up 58 - 59 - ----------------------------------------------------------------- 60 - 61 - A COMX driverek default 20 csomagnyi transmit queue-t rendelnek a halozati 62 - interfeszekhez. WAN halozatokban ennel hosszabbat is szokas hasznalni 63 - (20 es 100 kozott), hogy a vonal kihasznaltsaga nagy terheles eseten jobb 64 - legyen (bar ezzel megno a varhato kesleltetes a csomagok sorban allasa miatt): 65 - 66 - # ifconfig comx0 txqueuelen 50 67 - 68 - Ezt a beallitasi lehetoseget csak az ujabb disztribuciok ifconfig parancsa 69 - tamogatja (amik mar a 2.2 kernelekhez keszultek, mint a RedHat 6.1 vagy a 70 - Debian 2.2). 71 - 72 - A 2.1-es Debian disztribuciohoz a http://www.debian.org/~rcw/2.2/netbase/ 73 - cimrol toltheto le ujabb netbase csomag, ami mar ilyet tamogato ifconfig 74 - parancsot tartalmaz. Bovebben a 2.2 kernel hasznalatarol Debian 2.1 alatt: 75 - http://www.debian.org/releases/stable/running-kernel-2.2 76 - 77 - ----------------------------------------------------------------- 78 - 79 - A kartya LED-jeinek jelentese: 80 - 81 - piros - eg, ha Remote Alarm-ot kuld a tuloldal 82 - zold - eg, ha a vett jelben megtalalja a keretszinkront 83 - 84 - Reszletesebben: 85 - 86 - piros: zold: jelentes: 87 - 88 - - - nincs keretszinkron (nincs jel, vagy rossz a jel) 89 - - eg "minden rendben" 90 - eg eg a vetel OK, de a tuloldal Remote Alarm-ot kuld 91 - eg - ez nincs ertelmezve, egyelore funkcio nelkul 92 - 93 - ----------------------------------------------------------------- 94 - 95 - Reszletesebb leiras a hardver beallitasi lehetosegeirol: 96 - 97 - Az altalanos,- es a protokoll-retegek beallitasi lehetosegeirol a 'comx.txt' 98 - fajlban leirtak SliceCOM kartyanal is ervenyesek, itt csak a hardver-specifikus 99 - beallitasi lehetosegek vannak osszefoglalva: 100 - 101 - Konfiguralasi interfesz a /proc/comx/ alatt: 102 - 103 - Minden timeslot-csoportnak kulon comx* interfeszt kell letrehozni mkdir-rel: 104 - comx0, comx1, .. stb. Itt beallithato, hogy az adott interfesz hanyadik kartya 105 - melyik timeslotja(i)bol alljon ossze. A Cisco-fele serial3:1 elnevezesek 106 - (serial3:1 = a 3. kartyaban az 1-es idoszelet-csoport) Linuxon aliasing-ot 107 - jelentenenek, ezert mi nem tudunk ilyen elnevezest hasznalni. 108 - 109 - Tobb kartya eseten a comx0.1, comx0.2, ... vagy slice0.1, slice0.2 nevek 110 - hasznalhatoak. 111 - 112 - Tobb SliceCOM kartya is lehet egy gepben, de sajat interrupt kell mindegyiknek, 113 - nem tud meg megosztott interruptot kezelni. 114 - 115 - Az egesz kartyat erinto beallitasok: 116 - 117 - Az ioport es irq beallitas nincs: amit a PCI BIOS kioszt a rendszernek, 118 - azt hasznalja a driver. 119 - 120 - 121 - comx0/boardnum - hanyadik SliceCOM kartya a gepben (a 'termeszetes' PCI 122 - sorrendben ertve: ahogyan a /proc/pci-ban vagy az 'lspci' 123 - kimeneteben megjelenik, altalaban az alaplapi PCI meghajto 124 - aramkorokhoz kozelebb eso kartyak a kisebb sorszamuak) 125 - 126 - Default: 0 (0-tol kezdodik a szamolas) 127 - 128 - 129 - Bar a kovetkezoket csak egy-egy interfeszen allitjuk at, megis az egesz kartya 130 - mukodeset egyszerre allitjak. A megkotes hogy csak UP-ban levo interfeszen 131 - hasznalhatoak, azert van, mert kulonben nem vart eredmenyekre vezetne egy ilyen 132 - paranccsorozat: 133 - 134 - echo 0 >boardnum 135 - echo internal >clock_source 136 - echo 1 >boardnum 137 - 138 - - Ez a 0-s board clock_source-at allitana at. 139 - 140 - Ezek a beallitasok megmaradnak az osszes interfesz torlesekor, de torlodnek 141 - a driver modul ki/betoltesekor. 142 - 143 - 144 - comx0/clock_source - A Tx orajelforrasa, a Cisco-val hasonlatosra keszult. 145 - Hasznalata: 146 - 147 - papaya:# echo line >/proc/comx/comx0/clock_source 148 - papaya:# echo internal >/proc/comx/comx0/clock_source 149 - 150 - line - A Tx orajelet a vett adatfolyambol dekodolja, igyekszik 151 - igazodni hozza. Ha nem lat orajelet az inputon, akkor 152 - atall a sajat orajelgeneratorara. 153 - internal - A Tx orajelet a sajat orajelgeneratora szolgaltatja. 154 - 155 - Default: line 156 - 157 - Normal osszeallitas eseten a tavkozlesi szolgaltato eszkoze 158 - (pl. HDSL modem) adja az orajelet, ezert ez a default. 159 - 160 - 161 - comx0/framing - A CRC4 ki/be kapcsolasa 162 - 163 - A CRC4: 16 PCM keretet (A PCM keret az, amibe a 32 darab 64 164 - kilobites csatorna van bemultiplexalva. Nem osszetevesztendo a HDLC 165 - kerettel.) 2x8 -as csoportokra osztanak, es azokhoz 4-4 bites CRC-t 166 - szamolnak. Elsosorban a vonal minosegenek a monitorozasara szolgal. 167 - 168 - papaya:~# echo crc4 >/proc/comx/comx0/framing 169 - papaya:~# echo no-crc4 >/proc/comx/comx0/framing 170 - 171 - Default a 'crc4', a MATAV vonalak altalaban igy futnak. De ha nem 172 - egyforma is a beallitas a vonal ket vegen, attol a forgalom altalaban 173 - at tud menni. 174 - 175 - 176 - comx0/linecode - A vonali kodolas beallitasa 177 - 178 - papaya:~# echo hdb3 >/proc/comx/comx0/linecode 179 - papaya:~# echo ami >/proc/comx/comx0/linecode 180 - 181 - Default a 'hdb3', a MATAV vonalak igy futnak. 182 - 183 - (az AMI kodolas igen ritka E1-es vonalaknal). Ha ez a beallitas nem 184 - egyezik a vonal ket vegen, akkor elofordulhat hogy a keretszinkron 185 - osszejon, de CRC4-hibak es a vonalakon atvitt adatokban is hibak 186 - keletkeznek (amit a HDLC/SyncPPP szinten CRC-hibaval jelez) 187 - 188 - 189 - comx0/reg - a kartya aramkoreinek, a MUNICH (reg) es a FALC (lbireg) 190 - comx0/lbireg regisztereinek kozvetlen elerese. Hasznalata: 191 - 192 - echo >reg 0x04 0x0 - a 4-es regiszterbe 0-t ir 193 - echo >reg 0x104 - printk()-val kiirja a 4-es regiszter 194 - tartalmat a syslogba. 195 - 196 - WARNING: ezek csak a fejleszteshez keszultek, sok galibat 197 - lehet veluk okozni! 198 - 199 - 200 - comx0/loopback - A kartya G.703 jelenek a visszahurkolasara is van lehetoseg: 201 - 202 - papaya:# echo none >/proc/comx/comx0/loopback 203 - papaya:# echo local >/proc/comx/comx0/loopback 204 - papaya:# echo remote >/proc/comx/comx0/loopback 205 - 206 - none - nincs visszahurkolas, normal mukodes 207 - local - a kartya a sajat maga altal adott jelet kapja vissza 208 - remote - a kartya a kivulrol vett jelet adja kifele 209 - 210 - Default: none 211 - 212 - ----------------------------------------------------------------- 213 - 214 - Az interfeszhez (Cisco terminologiaban 'channel-group') kapcsolodo beallitasok: 215 - 216 - comx0/timeslots - mely timeslotok (idoszeletek) tartoznak az adott interfeszhez. 217 - 218 - papaya:~# cat /proc/comx/comx0/timeslots 219 - 1 3 4 5 6 220 - papaya:~# 221 - 222 - Egy timeslot megkeresese (hanyas interfeszbe tartozik nalunk): 223 - 224 - papaya:~# grep ' 4' /proc/comx/comx*/timeslots 225 - /proc/comx/comx0/timeslots:1 3 4 5 6 226 - papaya:~# 227 - 228 - Beallitasa: 229 - papaya:~# echo '1 5 2 6 7 8' >/proc/comx/comx0/timeslots 230 - 231 - A timeslotok sorrendje nem szamit, '1 3 2' ugyanaz mint az '1 2 3'. 232 - 233 - Beallitashoz az adott interfesznek DOWN-ban kell lennie 234 - (ifconfig comx0 down), de ugyanannak a kartyanak a tobbi interfesze 235 - uzemelhet kozben. 236 - 237 - Beallitaskor leellenorzi, hogy az uj timeslotok nem utkoznek-e egy 238 - masik interfesz timeslotjaival. Ha utkoznek, akkor nem allitja at. 239 - 240 - Mindig 10-es szamrendszerben tortenik a timeslotok ertelmezese, nehogy 241 - a 08, 09 alaku felirast rosszul ertelmezze. 242 - 243 - ----------------------------------------------------------------- 244 - 245 - Az interfeszek es a kartya allapotanak lekerdezese: 246 - 247 - - A ' '-szel kezdodo sorok az eredeti kimenetet, a //-rel kezdodo sorok a 248 - magyarazatot jelzik. 249 - 250 - papaya:~$ cat /proc/comx/comx1/status 251 - Interface administrative status is UP, modem status is UP, protocol is UP 252 - Modem status changes: 0, Transmitter status is IDLE, tbusy: 0 253 - Interface load (input): 978376 / 947808 / 951024 bits/s (5s/5m/15m) 254 - (output): 978376 / 947848 / 951024 bits/s (5s/5m/15m) 255 - Debug flags: none 256 - RX errors: len: 22, overrun: 1, crc: 0, aborts: 0 257 - buffer overrun: 0, pbuffer overrun: 0 258 - TX errors: underrun: 0 259 - Line keepalive (value: 10) status UP [0] 260 - 261 - // Itt kezdodik a hardver-specifikus resz: 262 - Controller status: 263 - No alarms 264 - 265 - // Alarm: hibajelzes: 266 - // 267 - // No alarms - minden rendben 268 - // 269 - // LOS - Loss Of Signal - nem erzekel jelet a bemeneten. 270 - // AIS - Alarm Indication Signal - csak egymas utani 1-esek jonnek 271 - // a bemeneten, a tuloldal igy is jelezheti hogy meghibasodott vagy 272 - // nincs inicializalva. 273 - // AUXP - Auxiliary Pattern Indication - 01010101.. sorozat jon a bemeneten. 274 - // LFA - Loss of Frame Alignment - nincs keretszinkron 275 - // RRA - Receive Remote Alarm - a tuloldal el, de hibat jelez. 276 - // LMFA - Loss of CRC4 Multiframe Alignment - nincs CRC4-multikeret-szinkron 277 - // NMF - No Multiframe alignment Found after 400 msec - ilyen alarm a no-crc4 278 - // es crc4 keretezesek eseten nincs, lasd lentebb 279 - // 280 - // Egyeb lehetseges hibajelzesek: 281 - // 282 - // Transmit Line Short - a kartya ugy erzi hogy az adasi kimenete rovidre 283 - // van zarva, ezert kikapcsolta az adast. (nem feltetlenul veszi eszre 284 - // a kulso rovidzarat) 285 - 286 - // A veteli oldal csomagjainak lancolt listai, debug celokra: 287 - 288 - Rx ring: 289 - rafutott: 0 290 - lastcheck: 50845731, jiffies: 51314281 291 - base: 017b1858 292 - rx_desc_ptr: 0 293 - rx_desc_ptr: 017b1858 294 - hw_curr_ptr: 017b1858 295 - 06040000 017b1868 017b1898 c016ff00 296 - 06040000 017b1878 017b1e9c c016ff00 297 - 46040000 017b1888 017b24a0 c016ff00 298 - 06040000 017b1858 017b2aa4 c016ff00 299 - 300 - // A kartyat hasznalo tobbi interfesz: a 0-s channel-group a comx1 interfesz, 301 - // es az 1,2,...,16 timeslotok tartoznak hozza: 302 - 303 - Interfaces using this board: (channel-group, interface, timeslots) 304 - 0 comx1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 305 - 1 comx2: 17 306 - 2 comx3: 18 307 - 3 comx4: 19 308 - 4 comx5: 20 309 - 5 comx6: 21 310 - 6 comx7: 22 311 - 7 comx8: 23 312 - 8 comx9: 24 313 - 9 comx10: 25 314 - 10 comx11: 26 315 - 11 comx12: 27 316 - 12 comx13: 28 317 - 13 comx14: 29 318 - 14 comx15: 30 319 - 15 comx16: 31 320 - 321 - // Hany esemenyt kezelt le a driver egy-egy hardver-interrupt kiszolgalasanal: 322 - 323 - Interrupt work histogram: 324 - hist[ 0]: 0 hist[ 1]: 2 hist[ 2]: 18574 hist[ 3]: 79 325 - hist[ 4]: 14 hist[ 5]: 1 hist[ 6]: 0 hist[ 7]: 1 326 - hist[ 8]: 0 hist[ 9]: 7 327 - 328 - // Hany kikuldendo csomag volt mar a Tx-ringben amikor ujabb lett irva bele: 329 - 330 - Tx ring histogram: 331 - hist[ 0]: 2329 hist[ 1]: 0 hist[ 2]: 0 hist[ 3]: 0 332 - 333 - // Az E1-interfesz hiba-szamlaloi, az rfc2495-nek megfeleloen: 334 - // (kb. a Cisco routerek "show controllers e1" formatumaban: http://www.cisco.com/univercd/cc/td/doc/product/software/ios11/rbook/rinterfc.htm#xtocid25669126) 335 - 336 - Data in current interval (91 seconds elapsed): 337 - 9516 Line Code Violations, 65 Path Code Violations, 2 E-Bit Errors 338 - 0 Slip Secs, 2 Fr Loss Secs, 2 Line Err Secs, 0 Degraded Mins 339 - 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 11 Unavail Secs 340 - Data in Interval 1 (15 minutes): 341 - 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors 342 - 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 343 - 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 344 - Data in last 4 intervals (1 hour): 345 - 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors 346 - 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 347 - 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 348 - Data in last 96 intervals (24 hours): 349 - 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors 350 - 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 351 - 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 352 - 353 - ----------------------------------------------------------------- 354 - 355 - Nehany kulonlegesebb beallitasi lehetoseg (idovel beepulhetnek majd a driverbe): 356 - Ezekkel sok galibat lehet okozni, nagyon ovatosan kell oket hasznalni! 357 - 358 - modified CRC-4, for improved interworking of CRC-4 and non-CRC-4 359 - devices: (lasd page 107 es g706 Annex B) 360 - lbireg[ 0x1b ] |= 0x08 361 - lbireg[ 0x1c ] |= 0xc0 362 - - ilyenkor ertelmezett az NMF - 'No Multiframe alignment Found after 363 - 400 msec' alarm. 364 - 365 - FALC - a vonali meghajto IC 366 - local loop - a sajat adasomat halljam vissza 367 - remote loop - a kivulrol jovo adast adom vissza 368 - 369 - Egy hibakeresesre hasznalhato dolog: 370 - - 1-es timeslot local loop a FALC-ban: echo >lbireg 0x1d 0x21 371 - - local loop kikapcsolasa: echo >lbireg 0x1d 0x00
-369
Documentation/networking/slicecom.txt
··· 1 - 2 - SliceCOM adapter user's documentation - for the 0.51 driver version 3 - 4 - Written by Bartók István <bartoki@itc.hu> 5 - 6 - English translation: Lakatos György <gyuri@itc.hu> 7 - Mon Dec 11 15:28:42 CET 2000 8 - 9 - Last modified: Wed Aug 29 17:25:37 CEST 2001 10 - 11 - ----------------------------------------------------------------- 12 - 13 - Usage: 14 - 15 - Compiling the kernel: 16 - 17 - Code maturity level options 18 - [*] Prompt for development and/or incomplete code/drivers 19 - 20 - Network device support 21 - Wan interfaces 22 - <M> MultiGate (COMX) synchronous 23 - <M> Support for MUNICH based boards: SliceCOM, PCICOM (NEW) 24 - <M> Support for HDLC and syncPPP... 25 - 26 - 27 - Loading the modules: 28 - 29 - modprobe comx 30 - 31 - modprobe comx-proto-ppp # module for Cisco-HDLC and SyncPPP protocols 32 - 33 - modprobe comx-hw-munich # the module logs information by the kernel 34 - # about the detected boards 35 - 36 - 37 - Configuring the board: 38 - 39 - # This interface will use the Cisco-HDLC line protocol, 40 - # the timeslices assigned are 1,2 (128 KiBit line speed) 41 - # (the first data timeslice in the G.703 frame is no. 1) 42 - # 43 - mkdir /proc/comx/comx0.1/ 44 - echo slicecom >/proc/comx/comx0.1/boardtype 45 - echo hdlc >/proc/comx/comx0.1/protocol 46 - echo 1 2 >/proc/comx/comx0.1/timeslots 47 - 48 - 49 - # This interface uses SyncPPP line protocol, the assigned 50 - # is no. 3 (64 KiBit line speed) 51 - # 52 - mkdir /proc/comx/comx0.2/ 53 - echo slicecom >/proc/comx/comx0.2/boardtype 54 - echo ppp >/proc/comx/comx0.2/protocol 55 - echo 3 >/proc/comx/comx0.2/timeslots 56 - 57 - ... 58 - 59 - ifconfig comx0.1 up 60 - ifconfig comx0.2 up 61 - 62 - ----------------------------------------------------------------- 63 - 64 - The COMX interfaces use a 10 packet transmit queue by default, however WAN 65 - networks sometimes use bigger values (20 to 100), to utilize the line better 66 - by large traffic (though the line delay increases because of more packets 67 - join the queue). 68 - 69 - # ifconfig comx0 txqueuelen 50 70 - 71 - This option is only supported by the ifconfig command of the later 72 - distributions, which came with 2.2 kernels, such as RedHat 6.1 or Debian 2.2. 73 - 74 - You can download a newer netbase packet from 75 - http://www.debian.org/~rcw/2.2/netbase/ for Debian 2.1, which has a new 76 - ifconfig. You can get further information about using 2.2 kernel with 77 - Debian 2.1 from http://www.debian.org/releases/stable/running-kernel-2.2 78 - 79 - ----------------------------------------------------------------- 80 - 81 - The SliceCom LEDs: 82 - 83 - red - on, if the interface is unconfigured, or it gets Remote Alarm-s 84 - green - on, if the board finds frame-sync in the received signal 85 - 86 - A bit more detailed: 87 - 88 - red: green: meaning: 89 - 90 - - - no frame-sync, no signal received, or signal SNAFU. 91 - - on "Everything is OK" 92 - on on Reception is ok, but the remote end sends Remote Alarm 93 - on - The interface is unconfigured 94 - 95 - ----------------------------------------------------------------- 96 - 97 - A more detailed description of the hardware setting options: 98 - 99 - The general and the protocol layer options described in the 'comx.txt' file 100 - apply to the SliceCom as well, I only summarize the SliceCom hardware specific 101 - settings below. 102 - 103 - The '/proc/comx' configuring interface: 104 - 105 - An interface directory should be created for every timeslot group with 106 - 'mkdir', e,g: 'comx0', 'comx1' etc. The timeslots can be assigned here to the 107 - specific interface. The Cisco-like naming convention (serial3:1 - first 108 - timeslot group of the 3rd. board) can't be used here, because these mean IP 109 - aliasing in Linux. 110 - 111 - You can give any meaningful name to keep the configuration clear; 112 - e.g: 'comx0.1', 'comx0.2', 'comx1.1', comx1.2', if you have two boards 113 - with two interfaces each. 114 - 115 - Settings, which apply to the board: 116 - 117 - Neither 'io' nor 'irq' settings required, the driver uses the resources 118 - given by the PCI BIOS. 119 - 120 - comx0/boardnum - board number of the SliceCom in the PC (using the 'natural' 121 - PCI order) as listed in '/proc/pci' or the output of the 122 - 'lspci' command, generally the slots nearer to the motherboard 123 - PCI driver chips have the lower numbers. 124 - 125 - Default: 0 (the counting starts with 0) 126 - 127 - Though the options below are to be set on a single interface, they apply to the 128 - whole board. The restriction, to use them on 'UP' interfaces, is because the 129 - command sequence below could lead to unpredictable results. 130 - 131 - # echo 0 >boardnum 132 - # echo internal >clock_source 133 - # echo 1 >boardnum 134 - 135 - The sequence would set the clock source of board 0. 136 - 137 - These settings will persist after all the interfaces are cleared, but are 138 - cleared when the driver module is unloaded and loaded again. 139 - 140 - comx0/clock_source - source of the transmit clock 141 - Usage: 142 - 143 - # echo line >/proc/comx/comx0/clock_source 144 - # echo internal >/proc/comx/comx0/clock_source 145 - 146 - line - The Tx clock is being decoded if the input data stream, 147 - if no clock seen on the input, then the board will use it's 148 - own clock generator. 149 - 150 - internal - The Tx clock is supplied by the builtin clock generator. 151 - 152 - Default: line 153 - 154 - Normally, the telecommunication company's end device (the HDSL 155 - modem) provides the Tx clock, that's why 'line' is the default. 156 - 157 - comx0/framing - Switching CRC4 off/on 158 - 159 - CRC4: 16 PCM frames (The 32 64Kibit channels are multiplexed into a 160 - PCM frame, nothing to do with HDLC frames) are divided into 2x8 161 - groups, each group has a 4 bit CRC. 162 - 163 - # echo crc4 >/proc/comx/comx0/framing 164 - # echo no-crc4 >/proc/comx/comx0/framing 165 - 166 - Default is 'crc4', the Hungarian MATAV lines behave like this. 167 - The traffic generally passes if this setting on both ends don't match. 168 - 169 - comx0/linecode - Setting the line coding 170 - 171 - # echo hdb3 >/proc/comx/comx0/linecode 172 - # echo ami >/proc/comx/comx0/linecode 173 - 174 - Default a 'hdb3', MATAV lines use this. 175 - 176 - (AMI coding is rarely used with E1 lines). Frame sync may occur, if 177 - this setting doesn't match the other end's, but CRC4 and data errors 178 - will come, which will result in CRC errors on HDLC/SyncPPP level. 179 - 180 - comx0/reg - direct access to the board's MUNICH (reg) and FALC (lbireg) 181 - comx0/lbireg circuit's registers 182 - 183 - # echo >reg 0x04 0x0 - write 0 to register 4 184 - # echo >reg 0x104 - write the contents of register 4 with 185 - printk() to syslog 186 - 187 - WARNING! These are only for development purposes, messing with this will 188 - result much trouble! 189 - 190 - comx0/loopback - Places a loop to the board's G.703 signals 191 - 192 - # echo none >/proc/comx/comx0/loopback 193 - # echo local >/proc/comx/comx0/loopback 194 - # echo remote >/proc/comx/comx0/loopback 195 - 196 - none - normal operation, no loop 197 - local - the board receives it's own output 198 - remote - the board sends the received data to the remote side 199 - 200 - Default: none 201 - 202 - ----------------------------------------------------------------- 203 - 204 - Interface (channel group in Cisco terms) settings: 205 - 206 - comx0/timeslots - which timeslots belong to the given interface 207 - 208 - Setting: 209 - 210 - # echo '1 5 2 6 7 8' >/proc/comx/comx0/timeslots 211 - 212 - # cat /proc/comx/comx0/timeslots 213 - 1 2 5 6 7 8 214 - # 215 - 216 - Finding a timeslot: 217 - 218 - # grep ' 4' /proc/comx/comx*/timeslots 219 - /proc/comx/comx0/timeslots:1 3 4 5 6 220 - # 221 - 222 - The timeslots can be in any order, '1 2 3' is the same as '1 3 2'. 223 - 224 - The interface has to be DOWN during the setting ('ifconfig comx0 225 - down'), but the other interfaces could operate normally. 226 - 227 - The driver checks if the assigned timeslots are vacant, if not, then 228 - the setting won't be applied. 229 - 230 - The timeslot values are treated as decimal numbers, not to misunderstand 231 - values of 08, 09 form. 232 - 233 - ----------------------------------------------------------------- 234 - 235 - Checking the interface and board status: 236 - 237 - - Lines beginning with ' ' (space) belong to the original output, the lines 238 - which begin with '//' are the comments. 239 - 240 - papaya:~$ cat /proc/comx/comx1/status 241 - Interface administrative status is UP, modem status is UP, protocol is UP 242 - Modem status changes: 0, Transmitter status is IDLE, tbusy: 0 243 - Interface load (input): 978376 / 947808 / 951024 bits/s (5s/5m/15m) 244 - (output): 978376 / 947848 / 951024 bits/s (5s/5m/15m) 245 - Debug flags: none 246 - RX errors: len: 22, overrun: 1, crc: 0, aborts: 0 247 - buffer overrun: 0, pbuffer overrun: 0 248 - TX errors: underrun: 0 249 - Line keepalive (value: 10) status UP [0] 250 - 251 - // The hardware specific part starts here: 252 - Controller status: 253 - No alarms 254 - 255 - // Alarm: 256 - // 257 - // No alarms - Everything OK 258 - // 259 - // LOS - Loss Of Signal - No signal sensed on the input 260 - // AIS - Alarm Indication Signal - The remote side sends '11111111'-s, 261 - // it tells, that there's an error condition, or it's not 262 - // initialised. 263 - // AUXP - Auxiliary Pattern Indication - 01010101.. received. 264 - // LFA - Loss of Frame Alignment - no frame sync received. 265 - // RRA - Receive Remote Alarm - the remote end's OK, but signals error cond. 266 - // LMFA - Loss of CRC4 Multiframe Alignment - no CRC4 multiframe sync. 267 - // NMF - No Multiframe alignment Found after 400 msec - no such alarm using 268 - // no-crc4 or crc4 framing, see below. 269 - // 270 - // Other possible error messages: 271 - // 272 - // Transmit Line Short - the board felt, that it's output is short-circuited, 273 - // so it switched the transmission off. (The board can't definitely tell, 274 - // that it's output is short-circuited.) 275 - 276 - // Chained list of the received packets, for debug purposes: 277 - 278 - Rx ring: 279 - rafutott: 0 280 - lastcheck: 50845731, jiffies: 51314281 281 - base: 017b1858 282 - rx_desc_ptr: 0 283 - rx_desc_ptr: 017b1858 284 - hw_curr_ptr: 017b1858 285 - 06040000 017b1868 017b1898 c016ff00 286 - 06040000 017b1878 017b1e9c c016ff00 287 - 46040000 017b1888 017b24a0 c016ff00 288 - 06040000 017b1858 017b2aa4 c016ff00 289 - 290 - // All the interfaces using the board: comx1, using the 1,2,...16 timeslots, 291 - // comx2, using timeslot 17, etc. 292 - 293 - Interfaces using this board: (channel-group, interface, timeslots) 294 - 0 comx1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 295 - 1 comx2: 17 296 - 2 comx3: 18 297 - 3 comx4: 19 298 - 4 comx5: 20 299 - 5 comx6: 21 300 - 6 comx7: 22 301 - 7 comx8: 23 302 - 8 comx9: 24 303 - 9 comx10: 25 304 - 10 comx11: 26 305 - 11 comx12: 27 306 - 12 comx13: 28 307 - 13 comx14: 29 308 - 14 comx15: 30 309 - 15 comx16: 31 310 - 311 - // The number of events handled by the driver during an interrupt cycle: 312 - 313 - Interrupt work histogram: 314 - hist[ 0]: 0 hist[ 1]: 2 hist[ 2]: 18574 hist[ 3]: 79 315 - hist[ 4]: 14 hist[ 5]: 1 hist[ 6]: 0 hist[ 7]: 1 316 - hist[ 8]: 0 hist[ 9]: 7 317 - 318 - // The number of packets to send in the Tx ring, when a new one arrived: 319 - 320 - Tx ring histogram: 321 - hist[ 0]: 2329 hist[ 1]: 0 hist[ 2]: 0 hist[ 3]: 0 322 - 323 - // The error counters of the E1 interface, according to the RFC2495, 324 - // (similar to the Cisco "show controllers e1" command's output: 325 - // http://www.cisco.com/univercd/cc/td/doc/product/software/ios11/rbook/rinterfc.htm#xtocid25669126) 326 - 327 - Data in current interval (91 seconds elapsed): 328 - 9516 Line Code Violations, 65 Path Code Violations, 2 E-Bit Errors 329 - 0 Slip Secs, 2 Fr Loss Secs, 2 Line Err Secs, 0 Degraded Mins 330 - 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 11 Unavail Secs 331 - Data in Interval 1 (15 minutes): 332 - 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors 333 - 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 334 - 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 335 - Data in last 4 intervals (1 hour): 336 - 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors 337 - 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 338 - 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 339 - Data in last 96 intervals (24 hours): 340 - 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors 341 - 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 342 - 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 343 - 344 - ----------------------------------------------------------------- 345 - 346 - Some unique options, (may get into the driver later): 347 - Treat them very carefully, these can cause much trouble! 348 - 349 - modified CRC-4, for improved interworking of CRC-4 and non-CRC-4 350 - devices: (see page 107 and g706 Annex B) 351 - lbireg[ 0x1b ] |= 0x08 352 - lbireg[ 0x1c ] |= 0xc0 353 - 354 - - The NMF - 'No Multiframe alignment Found after 400 msec' alarm 355 - comes into account. 356 - 357 - FALC - the line driver chip. 358 - local loop - I hear my transmission back. 359 - remote loop - I echo the remote transmission back. 360 - 361 - Something useful for finding errors: 362 - 363 - - local loop for timeslot 1 in the FALC chip: 364 - 365 - # echo >lbireg 0x1d 0x21 366 - 367 - - Switching the loop off: 368 - 369 - # echo >lbireg 0x1d 0x00
+104 -66
drivers/char/tty_ioctl.c
··· 730 730 return 0; 731 731 } 732 732 733 - int n_tty_ioctl(struct tty_struct * tty, struct file * file, 734 - unsigned int cmd, unsigned long arg) 733 + /** 734 + * tty_mode_ioctl - mode related ioctls 735 + * @tty: tty for the ioctl 736 + * @file: file pointer for the tty 737 + * @cmd: command 738 + * @arg: ioctl argument 739 + * 740 + * Perform non line discipline specific mode control ioctls. This 741 + * is designed to be called by line disciplines to ensure they provide 742 + * consistent mode setting. 743 + */ 744 + 745 + int tty_mode_ioctl(struct tty_struct * tty, struct file *file, 746 + unsigned int cmd, unsigned long arg) 735 747 { 736 748 struct tty_struct * real_tty; 737 749 void __user *p = (void __user *)arg; 738 - int retval; 739 - struct tty_ldisc *ld; 740 750 741 751 if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 742 752 tty->driver->subtype == PTY_TYPE_MASTER) ··· 809 799 return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); 810 800 case TCSETA: 811 801 return set_termios(real_tty, p, TERMIOS_TERMIO); 802 + #ifndef TCGETS2 803 + case TIOCGLCKTRMIOS: 804 + if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked)) 805 + return -EFAULT; 806 + return 0; 807 + 808 + case TIOCSLCKTRMIOS: 809 + if (!capable(CAP_SYS_ADMIN)) 810 + return -EPERM; 811 + if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg)) 812 + return -EFAULT; 813 + return 0; 814 + #else 815 + case TIOCGLCKTRMIOS: 816 + if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked)) 817 + return -EFAULT; 818 + return 0; 819 + 820 + case TIOCSLCKTRMIOS: 821 + if (!capable(CAP_SYS_ADMIN)) 822 + return -EPERM; 823 + if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg)) 824 + return -EFAULT; 825 + return 0; 826 + #endif 827 + case TIOCGSOFTCAR: 828 + return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg); 829 + case TIOCSSOFTCAR: 830 + if (get_user(arg, (unsigned int __user *) arg)) 831 + return -EFAULT; 832 + mutex_lock(&tty->termios_mutex); 833 + tty->termios->c_cflag = 834 + ((tty->termios->c_cflag & ~CLOCAL) | 835 + (arg ? CLOCAL : 0)); 836 + mutex_unlock(&tty->termios_mutex); 837 + return 0; 838 + default: 839 + return -ENOIOCTLCMD; 840 + } 841 + } 842 + 843 + EXPORT_SYMBOL_GPL(tty_mode_ioctl); 844 + 845 + int tty_perform_flush(struct tty_struct *tty, unsigned long arg) 846 + { 847 + struct tty_ldisc *ld; 848 + int retval = tty_check_change(tty); 849 + if (retval) 850 + return retval; 851 + 852 + ld = tty_ldisc_ref(tty); 853 + switch (arg) { 854 + case TCIFLUSH: 855 + if (ld && ld->flush_buffer) 856 + ld->flush_buffer(tty); 857 + break; 858 + case TCIOFLUSH: 859 + if (ld && ld->flush_buffer) 860 + ld->flush_buffer(tty); 861 + /* fall through */ 862 + case TCOFLUSH: 863 + if (tty->driver->flush_buffer) 864 + tty->driver->flush_buffer(tty); 865 + break; 866 + default: 867 + tty_ldisc_deref(ld); 868 + return -EINVAL; 869 + } 870 + tty_ldisc_deref(ld); 871 + return 0; 872 + } 873 + 874 + EXPORT_SYMBOL_GPL(tty_perform_flush); 875 + 876 + int n_tty_ioctl(struct tty_struct * tty, struct file * file, 877 + unsigned int cmd, unsigned long arg) 878 + { 879 + struct tty_struct * real_tty; 880 + int retval; 881 + 882 + if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 883 + tty->driver->subtype == PTY_TYPE_MASTER) 884 + real_tty = tty->link; 885 + else 886 + real_tty = tty; 887 + 888 + switch (cmd) { 812 889 case TCXONC: 813 890 retval = tty_check_change(tty); 814 891 if (retval) ··· 926 829 } 927 830 return 0; 928 831 case TCFLSH: 929 - retval = tty_check_change(tty); 930 - if (retval) 931 - return retval; 932 - 933 - ld = tty_ldisc_ref(tty); 934 - switch (arg) { 935 - case TCIFLUSH: 936 - if (ld && ld->flush_buffer) 937 - ld->flush_buffer(tty); 938 - break; 939 - case TCIOFLUSH: 940 - if (ld && ld->flush_buffer) 941 - ld->flush_buffer(tty); 942 - /* fall through */ 943 - case TCOFLUSH: 944 - if (tty->driver->flush_buffer) 945 - tty->driver->flush_buffer(tty); 946 - break; 947 - default: 948 - tty_ldisc_deref(ld); 949 - return -EINVAL; 950 - } 951 - tty_ldisc_deref(ld); 952 - return 0; 832 + return tty_perform_flush(tty, arg); 953 833 case TIOCOUTQ: 954 834 return put_user(tty->driver->chars_in_buffer ? 955 835 tty->driver->chars_in_buffer(tty) : 0, ··· 936 862 if (L_ICANON(tty)) 937 863 retval = inq_canon(tty); 938 864 return put_user(retval, (unsigned int __user *) arg); 939 - #ifndef TCGETS2 940 - case TIOCGLCKTRMIOS: 941 - if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked)) 942 - return -EFAULT; 943 - return 0; 944 - 945 - case TIOCSLCKTRMIOS: 946 - if (!capable(CAP_SYS_ADMIN)) 947 - return -EPERM; 948 - if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg)) 949 - return -EFAULT; 950 - return 0; 951 - #else 952 - case TIOCGLCKTRMIOS: 953 - if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked)) 954 - return -EFAULT; 955 - return 0; 956 - 957 - case TIOCSLCKTRMIOS: 958 - if (!capable(CAP_SYS_ADMIN)) 959 - return -EPERM; 960 - if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg)) 961 - return -EFAULT; 962 - return 0; 963 - #endif 964 - 965 865 case TIOCPKT: 966 866 { 967 867 int pktmode; ··· 954 906 tty->packet = 0; 955 907 return 0; 956 908 } 957 - case TIOCGSOFTCAR: 958 - return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg); 959 - case TIOCSSOFTCAR: 960 - if (get_user(arg, (unsigned int __user *) arg)) 961 - return -EFAULT; 962 - mutex_lock(&tty->termios_mutex); 963 - tty->termios->c_cflag = 964 - ((tty->termios->c_cflag & ~CLOCAL) | 965 - (arg ? CLOCAL : 0)); 966 - mutex_unlock(&tty->termios_mutex); 967 - return 0; 968 909 default: 969 - return -ENOIOCTLCMD; 910 + /* Try the mode commands */ 911 + return tty_mode_ioctl(tty, file, cmd, arg); 970 912 } 971 913 } 972 914
+4 -3
drivers/net/Kconfig
··· 136 136 If you don't know what to use this for, you don't need it. 137 137 138 138 config VETH 139 - tristate "Virtual ethernet device" 139 + tristate "Virtual ethernet pair device" 140 140 ---help--- 141 - The device is an ethernet tunnel. Devices are created in pairs. When 142 - one end receives the packet it appears on its pair and vice versa. 141 + This device is a local ethernet tunnel. Devices are created in pairs. 142 + When one end receives the packet it appears on its pair and vice 143 + versa. 143 144 144 145 config NET_SB1000 145 146 tristate "General Instruments Surfboard 1000"
+10 -16
drivers/net/hamradio/6pack.c
··· 762 762 763 763 if (copy_from_user(&addr, 764 764 (void __user *) arg, AX25_ADDR_LEN)) { 765 - err = -EFAULT; 765 + err = -EFAULT; 766 + break; 767 + } 768 + 769 + netif_tx_lock_bh(dev); 770 + memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); 771 + netif_tx_unlock_bh(dev); 772 + 773 + err = 0; 766 774 break; 767 775 } 768 776 769 - netif_tx_lock_bh(dev); 770 - memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); 771 - netif_tx_unlock_bh(dev); 772 - 773 - err = 0; 774 - break; 775 - } 776 - 777 - /* Allow stty to read, but not set, the serial port */ 778 - case TCGETS: 779 - case TCGETA: 780 - err = n_tty_ioctl(tty, (struct file *) file, cmd, arg); 781 - break; 782 - 783 777 default: 784 - err = -ENOIOCTLCMD; 778 + err = tty_mode_ioctl(tty, file, cmd, arg); 785 779 } 786 780 787 781 sp_put(sp);
+1 -6
drivers/net/irda/irtty-sir.c
··· 434 434 IRDA_ASSERT(dev != NULL, return -1;); 435 435 436 436 switch (cmd) { 437 - case TCGETS: 438 - case TCGETA: 439 - err = n_tty_ioctl(tty, file, cmd, arg); 440 - break; 441 - 442 437 case IRTTY_IOCTDONGLE: 443 438 /* this call blocks for completion */ 444 439 err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg); ··· 449 454 err = -EFAULT; 450 455 break; 451 456 default: 452 - err = -ENOIOCTLCMD; 457 + err = tty_mode_ioctl(tty, file, cmd, arg); 453 458 break; 454 459 } 455 460 return err;
+3 -7
drivers/net/ppp_async.c
··· 309 309 err = 0; 310 310 break; 311 311 312 - case TCGETS: 313 - case TCGETA: 314 - err = n_tty_ioctl(tty, file, cmd, arg); 315 - break; 316 - 317 312 case TCFLSH: 318 313 /* flush our buffers and the serial port's buffer */ 319 314 if (arg == TCIOFLUSH || arg == TCOFLUSH) 320 315 ppp_async_flush_output(ap); 321 - err = n_tty_ioctl(tty, file, cmd, arg); 316 + err = tty_perform_flush(tty, arg); 322 317 break; 323 318 324 319 case FIONREAD: ··· 324 329 break; 325 330 326 331 default: 327 - err = -ENOIOCTLCMD; 332 + /* Try the various mode ioctls */ 333 + err = tty_mode_ioctl(tty, file, cmd, arg); 328 334 } 329 335 330 336 ap_put(ap);
+3 -7
drivers/net/ppp_synctty.c
··· 349 349 err = 0; 350 350 break; 351 351 352 - case TCGETS: 353 - case TCGETA: 354 - err = n_tty_ioctl(tty, file, cmd, arg); 355 - break; 356 - 357 352 case TCFLSH: 358 353 /* flush our buffers and the serial port's buffer */ 359 354 if (arg == TCIOFLUSH || arg == TCOFLUSH) 360 355 ppp_sync_flush_output(ap); 361 - err = n_tty_ioctl(tty, file, cmd, arg); 356 + err = tty_perform_flush(tty, arg); 362 357 break; 363 358 364 359 case FIONREAD: ··· 364 369 break; 365 370 366 371 default: 367 - err = -ENOIOCTLCMD; 372 + err = tty_mode_ioctl(tty, file, cmd, arg); 373 + break; 368 374 } 369 375 370 376 sp_put(ap);
+18 -7
drivers/net/pppol2tp.c
··· 488 488 { 489 489 struct pppol2tp_session *session = NULL; 490 490 struct pppol2tp_tunnel *tunnel; 491 - unsigned char *ptr; 491 + unsigned char *ptr, *optr; 492 492 u16 hdrflags; 493 493 u16 tunnel_id, session_id; 494 494 int length; ··· 496 496 497 497 tunnel = pppol2tp_sock_to_tunnel(sock); 498 498 if (tunnel == NULL) 499 - goto error; 499 + goto no_tunnel; 500 500 501 501 /* UDP always verifies the packet length. */ 502 502 __skb_pull(skb, sizeof(struct udphdr)); ··· 509 509 } 510 510 511 511 /* Point to L2TP header */ 512 - ptr = skb->data; 512 + optr = ptr = skb->data; 513 513 514 514 /* Get L2TP header flags */ 515 515 hdrflags = ntohs(*(__be16*)ptr); ··· 637 637 /* If offset bit set, skip it. */ 638 638 if (hdrflags & L2TP_HDRFLAG_O) { 639 639 offset = ntohs(*(__be16 *)ptr); 640 - skb->transport_header += 2 + offset; 641 - if (!pskb_may_pull(skb, skb_transport_offset(skb) + 2)) 642 - goto discard; 640 + ptr += 2 + offset; 643 641 } 644 642 645 - __skb_pull(skb, skb_transport_offset(skb)); 643 + offset = ptr - optr; 644 + if (!pskb_may_pull(skb, offset)) 645 + goto discard; 646 + 647 + __skb_pull(skb, offset); 646 648 647 649 /* Skip PPP header, if present. In testing, Microsoft L2TP clients 648 650 * don't send the PPP header (PPP header compression enabled), but ··· 654 652 * Note that skb->data[] isn't dereferenced from a u16 ptr here since 655 653 * the field may be unaligned. 656 654 */ 655 + if (!pskb_may_pull(skb, 2)) 656 + goto discard; 657 + 657 658 if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03)) 658 659 skb_pull(skb, 2); 659 660 ··· 714 709 return 0; 715 710 716 711 error: 712 + /* Put UDP header back */ 713 + __skb_push(skb, sizeof(struct udphdr)); 714 + 715 + no_tunnel: 717 716 return 1; 718 717 } 719 718 ··· 1059 1050 /* Get routing info from the tunnel socket */ 1060 1051 dst_release(skb->dst); 1061 1052 skb->dst = sk_dst_get(sk_tun); 1053 + skb_orphan(skb); 1054 + skb->sk = sk_tun; 1062 1055 1063 1056 /* Queue the packet to IP for output */ 1064 1057 len = skb->len;
-18
drivers/net/rrunner.c
··· 78 78 * stack will need to know about I/O vectors or something similar. 79 79 */ 80 80 81 - /* 82 - * sysctl_[wr]mem_max are checked at init time to see if they are at 83 - * least 256KB and increased to 256KB if they are not. This is done to 84 - * avoid ending up with socket buffers smaller than the MTU size, 85 - */ 86 - 87 81 static int __devinit rr_init_one(struct pci_dev *pdev, 88 82 const struct pci_device_id *ent) 89 83 { ··· 554 560 555 561 sram_size = rr_read_eeprom_word(rrpriv, (void *)8); 556 562 printk(" SRAM size 0x%06x\n", sram_size); 557 - 558 - if (sysctl_rmem_max < 262144){ 559 - printk(" Receive socket buffer limit too low (%i), " 560 - "setting to 262144\n", sysctl_rmem_max); 561 - sysctl_rmem_max = 262144; 562 - } 563 - 564 - if (sysctl_wmem_max < 262144){ 565 - printk(" Transmit socket buffer limit too low (%i), " 566 - "setting to 262144\n", sysctl_wmem_max); 567 - sysctl_wmem_max = 262144; 568 - } 569 563 570 564 return 0; 571 565 }
+1 -7
drivers/net/slip.c
··· 1218 1218 return 0; 1219 1219 /* VSV changes end */ 1220 1220 #endif 1221 - 1222 - /* Allow stty to read, but not set, the serial port */ 1223 - case TCGETS: 1224 - case TCGETA: 1225 - return n_tty_ioctl(tty, file, cmd, arg); 1226 - 1227 1221 default: 1228 - return -ENOIOCTLCMD; 1222 + return tty_mode_ioctl(tty, file, cmd, arg); 1229 1223 } 1230 1224 } 1231 1225
+1 -8
drivers/net/usb/Kconfig
··· 93 93 To compile this driver as a module, choose M here: the 94 94 module will be called rtl8150. 95 95 96 - config USB_USBNET_MII 97 - tristate 98 - default n 99 - 100 96 config USB_USBNET 101 97 tristate "Multi-purpose USB Networking Framework" 102 - select MII if USB_USBNET_MII != n 98 + select MII 103 99 ---help--- 104 100 This driver supports several kinds of network links over USB, 105 101 with "minidrivers" built around a common network driver core ··· 131 135 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" 132 136 depends on USB_USBNET && NET_ETHERNET 133 137 select CRC32 134 - select USB_USBNET_MII 135 138 default y 136 139 help 137 140 This option adds support for ASIX AX88xxx based USB 2.0 ··· 185 190 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" 186 191 depends on USB_USBNET 187 192 select CRC32 188 - select USB_USBNET_MII 189 193 help 190 194 This option adds support for Davicom DM9601 based USB 1.1 191 195 10/100 Ethernet adapters. ··· 219 225 config USB_NET_MCS7830 220 226 tristate "MosChip MCS7830 based Ethernet adapters" 221 227 depends on USB_USBNET 222 - select USB_USBNET_MII 223 228 help 224 229 Choose this option if you're using a 10/100 Ethernet USB2 225 230 adapter based on the MosChip 7830 controller. This includes
-7
drivers/net/usb/usbnet.c
··· 683 683 * they'll probably want to use this base set. 684 684 */ 685 685 686 - #if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE) 687 - #define HAVE_MII 688 - 689 686 int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) 690 687 { 691 688 struct usbnet *dev = netdev_priv(net); ··· 741 744 } 742 745 EXPORT_SYMBOL_GPL(usbnet_nway_reset); 743 746 744 - #endif /* HAVE_MII */ 745 - 746 747 void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) 747 748 { 748 749 struct usbnet *dev = netdev_priv(net); ··· 771 776 772 777 /* drivers may override default ethtool_ops in their bind() routine */ 773 778 static struct ethtool_ops usbnet_ethtool_ops = { 774 - #ifdef HAVE_MII 775 779 .get_settings = usbnet_get_settings, 776 780 .set_settings = usbnet_set_settings, 777 781 .get_link = usbnet_get_link, 778 782 .nway_reset = usbnet_nway_reset, 779 - #endif 780 783 .get_drvinfo = usbnet_get_drvinfo, 781 784 .get_msglevel = usbnet_get_msglevel, 782 785 .set_msglevel = usbnet_set_msglevel,
+1 -5
drivers/net/wan/x25_asy.c
··· 719 719 return 0; 720 720 case SIOCSIFHWADDR: 721 721 return -EINVAL; 722 - /* Allow stty to read, but not set, the serial port */ 723 - case TCGETS: 724 - case TCGETA: 725 - return n_tty_ioctl(tty, file, cmd, arg); 726 722 default: 727 - return -ENOIOCTLCMD; 723 + return tty_mode_ioctl(tty, file, cmd, arg); 728 724 } 729 725 } 730 726
+1 -9
drivers/net/wireless/strip.c
··· 2735 2735 return -EFAULT; 2736 2736 return set_mac_address(strip_info, &addr); 2737 2737 } 2738 - /* 2739 - * Allow stty to read, but not set, the serial port 2740 - */ 2741 - 2742 - case TCGETS: 2743 - case TCGETA: 2744 - return n_tty_ioctl(tty, file, cmd, arg); 2745 - break; 2746 2738 default: 2747 - return -ENOIOCTLCMD; 2739 + return tty_mode_ioctl(tty, file, cmd, arg); 2748 2740 break; 2749 2741 } 2750 2742 return 0;
+1 -5
fs/dlm/lowcomms.c
··· 1062 1062 subscribe.sctp_shutdown_event = 1; 1063 1063 subscribe.sctp_partial_delivery_event = 1; 1064 1064 1065 - result = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, 1065 + result = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE, 1066 1066 (char *)&bufsize, sizeof(bufsize)); 1067 1067 if (result) 1068 1068 log_print("Error increasing buffer space on socket %d", result); ··· 1453 1453 NULL); 1454 1454 if (!con_cache) 1455 1455 goto out; 1456 - 1457 - /* Set some sysctl minima */ 1458 - if (sysctl_rmem_max < NEEDED_RMEM) 1459 - sysctl_rmem_max = NEEDED_RMEM; 1460 1456 1461 1457 /* Start listening */ 1462 1458 if (dlm_config.ci_protocol == 0)
-7
fs/proc/proc_net.c
··· 26 26 #include "internal.h" 27 27 28 28 29 - struct proc_dir_entry *proc_net_create(struct net *net, 30 - const char *name, mode_t mode, get_info_t *get_info) 31 - { 32 - return create_proc_info_entry(name,mode, net->proc_net, get_info); 33 - } 34 - EXPORT_SYMBOL_GPL(proc_net_create); 35 - 36 29 struct proc_dir_entry *proc_net_fops_create(struct net *net, 37 30 const char *name, mode_t mode, const struct file_operations *fops) 38 31 {
+12
include/linux/mroute.h
··· 128 128 #ifdef __KERNEL__ 129 129 #include <net/sock.h> 130 130 131 + #ifdef CONFIG_IP_MROUTE 132 + static inline int ip_mroute_opt(int opt) 133 + { 134 + return (opt >= MRT_BASE) && (opt <= MRT_BASE + 10); 135 + } 136 + #else 137 + static inline int ip_mroute_opt(int opt) 138 + { 139 + return 0; 140 + } 141 + #endif 142 + 131 143 extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); 132 144 extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 133 145 extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
+9 -9
include/linux/netfilter/Kbuild
··· 4 4 header-y += nfnetlink_log.h 5 5 header-y += nfnetlink_queue.h 6 6 header-y += xt_CLASSIFY.h 7 + header-y += xt_CONNMARK.h 8 + header-y += xt_CONNSECMARK.h 9 + header-y += xt_DSCP.h 10 + header-y += xt_MARK.h 11 + header-y += xt_NFLOG.h 12 + header-y += xt_NFQUEUE.h 13 + header-y += xt_SECMARK.h 14 + header-y += xt_TCPMSS.h 7 15 header-y += xt_comment.h 8 16 header-y += xt_connbytes.h 9 17 header-y += xt_connmark.h 10 - header-y += xt_CONNMARK.h 11 18 header-y += xt_conntrack.h 12 19 header-y += xt_dccp.h 13 20 header-y += xt_dscp.h 14 - header-y += xt_DSCP.h 15 21 header-y += xt_esp.h 16 - header-y += xt_helper.h 17 22 header-y += xt_hashlimit.h 23 + header-y += xt_helper.h 18 24 header-y += xt_length.h 19 25 header-y += xt_limit.h 20 26 header-y += xt_mac.h 21 27 header-y += xt_mark.h 22 - header-y += xt_MARK.h 23 28 header-y += xt_multiport.h 24 - header-y += xt_NFQUEUE.h 25 - header-y += xt_NFLOG.h 26 29 header-y += xt_pkttype.h 27 30 header-y += xt_policy.h 28 31 header-y += xt_realm.h ··· 35 32 header-y += xt_string.h 36 33 header-y += xt_tcpmss.h 37 34 header-y += xt_tcpudp.h 38 - header-y += xt_SECMARK.h 39 - header-y += xt_CONNSECMARK.h 40 - header-y += xt_TCPMSS.h 41 35 42 36 unifdef-y += nf_conntrack_common.h 43 37 unifdef-y += nf_conntrack_ftp.h
+14 -14
include/linux/netfilter_ipv4/Kbuild
··· 1 - header-y += ipt_addrtype.h 2 - header-y += ipt_ah.h 3 1 header-y += ipt_CLASSIFY.h 4 2 header-y += ipt_CLUSTERIP.h 3 + header-y += ipt_CONNMARK.h 4 + header-y += ipt_DSCP.h 5 + header-y += ipt_ECN.h 6 + header-y += ipt_LOG.h 7 + header-y += ipt_MARK.h 8 + header-y += ipt_NFQUEUE.h 9 + header-y += ipt_REJECT.h 10 + header-y += ipt_SAME.h 11 + header-y += ipt_TCPMSS.h 12 + header-y += ipt_TOS.h 13 + header-y += ipt_TTL.h 14 + header-y += ipt_ULOG.h 15 + header-y += ipt_addrtype.h 16 + header-y += ipt_ah.h 5 17 header-y += ipt_comment.h 6 18 header-y += ipt_connbytes.h 7 19 header-y += ipt_connmark.h 8 - header-y += ipt_CONNMARK.h 9 20 header-y += ipt_conntrack.h 10 21 header-y += ipt_dccp.h 11 22 header-y += ipt_dscp.h 12 - header-y += ipt_DSCP.h 13 23 header-y += ipt_ecn.h 14 - header-y += ipt_ECN.h 15 24 header-y += ipt_esp.h 16 25 header-y += ipt_hashlimit.h 17 26 header-y += ipt_helper.h 18 27 header-y += ipt_iprange.h 19 28 header-y += ipt_length.h 20 29 header-y += ipt_limit.h 21 - header-y += ipt_LOG.h 22 30 header-y += ipt_mac.h 23 31 header-y += ipt_mark.h 24 - header-y += ipt_MARK.h 25 32 header-y += ipt_multiport.h 26 - header-y += ipt_NFQUEUE.h 27 33 header-y += ipt_owner.h 28 34 header-y += ipt_physdev.h 29 35 header-y += ipt_pkttype.h 30 36 header-y += ipt_policy.h 31 37 header-y += ipt_realm.h 32 38 header-y += ipt_recent.h 33 - header-y += ipt_REJECT.h 34 - header-y += ipt_SAME.h 35 39 header-y += ipt_sctp.h 36 40 header-y += ipt_state.h 37 41 header-y += ipt_string.h 38 42 header-y += ipt_tcpmss.h 39 - header-y += ipt_TCPMSS.h 40 43 header-y += ipt_tos.h 41 - header-y += ipt_TOS.h 42 44 header-y += ipt_ttl.h 43 - header-y += ipt_TTL.h 44 - header-y += ipt_ULOG.h 45 45 46 46 unifdef-y += ip_queue.h 47 47 unifdef-y += ip_tables.h
+1 -1
include/linux/netfilter_ipv6/Kbuild
··· 14 14 header-y += ip6t_multiport.h 15 15 header-y += ip6t_opts.h 16 16 header-y += ip6t_owner.h 17 - header-y += ip6t_policy.h 18 17 header-y += ip6t_physdev.h 18 + header-y += ip6t_policy.h 19 19 header-y += ip6t_rt.h 20 20 21 21 unifdef-y += ip6_tables.h
+1 -1
include/linux/netlink.h
··· 192 192 /* finegrained unicast helpers: */ 193 193 struct sock *netlink_getsockbyfilp(struct file *filp); 194 194 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 195 - long timeo, struct sock *ssk); 195 + long *timeo, struct sock *ssk); 196 196 void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 197 197 int netlink_sendskb(struct sock *sk, struct sk_buff *skb); 198 198
-3
include/linux/proc_fs.h
··· 196 196 return res; 197 197 } 198 198 199 - extern struct proc_dir_entry *proc_net_create(struct net *net, 200 - const char *name, mode_t mode, get_info_t *get_info); 201 199 extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 202 200 const char *name, mode_t mode, const struct file_operations *fops); 203 201 extern void proc_net_remove(struct net *net, const char *name); ··· 206 208 #define proc_bus NULL 207 209 208 210 #define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) 209 - #define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; }) 210 211 static inline void proc_net_remove(struct net *net, const char *name) {} 211 212 212 213 static inline void proc_flush_task(struct task_struct *task)
+3 -1
include/linux/tty.h
··· 332 332 333 333 extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 334 334 unsigned long arg); 335 - 335 + extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, 336 + unsigned int cmd, unsigned long arg); 337 + extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 336 338 extern dev_t tty_devnum(struct tty_struct *tty); 337 339 extern void proc_clear_tty(struct task_struct *p); 338 340 extern struct tty_struct *get_current_tty(void);
+65 -6
include/net/inet_hashtables.h
··· 37 37 * I'll experiment with dynamic table growth later. 38 38 */ 39 39 struct inet_ehash_bucket { 40 - rwlock_t lock; 41 40 struct hlist_head chain; 42 41 struct hlist_head twchain; 43 42 }; ··· 99 100 * TIME_WAIT sockets use a separate chain (twchain). 100 101 */ 101 102 struct inet_ehash_bucket *ehash; 103 + rwlock_t *ehash_locks; 104 + unsigned int ehash_size; 105 + unsigned int ehash_locks_mask; 102 106 103 107 /* Ok, let's try this, I give up, we do need a local binding 104 108 * TCP hash as well as the others for fast bind/connect. ··· 109 107 struct inet_bind_hashbucket *bhash; 110 108 111 109 unsigned int bhash_size; 112 - unsigned int ehash_size; 110 + /* Note : 4 bytes padding on 64 bit arches */ 113 111 114 112 /* All sockets in TCP_LISTEN state will be in here. This is the only 115 113 * table where wildcard'd TCP sockets can exist. Hash function here ··· 134 132 unsigned int hash) 135 133 { 136 134 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; 135 + } 136 + 137 + static inline rwlock_t *inet_ehash_lockp( 138 + struct inet_hashinfo *hashinfo, 139 + unsigned int hash) 140 + { 141 + return &hashinfo->ehash_locks[hash & hashinfo->ehash_locks_mask]; 142 + } 143 + 144 + static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) 145 + { 146 + unsigned int i, size = 256; 147 + #if defined(CONFIG_PROVE_LOCKING) 148 + unsigned int nr_pcpus = 2; 149 + #else 150 + unsigned int nr_pcpus = num_possible_cpus(); 151 + #endif 152 + if (nr_pcpus >= 4) 153 + size = 512; 154 + if (nr_pcpus >= 8) 155 + size = 1024; 156 + if (nr_pcpus >= 16) 157 + size = 2048; 158 + if (nr_pcpus >= 32) 159 + size = 4096; 160 + if (sizeof(rwlock_t) != 0) { 161 + #ifdef CONFIG_NUMA 162 + if (size * sizeof(rwlock_t) > PAGE_SIZE) 163 + hashinfo->ehash_locks = vmalloc(size * sizeof(rwlock_t)); 164 + else 165 + #endif 166 + hashinfo->ehash_locks = kmalloc(size * sizeof(rwlock_t), 167 + GFP_KERNEL); 168 + if (!hashinfo->ehash_locks) 169 + return ENOMEM; 170 + for (i = 0; i < size; i++) 171 + rwlock_init(&hashinfo->ehash_locks[i]); 172 + } 173 + hashinfo->ehash_locks_mask = size - 1; 174 + return 0; 175 + } 176 + 177 + static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo) 178 + { 179 + if (hashinfo->ehash_locks) { 180 + #ifdef CONFIG_NUMA 181 + unsigned int size = (hashinfo->ehash_locks_mask + 1) * 182 + sizeof(rwlock_t); 183 + if (size > PAGE_SIZE) 184 + vfree(hashinfo->ehash_locks); 185 + else 186 + #else 187 + kfree(hashinfo->ehash_locks); 188 + #endif 189 + hashinfo->ehash_locks = NULL; 190 + } 137 191 } 138 192 139 193 extern struct inet_bind_bucket * ··· 280 222 sk->sk_hash = inet_sk_ehashfn(sk); 281 223 head = inet_ehash_bucket(hashinfo, sk->sk_hash); 282 224 list = &head->chain; 283 - lock = &head->lock; 225 + lock = inet_ehash_lockp(hashinfo, sk->sk_hash); 284 226 write_lock(lock); 285 227 } 286 228 __sk_add_node(sk, list); ··· 311 253 inet_listen_wlock(hashinfo); 312 254 lock = &hashinfo->lhash_lock; 313 255 } else { 314 - lock = &inet_ehash_bucket(hashinfo, sk->sk_hash)->lock; 256 + lock = inet_ehash_lockp(hashinfo, sk->sk_hash); 315 257 write_lock_bh(lock); 316 258 } 317 259 ··· 412 354 */ 413 355 unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); 414 356 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); 357 + rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); 415 358 416 359 prefetch(head->chain.first); 417 - read_lock(&head->lock); 360 + read_lock(lock); 418 361 sk_for_each(sk, node, &head->chain) { 419 362 if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) 420 363 goto hit; /* You sunk my battleship! */ ··· 428 369 } 429 370 sk = NULL; 430 371 out: 431 - read_unlock(&head->lock); 372 + read_unlock(lock); 432 373 return sk; 433 374 hit: 434 375 sock_hold(sk);
+6 -9
include/net/ip_fib.h
··· 185 185 } 186 186 187 187 #else /* CONFIG_IP_MULTIPLE_TABLES */ 188 + extern void __init fib4_rules_init(void); 189 + 190 + #ifdef CONFIG_NET_CLS_ROUTE 191 + extern u32 fib_rules_tclass(struct fib_result *res); 192 + #endif 193 + 188 194 #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) 189 195 #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) 190 196 ··· 219 213 220 214 /* Exported by fib_hash.c */ 221 215 extern struct fib_table *fib_hash_init(u32 id); 222 - 223 - #ifdef CONFIG_IP_MULTIPLE_TABLES 224 - extern void __init fib4_rules_init(void); 225 - 226 - #ifdef CONFIG_NET_CLS_ROUTE 227 - extern u32 fib_rules_tclass(struct fib_result *res); 228 - #endif 229 - 230 - #endif 231 216 232 217 static inline void fib_combine_itag(u32 *itag, struct fib_result *res) 233 218 {
+8
include/net/ip_vs.h
··· 520 520 spinlock_t lock; /* lock for state transition */ 521 521 volatile __u16 flags; /* status flags */ 522 522 volatile __u16 state; /* state info */ 523 + volatile __u16 old_state; /* old state, to be used for 524 + * state transition triggerd 525 + * synchronization 526 + */ 523 527 524 528 /* Control members */ 525 529 struct ip_vs_conn *control; /* Master control connection */ ··· 905 901 extern void ip_vs_use_count_dec(void); 906 902 extern int ip_vs_control_init(void); 907 903 extern void ip_vs_control_cleanup(void); 904 + extern struct ip_vs_dest * 905 + ip_vs_find_dest(__be32 daddr, __be16 dport, 906 + __be32 vaddr, __be16 vport, __u16 protocol); 907 + extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 908 908 909 909 910 910 /*
+57 -6
include/net/sock.h
··· 560 560 void (*unhash)(struct sock *sk); 561 561 int (*get_port)(struct sock *sk, unsigned short snum); 562 562 563 + #ifdef CONFIG_SMP 564 + /* Keeping track of sockets in use */ 565 + void (*inuse_add)(struct proto *prot, int inc); 566 + int (*inuse_getval)(const struct proto *prot); 567 + int *inuse_ptr; 568 + #else 569 + int inuse; 570 + #endif 563 571 /* Memory pressure */ 564 572 void (*enter_memory_pressure)(void); 565 573 atomic_t *memory_allocated; /* Current allocated memory. */ ··· 600 592 #ifdef SOCK_REFCNT_DEBUG 601 593 atomic_t socks; 602 594 #endif 603 - struct { 604 - int inuse; 605 - u8 __pad[SMP_CACHE_BYTES - sizeof(int)]; 606 - } stats[NR_CPUS]; 607 595 }; 596 + 597 + /* 598 + * Special macros to let protos use a fast version of inuse{get|add} 599 + * using a static percpu variable per proto instead of an allocated one, 600 + * saving one dereference. 601 + * This might be changed if/when dynamic percpu vars become fast. 602 + */ 603 + #ifdef CONFIG_SMP 604 + # define DEFINE_PROTO_INUSE(NAME) \ 605 + static DEFINE_PER_CPU(int, NAME##_inuse); \ 606 + static void NAME##_inuse_add(struct proto *prot, int inc) \ 607 + { \ 608 + __get_cpu_var(NAME##_inuse) += inc; \ 609 + } \ 610 + \ 611 + static int NAME##_inuse_getval(const struct proto *prot)\ 612 + { \ 613 + int res = 0, cpu; \ 614 + \ 615 + for_each_possible_cpu(cpu) \ 616 + res += per_cpu(NAME##_inuse, cpu); \ 617 + return res; \ 618 + } 619 + # define REF_PROTO_INUSE(NAME) \ 620 + .inuse_add = NAME##_inuse_add, \ 621 + .inuse_getval = NAME##_inuse_getval, 622 + #else 623 + # define DEFINE_PROTO_INUSE(NAME) 624 + # define REF_PROTO_INUSE(NAME) 625 + #endif 608 626 609 627 extern int proto_register(struct proto *prot, int alloc_slab); 610 628 extern void proto_unregister(struct proto *prot); ··· 663 629 /* Called with local bh disabled */ 664 630 static __inline__ void sock_prot_inc_use(struct proto *prot) 665 631 { 666 - prot->stats[smp_processor_id()].inuse++; 632 + #ifdef CONFIG_SMP 633 + prot->inuse_add(prot, 1); 634 + #else 635 + prot->inuse++; 636 + #endif 667 637 } 668 638 669 639 static __inline__ void sock_prot_dec_use(struct proto *prot) 670 640 { 671 - prot->stats[smp_processor_id()].inuse--; 641 + #ifdef CONFIG_SMP 642 + prot->inuse_add(prot, -1); 643 + #else 644 + prot->inuse--; 645 + #endif 646 + } 647 + 648 + static __inline__ int sock_prot_inuse(struct proto *proto) 649 + { 650 + #ifdef CONFIG_SMP 651 + return proto->inuse_getval(proto); 652 + #else 653 + return proto->inuse; 654 + #endif 672 655 } 673 656 674 657 /* With per-bucket locks this operation is not-atomic, so that
+4 -2
ipc/mqueue.c
··· 1010 1010 return -EINVAL; 1011 1011 } 1012 1012 if (notification.sigev_notify == SIGEV_THREAD) { 1013 + long timeo; 1014 + 1013 1015 /* create the notify skb */ 1014 1016 nc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL); 1015 1017 ret = -ENOMEM; ··· 1040 1038 goto out; 1041 1039 } 1042 1040 1043 - ret = netlink_attachskb(sock, nc, 0, 1044 - MAX_SCHEDULE_TIMEOUT, NULL); 1041 + timeo = MAX_SCHEDULE_TIMEOUT; 1042 + ret = netlink_attachskb(sock, nc, 0, &timeo, NULL); 1045 1043 if (ret == 1) 1046 1044 goto retry; 1047 1045 if (ret) {
+1
net/8021q/vlan.c
··· 747 747 vlan_dev_set_ingress_priority(dev, 748 748 args.u.skb_priority, 749 749 args.vlan_qos); 750 + err = 0; 750 751 break; 751 752 752 753 case SET_VLAN_EGRESS_PRIORITY_CMD:
+1 -1
net/bridge/netfilter/ebt_arp.c
··· 34 34 ah->ar_pro, EBT_ARP_PTYPE)) 35 35 return EBT_NOMATCH; 36 36 37 - if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP)) { 37 + if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_GRAT)) { 38 38 __be32 saddr, daddr, *sap, *dap; 39 39 40 40 if (ah->ar_pln != sizeof(__be32) || ah->ar_pro != htons(ETH_P_IP))
-1
net/core/dst.c
··· 18 18 #include <linux/types.h> 19 19 #include <net/net_namespace.h> 20 20 21 - #include <net/net_namespace.h> 22 21 #include <net/dst.h> 23 22 24 23 /*
+2
net/core/neighbour.c
··· 1435 1435 kfree(tbl->phash_buckets); 1436 1436 tbl->phash_buckets = NULL; 1437 1437 1438 + remove_proc_entry(tbl->id, init_net.proc_net_stat); 1439 + 1438 1440 free_percpu(tbl->stats); 1439 1441 tbl->stats = NULL; 1440 1442
+14 -14
net/core/net_namespace.c
··· 64 64 return kmem_cache_zalloc(net_cachep, GFP_KERNEL); 65 65 } 66 66 67 + static void net_free(struct net *net) 68 + { 69 + if (!net) 70 + return; 71 + 72 + if (unlikely(atomic_read(&net->use_count) != 0)) { 73 + printk(KERN_EMERG "network namespace not free! Usage: %d\n", 74 + atomic_read(&net->use_count)); 75 + return; 76 + } 77 + 78 + kmem_cache_free(net_cachep, net); 79 + } 80 + 67 81 struct net *copy_net_ns(unsigned long flags, struct net *old_net) 68 82 { 69 83 struct net *new_net = NULL; ··· 112 98 new_net = ERR_PTR(err); 113 99 } 114 100 return new_net; 115 - } 116 - 117 - static void net_free(struct net *net) 118 - { 119 - if (!net) 120 - return; 121 - 122 - if (unlikely(atomic_read(&net->use_count) != 0)) { 123 - printk(KERN_EMERG "network namespace not free! Usage: %d\n", 124 - atomic_read(&net->use_count)); 125 - return; 126 - } 127 - 128 - kmem_cache_free(net_cachep, net); 129 101 } 130 102 131 103 static void cleanup_net(struct work_struct *work)
+63 -6
net/core/sock.c
··· 1801 1801 static DEFINE_RWLOCK(proto_list_lock); 1802 1802 static LIST_HEAD(proto_list); 1803 1803 1804 + #ifdef CONFIG_SMP 1805 + /* 1806 + * Define default functions to keep track of inuse sockets per protocol 1807 + * Note that often used protocols use dedicated functions to get a speed increase. 1808 + * (see DEFINE_PROTO_INUSE/REF_PROTO_INUSE) 1809 + */ 1810 + static void inuse_add(struct proto *prot, int inc) 1811 + { 1812 + per_cpu_ptr(prot->inuse_ptr, smp_processor_id())[0] += inc; 1813 + } 1814 + 1815 + static int inuse_get(const struct proto *prot) 1816 + { 1817 + int res = 0, cpu; 1818 + for_each_possible_cpu(cpu) 1819 + res += per_cpu_ptr(prot->inuse_ptr, cpu)[0]; 1820 + return res; 1821 + } 1822 + 1823 + static int inuse_init(struct proto *prot) 1824 + { 1825 + if (!prot->inuse_getval || !prot->inuse_add) { 1826 + prot->inuse_ptr = alloc_percpu(int); 1827 + if (prot->inuse_ptr == NULL) 1828 + return -ENOBUFS; 1829 + 1830 + prot->inuse_getval = inuse_get; 1831 + prot->inuse_add = inuse_add; 1832 + } 1833 + return 0; 1834 + } 1835 + 1836 + static void inuse_fini(struct proto *prot) 1837 + { 1838 + if (prot->inuse_ptr != NULL) { 1839 + free_percpu(prot->inuse_ptr); 1840 + prot->inuse_ptr = NULL; 1841 + prot->inuse_getval = NULL; 1842 + prot->inuse_add = NULL; 1843 + } 1844 + } 1845 + #else 1846 + static inline int inuse_init(struct proto *prot) 1847 + { 1848 + return 0; 1849 + } 1850 + 1851 + static inline void inuse_fini(struct proto *prot) 1852 + { 1853 + } 1854 + #endif 1855 + 1804 1856 int proto_register(struct proto *prot, int alloc_slab) 1805 1857 { 1806 1858 char *request_sock_slab_name = NULL; 1807 1859 char *timewait_sock_slab_name; 1808 - int rc = -ENOBUFS; 1860 + 1861 + if (inuse_init(prot)) 1862 + goto out; 1809 1863 1810 1864 if (alloc_slab) { 1811 1865 prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, ··· 1868 1814 if (prot->slab == NULL) { 1869 1815 printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", 1870 1816 prot->name); 1871 - goto out; 1817 + goto out_free_inuse; 1872 1818 } 1873 1819 1874 1820 if (prot->rsk_prot != NULL) { ··· 1912 1858 write_lock(&proto_list_lock); 1913 1859 list_add(&prot->node, &proto_list); 1914 1860 write_unlock(&proto_list_lock); 1915 - rc = 0; 1916 - out: 1917 - return rc; 1861 + return 0; 1862 + 1918 1863 out_free_timewait_sock_slab_name: 1919 1864 kfree(timewait_sock_slab_name); 1920 1865 out_free_request_sock_slab: ··· 1926 1873 out_free_sock_slab: 1927 1874 kmem_cache_destroy(prot->slab); 1928 1875 prot->slab = NULL; 1929 - goto out; 1876 + out_free_inuse: 1877 + inuse_fini(prot); 1878 + out: 1879 + return -ENOBUFS; 1930 1880 } 1931 1881 1932 1882 EXPORT_SYMBOL(proto_register); ··· 1940 1884 list_del(&prot->node); 1941 1885 write_unlock(&proto_list_lock); 1942 1886 1887 + inuse_fini(prot); 1943 1888 if (prot->slab != NULL) { 1944 1889 kmem_cache_destroy(prot->slab); 1945 1890 prot->slab = NULL;
+3
net/dccp/ipv4.c
··· 922 922 .twsk_obj_size = sizeof(struct inet_timewait_sock), 923 923 }; 924 924 925 + DEFINE_PROTO_INUSE(dccp_v4) 926 + 925 927 static struct proto dccp_v4_prot = { 926 928 .name = "DCCP", 927 929 .owner = THIS_MODULE, ··· 952 950 .compat_setsockopt = compat_dccp_setsockopt, 953 951 .compat_getsockopt = compat_dccp_getsockopt, 954 952 #endif 953 + REF_PROTO_INUSE(dccp_v4) 955 954 }; 956 955 957 956 static struct net_protocol dccp_v4_protocol = {
+3
net/dccp/ipv6.c
··· 1107 1107 .twsk_obj_size = sizeof(struct dccp6_timewait_sock), 1108 1108 }; 1109 1109 1110 + DEFINE_PROTO_INUSE(dccp_v6) 1111 + 1110 1112 static struct proto dccp_v6_prot = { 1111 1113 .name = "DCCPv6", 1112 1114 .owner = THIS_MODULE, ··· 1137 1135 .compat_setsockopt = compat_dccp_setsockopt, 1138 1136 .compat_getsockopt = compat_dccp_getsockopt, 1139 1137 #endif 1138 + REF_PROTO_INUSE(dccp_v6) 1140 1139 }; 1141 1140 1142 1141 static struct inet6_protocol dccp_v6_protocol = {
+7 -2
net/dccp/proto.c
··· 1072 1072 } 1073 1073 1074 1074 for (i = 0; i < dccp_hashinfo.ehash_size; i++) { 1075 - rwlock_init(&dccp_hashinfo.ehash[i].lock); 1076 1075 INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].chain); 1077 1076 INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].twchain); 1078 1077 } 1078 + 1079 + if (inet_ehash_locks_alloc(&dccp_hashinfo)) 1080 + goto out_free_dccp_ehash; 1079 1081 1080 1082 bhash_order = ehash_order; 1081 1083 ··· 1093 1091 1094 1092 if (!dccp_hashinfo.bhash) { 1095 1093 DCCP_CRIT("Failed to allocate DCCP bind hash table"); 1096 - goto out_free_dccp_ehash; 1094 + goto out_free_dccp_locks; 1097 1095 } 1098 1096 1099 1097 for (i = 0; i < dccp_hashinfo.bhash_size; i++) { ··· 1123 1121 out_free_dccp_bhash: 1124 1122 free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order); 1125 1123 dccp_hashinfo.bhash = NULL; 1124 + out_free_dccp_locks: 1125 + inet_ehash_locks_free(&dccp_hashinfo); 1126 1126 out_free_dccp_ehash: 1127 1127 free_pages((unsigned long)dccp_hashinfo.ehash, ehash_order); 1128 1128 dccp_hashinfo.ehash = NULL; ··· 1143 1139 free_pages((unsigned long)dccp_hashinfo.ehash, 1144 1140 get_order(dccp_hashinfo.ehash_size * 1145 1141 sizeof(struct inet_ehash_bucket))); 1142 + inet_ehash_locks_free(&dccp_hashinfo); 1146 1143 kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); 1147 1144 dccp_ackvec_exit(); 1148 1145 dccp_sysctl_exit();
+1 -1
net/decnet/dn_dev.c
··· 1439 1439 1440 1440 #endif /* CONFIG_PROC_FS */ 1441 1441 1442 - static int __initdata addr[2]; 1442 + static int addr[2]; 1443 1443 module_param_array(addr, int, NULL, 0444); 1444 1444 MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); 1445 1445
-1
net/ieee80211/ieee80211_crypt_tkip.c
··· 25 25 #include <net/ieee80211.h> 26 26 27 27 #include <linux/crypto.h> 28 - #include <linux/scatterlist.h> 29 28 #include <linux/crc32.h> 30 29 31 30 MODULE_AUTHOR("Jouni Malinen");
-1
net/ieee80211/ieee80211_crypt_wep.c
··· 22 22 #include <net/ieee80211.h> 23 23 24 24 #include <linux/crypto.h> 25 - #include <linux/scatterlist.h> 26 25 #include <linux/crc32.h> 27 26 28 27 MODULE_AUTHOR("Jouni Malinen");
+8 -7
net/ipv4/fib_frontend.c
··· 59 59 #define FIB_TABLE_HASHSZ 1 60 60 static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; 61 61 62 + static void __init fib4_rules_init(void) 63 + { 64 + ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL); 65 + hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]); 66 + ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN); 67 + hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]); 68 + } 62 69 #else 63 70 64 71 #define FIB_TABLE_HASHSZ 256 ··· 912 905 913 906 for (i = 0; i < FIB_TABLE_HASHSZ; i++) 914 907 INIT_HLIST_HEAD(&fib_table_hash[i]); 915 - #ifndef CONFIG_IP_MULTIPLE_TABLES 916 - ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL); 917 - hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]); 918 - ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN); 919 - hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]); 920 - #else 908 + 921 909 fib4_rules_init(); 922 - #endif 923 910 924 911 register_netdevice_notifier(&fib_netdev_notifier); 925 912 register_inetaddr_notifier(&fib_inetaddr_notifier);
+5 -4
net/ipv4/inet_diag.c
··· 747 747 748 748 for (i = s_i; i < hashinfo->ehash_size; i++) { 749 749 struct inet_ehash_bucket *head = &hashinfo->ehash[i]; 750 + rwlock_t *lock = inet_ehash_lockp(hashinfo, i); 750 751 struct sock *sk; 751 752 struct hlist_node *node; 752 753 753 754 if (i > s_i) 754 755 s_num = 0; 755 756 756 - read_lock_bh(&head->lock); 757 + read_lock_bh(lock); 757 758 num = 0; 758 759 sk_for_each(sk, node, &head->chain) { 759 760 struct inet_sock *inet = inet_sk(sk); ··· 770 769 r->id.idiag_dport) 771 770 goto next_normal; 772 771 if (inet_csk_diag_dump(sk, skb, cb) < 0) { 773 - read_unlock_bh(&head->lock); 772 + read_unlock_bh(lock); 774 773 goto done; 775 774 } 776 775 next_normal: ··· 792 791 r->id.idiag_dport) 793 792 goto next_dying; 794 793 if (inet_twsk_diag_dump(tw, skb, cb) < 0) { 795 - read_unlock_bh(&head->lock); 794 + read_unlock_bh(lock); 796 795 goto done; 797 796 } 798 797 next_dying: 799 798 ++num; 800 799 } 801 800 } 802 - read_unlock_bh(&head->lock); 801 + read_unlock_bh(lock); 803 802 } 804 803 805 804 done:
+4 -3
net/ipv4/inet_hashtables.c
··· 204 204 const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); 205 205 unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); 206 206 struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); 207 + rwlock_t *lock = inet_ehash_lockp(hinfo, hash); 207 208 struct sock *sk2; 208 209 const struct hlist_node *node; 209 210 struct inet_timewait_sock *tw; 210 211 211 212 prefetch(head->chain.first); 212 - write_lock(&head->lock); 213 + write_lock(lock); 213 214 214 215 /* Check TIME-WAIT sockets first. */ 215 216 sk_for_each(sk2, node, &head->twchain) { ··· 240 239 BUG_TRAP(sk_unhashed(sk)); 241 240 __sk_add_node(sk, &head->chain); 242 241 sock_prot_inc_use(sk->sk_prot); 243 - write_unlock(&head->lock); 242 + write_unlock(lock); 244 243 245 244 if (twp) { 246 245 *twp = tw; ··· 256 255 return 0; 257 256 258 257 not_unique: 259 - write_unlock(&head->lock); 258 + write_unlock(lock); 260 259 return -EADDRNOTAVAIL; 261 260 } 262 261
+7 -6
net/ipv4/inet_timewait_sock.c
··· 20 20 struct inet_bind_hashbucket *bhead; 21 21 struct inet_bind_bucket *tb; 22 22 /* Unlink from established hashes. */ 23 - struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, tw->tw_hash); 23 + rwlock_t *lock = inet_ehash_lockp(hashinfo, tw->tw_hash); 24 24 25 - write_lock(&ehead->lock); 25 + write_lock(lock); 26 26 if (hlist_unhashed(&tw->tw_node)) { 27 - write_unlock(&ehead->lock); 27 + write_unlock(lock); 28 28 return; 29 29 } 30 30 __hlist_del(&tw->tw_node); 31 31 sk_node_init(&tw->tw_node); 32 - write_unlock(&ehead->lock); 32 + write_unlock(lock); 33 33 34 34 /* Disassociate with bind bucket. */ 35 35 bhead = &hashinfo->bhash[inet_bhashfn(tw->tw_num, hashinfo->bhash_size)]; ··· 59 59 const struct inet_sock *inet = inet_sk(sk); 60 60 const struct inet_connection_sock *icsk = inet_csk(sk); 61 61 struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, sk->sk_hash); 62 + rwlock_t *lock = inet_ehash_lockp(hashinfo, sk->sk_hash); 62 63 struct inet_bind_hashbucket *bhead; 63 64 /* Step 1: Put TW into bind hash. Original socket stays there too. 64 65 Note, that any socket with inet->num != 0 MUST be bound in ··· 72 71 inet_twsk_add_bind_node(tw, &tw->tw_tb->owners); 73 72 spin_unlock(&bhead->lock); 74 73 75 - write_lock(&ehead->lock); 74 + write_lock(lock); 76 75 77 76 /* Step 2: Remove SK from established hash. */ 78 77 if (__sk_del_node_init(sk)) ··· 82 81 inet_twsk_add_node(tw, &ehead->twchain); 83 82 atomic_inc(&tw->tw_refcnt); 84 83 85 - write_unlock(&ehead->lock); 84 + write_unlock(lock); 86 85 } 87 86 88 87 EXPORT_SYMBOL_GPL(__inet_twsk_hashdance);
+13 -15
net/ipv4/ip_output.c
··· 1183 1183 return err; 1184 1184 } 1185 1185 1186 + static void ip_cork_release(struct inet_sock *inet) 1187 + { 1188 + inet->cork.flags &= ~IPCORK_OPT; 1189 + kfree(inet->cork.opt); 1190 + inet->cork.opt = NULL; 1191 + if (inet->cork.rt) { 1192 + ip_rt_put(inet->cork.rt); 1193 + inet->cork.rt = NULL; 1194 + } 1195 + } 1196 + 1186 1197 /* 1187 1198 * Combined all pending IP fragments on the socket as one IP datagram 1188 1199 * and push them out. ··· 1287 1276 } 1288 1277 1289 1278 out: 1290 - inet->cork.flags &= ~IPCORK_OPT; 1291 - kfree(inet->cork.opt); 1292 - inet->cork.opt = NULL; 1293 - if (inet->cork.rt) { 1294 - ip_rt_put(inet->cork.rt); 1295 - inet->cork.rt = NULL; 1296 - } 1279 + ip_cork_release(inet); 1297 1280 return err; 1298 1281 1299 1282 error: ··· 1300 1295 */ 1301 1296 void ip_flush_pending_frames(struct sock *sk) 1302 1297 { 1303 - struct inet_sock *inet = inet_sk(sk); 1304 1298 struct sk_buff *skb; 1305 1299 1306 1300 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) 1307 1301 kfree_skb(skb); 1308 1302 1309 - inet->cork.flags &= ~IPCORK_OPT; 1310 - kfree(inet->cork.opt); 1311 - inet->cork.opt = NULL; 1312 - if (inet->cork.rt) { 1313 - ip_rt_put(inet->cork.rt); 1314 - inet->cork.rt = NULL; 1315 - } 1303 + ip_cork_release(inet_sk(sk)); 1316 1304 } 1317 1305 1318 1306
+12 -27
net/ipv4/ip_sockglue.c
··· 437 437 438 438 /* If optlen==0, it is equivalent to val == 0 */ 439 439 440 - #ifdef CONFIG_IP_MROUTE 441 - if (optname >= MRT_BASE && optname <= (MRT_BASE + 10)) 440 + if (ip_mroute_opt(optname)) 442 441 return ip_mroute_setsockopt(sk,optname,optval,optlen); 443 - #endif 444 442 445 443 err = 0; 446 444 lock_sock(sk); ··· 907 909 #ifdef CONFIG_NETFILTER 908 910 /* we need to exclude all possible ENOPROTOOPTs except default case */ 909 911 if (err == -ENOPROTOOPT && optname != IP_HDRINCL && 910 - optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY 911 - #ifdef CONFIG_IP_MROUTE 912 - && (optname < MRT_BASE || optname > (MRT_BASE + 10)) 913 - #endif 914 - ) { 912 + optname != IP_IPSEC_POLICY && 913 + optname != IP_XFRM_POLICY && 914 + !ip_mroute_opt(optname)) { 915 915 lock_sock(sk); 916 916 err = nf_setsockopt(sk, PF_INET, optname, optval, optlen); 917 917 release_sock(sk); ··· 931 935 #ifdef CONFIG_NETFILTER 932 936 /* we need to exclude all possible ENOPROTOOPTs except default case */ 933 937 if (err == -ENOPROTOOPT && optname != IP_HDRINCL && 934 - optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY 935 - #ifdef CONFIG_IP_MROUTE 936 - && (optname < MRT_BASE || optname > (MRT_BASE + 10)) 937 - #endif 938 - ) { 938 + optname != IP_IPSEC_POLICY && 939 + optname != IP_XFRM_POLICY && 940 + !ip_mroute_opt(optname)) { 939 941 lock_sock(sk); 940 942 err = compat_nf_setsockopt(sk, PF_INET, optname, 941 943 optval, optlen); ··· 961 967 if (level != SOL_IP) 962 968 return -EOPNOTSUPP; 963 969 964 - #ifdef CONFIG_IP_MROUTE 965 - if (optname >= MRT_BASE && optname <= MRT_BASE+10) { 970 + if (ip_mroute_opt(optname)) 966 971 return ip_mroute_getsockopt(sk,optname,optval,optlen); 967 - } 968 - #endif 969 972 970 973 if (get_user(len,optlen)) 971 974 return -EFAULT; ··· 1162 1171 err = do_ip_getsockopt(sk, level, optname, optval, optlen); 1163 1172 #ifdef CONFIG_NETFILTER 1164 1173 /* we need to exclude all possible ENOPROTOOPTs except default case */ 1165 - if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS 1166 - #ifdef CONFIG_IP_MROUTE 1167 - && (optname < MRT_BASE || optname > MRT_BASE+10) 1168 - #endif 1169 - ) { 1174 + if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && 1175 + !ip_mroute_opt(optname)) { 1170 1176 int len; 1171 1177 1172 1178 if (get_user(len,optlen)) ··· 1188 1200 int err = do_ip_getsockopt(sk, level, optname, optval, optlen); 1189 1201 #ifdef CONFIG_NETFILTER 1190 1202 /* we need to exclude all possible ENOPROTOOPTs except default case */ 1191 - if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS 1192 - #ifdef CONFIG_IP_MROUTE 1193 - && (optname < MRT_BASE || optname > MRT_BASE+10) 1194 - #endif 1195 - ) { 1203 + if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && 1204 + !ip_mroute_opt(optname)) { 1196 1205 int len; 1197 1206 1198 1207 if (get_user(len, optlen))
+2 -1
net/ipv4/ipcomp.c
··· 16 16 #include <linux/module.h> 17 17 #include <asm/semaphore.h> 18 18 #include <linux/crypto.h> 19 + #include <linux/err.h> 19 20 #include <linux/pfkeyv2.h> 20 21 #include <linux/percpu.h> 21 22 #include <linux/smp.h> ··· 345 344 for_each_possible_cpu(cpu) { 346 345 struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, 347 346 CRYPTO_ALG_ASYNC); 348 - if (!tfm) 347 + if (IS_ERR(tfm)) 349 348 goto error; 350 349 *per_cpu_ptr(tfms, cpu) = tfm; 351 350 }
+19
net/ipv4/ipvs/ip_vs_conn.c
··· 426 426 427 427 428 428 /* 429 + * Check if there is a destination for the connection, if so 430 + * bind the connection to the destination. 431 + */ 432 + struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp) 433 + { 434 + struct ip_vs_dest *dest; 435 + 436 + if ((cp) && (!cp->dest)) { 437 + dest = ip_vs_find_dest(cp->daddr, cp->dport, 438 + cp->vaddr, cp->vport, cp->protocol); 439 + ip_vs_bind_dest(cp, dest); 440 + return dest; 441 + } else 442 + return NULL; 443 + } 444 + EXPORT_SYMBOL(ip_vs_try_bind_dest); 445 + 446 + 447 + /* 429 448 * Unbind a connection entry with its VS destination 430 449 * Called by the ip_vs_conn_expire function. 431 450 */
+14 -6
net/ipv4/ipvs/ip_vs_core.c
··· 979 979 ret = NF_ACCEPT; 980 980 } 981 981 982 - /* increase its packet counter and check if it is needed 983 - to be synchronized */ 982 + /* Increase its packet counter and check if it is needed 983 + * to be synchronized 984 + * 985 + * Sync connection if it is about to close to 986 + * encorage the standby servers to update the connections timeout 987 + */ 984 988 atomic_inc(&cp->in_pkts); 985 989 if ((ip_vs_sync_state & IP_VS_STATE_MASTER) && 986 - (cp->protocol != IPPROTO_TCP || 987 - cp->state == IP_VS_TCP_S_ESTABLISHED) && 988 - (atomic_read(&cp->in_pkts) % sysctl_ip_vs_sync_threshold[1] 989 - == sysctl_ip_vs_sync_threshold[0])) 990 + (((cp->protocol != IPPROTO_TCP || 991 + cp->state == IP_VS_TCP_S_ESTABLISHED) && 992 + (atomic_read(&cp->in_pkts) % sysctl_ip_vs_sync_threshold[1] 993 + == sysctl_ip_vs_sync_threshold[0])) || 994 + ((cp->protocol == IPPROTO_TCP) && (cp->old_state != cp->state) && 995 + ((cp->state == IP_VS_TCP_S_FIN_WAIT) || 996 + (cp->state == IP_VS_TCP_S_CLOSE))))) 990 997 ip_vs_sync_conn(cp); 998 + cp->old_state = cp->state; 991 999 992 1000 ip_vs_conn_put(cp); 993 1001 return ret;
+26
net/ipv4/ipvs/ip_vs_ctl.c
··· 579 579 return NULL; 580 580 } 581 581 582 + /* 583 + * Find destination by {daddr,dport,vaddr,protocol} 584 + * Cretaed to be used in ip_vs_process_message() in 585 + * the backup synchronization daemon. It finds the 586 + * destination to be bound to the received connection 587 + * on the backup. 588 + * 589 + * ip_vs_lookup_real_service() looked promissing, but 590 + * seems not working as expected. 591 + */ 592 + struct ip_vs_dest *ip_vs_find_dest(__be32 daddr, __be16 dport, 593 + __be32 vaddr, __be16 vport, __u16 protocol) 594 + { 595 + struct ip_vs_dest *dest; 596 + struct ip_vs_service *svc; 597 + 598 + svc = ip_vs_service_get(0, protocol, vaddr, vport); 599 + if (!svc) 600 + return NULL; 601 + dest = ip_vs_lookup_dest(svc, daddr, dport); 602 + if (dest) 603 + atomic_inc(&dest->refcnt); 604 + ip_vs_service_put(svc); 605 + return dest; 606 + } 607 + EXPORT_SYMBOL(ip_vs_find_dest); 582 608 583 609 /* 584 610 * Lookup dest by {svc,addr,port} in the destination trash.
+20 -4
net/ipv4/ipvs/ip_vs_sync.c
··· 284 284 struct ip_vs_sync_conn_options *opt; 285 285 struct ip_vs_conn *cp; 286 286 struct ip_vs_protocol *pp; 287 + struct ip_vs_dest *dest; 287 288 char *p; 288 289 int i; 289 290 ··· 318 317 s->caddr, s->cport, 319 318 s->vaddr, s->vport); 320 319 if (!cp) { 320 + /* 321 + * Find the appropriate destination for the connection. 322 + * If it is not found the connection will remain unbound 323 + * but still handled. 324 + */ 325 + dest = ip_vs_find_dest(s->daddr, s->dport, 326 + s->vaddr, s->vport, 327 + s->protocol); 321 328 cp = ip_vs_conn_new(s->protocol, 322 329 s->caddr, s->cport, 323 330 s->vaddr, s->vport, 324 331 s->daddr, s->dport, 325 - flags, NULL); 332 + flags, dest); 333 + if (dest) 334 + atomic_dec(&dest->refcnt); 326 335 if (!cp) { 327 336 IP_VS_ERR("ip_vs_conn_new failed\n"); 328 337 return; 329 338 } 330 339 cp->state = ntohs(s->state); 331 340 } else if (!cp->dest) { 332 - /* it is an entry created by the synchronization */ 333 - cp->state = ntohs(s->state); 334 - cp->flags = flags | IP_VS_CONN_F_HASHED; 341 + dest = ip_vs_try_bind_dest(cp); 342 + if (!dest) { 343 + /* it is an unbound entry created by 344 + * synchronization */ 345 + cp->flags = flags | IP_VS_CONN_F_HASHED; 346 + } else 347 + atomic_dec(&dest->refcnt); 335 348 } /* Note that we don't touch its state and flags 336 349 if it is a normal entry. */ 337 350 ··· 357 342 p += SIMPLE_CONN_SIZE; 358 343 359 344 atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); 345 + cp->state = ntohs(s->state); 360 346 pp = ip_vs_proto_get(s->protocol); 361 347 cp->timeout = pp->timeout_table[cp->state]; 362 348 ip_vs_conn_put(cp);
+13 -13
net/ipv4/netfilter/Makefile
··· 41 41 obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o 42 42 43 43 # matches 44 + obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o 45 + obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o 46 + obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o 44 47 obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o 45 48 obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o 46 - obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o 47 49 obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o 48 - obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o 49 - obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o 50 + obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o 50 51 obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o 51 - obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o 52 52 53 53 # targets 54 - obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o 55 - obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o 56 - obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o 57 - obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o 58 - obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o 59 - obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o 60 - obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o 61 - obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o 62 - obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o 63 54 obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o 55 + obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o 56 + obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o 57 + obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o 58 + obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o 59 + obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o 60 + obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o 61 + obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o 62 + obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o 64 63 obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o 64 + obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o 65 65 66 66 # generic ARP tables 67 67 obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o
+21 -18
net/ipv4/netfilter/ip_queue.c
··· 22 22 #include <linux/spinlock.h> 23 23 #include <linux/sysctl.h> 24 24 #include <linux/proc_fs.h> 25 + #include <linux/seq_file.h> 25 26 #include <linux/security.h> 26 27 #include <linux/mutex.h> 27 28 #include <net/net_namespace.h> ··· 608 607 { .ctl_name = 0 } 609 608 }; 610 609 611 - #ifdef CONFIG_PROC_FS 612 - static int 613 - ipq_get_info(char *buffer, char **start, off_t offset, int length) 610 + static int ip_queue_show(struct seq_file *m, void *v) 614 611 { 615 - int len; 616 - 617 612 read_lock_bh(&queue_lock); 618 613 619 - len = sprintf(buffer, 614 + seq_printf(m, 620 615 "Peer PID : %d\n" 621 616 "Copy mode : %hu\n" 622 617 "Copy range : %u\n" ··· 629 632 queue_user_dropped); 630 633 631 634 read_unlock_bh(&queue_lock); 632 - 633 - *start = buffer + offset; 634 - len -= offset; 635 - if (len > length) 636 - len = length; 637 - else if (len < 0) 638 - len = 0; 639 - return len; 635 + return 0; 640 636 } 641 - #endif /* CONFIG_PROC_FS */ 637 + 638 + static int ip_queue_open(struct inode *inode, struct file *file) 639 + { 640 + return single_open(file, ip_queue_show, NULL); 641 + } 642 + 643 + static const struct file_operations ip_queue_proc_fops = { 644 + .open = ip_queue_open, 645 + .read = seq_read, 646 + .llseek = seq_lseek, 647 + .release = single_release, 648 + .owner = THIS_MODULE, 649 + }; 642 650 643 651 static struct nf_queue_handler nfqh = { 644 652 .name = "ip_queue", ··· 663 661 goto cleanup_netlink_notifier; 664 662 } 665 663 666 - proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info); 667 - if (proc) 664 + proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); 665 + if (proc) { 668 666 proc->owner = THIS_MODULE; 669 - else { 667 + proc->proc_fops = &ip_queue_proc_fops; 668 + } else { 670 669 printk(KERN_ERR "ip_queue: failed to create proc entry\n"); 671 670 goto cleanup_ipqnl; 672 671 }
+1 -1
net/ipv4/netfilter/nf_nat_amanda.c
··· 69 69 70 70 static int __init nf_nat_amanda_init(void) 71 71 { 72 - BUG_ON(rcu_dereference(nf_nat_amanda_hook)); 72 + BUG_ON(nf_nat_amanda_hook != NULL); 73 73 rcu_assign_pointer(nf_nat_amanda_hook, help); 74 74 return 0; 75 75 }
+1 -1
net/ipv4/netfilter/nf_nat_ftp.c
··· 147 147 148 148 static int __init nf_nat_ftp_init(void) 149 149 { 150 - BUG_ON(rcu_dereference(nf_nat_ftp_hook)); 150 + BUG_ON(nf_nat_ftp_hook != NULL); 151 151 rcu_assign_pointer(nf_nat_ftp_hook, nf_nat_ftp); 152 152 return 0; 153 153 }
+9 -9
net/ipv4/netfilter/nf_nat_h323.c
··· 544 544 /****************************************************************************/ 545 545 static int __init init(void) 546 546 { 547 - BUG_ON(rcu_dereference(set_h245_addr_hook) != NULL); 548 - BUG_ON(rcu_dereference(set_h225_addr_hook) != NULL); 549 - BUG_ON(rcu_dereference(set_sig_addr_hook) != NULL); 550 - BUG_ON(rcu_dereference(set_ras_addr_hook) != NULL); 551 - BUG_ON(rcu_dereference(nat_rtp_rtcp_hook) != NULL); 552 - BUG_ON(rcu_dereference(nat_t120_hook) != NULL); 553 - BUG_ON(rcu_dereference(nat_h245_hook) != NULL); 554 - BUG_ON(rcu_dereference(nat_callforwarding_hook) != NULL); 555 - BUG_ON(rcu_dereference(nat_q931_hook) != NULL); 547 + BUG_ON(set_h245_addr_hook != NULL); 548 + BUG_ON(set_h225_addr_hook != NULL); 549 + BUG_ON(set_sig_addr_hook != NULL); 550 + BUG_ON(set_ras_addr_hook != NULL); 551 + BUG_ON(nat_rtp_rtcp_hook != NULL); 552 + BUG_ON(nat_t120_hook != NULL); 553 + BUG_ON(nat_h245_hook != NULL); 554 + BUG_ON(nat_callforwarding_hook != NULL); 555 + BUG_ON(nat_q931_hook != NULL); 556 556 557 557 rcu_assign_pointer(set_h245_addr_hook, set_h245_addr); 558 558 rcu_assign_pointer(set_h225_addr_hook, set_h225_addr);
+1 -1
net/ipv4/netfilter/nf_nat_irc.c
··· 74 74 75 75 static int __init nf_nat_irc_init(void) 76 76 { 77 - BUG_ON(rcu_dereference(nf_nat_irc_hook)); 77 + BUG_ON(nf_nat_irc_hook != NULL); 78 78 rcu_assign_pointer(nf_nat_irc_hook, help); 79 79 return 0; 80 80 }
+4 -4
net/ipv4/netfilter/nf_nat_pptp.c
··· 281 281 { 282 282 nf_nat_need_gre(); 283 283 284 - BUG_ON(rcu_dereference(nf_nat_pptp_hook_outbound)); 284 + BUG_ON(nf_nat_pptp_hook_outbound != NULL); 285 285 rcu_assign_pointer(nf_nat_pptp_hook_outbound, pptp_outbound_pkt); 286 286 287 - BUG_ON(rcu_dereference(nf_nat_pptp_hook_inbound)); 287 + BUG_ON(nf_nat_pptp_hook_inbound != NULL); 288 288 rcu_assign_pointer(nf_nat_pptp_hook_inbound, pptp_inbound_pkt); 289 289 290 - BUG_ON(rcu_dereference(nf_nat_pptp_hook_exp_gre)); 290 + BUG_ON(nf_nat_pptp_hook_exp_gre != NULL); 291 291 rcu_assign_pointer(nf_nat_pptp_hook_exp_gre, pptp_exp_gre); 292 292 293 - BUG_ON(rcu_dereference(nf_nat_pptp_hook_expectfn)); 293 + BUG_ON(nf_nat_pptp_hook_expectfn != NULL); 294 294 rcu_assign_pointer(nf_nat_pptp_hook_expectfn, pptp_nat_expected); 295 295 return 0; 296 296 }
+2 -2
net/ipv4/netfilter/nf_nat_sip.c
··· 293 293 294 294 static int __init nf_nat_sip_init(void) 295 295 { 296 - BUG_ON(rcu_dereference(nf_nat_sip_hook)); 297 - BUG_ON(rcu_dereference(nf_nat_sdp_hook)); 296 + BUG_ON(nf_nat_sip_hook != NULL); 297 + BUG_ON(nf_nat_sdp_hook != NULL); 298 298 rcu_assign_pointer(nf_nat_sip_hook, ip_nat_sip); 299 299 rcu_assign_pointer(nf_nat_sdp_hook, ip_nat_sdp); 300 300 return 0;
+1 -1
net/ipv4/netfilter/nf_nat_tftp.c
··· 43 43 44 44 static int __init nf_nat_tftp_init(void) 45 45 { 46 - BUG_ON(rcu_dereference(nf_nat_tftp_hook)); 46 + BUG_ON(nf_nat_tftp_hook != NULL); 47 47 rcu_assign_pointer(nf_nat_tftp_hook, help); 48 48 return 0; 49 49 }
+4 -15
net/ipv4/proc.c
··· 46 46 #include <net/sock.h> 47 47 #include <net/raw.h> 48 48 49 - static int fold_prot_inuse(struct proto *proto) 50 - { 51 - int res = 0; 52 - int cpu; 53 - 54 - for_each_possible_cpu(cpu) 55 - res += proto->stats[cpu].inuse; 56 - 57 - return res; 58 - } 59 - 60 49 /* 61 50 * Report socket allocation statistics [mea@utu.fi] 62 51 */ ··· 53 64 { 54 65 socket_seq_show(seq); 55 66 seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", 56 - fold_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count), 67 + sock_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count), 57 68 tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated), 58 69 atomic_read(&tcp_memory_allocated)); 59 - seq_printf(seq, "UDP: inuse %d\n", fold_prot_inuse(&udp_prot)); 60 - seq_printf(seq, "UDPLITE: inuse %d\n", fold_prot_inuse(&udplite_prot)); 61 - seq_printf(seq, "RAW: inuse %d\n", fold_prot_inuse(&raw_prot)); 70 + seq_printf(seq, "UDP: inuse %d\n", sock_prot_inuse(&udp_prot)); 71 + seq_printf(seq, "UDPLITE: inuse %d\n", sock_prot_inuse(&udplite_prot)); 72 + seq_printf(seq, "RAW: inuse %d\n", sock_prot_inuse(&raw_prot)); 62 73 seq_printf(seq, "FRAG: inuse %d memory %d\n", 63 74 ip_frag_nqueues(), ip_frag_mem()); 64 75 return 0;
+3
net/ipv4/raw.c
··· 760 760 } 761 761 } 762 762 763 + DEFINE_PROTO_INUSE(raw) 764 + 763 765 struct proto raw_prot = { 764 766 .name = "RAW", 765 767 .owner = THIS_MODULE, ··· 783 781 .compat_setsockopt = compat_raw_setsockopt, 784 782 .compat_getsockopt = compat_raw_getsockopt, 785 783 #endif 784 + REF_PROTO_INUSE(raw) 786 785 }; 787 786 788 787 #ifdef CONFIG_PROC_FS
+2 -2
net/ipv4/tcp.c
··· 2456 2456 thash_entries ? 0 : 512 * 1024); 2457 2457 tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size; 2458 2458 for (i = 0; i < tcp_hashinfo.ehash_size; i++) { 2459 - rwlock_init(&tcp_hashinfo.ehash[i].lock); 2460 2459 INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].chain); 2461 2460 INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].twchain); 2462 2461 } 2463 - 2462 + if (inet_ehash_locks_alloc(&tcp_hashinfo)) 2463 + panic("TCP: failed to alloc ehash_locks"); 2464 2464 tcp_hashinfo.bhash = 2465 2465 alloc_large_system_hash("TCP bind", 2466 2466 sizeof(struct inet_bind_hashbucket),
+9 -5
net/ipv4/tcp_ipv4.c
··· 2049 2049 struct sock *sk; 2050 2050 struct hlist_node *node; 2051 2051 struct inet_timewait_sock *tw; 2052 + rwlock_t *lock = inet_ehash_lockp(&tcp_hashinfo, st->bucket); 2052 2053 2053 - read_lock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2054 + read_lock_bh(lock); 2054 2055 sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { 2055 2056 if (sk->sk_family != st->family) { 2056 2057 continue; ··· 2068 2067 rc = tw; 2069 2068 goto out; 2070 2069 } 2071 - read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2070 + read_unlock_bh(lock); 2072 2071 st->state = TCP_SEQ_STATE_ESTABLISHED; 2073 2072 } 2074 2073 out: ··· 2095 2094 cur = tw; 2096 2095 goto out; 2097 2096 } 2098 - read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2097 + read_unlock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket)); 2099 2098 st->state = TCP_SEQ_STATE_ESTABLISHED; 2100 2099 2101 2100 if (++st->bucket < tcp_hashinfo.ehash_size) { 2102 - read_lock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2101 + read_lock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket)); 2103 2102 sk = sk_head(&tcp_hashinfo.ehash[st->bucket].chain); 2104 2103 } else { 2105 2104 cur = NULL; ··· 2207 2206 case TCP_SEQ_STATE_TIME_WAIT: 2208 2207 case TCP_SEQ_STATE_ESTABLISHED: 2209 2208 if (v) 2210 - read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2209 + read_unlock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket)); 2211 2210 break; 2212 2211 } 2213 2212 } ··· 2418 2417 } 2419 2418 #endif /* CONFIG_PROC_FS */ 2420 2419 2420 + DEFINE_PROTO_INUSE(tcp) 2421 + 2421 2422 struct proto tcp_prot = { 2422 2423 .name = "TCP", 2423 2424 .owner = THIS_MODULE, ··· 2454 2451 .compat_setsockopt = compat_tcp_setsockopt, 2455 2452 .compat_getsockopt = compat_tcp_getsockopt, 2456 2453 #endif 2454 + REF_PROTO_INUSE(tcp) 2457 2455 }; 2458 2456 2459 2457 void __init tcp_v4_init(struct net_proto_family *ops)
+3
net/ipv4/udp.c
··· 1430 1430 1431 1431 } 1432 1432 1433 + DEFINE_PROTO_INUSE(udp) 1434 + 1433 1435 struct proto udp_prot = { 1434 1436 .name = "UDP", 1435 1437 .owner = THIS_MODULE, ··· 1454 1452 .compat_setsockopt = compat_udp_setsockopt, 1455 1453 .compat_getsockopt = compat_udp_getsockopt, 1456 1454 #endif 1455 + REF_PROTO_INUSE(udp) 1457 1456 }; 1458 1457 1459 1458 /* ------------------------------------------------------------------------ */
+3
net/ipv4/udplite.c
··· 44 44 .no_policy = 1, 45 45 }; 46 46 47 + DEFINE_PROTO_INUSE(udplite) 48 + 47 49 struct proto udplite_prot = { 48 50 .name = "UDP-Lite", 49 51 .owner = THIS_MODULE, ··· 69 67 .compat_setsockopt = compat_udp_setsockopt, 70 68 .compat_getsockopt = compat_udp_getsockopt, 71 69 #endif 70 + REF_PROTO_INUSE(udplite) 72 71 }; 73 72 74 73 static struct inet_protosw udplite4_protosw = {
+10 -9
net/ipv6/inet6_hashtables.c
··· 37 37 } else { 38 38 unsigned int hash; 39 39 sk->sk_hash = hash = inet6_sk_ehashfn(sk); 40 - hash &= (hashinfo->ehash_size - 1); 41 - list = &hashinfo->ehash[hash].chain; 42 - lock = &hashinfo->ehash[hash].lock; 40 + list = &inet_ehash_bucket(hashinfo, hash)->chain; 41 + lock = inet_ehash_lockp(hashinfo, hash); 43 42 write_lock(lock); 44 43 } 45 44 ··· 69 70 */ 70 71 unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport); 71 72 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); 73 + rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); 72 74 73 75 prefetch(head->chain.first); 74 - read_lock(&head->lock); 76 + read_lock(lock); 75 77 sk_for_each(sk, node, &head->chain) { 76 78 /* For IPV6 do the cheaper port and family tests first. */ 77 79 if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif)) ··· 92 92 goto hit; 93 93 } 94 94 } 95 - read_unlock(&head->lock); 95 + read_unlock(lock); 96 96 return NULL; 97 97 98 98 hit: 99 99 sock_hold(sk); 100 - read_unlock(&head->lock); 100 + read_unlock(lock); 101 101 return sk; 102 102 } 103 103 EXPORT_SYMBOL(__inet6_lookup_established); ··· 175 175 const unsigned int hash = inet6_ehashfn(daddr, lport, saddr, 176 176 inet->dport); 177 177 struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); 178 + rwlock_t *lock = inet_ehash_lockp(hinfo, hash); 178 179 struct sock *sk2; 179 180 const struct hlist_node *node; 180 181 struct inet_timewait_sock *tw; 181 182 182 183 prefetch(head->chain.first); 183 - write_lock(&head->lock); 184 + write_lock(lock); 184 185 185 186 /* Check TIME-WAIT sockets first. */ 186 187 sk_for_each(sk2, node, &head->twchain) { ··· 217 216 __sk_add_node(sk, &head->chain); 218 217 sk->sk_hash = hash; 219 218 sock_prot_inc_use(sk->sk_prot); 220 - write_unlock(&head->lock); 219 + write_unlock(lock); 221 220 222 221 if (twp != NULL) { 223 222 *twp = tw; ··· 232 231 return 0; 233 232 234 233 not_unique: 235 - write_unlock(&head->lock); 234 + write_unlock(lock); 236 235 return -EADDRNOTAVAIL; 237 236 } 238 237
+15 -21
net/ipv6/ip6_output.c
··· 1339 1339 return err; 1340 1340 } 1341 1341 1342 + static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np) 1343 + { 1344 + inet->cork.flags &= ~IPCORK_OPT; 1345 + kfree(np->cork.opt); 1346 + np->cork.opt = NULL; 1347 + if (np->cork.rt) { 1348 + dst_release(&np->cork.rt->u.dst); 1349 + np->cork.rt = NULL; 1350 + inet->cork.flags &= ~IPCORK_ALLFRAG; 1351 + } 1352 + memset(&inet->cork.fl, 0, sizeof(inet->cork.fl)); 1353 + } 1354 + 1342 1355 int ip6_push_pending_frames(struct sock *sk) 1343 1356 { 1344 1357 struct sk_buff *skb, *tmp_skb; ··· 1428 1415 } 1429 1416 1430 1417 out: 1431 - inet->cork.flags &= ~IPCORK_OPT; 1432 - kfree(np->cork.opt); 1433 - np->cork.opt = NULL; 1434 - if (np->cork.rt) { 1435 - dst_release(&np->cork.rt->u.dst); 1436 - np->cork.rt = NULL; 1437 - inet->cork.flags &= ~IPCORK_ALLFRAG; 1438 - } 1439 - memset(&inet->cork.fl, 0, sizeof(inet->cork.fl)); 1418 + ip6_cork_release(inet, np); 1440 1419 return err; 1441 1420 error: 1442 1421 goto out; ··· 1436 1431 1437 1432 void ip6_flush_pending_frames(struct sock *sk) 1438 1433 { 1439 - struct inet_sock *inet = inet_sk(sk); 1440 - struct ipv6_pinfo *np = inet6_sk(sk); 1441 1434 struct sk_buff *skb; 1442 1435 1443 1436 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { ··· 1445 1442 kfree_skb(skb); 1446 1443 } 1447 1444 1448 - inet->cork.flags &= ~IPCORK_OPT; 1449 - 1450 - kfree(np->cork.opt); 1451 - np->cork.opt = NULL; 1452 - if (np->cork.rt) { 1453 - dst_release(&np->cork.rt->u.dst); 1454 - np->cork.rt = NULL; 1455 - inet->cork.flags &= ~IPCORK_ALLFRAG; 1456 - } 1457 - memset(&inet->cork.fl, 0, sizeof(inet->cork.fl)); 1445 + ip6_cork_release(inet_sk(sk), inet6_sk(sk)); 1458 1446 }
+2 -1
net/ipv6/ipcomp6.c
··· 36 36 #include <net/ipcomp.h> 37 37 #include <asm/semaphore.h> 38 38 #include <linux/crypto.h> 39 + #include <linux/err.h> 39 40 #include <linux/pfkeyv2.h> 40 41 #include <linux/random.h> 41 42 #include <linux/percpu.h> ··· 359 358 for_each_possible_cpu(cpu) { 360 359 struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, 361 360 CRYPTO_ALG_ASYNC); 362 - if (!tfm) 361 + if (IS_ERR(tfm)) 363 362 goto error; 364 363 *per_cpu_ptr(tfms, cpu) = tfm; 365 364 }
+16 -12
net/ipv6/netfilter/Makefile
··· 4 4 5 5 # Link order matters here. 6 6 obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o 7 - obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o 8 - obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o 9 - obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o 10 - obj-$(CONFIG_IP6_NF_MATCH_FRAG) += ip6t_frag.o 11 - obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o 12 - obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o 13 - obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o 14 7 obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o 15 8 obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o 16 - obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o 17 9 obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o 18 - obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o 19 10 obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o 20 - obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o 21 - obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o 22 - obj-$(CONFIG_IP6_NF_MATCH_MH) += ip6t_mh.o 23 11 24 12 # objects for l3 independent conntrack 25 13 nf_conntrack_ipv6-objs := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o nf_conntrack_reasm.o 26 14 27 15 # l3 independent conntrack 28 16 obj-$(CONFIG_NF_CONNTRACK_IPV6) += nf_conntrack_ipv6.o 17 + 18 + # matches 19 + obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o 20 + obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o 21 + obj-$(CONFIG_IP6_NF_MATCH_FRAG) += ip6t_frag.o 22 + obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o 23 + obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o 24 + obj-$(CONFIG_IP6_NF_MATCH_MH) += ip6t_mh.o 25 + obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o 26 + obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o 27 + obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o 28 + 29 + # targets 30 + obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o 31 + obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o 32 + obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o
+21 -18
net/ipv6/netfilter/ip6_queue.c
··· 23 23 #include <linux/spinlock.h> 24 24 #include <linux/sysctl.h> 25 25 #include <linux/proc_fs.h> 26 + #include <linux/seq_file.h> 26 27 #include <linux/mutex.h> 27 28 #include <net/net_namespace.h> 28 29 #include <net/sock.h> ··· 597 596 { .ctl_name = 0 } 598 597 }; 599 598 600 - #ifdef CONFIG_PROC_FS 601 - static int 602 - ipq_get_info(char *buffer, char **start, off_t offset, int length) 599 + static int ip6_queue_show(struct seq_file *m, void *v) 603 600 { 604 - int len; 605 - 606 601 read_lock_bh(&queue_lock); 607 602 608 - len = sprintf(buffer, 603 + seq_printf(m, 609 604 "Peer PID : %d\n" 610 605 "Copy mode : %hu\n" 611 606 "Copy range : %u\n" ··· 618 621 queue_user_dropped); 619 622 620 623 read_unlock_bh(&queue_lock); 621 - 622 - *start = buffer + offset; 623 - len -= offset; 624 - if (len > length) 625 - len = length; 626 - else if (len < 0) 627 - len = 0; 628 - return len; 624 + return 0; 629 625 } 630 - #endif /* CONFIG_PROC_FS */ 626 + 627 + static int ip6_queue_open(struct inode *inode, struct file *file) 628 + { 629 + return single_open(file, ip6_queue_show, NULL); 630 + } 631 + 632 + static const struct file_operations ip6_queue_proc_fops = { 633 + .open = ip6_queue_open, 634 + .read = seq_read, 635 + .llseek = seq_lseek, 636 + .release = single_release, 637 + .owner = THIS_MODULE, 638 + }; 631 639 632 640 static struct nf_queue_handler nfqh = { 633 641 .name = "ip6_queue", ··· 652 650 goto cleanup_netlink_notifier; 653 651 } 654 652 655 - proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info); 656 - if (proc) 653 + proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); 654 + if (proc) { 657 655 proc->owner = THIS_MODULE; 658 - else { 656 + proc->proc_fops = &ip6_queue_proc_fops; 657 + } else { 659 658 printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); 660 659 goto cleanup_ipqnl; 661 660 }
+4 -15
net/ipv6/proc.c
··· 32 32 33 33 static struct proc_dir_entry *proc_net_devsnmp6; 34 34 35 - static int fold_prot_inuse(struct proto *proto) 36 - { 37 - int res = 0; 38 - int cpu; 39 - 40 - for_each_possible_cpu(cpu) 41 - res += proto->stats[cpu].inuse; 42 - 43 - return res; 44 - } 45 - 46 35 static int sockstat6_seq_show(struct seq_file *seq, void *v) 47 36 { 48 37 seq_printf(seq, "TCP6: inuse %d\n", 49 - fold_prot_inuse(&tcpv6_prot)); 38 + sock_prot_inuse(&tcpv6_prot)); 50 39 seq_printf(seq, "UDP6: inuse %d\n", 51 - fold_prot_inuse(&udpv6_prot)); 40 + sock_prot_inuse(&udpv6_prot)); 52 41 seq_printf(seq, "UDPLITE6: inuse %d\n", 53 - fold_prot_inuse(&udplitev6_prot)); 42 + sock_prot_inuse(&udplitev6_prot)); 54 43 seq_printf(seq, "RAW6: inuse %d\n", 55 - fold_prot_inuse(&rawv6_prot)); 44 + sock_prot_inuse(&rawv6_prot)); 56 45 seq_printf(seq, "FRAG6: inuse %d memory %d\n", 57 46 ip6_frag_nqueues(), ip6_frag_mem()); 58 47 return 0;
+3
net/ipv6/raw.c
··· 1144 1144 return(0); 1145 1145 } 1146 1146 1147 + DEFINE_PROTO_INUSE(rawv6) 1148 + 1147 1149 struct proto rawv6_prot = { 1148 1150 .name = "RAWv6", 1149 1151 .owner = THIS_MODULE, ··· 1168 1166 .compat_setsockopt = compat_rawv6_setsockopt, 1169 1167 .compat_getsockopt = compat_rawv6_getsockopt, 1170 1168 #endif 1169 + REF_PROTO_INUSE(rawv6) 1171 1170 }; 1172 1171 1173 1172 #ifdef CONFIG_PROC_FS
+30 -63
net/ipv6/route.c
··· 38 38 #include <linux/in6.h> 39 39 #include <linux/init.h> 40 40 #include <linux/if_arp.h> 41 - 42 - #ifdef CONFIG_PROC_FS 43 41 #include <linux/proc_fs.h> 44 42 #include <linux/seq_file.h> 45 - #endif 46 - 47 43 #include <net/net_namespace.h> 48 44 #include <net/snmp.h> 49 45 #include <net/ipv6.h> ··· 2284 2288 2285 2289 static int rt6_info_route(struct rt6_info *rt, void *p_arg) 2286 2290 { 2287 - struct rt6_proc_arg *arg = (struct rt6_proc_arg *) p_arg; 2291 + struct seq_file *m = p_arg; 2288 2292 2289 - if (arg->skip < arg->offset / RT6_INFO_LEN) { 2290 - arg->skip++; 2291 - return 0; 2292 - } 2293 - 2294 - if (arg->len >= arg->length) 2295 - return 0; 2296 - 2297 - arg->len += sprintf(arg->buffer + arg->len, 2298 - NIP6_SEQFMT " %02x ", 2299 - NIP6(rt->rt6i_dst.addr), 2300 - rt->rt6i_dst.plen); 2293 + seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_dst.addr), 2294 + rt->rt6i_dst.plen); 2301 2295 2302 2296 #ifdef CONFIG_IPV6_SUBTREES 2303 - arg->len += sprintf(arg->buffer + arg->len, 2304 - NIP6_SEQFMT " %02x ", 2305 - NIP6(rt->rt6i_src.addr), 2306 - rt->rt6i_src.plen); 2297 + seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_src.addr), 2298 + rt->rt6i_src.plen); 2307 2299 #else 2308 - arg->len += sprintf(arg->buffer + arg->len, 2309 - "00000000000000000000000000000000 00 "); 2300 + seq_puts(m, "00000000000000000000000000000000 00 "); 2310 2301 #endif 2311 2302 2312 2303 if (rt->rt6i_nexthop) { 2313 - arg->len += sprintf(arg->buffer + arg->len, 2314 - NIP6_SEQFMT, 2315 - NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key))); 2304 + seq_printf(m, NIP6_SEQFMT, 2305 + NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key))); 2316 2306 } else { 2317 - arg->len += sprintf(arg->buffer + arg->len, 2318 - "00000000000000000000000000000000"); 2307 + seq_puts(m, "00000000000000000000000000000000"); 2319 2308 } 2320 - arg->len += sprintf(arg->buffer + arg->len, 2321 - " %08x %08x %08x %08x %8s\n", 2322 - rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt), 2323 - rt->u.dst.__use, rt->rt6i_flags, 2324 - rt->rt6i_dev ? rt->rt6i_dev->name : ""); 2309 + seq_printf(m, " %08x %08x %08x %08x %8s\n", 2310 + rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt), 2311 + rt->u.dst.__use, rt->rt6i_flags, 2312 + rt->rt6i_dev ? rt->rt6i_dev->name : ""); 2325 2313 return 0; 2326 2314 } 2327 2315 2328 - static int rt6_proc_info(char *buffer, char **start, off_t offset, int length) 2316 + static int ipv6_route_show(struct seq_file *m, void *v) 2329 2317 { 2330 - struct rt6_proc_arg arg = { 2331 - .buffer = buffer, 2332 - .offset = offset, 2333 - .length = length, 2334 - }; 2335 - 2336 - fib6_clean_all(rt6_info_route, 0, &arg); 2337 - 2338 - *start = buffer; 2339 - if (offset) 2340 - *start += offset % RT6_INFO_LEN; 2341 - 2342 - arg.len -= offset % RT6_INFO_LEN; 2343 - 2344 - if (arg.len > length) 2345 - arg.len = length; 2346 - if (arg.len < 0) 2347 - arg.len = 0; 2348 - 2349 - return arg.len; 2318 + fib6_clean_all(rt6_info_route, 0, m); 2319 + return 0; 2350 2320 } 2321 + 2322 + static int ipv6_route_open(struct inode *inode, struct file *file) 2323 + { 2324 + return single_open(file, ipv6_route_show, NULL); 2325 + } 2326 + 2327 + static const struct file_operations ipv6_route_proc_fops = { 2328 + .owner = THIS_MODULE, 2329 + .open = ipv6_route_open, 2330 + .read = seq_read, 2331 + .llseek = seq_lseek, 2332 + .release = single_release, 2333 + }; 2351 2334 2352 2335 static int rt6_stats_seq_show(struct seq_file *seq, void *v) 2353 2336 { ··· 2464 2489 2465 2490 void __init ip6_route_init(void) 2466 2491 { 2467 - #ifdef CONFIG_PROC_FS 2468 - struct proc_dir_entry *p; 2469 - #endif 2470 2492 ip6_dst_ops.kmem_cachep = 2471 2493 kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0, 2472 2494 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 2473 2495 ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep; 2474 2496 2475 2497 fib6_init(); 2476 - #ifdef CONFIG_PROC_FS 2477 - p = proc_net_create(&init_net, "ipv6_route", 0, rt6_proc_info); 2478 - if (p) 2479 - p->owner = THIS_MODULE; 2480 - 2498 + proc_net_fops_create(&init_net, "ipv6_route", 0, &ipv6_route_proc_fops); 2481 2499 proc_net_fops_create(&init_net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); 2482 - #endif 2483 2500 #ifdef CONFIG_XFRM 2484 2501 xfrm6_init(); 2485 2502 #endif
+3
net/ipv6/tcp_ipv6.c
··· 2107 2107 } 2108 2108 #endif 2109 2109 2110 + DEFINE_PROTO_INUSE(tcpv6) 2111 + 2110 2112 struct proto tcpv6_prot = { 2111 2113 .name = "TCPv6", 2112 2114 .owner = THIS_MODULE, ··· 2143 2141 .compat_setsockopt = compat_tcp_setsockopt, 2144 2142 .compat_getsockopt = compat_tcp_getsockopt, 2145 2143 #endif 2144 + REF_PROTO_INUSE(tcpv6) 2146 2145 }; 2147 2146 2148 2147 static struct inet6_protocol tcpv6_protocol = {
+5 -3
net/ipv6/udp.c
··· 205 205 return err; 206 206 207 207 csum_copy_err: 208 + UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite); 208 209 skb_kill_datagram(sk, skb, flags); 209 210 210 - if (flags & MSG_DONTWAIT) { 211 - UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite); 211 + if (flags & MSG_DONTWAIT) 212 212 return -EAGAIN; 213 - } 214 213 goto try_again; 215 214 } 216 215 ··· 970 971 971 972 /* ------------------------------------------------------------------------ */ 972 973 974 + DEFINE_PROTO_INUSE(udpv6) 975 + 973 976 struct proto udpv6_prot = { 974 977 .name = "UDPv6", 975 978 .owner = THIS_MODULE, ··· 993 992 .compat_setsockopt = compat_udpv6_setsockopt, 994 993 .compat_getsockopt = compat_udpv6_getsockopt, 995 994 #endif 995 + REF_PROTO_INUSE(udpv6) 996 996 }; 997 997 998 998 static struct inet_protosw udpv6_protosw = {
+3
net/ipv6/udplite.c
··· 40 40 return udplite_get_port(sk, snum, ipv6_rcv_saddr_equal); 41 41 } 42 42 43 + DEFINE_PROTO_INUSE(udplitev6) 44 + 43 45 struct proto udplitev6_prot = { 44 46 .name = "UDPLITEv6", 45 47 .owner = THIS_MODULE, ··· 64 62 .compat_setsockopt = compat_udpv6_setsockopt, 65 63 .compat_getsockopt = compat_udpv6_getsockopt, 66 64 #endif 65 + REF_PROTO_INUSE(udplitev6) 67 66 }; 68 67 69 68 static struct inet_protosw udplite6_protosw = {
+7 -7
net/netfilter/Makefile
··· 40 40 # targets 41 41 obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o 42 42 obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o 43 + obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o 43 44 obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o 44 45 obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o 45 - obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o 46 46 obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o 47 + obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o 47 48 obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o 48 - obj-$(CONFIG_NETFILTER_XT_TARGET_TRACE) += xt_TRACE.o 49 49 obj-$(CONFIG_NETFILTER_XT_TARGET_SECMARK) += xt_SECMARK.o 50 50 obj-$(CONFIG_NETFILTER_XT_TARGET_TCPMSS) += xt_TCPMSS.o 51 - obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o 51 + obj-$(CONFIG_NETFILTER_XT_TARGET_TRACE) += xt_TRACE.o 52 52 53 53 # matches 54 54 obj-$(CONFIG_NETFILTER_XT_MATCH_COMMENT) += xt_comment.o ··· 59 59 obj-$(CONFIG_NETFILTER_XT_MATCH_DCCP) += xt_dccp.o 60 60 obj-$(CONFIG_NETFILTER_XT_MATCH_DSCP) += xt_dscp.o 61 61 obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += xt_esp.o 62 + obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o 62 63 obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o 63 64 obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o 64 65 obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o 65 66 obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o 66 67 obj-$(CONFIG_NETFILTER_XT_MATCH_MARK) += xt_mark.o 67 68 obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o 68 - obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o 69 + obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o 69 70 obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o 71 + obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o 70 72 obj-$(CONFIG_NETFILTER_XT_MATCH_QUOTA) += xt_quota.o 71 73 obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o 72 74 obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o 73 75 obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o 74 76 obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o 75 77 obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o 76 - obj-$(CONFIG_NETFILTER_XT_MATCH_TIME) += xt_time.o 77 78 obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o 78 - obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o 79 + obj-$(CONFIG_NETFILTER_XT_MATCH_TIME) += xt_time.o 79 80 obj-$(CONFIG_NETFILTER_XT_MATCH_U32) += xt_u32.o 80 - obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o
+4 -9
net/netfilter/nf_sockopt.c
··· 23 23 /* Functions to register sockopt ranges (exclusive). */ 24 24 int nf_register_sockopt(struct nf_sockopt_ops *reg) 25 25 { 26 - struct list_head *i; 26 + struct nf_sockopt_ops *ops; 27 27 int ret = 0; 28 28 29 29 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 30 30 return -EINTR; 31 31 32 - list_for_each(i, &nf_sockopts) { 33 - struct nf_sockopt_ops *ops = (struct nf_sockopt_ops *)i; 32 + list_for_each_entry(ops, &nf_sockopts, list) { 34 33 if (ops->pf == reg->pf 35 34 && (overlap(ops->set_optmin, ops->set_optmax, 36 35 reg->set_optmin, reg->set_optmax) ··· 64 65 static int nf_sockopt(struct sock *sk, int pf, int val, 65 66 char __user *opt, int *len, int get) 66 67 { 67 - struct list_head *i; 68 68 struct nf_sockopt_ops *ops; 69 69 int ret; 70 70 ··· 73 75 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 74 76 return -EINTR; 75 77 76 - list_for_each(i, &nf_sockopts) { 77 - ops = (struct nf_sockopt_ops *)i; 78 + list_for_each_entry(ops, &nf_sockopts, list) { 78 79 if (ops->pf == pf) { 79 80 if (!try_module_get(ops->owner)) 80 81 goto out_nosup; ··· 121 124 static int compat_nf_sockopt(struct sock *sk, int pf, int val, 122 125 char __user *opt, int *len, int get) 123 126 { 124 - struct list_head *i; 125 127 struct nf_sockopt_ops *ops; 126 128 int ret; 127 129 ··· 131 135 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 132 136 return -EINTR; 133 137 134 - list_for_each(i, &nf_sockopts) { 135 - ops = (struct nf_sockopt_ops *)i; 138 + list_for_each_entry(ops, &nf_sockopts, list) { 136 139 if (ops->pf == pf) { 137 140 if (!try_module_get(ops->owner)) 138 141 goto out_nosup;
+3 -2
net/netfilter/xt_connlimit.c
··· 4 4 * (c) 2000 Gerd Knorr <kraxel@bytesex.org> 5 5 * Nov 2002: Martin Bene <martin.bene@icomedias.com>: 6 6 * only ignore TIME_WAIT or gone connections 7 - * Copyright © Jan Engelhardt <jengelh@gmx.de>, 2007 7 + * (C) CC Computer Consultants GmbH, 2007 8 + * Contact: <jengelh@computergmbh.de> 8 9 * 9 10 * based on ... 10 11 * ··· 307 306 308 307 module_init(xt_connlimit_init); 309 308 module_exit(xt_connlimit_exit); 310 - MODULE_AUTHOR("Jan Engelhardt <jengelh@gmx.de>"); 309 + MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>"); 311 310 MODULE_DESCRIPTION("netfilter xt_connlimit match module"); 312 311 MODULE_LICENSE("GPL"); 313 312 MODULE_ALIAS("ipt_connlimit");
+2 -1
net/netfilter/xt_time.c
··· 1 1 /* 2 2 * xt_time 3 - * Copyright © Jan Engelhardt <jengelh@computergmbh.de>, 2007 3 + * Copyright © CC Computer Consultants GmbH, 2007 4 + * Contact: <jengelh@computergmbh.de> 4 5 * 5 6 * based on ipt_time by Fabrice MARIE <fabrice@netfilter.org> 6 7 * This is a module which is used for time matching
+3 -2
net/netfilter/xt_u32.c
··· 2 2 * xt_u32 - kernel module to match u32 packet content 3 3 * 4 4 * Original author: Don Cohen <don@isis.cs3-inc.com> 5 - * © Jan Engelhardt <jengelh@gmx.de>, 2007 5 + * (C) CC Computer Consultants GmbH, 2007 6 + * Contact: <jengelh@computergmbh.de> 6 7 */ 7 8 8 9 #include <linux/module.h> ··· 130 129 131 130 module_init(xt_u32_init); 132 131 module_exit(xt_u32_exit); 133 - MODULE_AUTHOR("Jan Engelhardt <jengelh@gmx.de>"); 132 + MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>"); 134 133 MODULE_DESCRIPTION("netfilter u32 match module"); 135 134 MODULE_LICENSE("GPL"); 136 135 MODULE_ALIAS("ipt_u32");
+5 -5
net/netlink/af_netlink.c
··· 752 752 * 1: repeat lookup - reference dropped while waiting for socket memory. 753 753 */ 754 754 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 755 - long timeo, struct sock *ssk) 755 + long *timeo, struct sock *ssk) 756 756 { 757 757 struct netlink_sock *nlk; 758 758 ··· 761 761 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || 762 762 test_bit(0, &nlk->state)) { 763 763 DECLARE_WAITQUEUE(wait, current); 764 - if (!timeo) { 764 + if (!*timeo) { 765 765 if (!ssk || netlink_is_kernel(ssk)) 766 766 netlink_overrun(sk); 767 767 sock_put(sk); ··· 775 775 if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || 776 776 test_bit(0, &nlk->state)) && 777 777 !sock_flag(sk, SOCK_DEAD)) 778 - timeo = schedule_timeout(timeo); 778 + *timeo = schedule_timeout(*timeo); 779 779 780 780 __set_current_state(TASK_RUNNING); 781 781 remove_wait_queue(&nlk->wait, &wait); ··· 783 783 784 784 if (signal_pending(current)) { 785 785 kfree_skb(skb); 786 - return sock_intr_errno(timeo); 786 + return sock_intr_errno(*timeo); 787 787 } 788 788 return 1; 789 789 } ··· 877 877 if (netlink_is_kernel(sk)) 878 878 return netlink_unicast_kernel(sk, skb); 879 879 880 - err = netlink_attachskb(sk, skb, nonblock, timeo, ssk); 880 + err = netlink_attachskb(sk, skb, nonblock, &timeo, ssk); 881 881 if (err == 1) 882 882 goto retry; 883 883 if (err)
+2 -2
net/sched/cls_u32.c
··· 91 91 92 92 static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel, u8 fshift) 93 93 { 94 - unsigned h = (key & sel->hmask)>>fshift; 94 + unsigned h = ntohl(key & sel->hmask)>>fshift; 95 95 96 96 return h; 97 97 } ··· 615 615 n->handle = handle; 616 616 { 617 617 u8 i = 0; 618 - u32 mask = s->hmask; 618 + u32 mask = ntohl(s->hmask); 619 619 if (mask) { 620 620 while (!(mask & 1)) { 621 621 i++;
+3
net/sched/sch_teql.c
··· 252 252 static inline int teql_resolve(struct sk_buff *skb, 253 253 struct sk_buff *skb_res, struct net_device *dev) 254 254 { 255 + if (dev->qdisc == &noop_qdisc) 256 + return -ENODEV; 257 + 255 258 if (dev->header_ops == NULL || 256 259 skb->dst == NULL || 257 260 skb->dst->neighbour == NULL)
+6
net/sctp/socket.c
··· 6455 6455 } 6456 6456 6457 6457 6458 + DEFINE_PROTO_INUSE(sctp) 6459 + 6458 6460 /* This proto struct describes the ULP interface for SCTP. */ 6459 6461 struct proto sctp_prot = { 6460 6462 .name = "SCTP", ··· 6485 6483 .memory_pressure = &sctp_memory_pressure, 6486 6484 .enter_memory_pressure = sctp_enter_memory_pressure, 6487 6485 .memory_allocated = &sctp_memory_allocated, 6486 + REF_PROTO_INUSE(sctp) 6488 6487 }; 6489 6488 6490 6489 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 6490 + DEFINE_PROTO_INUSE(sctpv6) 6491 + 6491 6492 struct proto sctpv6_prot = { 6492 6493 .name = "SCTPv6", 6493 6494 .owner = THIS_MODULE, ··· 6518 6513 .memory_pressure = &sctp_memory_pressure, 6519 6514 .enter_memory_pressure = sctp_enter_memory_pressure, 6520 6515 .memory_allocated = &sctp_memory_allocated, 6516 + REF_PROTO_INUSE(sctpv6) 6521 6517 }; 6522 6518 #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */