diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-09 18:07:57 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-09 18:07:57 -0500 |
| commit | c5b875e354a54e2b5ba24eecae69bf94e025edd5 (patch) | |
| tree | 0446a68d99ad50305ab78835456d9faa62be5948 | |
| parent | eae1920a21b4f87e89cea802e7df39442b119617 (diff) | |
| parent | c3d8d1e30cace31fed6186a4b8c6b1401836d89c (diff) | |
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.
...
93 files changed, 771 insertions, 1718 deletions
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX index f5a5e6d3d541..563e442f2d42 100644 --- a/Documentation/networking/00-INDEX +++ b/Documentation/networking/00-INDEX | |||
| @@ -4,8 +4,6 @@ | |||
| 4 | - information on the 3Com EtherLink Plus (3c505) driver. | 4 | - information on the 3Com EtherLink Plus (3c505) driver. |
| 5 | 6pack.txt | 5 | 6pack.txt |
| 6 | - info on the 6pack protocol, an alternative to KISS for AX.25 | 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 | DLINK.txt | 7 | DLINK.txt |
| 10 | - info on the D-Link DE-600/DE-620 parallel port pocket adapters | 8 | - info on the D-Link DE-600/DE-620 parallel port pocket adapters |
| 11 | PLIP.txt | 9 | PLIP.txt |
| @@ -26,8 +24,6 @@ baycom.txt | |||
| 26 | - info on the driver for Baycom style amateur radio modems | 24 | - info on the driver for Baycom style amateur radio modems |
| 27 | bridge.txt | 25 | bridge.txt |
| 28 | - where to get user space programs for ethernet bridging with Linux. | 26 | - where to get user space programs for ethernet bridging with Linux. |
| 29 | comx.txt | ||
| 30 | - info on drivers for COMX line of synchronous serial adapters. | ||
| 31 | cops.txt | 27 | cops.txt |
| 32 | - info on the COPS LocalTalk Linux driver | 28 | - info on the COPS LocalTalk Linux driver |
| 33 | cs89x0.txt | 29 | cs89x0.txt |
| @@ -78,20 +74,14 @@ ltpc.txt | |||
| 78 | - the Apple or Farallon LocalTalk PC card driver | 74 | - the Apple or Farallon LocalTalk PC card driver |
| 79 | multicast.txt | 75 | multicast.txt |
| 80 | - Behaviour of cards under Multicast | 76 | - Behaviour of cards under Multicast |
| 81 | ncsa-telnet | ||
| 82 | - notes on how NCSA telnet (DOS) breaks with MTU discovery enabled. | ||
| 83 | netdevices.txt | 77 | netdevices.txt |
| 84 | - info on network device driver functions exported to the kernel. | 78 | - info on network device driver functions exported to the kernel. |
| 85 | olympic.txt | 79 | olympic.txt |
| 86 | - IBM PCI Pit/Pit-Phy/Olympic Token Ring driver info. | 80 | - IBM PCI Pit/Pit-Phy/Olympic Token Ring driver info. |
| 87 | policy-routing.txt | 81 | policy-routing.txt |
| 88 | - IP policy-based routing | 82 | - IP policy-based routing |
| 89 | pt.txt | ||
| 90 | - the Gracilis Packetwin AX.25 device driver | ||
| 91 | ray_cs.txt | 83 | ray_cs.txt |
| 92 | - Raylink Wireless LAN card driver info. | 84 | - Raylink Wireless LAN card driver info. |
| 93 | routing.txt | ||
| 94 | - the new routing mechanism | ||
| 95 | shaper.txt | 85 | shaper.txt |
| 96 | - info on the module that can shape/limit transmitted traffic. | 86 | - info on the module that can shape/limit transmitted traffic. |
| 97 | sk98lin.txt | 87 | sk98lin.txt |
diff --git a/Documentation/networking/Configurable b/Documentation/networking/Configurable deleted file mode 100644 index 69c0dd466ead..000000000000 --- a/Documentation/networking/Configurable +++ /dev/null | |||
| @@ -1,34 +0,0 @@ | |||
| 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 | ||
diff --git a/Documentation/networking/comx.txt b/Documentation/networking/comx.txt deleted file mode 100644 index d1526eba2645..000000000000 --- a/Documentation/networking/comx.txt +++ /dev/null | |||
| @@ -1,248 +0,0 @@ | |||
| 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 | |||
diff --git a/Documentation/networking/ncsa-telnet b/Documentation/networking/ncsa-telnet deleted file mode 100644 index d77d28b09093..000000000000 --- a/Documentation/networking/ncsa-telnet +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 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... | ||
diff --git a/Documentation/networking/pt.txt b/Documentation/networking/pt.txt deleted file mode 100644 index 72e888c1d988..000000000000 --- a/Documentation/networking/pt.txt +++ /dev/null | |||
| @@ -1,58 +0,0 @@ | |||
| 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> | ||
diff --git a/Documentation/networking/routing.txt b/Documentation/networking/routing.txt deleted file mode 100644 index a26838b930f2..000000000000 --- a/Documentation/networking/routing.txt +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 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 | ||
diff --git a/Documentation/networking/slicecom.hun b/Documentation/networking/slicecom.hun deleted file mode 100644 index bed2f045e550..000000000000 --- a/Documentation/networking/slicecom.hun +++ /dev/null | |||
| @@ -1,371 +0,0 @@ | |||
| 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 | ||
diff --git a/Documentation/networking/slicecom.txt b/Documentation/networking/slicecom.txt deleted file mode 100644 index c82c0cf981b4..000000000000 --- a/Documentation/networking/slicecom.txt +++ /dev/null | |||
| @@ -1,369 +0,0 @@ | |||
| 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 | ||
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 7a003504c265..1bdd2bf4f37d 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
| @@ -730,13 +730,23 @@ static int send_prio_char(struct tty_struct *tty, char ch) | |||
| 730 | return 0; | 730 | return 0; |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | int n_tty_ioctl(struct tty_struct * tty, struct file * file, | 733 | /** |
| 734 | unsigned int cmd, unsigned long arg) | 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 | struct tty_struct * real_tty; | 748 | struct tty_struct * real_tty; |
| 737 | void __user *p = (void __user *)arg; | 749 | void __user *p = (void __user *)arg; |
| 738 | int retval; | ||
| 739 | struct tty_ldisc *ld; | ||
| 740 | 750 | ||
| 741 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && | 751 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && |
| 742 | tty->driver->subtype == PTY_TYPE_MASTER) | 752 | tty->driver->subtype == PTY_TYPE_MASTER) |
| @@ -799,6 +809,93 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
| 799 | return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); | 809 | return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); |
| 800 | case TCSETA: | 810 | case TCSETA: |
| 801 | return set_termios(real_tty, p, TERMIOS_TERMIO); | 811 | return set_termios(real_tty, p, TERMIOS_TERMIO); |
| 812 | #ifndef TCGETS2 | ||
| 813 | case TIOCGLCKTRMIOS: | ||
| 814 | if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked)) | ||
| 815 | return -EFAULT; | ||
| 816 | return 0; | ||
| 817 | |||
| 818 | case TIOCSLCKTRMIOS: | ||
| 819 | if (!capable(CAP_SYS_ADMIN)) | ||
| 820 | return -EPERM; | ||
| 821 | if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg)) | ||
| 822 | return -EFAULT; | ||
| 823 | return 0; | ||
| 824 | #else | ||
| 825 | case TIOCGLCKTRMIOS: | ||
| 826 | if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked)) | ||
| 827 | return -EFAULT; | ||
| 828 | return 0; | ||
| 829 | |||
| 830 | case TIOCSLCKTRMIOS: | ||
| 831 | if (!capable(CAP_SYS_ADMIN)) | ||
| 832 | return -EPERM; | ||
| 833 | if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg)) | ||
| 834 | return -EFAULT; | ||
| 835 | return 0; | ||
| 836 | #endif | ||
| 837 | case TIOCGSOFTCAR: | ||
| 838 | return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg); | ||
| 839 | case TIOCSSOFTCAR: | ||
| 840 | if (get_user(arg, (unsigned int __user *) arg)) | ||
| 841 | return -EFAULT; | ||
| 842 | mutex_lock(&tty->termios_mutex); | ||
| 843 | tty->termios->c_cflag = | ||
| 844 | ((tty->termios->c_cflag & ~CLOCAL) | | ||
| 845 | (arg ? CLOCAL : 0)); | ||
| 846 | mutex_unlock(&tty->termios_mutex); | ||
| 847 | return 0; | ||
| 848 | default: | ||
| 849 | return -ENOIOCTLCMD; | ||
| 850 | } | ||
| 851 | } | ||
| 852 | |||
| 853 | EXPORT_SYMBOL_GPL(tty_mode_ioctl); | ||
| 854 | |||
| 855 | int tty_perform_flush(struct tty_struct *tty, unsigned long arg) | ||
| 856 | { | ||
| 857 | struct tty_ldisc *ld; | ||
| 858 | int retval = tty_check_change(tty); | ||
| 859 | if (retval) | ||
| 860 | return retval; | ||
| 861 | |||
| 862 | ld = tty_ldisc_ref(tty); | ||
| 863 | switch (arg) { | ||
| 864 | case TCIFLUSH: | ||
| 865 | if (ld && ld->flush_buffer) | ||
| 866 | ld->flush_buffer(tty); | ||
| 867 | break; | ||
| 868 | case TCIOFLUSH: | ||
| 869 | if (ld && ld->flush_buffer) | ||
| 870 | ld->flush_buffer(tty); | ||
| 871 | /* fall through */ | ||
| 872 | case TCOFLUSH: | ||
| 873 | if (tty->driver->flush_buffer) | ||
| 874 | tty->driver->flush_buffer(tty); | ||
| 875 | break; | ||
| 876 | default: | ||
| 877 | tty_ldisc_deref(ld); | ||
| 878 | return -EINVAL; | ||
| 879 | } | ||
| 880 | tty_ldisc_deref(ld); | ||
| 881 | return 0; | ||
| 882 | } | ||
| 883 | |||
| 884 | EXPORT_SYMBOL_GPL(tty_perform_flush); | ||
| 885 | |||
| 886 | int n_tty_ioctl(struct tty_struct * tty, struct file * file, | ||
| 887 | unsigned int cmd, unsigned long arg) | ||
| 888 | { | ||
| 889 | struct tty_struct * real_tty; | ||
| 890 | int retval; | ||
| 891 | |||
| 892 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && | ||
| 893 | tty->driver->subtype == PTY_TYPE_MASTER) | ||
| 894 | real_tty = tty->link; | ||
| 895 | else | ||
| 896 | real_tty = tty; | ||
| 897 | |||
| 898 | switch (cmd) { | ||
| 802 | case TCXONC: | 899 | case TCXONC: |
| 803 | retval = tty_check_change(tty); | 900 | retval = tty_check_change(tty); |
| 804 | if (retval) | 901 | if (retval) |
| @@ -829,30 +926,7 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
| 829 | } | 926 | } |
| 830 | return 0; | 927 | return 0; |
| 831 | case TCFLSH: | 928 | case TCFLSH: |
| 832 | retval = tty_check_change(tty); | 929 | return tty_perform_flush(tty, arg); |
| 833 | if (retval) | ||
| 834 | return retval; | ||
| 835 | |||
| 836 | ld = tty_ldisc_ref(tty); | ||
| 837 | switch (arg) { | ||
| 838 | case TCIFLUSH: | ||
| 839 | if (ld && ld->flush_buffer) | ||
| 840 | ld->flush_buffer(tty); | ||
| 841 | break; | ||
| 842 | case TCIOFLUSH: | ||
| 843 | if (ld && ld->flush_buffer) | ||
| 844 | ld->flush_buffer(tty); | ||
| 845 | /* fall through */ | ||
| 846 | case TCOFLUSH: | ||
| 847 | if (tty->driver->flush_buffer) | ||
| 848 | tty->driver->flush_buffer(tty); | ||
| 849 | break; | ||
| 850 | default: | ||
| 851 | tty_ldisc_deref(ld); | ||
| 852 | return -EINVAL; | ||
| 853 | } | ||
| 854 | tty_ldisc_deref(ld); | ||
| 855 | return 0; | ||
| 856 | case TIOCOUTQ: | 930 | case TIOCOUTQ: |
| 857 | return put_user(tty->driver->chars_in_buffer ? | 931 | return put_user(tty->driver->chars_in_buffer ? |
| 858 | tty->driver->chars_in_buffer(tty) : 0, | 932 | tty->driver->chars_in_buffer(tty) : 0, |
| @@ -862,32 +936,6 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
| 862 | if (L_ICANON(tty)) | 936 | if (L_ICANON(tty)) |
| 863 | retval = inq_canon(tty); | 937 | retval = inq_canon(tty); |
| 864 | return put_user(retval, (unsigned int __user *) arg); | 938 | return put_user(retval, (unsigned int __user *) arg); |
| 865 | #ifndef TCGETS2 | ||
| 866 | case TIOCGLCKTRMIOS: | ||
| 867 | if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked)) | ||
| 868 | return -EFAULT; | ||
| 869 | return 0; | ||
| 870 | |||
| 871 | case TIOCSLCKTRMIOS: | ||
| 872 | if (!capable(CAP_SYS_ADMIN)) | ||
| 873 | return -EPERM; | ||
| 874 | if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg)) | ||
| 875 | return -EFAULT; | ||
| 876 | return 0; | ||
| 877 | #else | ||
| 878 | case TIOCGLCKTRMIOS: | ||
| 879 | if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked)) | ||
| 880 | return -EFAULT; | ||
| 881 | return 0; | ||
| 882 | |||
| 883 | case TIOCSLCKTRMIOS: | ||
| 884 | if (!capable(CAP_SYS_ADMIN)) | ||
| 885 | return -EPERM; | ||
| 886 | if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg)) | ||
| 887 | return -EFAULT; | ||
| 888 | return 0; | ||
| 889 | #endif | ||
| 890 | |||
| 891 | case TIOCPKT: | 939 | case TIOCPKT: |
| 892 | { | 940 | { |
| 893 | int pktmode; | 941 | int pktmode; |
| @@ -906,19 +954,9 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
| 906 | tty->packet = 0; | 954 | tty->packet = 0; |
| 907 | return 0; | 955 | return 0; |
| 908 | } | 956 | } |
| 909 | case TIOCGSOFTCAR: | ||
| 910 | return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg); | ||
| 911 | case TIOCSSOFTCAR: | ||
| 912 | if (get_user(arg, (unsigned int __user *) arg)) | ||
| 913 | return -EFAULT; | ||
| 914 | mutex_lock(&tty->termios_mutex); | ||
| 915 | tty->termios->c_cflag = | ||
| 916 | ((tty->termios->c_cflag & ~CLOCAL) | | ||
| 917 | (arg ? CLOCAL : 0)); | ||
| 918 | mutex_unlock(&tty->termios_mutex); | ||
| 919 | return 0; | ||
| 920 | default: | 957 | default: |
| 921 | return -ENOIOCTLCMD; | 958 | /* Try the mode commands */ |
| 959 | return tty_mode_ioctl(tty, file, cmd, arg); | ||
| 922 | } | 960 | } |
| 923 | } | 961 | } |
| 924 | 962 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5f800a6dd978..cb581ebbe3c5 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -136,10 +136,11 @@ config TUN | |||
| 136 | If you don't know what to use this for, you don't need it. | 136 | If you don't know what to use this for, you don't need it. |
| 137 | 137 | ||
| 138 | config VETH | 138 | config VETH |
| 139 | tristate "Virtual ethernet device" | 139 | tristate "Virtual ethernet pair device" |
| 140 | ---help--- | 140 | ---help--- |
| 141 | The device is an ethernet tunnel. Devices are created in pairs. When | 141 | This device is a local ethernet tunnel. Devices are created in pairs. |
| 142 | one end receives the packet it appears on its pair and vice versa. | 142 | When one end receives the packet it appears on its pair and vice |
| 143 | versa. | ||
| 143 | 144 | ||
| 144 | config NET_SB1000 | 145 | config NET_SB1000 |
| 145 | tristate "General Instruments Surfboard 1000" | 146 | tristate "General Instruments Surfboard 1000" |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index e0119f6a3319..580cb4ab2af1 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
| @@ -762,26 +762,20 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file, | |||
| 762 | 762 | ||
| 763 | if (copy_from_user(&addr, | 763 | if (copy_from_user(&addr, |
| 764 | (void __user *) arg, AX25_ADDR_LEN)) { | 764 | (void __user *) arg, AX25_ADDR_LEN)) { |
| 765 | err = -EFAULT; | 765 | err = -EFAULT; |
| 766 | break; | 766 | break; |
| 767 | } | 767 | } |
| 768 | 768 | ||
| 769 | netif_tx_lock_bh(dev); | 769 | netif_tx_lock_bh(dev); |
| 770 | memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); | 770 | memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); |
| 771 | netif_tx_unlock_bh(dev); | 771 | netif_tx_unlock_bh(dev); |
| 772 | 772 | ||
| 773 | err = 0; | 773 | err = 0; |
| 774 | break; | 774 | break; |
| 775 | } | 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 | 776 | ||
| 783 | default: | 777 | default: |
| 784 | err = -ENOIOCTLCMD; | 778 | err = tty_mode_ioctl(tty, file, cmd, arg); |
| 785 | } | 779 | } |
| 786 | 780 | ||
| 787 | sp_put(sp); | 781 | sp_put(sp); |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 2c6f7be36e8a..fc753d7f674e 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
| @@ -434,11 +434,6 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
| 434 | IRDA_ASSERT(dev != NULL, return -1;); | 434 | IRDA_ASSERT(dev != NULL, return -1;); |
| 435 | 435 | ||
| 436 | switch (cmd) { | 436 | switch (cmd) { |
| 437 | case TCGETS: | ||
| 438 | case TCGETA: | ||
| 439 | err = n_tty_ioctl(tty, file, cmd, arg); | ||
| 440 | break; | ||
| 441 | |||
| 442 | case IRTTY_IOCTDONGLE: | 437 | case IRTTY_IOCTDONGLE: |
| 443 | /* this call blocks for completion */ | 438 | /* this call blocks for completion */ |
| 444 | err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg); | 439 | err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg); |
| @@ -454,7 +449,7 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
| 454 | err = -EFAULT; | 449 | err = -EFAULT; |
| 455 | break; | 450 | break; |
| 456 | default: | 451 | default: |
| 457 | err = -ENOIOCTLCMD; | 452 | err = tty_mode_ioctl(tty, file, cmd, arg); |
| 458 | break; | 453 | break; |
| 459 | } | 454 | } |
| 460 | return err; | 455 | return err; |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 27f5b904f48e..8d278c87ba48 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
| @@ -309,16 +309,11 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
| 309 | err = 0; | 309 | err = 0; |
| 310 | break; | 310 | break; |
| 311 | 311 | ||
| 312 | case TCGETS: | ||
| 313 | case TCGETA: | ||
| 314 | err = n_tty_ioctl(tty, file, cmd, arg); | ||
| 315 | break; | ||
| 316 | |||
| 317 | case TCFLSH: | 312 | case TCFLSH: |
| 318 | /* flush our buffers and the serial port's buffer */ | 313 | /* flush our buffers and the serial port's buffer */ |
| 319 | if (arg == TCIOFLUSH || arg == TCOFLUSH) | 314 | if (arg == TCIOFLUSH || arg == TCOFLUSH) |
| 320 | ppp_async_flush_output(ap); | 315 | ppp_async_flush_output(ap); |
| 321 | err = n_tty_ioctl(tty, file, cmd, arg); | 316 | err = tty_perform_flush(tty, arg); |
| 322 | break; | 317 | break; |
| 323 | 318 | ||
| 324 | case FIONREAD: | 319 | case FIONREAD: |
| @@ -329,7 +324,8 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
| 329 | break; | 324 | break; |
| 330 | 325 | ||
| 331 | default: | 326 | default: |
| 332 | err = -ENOIOCTLCMD; | 327 | /* Try the various mode ioctls */ |
| 328 | err = tty_mode_ioctl(tty, file, cmd, arg); | ||
| 333 | } | 329 | } |
| 334 | 330 | ||
| 335 | ap_put(ap); | 331 | ap_put(ap); |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index ce64032a465a..00e2fb48b4ae 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
| @@ -349,16 +349,11 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
| 349 | err = 0; | 349 | err = 0; |
| 350 | break; | 350 | break; |
| 351 | 351 | ||
| 352 | case TCGETS: | ||
| 353 | case TCGETA: | ||
| 354 | err = n_tty_ioctl(tty, file, cmd, arg); | ||
| 355 | break; | ||
| 356 | |||
| 357 | case TCFLSH: | 352 | case TCFLSH: |
| 358 | /* flush our buffers and the serial port's buffer */ | 353 | /* flush our buffers and the serial port's buffer */ |
| 359 | if (arg == TCIOFLUSH || arg == TCOFLUSH) | 354 | if (arg == TCIOFLUSH || arg == TCOFLUSH) |
| 360 | ppp_sync_flush_output(ap); | 355 | ppp_sync_flush_output(ap); |
| 361 | err = n_tty_ioctl(tty, file, cmd, arg); | 356 | err = tty_perform_flush(tty, arg); |
| 362 | break; | 357 | break; |
| 363 | 358 | ||
| 364 | case FIONREAD: | 359 | case FIONREAD: |
| @@ -369,7 +364,8 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
| 369 | break; | 364 | break; |
| 370 | 365 | ||
| 371 | default: | 366 | default: |
| 372 | err = -ENOIOCTLCMD; | 367 | err = tty_mode_ioctl(tty, file, cmd, arg); |
| 368 | break; | ||
| 373 | } | 369 | } |
| 374 | 370 | ||
| 375 | sp_put(ap); | 371 | sp_put(ap); |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index f8904fd92369..a7556cd2df79 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
| @@ -488,7 +488,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
| 488 | { | 488 | { |
| 489 | struct pppol2tp_session *session = NULL; | 489 | struct pppol2tp_session *session = NULL; |
| 490 | struct pppol2tp_tunnel *tunnel; | 490 | struct pppol2tp_tunnel *tunnel; |
| 491 | unsigned char *ptr; | 491 | unsigned char *ptr, *optr; |
| 492 | u16 hdrflags; | 492 | u16 hdrflags; |
| 493 | u16 tunnel_id, session_id; | 493 | u16 tunnel_id, session_id; |
| 494 | int length; | 494 | int length; |
| @@ -496,7 +496,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
| 496 | 496 | ||
| 497 | tunnel = pppol2tp_sock_to_tunnel(sock); | 497 | tunnel = pppol2tp_sock_to_tunnel(sock); |
| 498 | if (tunnel == NULL) | 498 | if (tunnel == NULL) |
| 499 | goto error; | 499 | goto no_tunnel; |
| 500 | 500 | ||
| 501 | /* UDP always verifies the packet length. */ | 501 | /* UDP always verifies the packet length. */ |
| 502 | __skb_pull(skb, sizeof(struct udphdr)); | 502 | __skb_pull(skb, sizeof(struct udphdr)); |
| @@ -509,7 +509,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
| 509 | } | 509 | } |
| 510 | 510 | ||
| 511 | /* Point to L2TP header */ | 511 | /* Point to L2TP header */ |
| 512 | ptr = skb->data; | 512 | optr = ptr = skb->data; |
| 513 | 513 | ||
| 514 | /* Get L2TP header flags */ | 514 | /* Get L2TP header flags */ |
| 515 | hdrflags = ntohs(*(__be16*)ptr); | 515 | hdrflags = ntohs(*(__be16*)ptr); |
| @@ -637,12 +637,14 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
| 637 | /* If offset bit set, skip it. */ | 637 | /* If offset bit set, skip it. */ |
| 638 | if (hdrflags & L2TP_HDRFLAG_O) { | 638 | if (hdrflags & L2TP_HDRFLAG_O) { |
| 639 | offset = ntohs(*(__be16 *)ptr); | 639 | offset = ntohs(*(__be16 *)ptr); |
| 640 | skb->transport_header += 2 + offset; | 640 | ptr += 2 + offset; |
| 641 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 2)) | ||
| 642 | goto discard; | ||
| 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 | /* Skip PPP header, if present. In testing, Microsoft L2TP clients | 649 | /* Skip PPP header, if present. In testing, Microsoft L2TP clients |
| 648 | * don't send the PPP header (PPP header compression enabled), but | 650 | * don't send the PPP header (PPP header compression enabled), but |
| @@ -652,6 +654,9 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
| 652 | * Note that skb->data[] isn't dereferenced from a u16 ptr here since | 654 | * Note that skb->data[] isn't dereferenced from a u16 ptr here since |
| 653 | * the field may be unaligned. | 655 | * the field may be unaligned. |
| 654 | */ | 656 | */ |
| 657 | if (!pskb_may_pull(skb, 2)) | ||
| 658 | goto discard; | ||
| 659 | |||
| 655 | if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03)) | 660 | if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03)) |
| 656 | skb_pull(skb, 2); | 661 | skb_pull(skb, 2); |
| 657 | 662 | ||
| @@ -709,6 +714,10 @@ discard: | |||
| 709 | return 0; | 714 | return 0; |
| 710 | 715 | ||
| 711 | error: | 716 | error: |
| 717 | /* Put UDP header back */ | ||
| 718 | __skb_push(skb, sizeof(struct udphdr)); | ||
| 719 | |||
| 720 | no_tunnel: | ||
| 712 | return 1; | 721 | return 1; |
| 713 | } | 722 | } |
| 714 | 723 | ||
| @@ -1050,6 +1059,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
| 1050 | /* Get routing info from the tunnel socket */ | 1059 | /* Get routing info from the tunnel socket */ |
| 1051 | dst_release(skb->dst); | 1060 | dst_release(skb->dst); |
| 1052 | skb->dst = sk_dst_get(sk_tun); | 1061 | skb->dst = sk_dst_get(sk_tun); |
| 1062 | skb_orphan(skb); | ||
| 1063 | skb->sk = sk_tun; | ||
| 1053 | 1064 | ||
| 1054 | /* Queue the packet to IP for output */ | 1065 | /* Queue the packet to IP for output */ |
| 1055 | len = skb->len; | 1066 | len = skb->len; |
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index b822859c8de3..73a7e6529ee0 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
| @@ -78,12 +78,6 @@ static char version[] __devinitdata = "rrunner.c: v0.50 11/11/2002 Jes Sorensen | |||
| 78 | * stack will need to know about I/O vectors or something similar. | 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 | static int __devinit rr_init_one(struct pci_dev *pdev, | 81 | static int __devinit rr_init_one(struct pci_dev *pdev, |
| 88 | const struct pci_device_id *ent) | 82 | const struct pci_device_id *ent) |
| 89 | { | 83 | { |
| @@ -561,18 +555,6 @@ static int __devinit rr_init(struct net_device *dev) | |||
| 561 | sram_size = rr_read_eeprom_word(rrpriv, (void *)8); | 555 | sram_size = rr_read_eeprom_word(rrpriv, (void *)8); |
| 562 | printk(" SRAM size 0x%06x\n", sram_size); | 556 | printk(" SRAM size 0x%06x\n", sram_size); |
| 563 | 557 | ||
| 564 | if (sysctl_rmem_max < 262144){ | ||
| 565 | printk(" Receive socket buffer limit too low (%i), " | ||
| 566 | "setting to 262144\n", sysctl_rmem_max); | ||
| 567 | sysctl_rmem_max = 262144; | ||
| 568 | } | ||
| 569 | |||
| 570 | if (sysctl_wmem_max < 262144){ | ||
| 571 | printk(" Transmit socket buffer limit too low (%i), " | ||
| 572 | "setting to 262144\n", sysctl_wmem_max); | ||
| 573 | sysctl_wmem_max = 262144; | ||
| 574 | } | ||
| 575 | |||
| 576 | return 0; | 558 | return 0; |
| 577 | } | 559 | } |
| 578 | 560 | ||
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 335b7cc80eba..251a3ce376ac 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
| @@ -1218,14 +1218,8 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm | |||
| 1218 | return 0; | 1218 | return 0; |
| 1219 | /* VSV changes end */ | 1219 | /* VSV changes end */ |
| 1220 | #endif | 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 | default: | 1221 | default: |
| 1228 | return -ENOIOCTLCMD; | 1222 | return tty_mode_ioctl(tty, file, cmd, arg); |
| 1229 | } | 1223 | } |
| 1230 | } | 1224 | } |
| 1231 | 1225 | ||
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 5a96d74e4ce8..a12c9c41b217 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
| @@ -93,13 +93,9 @@ config USB_RTL8150 | |||
| 93 | To compile this driver as a module, choose M here: the | 93 | To compile this driver as a module, choose M here: the |
| 94 | module will be called rtl8150. | 94 | module will be called rtl8150. |
| 95 | 95 | ||
| 96 | config USB_USBNET_MII | ||
| 97 | tristate | ||
| 98 | default n | ||
| 99 | |||
| 100 | config USB_USBNET | 96 | config USB_USBNET |
| 101 | tristate "Multi-purpose USB Networking Framework" | 97 | tristate "Multi-purpose USB Networking Framework" |
| 102 | select MII if USB_USBNET_MII != n | 98 | select MII |
| 103 | ---help--- | 99 | ---help--- |
| 104 | This driver supports several kinds of network links over USB, | 100 | This driver supports several kinds of network links over USB, |
| 105 | with "minidrivers" built around a common network driver core | 101 | with "minidrivers" built around a common network driver core |
| @@ -135,7 +131,6 @@ config USB_NET_AX8817X | |||
| 135 | tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" | 131 | tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" |
| 136 | depends on USB_USBNET && NET_ETHERNET | 132 | depends on USB_USBNET && NET_ETHERNET |
| 137 | select CRC32 | 133 | select CRC32 |
| 138 | select USB_USBNET_MII | ||
| 139 | default y | 134 | default y |
| 140 | help | 135 | help |
| 141 | This option adds support for ASIX AX88xxx based USB 2.0 | 136 | This option adds support for ASIX AX88xxx based USB 2.0 |
| @@ -190,7 +185,6 @@ config USB_NET_DM9601 | |||
| 190 | tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" | 185 | tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" |
| 191 | depends on USB_USBNET | 186 | depends on USB_USBNET |
| 192 | select CRC32 | 187 | select CRC32 |
| 193 | select USB_USBNET_MII | ||
| 194 | help | 188 | help |
| 195 | This option adds support for Davicom DM9601 based USB 1.1 | 189 | This option adds support for Davicom DM9601 based USB 1.1 |
| 196 | 10/100 Ethernet adapters. | 190 | 10/100 Ethernet adapters. |
| @@ -225,7 +219,6 @@ config USB_NET_PLUSB | |||
| 225 | config USB_NET_MCS7830 | 219 | config USB_NET_MCS7830 |
| 226 | tristate "MosChip MCS7830 based Ethernet adapters" | 220 | tristate "MosChip MCS7830 based Ethernet adapters" |
| 227 | depends on USB_USBNET | 221 | depends on USB_USBNET |
| 228 | select USB_USBNET_MII | ||
| 229 | help | 222 | help |
| 230 | Choose this option if you're using a 10/100 Ethernet USB2 | 223 | Choose this option if you're using a 10/100 Ethernet USB2 |
| 231 | adapter based on the MosChip 7830 controller. This includes | 224 | adapter based on the MosChip 7830 controller. This includes |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index acd5f1c0e63a..8ed1fc5cbc70 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
| @@ -683,9 +683,6 @@ done_nopm: | |||
| 683 | * they'll probably want to use this base set. | 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 | int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) | 686 | int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) |
| 690 | { | 687 | { |
| 691 | struct usbnet *dev = netdev_priv(net); | 688 | struct usbnet *dev = netdev_priv(net); |
| @@ -744,8 +741,6 @@ int usbnet_nway_reset(struct net_device *net) | |||
| 744 | } | 741 | } |
| 745 | EXPORT_SYMBOL_GPL(usbnet_nway_reset); | 742 | EXPORT_SYMBOL_GPL(usbnet_nway_reset); |
| 746 | 743 | ||
| 747 | #endif /* HAVE_MII */ | ||
| 748 | |||
| 749 | void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) | 744 | void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) |
| 750 | { | 745 | { |
| 751 | struct usbnet *dev = netdev_priv(net); | 746 | struct usbnet *dev = netdev_priv(net); |
| @@ -776,12 +771,10 @@ EXPORT_SYMBOL_GPL(usbnet_set_msglevel); | |||
| 776 | 771 | ||
| 777 | /* drivers may override default ethtool_ops in their bind() routine */ | 772 | /* drivers may override default ethtool_ops in their bind() routine */ |
| 778 | static struct ethtool_ops usbnet_ethtool_ops = { | 773 | static struct ethtool_ops usbnet_ethtool_ops = { |
| 779 | #ifdef HAVE_MII | ||
| 780 | .get_settings = usbnet_get_settings, | 774 | .get_settings = usbnet_get_settings, |
| 781 | .set_settings = usbnet_set_settings, | 775 | .set_settings = usbnet_set_settings, |
| 782 | .get_link = usbnet_get_link, | 776 | .get_link = usbnet_get_link, |
| 783 | .nway_reset = usbnet_nway_reset, | 777 | .nway_reset = usbnet_nway_reset, |
| 784 | #endif | ||
| 785 | .get_drvinfo = usbnet_get_drvinfo, | 778 | .get_drvinfo = usbnet_get_drvinfo, |
| 786 | .get_msglevel = usbnet_get_msglevel, | 779 | .get_msglevel = usbnet_get_msglevel, |
| 787 | .set_msglevel = usbnet_set_msglevel, | 780 | .set_msglevel = usbnet_set_msglevel, |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index c48b1cc63fd5..1e89d4de1bb7 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
| @@ -719,12 +719,8 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, | |||
| 719 | return 0; | 719 | return 0; |
| 720 | case SIOCSIFHWADDR: | 720 | case SIOCSIFHWADDR: |
| 721 | return -EINVAL; | 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 | default: | 722 | default: |
| 727 | return -ENOIOCTLCMD; | 723 | return tty_mode_ioctl(tty, file, cmd, arg); |
| 728 | } | 724 | } |
| 729 | } | 725 | } |
| 730 | 726 | ||
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index 4bd14b331862..88efe1bae58f 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
| @@ -2735,16 +2735,8 @@ static int strip_ioctl(struct tty_struct *tty, struct file *file, | |||
| 2735 | return -EFAULT; | 2735 | return -EFAULT; |
| 2736 | return set_mac_address(strip_info, &addr); | 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 | default: | 2738 | default: |
| 2747 | return -ENOIOCTLCMD; | 2739 | return tty_mode_ioctl(tty, file, cmd, arg); |
| 2748 | break; | 2740 | break; |
| 2749 | } | 2741 | } |
| 2750 | return 0; | 2742 | return 0; |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 58bf3f5cdbe2..e9923ca9c2d9 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
| @@ -1062,7 +1062,7 @@ static int sctp_listen_for_all(void) | |||
| 1062 | subscribe.sctp_shutdown_event = 1; | 1062 | subscribe.sctp_shutdown_event = 1; |
| 1063 | subscribe.sctp_partial_delivery_event = 1; | 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 | (char *)&bufsize, sizeof(bufsize)); | 1066 | (char *)&bufsize, sizeof(bufsize)); |
| 1067 | if (result) | 1067 | if (result) |
| 1068 | log_print("Error increasing buffer space on socket %d", result); | 1068 | log_print("Error increasing buffer space on socket %d", result); |
| @@ -1454,10 +1454,6 @@ int dlm_lowcomms_start(void) | |||
| 1454 | if (!con_cache) | 1454 | if (!con_cache) |
| 1455 | goto out; | 1455 | goto out; |
| 1456 | 1456 | ||
| 1457 | /* Set some sysctl minima */ | ||
| 1458 | if (sysctl_rmem_max < NEEDED_RMEM) | ||
| 1459 | sysctl_rmem_max = NEEDED_RMEM; | ||
| 1460 | |||
| 1461 | /* Start listening */ | 1457 | /* Start listening */ |
| 1462 | if (dlm_config.ci_protocol == 0) | 1458 | if (dlm_config.ci_protocol == 0) |
| 1463 | error = tcp_listen_for_all(); | 1459 | error = tcp_listen_for_all(); |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 749def054a34..153554cf5575 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
| @@ -26,13 +26,6 @@ | |||
| 26 | #include "internal.h" | 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 | struct proc_dir_entry *proc_net_fops_create(struct net *net, | 29 | struct proc_dir_entry *proc_net_fops_create(struct net *net, |
| 37 | const char *name, mode_t mode, const struct file_operations *fops) | 30 | const char *name, mode_t mode, const struct file_operations *fops) |
| 38 | { | 31 | { |
diff --git a/include/linux/mroute.h b/include/linux/mroute.h index 7da2cee8e132..35a8277ec1bd 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h | |||
| @@ -128,6 +128,18 @@ struct igmpmsg | |||
| 128 | #ifdef __KERNEL__ | 128 | #ifdef __KERNEL__ |
| 129 | #include <net/sock.h> | 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 | extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); | 143 | extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); |
| 132 | extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); | 144 | extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); |
| 133 | extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); | 145 | extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index f2eaea2234ec..b87e83a5e070 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
| @@ -4,25 +4,28 @@ header-y += nfnetlink_conntrack.h | |||
| 4 | header-y += nfnetlink_log.h | 4 | header-y += nfnetlink_log.h |
| 5 | header-y += nfnetlink_queue.h | 5 | header-y += nfnetlink_queue.h |
| 6 | header-y += xt_CLASSIFY.h | 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 | header-y += xt_comment.h | 15 | header-y += xt_comment.h |
| 8 | header-y += xt_connbytes.h | 16 | header-y += xt_connbytes.h |
| 9 | header-y += xt_connmark.h | 17 | header-y += xt_connmark.h |
| 10 | header-y += xt_CONNMARK.h | ||
| 11 | header-y += xt_conntrack.h | 18 | header-y += xt_conntrack.h |
| 12 | header-y += xt_dccp.h | 19 | header-y += xt_dccp.h |
| 13 | header-y += xt_dscp.h | 20 | header-y += xt_dscp.h |
| 14 | header-y += xt_DSCP.h | ||
| 15 | header-y += xt_esp.h | 21 | header-y += xt_esp.h |
| 16 | header-y += xt_helper.h | ||
| 17 | header-y += xt_hashlimit.h | 22 | header-y += xt_hashlimit.h |
| 23 | header-y += xt_helper.h | ||
| 18 | header-y += xt_length.h | 24 | header-y += xt_length.h |
| 19 | header-y += xt_limit.h | 25 | header-y += xt_limit.h |
| 20 | header-y += xt_mac.h | 26 | header-y += xt_mac.h |
| 21 | header-y += xt_mark.h | 27 | header-y += xt_mark.h |
| 22 | header-y += xt_MARK.h | ||
| 23 | header-y += xt_multiport.h | 28 | header-y += xt_multiport.h |
| 24 | header-y += xt_NFQUEUE.h | ||
| 25 | header-y += xt_NFLOG.h | ||
| 26 | header-y += xt_pkttype.h | 29 | header-y += xt_pkttype.h |
| 27 | header-y += xt_policy.h | 30 | header-y += xt_policy.h |
| 28 | header-y += xt_realm.h | 31 | header-y += xt_realm.h |
| @@ -32,9 +35,6 @@ header-y += xt_statistic.h | |||
| 32 | header-y += xt_string.h | 35 | header-y += xt_string.h |
| 33 | header-y += xt_tcpmss.h | 36 | header-y += xt_tcpmss.h |
| 34 | header-y += xt_tcpudp.h | 37 | header-y += xt_tcpudp.h |
| 35 | header-y += xt_SECMARK.h | ||
| 36 | header-y += xt_CONNSECMARK.h | ||
| 37 | header-y += xt_TCPMSS.h | ||
| 38 | 38 | ||
| 39 | unifdef-y += nf_conntrack_common.h | 39 | unifdef-y += nf_conntrack_common.h |
| 40 | unifdef-y += nf_conntrack_ftp.h | 40 | unifdef-y += nf_conntrack_ftp.h |
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild index 7185792b900f..3a7105bb8f33 100644 --- a/include/linux/netfilter_ipv4/Kbuild +++ b/include/linux/netfilter_ipv4/Kbuild | |||
| @@ -1,47 +1,47 @@ | |||
| 1 | header-y += ipt_addrtype.h | ||
| 2 | header-y += ipt_ah.h | ||
| 3 | header-y += ipt_CLASSIFY.h | 1 | header-y += ipt_CLASSIFY.h |
| 4 | header-y += ipt_CLUSTERIP.h | 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 | header-y += ipt_comment.h | 17 | header-y += ipt_comment.h |
| 6 | header-y += ipt_connbytes.h | 18 | header-y += ipt_connbytes.h |
| 7 | header-y += ipt_connmark.h | 19 | header-y += ipt_connmark.h |
| 8 | header-y += ipt_CONNMARK.h | ||
| 9 | header-y += ipt_conntrack.h | 20 | header-y += ipt_conntrack.h |
| 10 | header-y += ipt_dccp.h | 21 | header-y += ipt_dccp.h |
| 11 | header-y += ipt_dscp.h | 22 | header-y += ipt_dscp.h |
| 12 | header-y += ipt_DSCP.h | ||
| 13 | header-y += ipt_ecn.h | 23 | header-y += ipt_ecn.h |
| 14 | header-y += ipt_ECN.h | ||
| 15 | header-y += ipt_esp.h | 24 | header-y += ipt_esp.h |
| 16 | header-y += ipt_hashlimit.h | 25 | header-y += ipt_hashlimit.h |
| 17 | header-y += ipt_helper.h | 26 | header-y += ipt_helper.h |
| 18 | header-y += ipt_iprange.h | 27 | header-y += ipt_iprange.h |
| 19 | header-y += ipt_length.h | 28 | header-y += ipt_length.h |
| 20 | header-y += ipt_limit.h | 29 | header-y += ipt_limit.h |
| 21 | header-y += ipt_LOG.h | ||
| 22 | header-y += ipt_mac.h | 30 | header-y += ipt_mac.h |
| 23 | header-y += ipt_mark.h | 31 | header-y += ipt_mark.h |
| 24 | header-y += ipt_MARK.h | ||
| 25 | header-y += ipt_multiport.h | 32 | header-y += ipt_multiport.h |
| 26 | header-y += ipt_NFQUEUE.h | ||
| 27 | header-y += ipt_owner.h | 33 | header-y += ipt_owner.h |
| 28 | header-y += ipt_physdev.h | 34 | header-y += ipt_physdev.h |
| 29 | header-y += ipt_pkttype.h | 35 | header-y += ipt_pkttype.h |
| 30 | header-y += ipt_policy.h | 36 | header-y += ipt_policy.h |
| 31 | header-y += ipt_realm.h | 37 | header-y += ipt_realm.h |
| 32 | header-y += ipt_recent.h | 38 | header-y += ipt_recent.h |
| 33 | header-y += ipt_REJECT.h | ||
| 34 | header-y += ipt_SAME.h | ||
| 35 | header-y += ipt_sctp.h | 39 | header-y += ipt_sctp.h |
| 36 | header-y += ipt_state.h | 40 | header-y += ipt_state.h |
| 37 | header-y += ipt_string.h | 41 | header-y += ipt_string.h |
| 38 | header-y += ipt_tcpmss.h | 42 | header-y += ipt_tcpmss.h |
| 39 | header-y += ipt_TCPMSS.h | ||
| 40 | header-y += ipt_tos.h | 43 | header-y += ipt_tos.h |
| 41 | header-y += ipt_TOS.h | ||
| 42 | header-y += ipt_ttl.h | 44 | header-y += ipt_ttl.h |
| 43 | header-y += ipt_TTL.h | ||
| 44 | header-y += ipt_ULOG.h | ||
| 45 | 45 | ||
| 46 | unifdef-y += ip_queue.h | 46 | unifdef-y += ip_queue.h |
| 47 | unifdef-y += ip_tables.h | 47 | unifdef-y += ip_tables.h |
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild index 9dd978d149ff..8887a5fcd1d0 100644 --- a/include/linux/netfilter_ipv6/Kbuild +++ b/include/linux/netfilter_ipv6/Kbuild | |||
| @@ -14,8 +14,8 @@ header-y += ip6t_mark.h | |||
| 14 | header-y += ip6t_multiport.h | 14 | header-y += ip6t_multiport.h |
| 15 | header-y += ip6t_opts.h | 15 | header-y += ip6t_opts.h |
| 16 | header-y += ip6t_owner.h | 16 | header-y += ip6t_owner.h |
| 17 | header-y += ip6t_policy.h | ||
| 18 | header-y += ip6t_physdev.h | 17 | header-y += ip6t_physdev.h |
| 18 | header-y += ip6t_policy.h | ||
| 19 | header-y += ip6t_rt.h | 19 | header-y += ip6t_rt.h |
| 20 | 20 | ||
| 21 | unifdef-y += ip6_tables.h | 21 | unifdef-y += ip6_tables.h |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 7c1f3b1d2ee5..d5bfaba595c7 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -192,7 +192,7 @@ extern int netlink_unregister_notifier(struct notifier_block *nb); | |||
| 192 | /* finegrained unicast helpers: */ | 192 | /* finegrained unicast helpers: */ |
| 193 | struct sock *netlink_getsockbyfilp(struct file *filp); | 193 | struct sock *netlink_getsockbyfilp(struct file *filp); |
| 194 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, | 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 | void netlink_detachskb(struct sock *sk, struct sk_buff *skb); | 196 | void netlink_detachskb(struct sock *sk, struct sk_buff *skb); |
| 197 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb); | 197 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb); |
| 198 | 198 | ||
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 1ff461672060..1273c6ec535c 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
| @@ -196,8 +196,6 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name, | |||
| 196 | return res; | 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 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, | 199 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, |
| 202 | const char *name, mode_t mode, const struct file_operations *fops); | 200 | const char *name, mode_t mode, const struct file_operations *fops); |
| 203 | extern void proc_net_remove(struct net *net, const char *name); | 201 | extern void proc_net_remove(struct net *net, const char *name); |
| @@ -208,7 +206,6 @@ extern void proc_net_remove(struct net *net, const char *name); | |||
| 208 | #define proc_bus NULL | 206 | #define proc_bus NULL |
| 209 | 207 | ||
| 210 | #define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) | 208 | #define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) |
| 211 | #define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; }) | ||
| 212 | static inline void proc_net_remove(struct net *net, const char *name) {} | 209 | static inline void proc_net_remove(struct net *net, const char *name) {} |
| 213 | 210 | ||
| 214 | static inline void proc_flush_task(struct task_struct *task) | 211 | static inline void proc_flush_task(struct task_struct *task) |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 56164d7ba0ad..c555f5442bd7 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -332,7 +332,9 @@ extern void tty_ldisc_flush(struct tty_struct *tty); | |||
| 332 | 332 | ||
| 333 | extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 333 | extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, |
| 334 | unsigned long arg); | 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 | extern dev_t tty_devnum(struct tty_struct *tty); | 338 | extern dev_t tty_devnum(struct tty_struct *tty); |
| 337 | extern void proc_clear_tty(struct task_struct *p); | 339 | extern void proc_clear_tty(struct task_struct *p); |
| 338 | extern struct tty_struct *get_current_tty(void); | 340 | extern struct tty_struct *get_current_tty(void); |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 4427dcd1e53a..8461cda37490 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | * I'll experiment with dynamic table growth later. | 37 | * I'll experiment with dynamic table growth later. |
| 38 | */ | 38 | */ |
| 39 | struct inet_ehash_bucket { | 39 | struct inet_ehash_bucket { |
| 40 | rwlock_t lock; | ||
| 41 | struct hlist_head chain; | 40 | struct hlist_head chain; |
| 42 | struct hlist_head twchain; | 41 | struct hlist_head twchain; |
| 43 | }; | 42 | }; |
| @@ -100,6 +99,9 @@ struct inet_hashinfo { | |||
| 100 | * TIME_WAIT sockets use a separate chain (twchain). | 99 | * TIME_WAIT sockets use a separate chain (twchain). |
| 101 | */ | 100 | */ |
| 102 | struct inet_ehash_bucket *ehash; | 101 | struct inet_ehash_bucket *ehash; |
| 102 | rwlock_t *ehash_locks; | ||
| 103 | unsigned int ehash_size; | ||
| 104 | unsigned int ehash_locks_mask; | ||
| 103 | 105 | ||
| 104 | /* Ok, let's try this, I give up, we do need a local binding | 106 | /* Ok, let's try this, I give up, we do need a local binding |
| 105 | * TCP hash as well as the others for fast bind/connect. | 107 | * TCP hash as well as the others for fast bind/connect. |
| @@ -107,7 +109,7 @@ struct inet_hashinfo { | |||
| 107 | struct inet_bind_hashbucket *bhash; | 109 | struct inet_bind_hashbucket *bhash; |
| 108 | 110 | ||
| 109 | unsigned int bhash_size; | 111 | unsigned int bhash_size; |
| 110 | unsigned int ehash_size; | 112 | /* Note : 4 bytes padding on 64 bit arches */ |
| 111 | 113 | ||
| 112 | /* All sockets in TCP_LISTEN state will be in here. This is the only | 114 | /* All sockets in TCP_LISTEN state will be in here. This is the only |
| 113 | * table where wildcard'd TCP sockets can exist. Hash function here | 115 | * table where wildcard'd TCP sockets can exist. Hash function here |
| @@ -134,6 +136,62 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket( | |||
| 134 | return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; | 136 | return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; |
| 135 | } | 137 | } |
| 136 | 138 | ||
| 139 | static inline rwlock_t *inet_ehash_lockp( | ||
| 140 | struct inet_hashinfo *hashinfo, | ||
| 141 | unsigned int hash) | ||
| 142 | { | ||
| 143 | return &hashinfo->ehash_locks[hash & hashinfo->ehash_locks_mask]; | ||
| 144 | } | ||
| 145 | |||
| 146 | static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) | ||
| 147 | { | ||
| 148 | unsigned int i, size = 256; | ||
| 149 | #if defined(CONFIG_PROVE_LOCKING) | ||
| 150 | unsigned int nr_pcpus = 2; | ||
| 151 | #else | ||
| 152 | unsigned int nr_pcpus = num_possible_cpus(); | ||
| 153 | #endif | ||
| 154 | if (nr_pcpus >= 4) | ||
| 155 | size = 512; | ||
| 156 | if (nr_pcpus >= 8) | ||
| 157 | size = 1024; | ||
| 158 | if (nr_pcpus >= 16) | ||
| 159 | size = 2048; | ||
| 160 | if (nr_pcpus >= 32) | ||
| 161 | size = 4096; | ||
| 162 | if (sizeof(rwlock_t) != 0) { | ||
| 163 | #ifdef CONFIG_NUMA | ||
| 164 | if (size * sizeof(rwlock_t) > PAGE_SIZE) | ||
| 165 | hashinfo->ehash_locks = vmalloc(size * sizeof(rwlock_t)); | ||
| 166 | else | ||
| 167 | #endif | ||
| 168 | hashinfo->ehash_locks = kmalloc(size * sizeof(rwlock_t), | ||
| 169 | GFP_KERNEL); | ||
| 170 | if (!hashinfo->ehash_locks) | ||
| 171 | return ENOMEM; | ||
| 172 | for (i = 0; i < size; i++) | ||
| 173 | rwlock_init(&hashinfo->ehash_locks[i]); | ||
| 174 | } | ||
| 175 | hashinfo->ehash_locks_mask = size - 1; | ||
| 176 | return 0; | ||
| 177 | } | ||
| 178 | |||
| 179 | static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo) | ||
| 180 | { | ||
| 181 | if (hashinfo->ehash_locks) { | ||
| 182 | #ifdef CONFIG_NUMA | ||
| 183 | unsigned int size = (hashinfo->ehash_locks_mask + 1) * | ||
| 184 | sizeof(rwlock_t); | ||
| 185 | if (size > PAGE_SIZE) | ||
| 186 | vfree(hashinfo->ehash_locks); | ||
| 187 | else | ||
| 188 | #else | ||
| 189 | kfree(hashinfo->ehash_locks); | ||
| 190 | #endif | ||
| 191 | hashinfo->ehash_locks = NULL; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 137 | extern struct inet_bind_bucket * | 195 | extern struct inet_bind_bucket * |
| 138 | inet_bind_bucket_create(struct kmem_cache *cachep, | 196 | inet_bind_bucket_create(struct kmem_cache *cachep, |
| 139 | struct inet_bind_hashbucket *head, | 197 | struct inet_bind_hashbucket *head, |
| @@ -222,7 +280,7 @@ static inline void __inet_hash(struct inet_hashinfo *hashinfo, | |||
| 222 | sk->sk_hash = inet_sk_ehashfn(sk); | 280 | sk->sk_hash = inet_sk_ehashfn(sk); |
| 223 | head = inet_ehash_bucket(hashinfo, sk->sk_hash); | 281 | head = inet_ehash_bucket(hashinfo, sk->sk_hash); |
| 224 | list = &head->chain; | 282 | list = &head->chain; |
| 225 | lock = &head->lock; | 283 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); |
| 226 | write_lock(lock); | 284 | write_lock(lock); |
| 227 | } | 285 | } |
| 228 | __sk_add_node(sk, list); | 286 | __sk_add_node(sk, list); |
| @@ -253,7 +311,7 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk) | |||
| 253 | inet_listen_wlock(hashinfo); | 311 | inet_listen_wlock(hashinfo); |
| 254 | lock = &hashinfo->lhash_lock; | 312 | lock = &hashinfo->lhash_lock; |
| 255 | } else { | 313 | } else { |
| 256 | lock = &inet_ehash_bucket(hashinfo, sk->sk_hash)->lock; | 314 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); |
| 257 | write_lock_bh(lock); | 315 | write_lock_bh(lock); |
| 258 | } | 316 | } |
| 259 | 317 | ||
| @@ -354,9 +412,10 @@ static inline struct sock * | |||
| 354 | */ | 412 | */ |
| 355 | unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); | 413 | unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); |
| 356 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); | 414 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); |
| 415 | rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); | ||
| 357 | 416 | ||
| 358 | prefetch(head->chain.first); | 417 | prefetch(head->chain.first); |
| 359 | read_lock(&head->lock); | 418 | read_lock(lock); |
| 360 | sk_for_each(sk, node, &head->chain) { | 419 | sk_for_each(sk, node, &head->chain) { |
| 361 | if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) | 420 | if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) |
| 362 | goto hit; /* You sunk my battleship! */ | 421 | goto hit; /* You sunk my battleship! */ |
| @@ -369,7 +428,7 @@ static inline struct sock * | |||
| 369 | } | 428 | } |
| 370 | sk = NULL; | 429 | sk = NULL; |
| 371 | out: | 430 | out: |
| 372 | read_unlock(&head->lock); | 431 | read_unlock(lock); |
| 373 | return sk; | 432 | return sk; |
| 374 | hit: | 433 | hit: |
| 375 | sock_hold(sk); | 434 | sock_hold(sk); |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 8cadc77c7df4..ed514bfb61ba 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
| @@ -185,6 +185,12 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | #else /* CONFIG_IP_MULTIPLE_TABLES */ | 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 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) | 194 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) |
| 189 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) | 195 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) |
| 190 | 196 | ||
| @@ -214,15 +220,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res); | |||
| 214 | /* Exported by fib_hash.c */ | 220 | /* Exported by fib_hash.c */ |
| 215 | extern struct fib_table *fib_hash_init(u32 id); | 221 | extern struct fib_table *fib_hash_init(u32 id); |
| 216 | 222 | ||
| 217 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
| 218 | extern void __init fib4_rules_init(void); | ||
| 219 | |||
| 220 | #ifdef CONFIG_NET_CLS_ROUTE | ||
| 221 | extern u32 fib_rules_tclass(struct fib_result *res); | ||
| 222 | #endif | ||
| 223 | |||
| 224 | #endif | ||
| 225 | |||
| 226 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 223 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) |
| 227 | { | 224 | { |
| 228 | #ifdef CONFIG_NET_CLS_ROUTE | 225 | #ifdef CONFIG_NET_CLS_ROUTE |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 41870564df8e..67ea2c0c0ab7 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -520,6 +520,10 @@ struct ip_vs_conn { | |||
| 520 | spinlock_t lock; /* lock for state transition */ | 520 | spinlock_t lock; /* lock for state transition */ |
| 521 | volatile __u16 flags; /* status flags */ | 521 | volatile __u16 flags; /* status flags */ |
| 522 | volatile __u16 state; /* state info */ | 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 | /* Control members */ | 528 | /* Control members */ |
| 525 | struct ip_vs_conn *control; /* Master control connection */ | 529 | struct ip_vs_conn *control; /* Master control connection */ |
| @@ -901,6 +905,10 @@ extern int ip_vs_use_count_inc(void); | |||
| 901 | extern void ip_vs_use_count_dec(void); | 905 | extern void ip_vs_use_count_dec(void); |
| 902 | extern int ip_vs_control_init(void); | 906 | extern int ip_vs_control_init(void); |
| 903 | extern void ip_vs_control_cleanup(void); | 907 | extern void ip_vs_control_cleanup(void); |
| 908 | extern struct ip_vs_dest * | ||
| 909 | ip_vs_find_dest(__be32 daddr, __be16 dport, | ||
| 910 | __be32 vaddr, __be16 vport, __u16 protocol); | ||
| 911 | extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); | ||
| 904 | 912 | ||
| 905 | 913 | ||
| 906 | /* | 914 | /* |
diff --git a/include/net/sock.h b/include/net/sock.h index 20de3fa7ae40..5504fb9fa88a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -560,6 +560,14 @@ struct proto { | |||
| 560 | void (*unhash)(struct sock *sk); | 560 | void (*unhash)(struct sock *sk); |
| 561 | int (*get_port)(struct sock *sk, unsigned short snum); | 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 | /* Memory pressure */ | 571 | /* Memory pressure */ |
| 564 | void (*enter_memory_pressure)(void); | 572 | void (*enter_memory_pressure)(void); |
| 565 | atomic_t *memory_allocated; /* Current allocated memory. */ | 573 | atomic_t *memory_allocated; /* Current allocated memory. */ |
| @@ -592,12 +600,38 @@ struct proto { | |||
| 592 | #ifdef SOCK_REFCNT_DEBUG | 600 | #ifdef SOCK_REFCNT_DEBUG |
| 593 | atomic_t socks; | 601 | atomic_t socks; |
| 594 | #endif | 602 | #endif |
| 595 | struct { | ||
| 596 | int inuse; | ||
| 597 | u8 __pad[SMP_CACHE_BYTES - sizeof(int)]; | ||
| 598 | } stats[NR_CPUS]; | ||
| 599 | }; | 603 | }; |
| 600 | 604 | ||
| 605 | /* | ||
| 606 | * Special macros to let protos use a fast version of inuse{get|add} | ||
| 607 | * using a static percpu variable per proto instead of an allocated one, | ||
| 608 | * saving one dereference. | ||
| 609 | * This might be changed if/when dynamic percpu vars become fast. | ||
| 610 | */ | ||
| 611 | #ifdef CONFIG_SMP | ||
| 612 | # define DEFINE_PROTO_INUSE(NAME) \ | ||
| 613 | static DEFINE_PER_CPU(int, NAME##_inuse); \ | ||
| 614 | static void NAME##_inuse_add(struct proto *prot, int inc) \ | ||
| 615 | { \ | ||
| 616 | __get_cpu_var(NAME##_inuse) += inc; \ | ||
| 617 | } \ | ||
| 618 | \ | ||
| 619 | static int NAME##_inuse_getval(const struct proto *prot)\ | ||
| 620 | { \ | ||
| 621 | int res = 0, cpu; \ | ||
| 622 | \ | ||
| 623 | for_each_possible_cpu(cpu) \ | ||
| 624 | res += per_cpu(NAME##_inuse, cpu); \ | ||
| 625 | return res; \ | ||
| 626 | } | ||
| 627 | # define REF_PROTO_INUSE(NAME) \ | ||
| 628 | .inuse_add = NAME##_inuse_add, \ | ||
| 629 | .inuse_getval = NAME##_inuse_getval, | ||
| 630 | #else | ||
| 631 | # define DEFINE_PROTO_INUSE(NAME) | ||
| 632 | # define REF_PROTO_INUSE(NAME) | ||
| 633 | #endif | ||
| 634 | |||
| 601 | extern int proto_register(struct proto *prot, int alloc_slab); | 635 | extern int proto_register(struct proto *prot, int alloc_slab); |
| 602 | extern void proto_unregister(struct proto *prot); | 636 | extern void proto_unregister(struct proto *prot); |
| 603 | 637 | ||
| @@ -629,12 +663,29 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) | |||
| 629 | /* Called with local bh disabled */ | 663 | /* Called with local bh disabled */ |
| 630 | static __inline__ void sock_prot_inc_use(struct proto *prot) | 664 | static __inline__ void sock_prot_inc_use(struct proto *prot) |
| 631 | { | 665 | { |
| 632 | prot->stats[smp_processor_id()].inuse++; | 666 | #ifdef CONFIG_SMP |
| 667 | prot->inuse_add(prot, 1); | ||
| 668 | #else | ||
| 669 | prot->inuse++; | ||
| 670 | #endif | ||
| 633 | } | 671 | } |
| 634 | 672 | ||
| 635 | static __inline__ void sock_prot_dec_use(struct proto *prot) | 673 | static __inline__ void sock_prot_dec_use(struct proto *prot) |
| 636 | { | 674 | { |
| 637 | prot->stats[smp_processor_id()].inuse--; | 675 | #ifdef CONFIG_SMP |
| 676 | prot->inuse_add(prot, -1); | ||
| 677 | #else | ||
| 678 | prot->inuse--; | ||
| 679 | #endif | ||
| 680 | } | ||
| 681 | |||
| 682 | static __inline__ int sock_prot_inuse(struct proto *proto) | ||
| 683 | { | ||
| 684 | #ifdef CONFIG_SMP | ||
| 685 | return proto->inuse_getval(proto); | ||
| 686 | #else | ||
| 687 | return proto->inuse; | ||
| 688 | #endif | ||
| 638 | } | 689 | } |
| 639 | 690 | ||
| 640 | /* With per-bucket locks this operation is not-atomic, so that | 691 | /* With per-bucket locks this operation is not-atomic, so that |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index bfa274ba9ed4..1e04cd464af9 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
| @@ -1010,6 +1010,8 @@ asmlinkage long sys_mq_notify(mqd_t mqdes, | |||
| 1010 | return -EINVAL; | 1010 | return -EINVAL; |
| 1011 | } | 1011 | } |
| 1012 | if (notification.sigev_notify == SIGEV_THREAD) { | 1012 | if (notification.sigev_notify == SIGEV_THREAD) { |
| 1013 | long timeo; | ||
| 1014 | |||
| 1013 | /* create the notify skb */ | 1015 | /* create the notify skb */ |
| 1014 | nc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL); | 1016 | nc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL); |
| 1015 | ret = -ENOMEM; | 1017 | ret = -ENOMEM; |
| @@ -1038,8 +1040,8 @@ retry: | |||
| 1038 | goto out; | 1040 | goto out; |
| 1039 | } | 1041 | } |
| 1040 | 1042 | ||
| 1041 | ret = netlink_attachskb(sock, nc, 0, | 1043 | timeo = MAX_SCHEDULE_TIMEOUT; |
| 1042 | MAX_SCHEDULE_TIMEOUT, NULL); | 1044 | ret = netlink_attachskb(sock, nc, 0, &timeo, NULL); |
| 1043 | if (ret == 1) | 1045 | if (ret == 1) |
| 1044 | goto retry; | 1046 | goto retry; |
| 1045 | if (ret) { | 1047 | if (ret) { |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 3fe4fc86055f..1037748c14db 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
| @@ -747,6 +747,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg) | |||
| 747 | vlan_dev_set_ingress_priority(dev, | 747 | vlan_dev_set_ingress_priority(dev, |
| 748 | args.u.skb_priority, | 748 | args.u.skb_priority, |
| 749 | args.vlan_qos); | 749 | args.vlan_qos); |
| 750 | err = 0; | ||
| 750 | break; | 751 | break; |
| 751 | 752 | ||
| 752 | case SET_VLAN_EGRESS_PRIORITY_CMD: | 753 | case SET_VLAN_EGRESS_PRIORITY_CMD: |
diff --git a/net/bridge/netfilter/ebt_arp.c b/net/bridge/netfilter/ebt_arp.c index 1a46952a56d9..18141392a9b4 100644 --- a/net/bridge/netfilter/ebt_arp.c +++ b/net/bridge/netfilter/ebt_arp.c | |||
| @@ -34,7 +34,7 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in | |||
| 34 | ah->ar_pro, EBT_ARP_PTYPE)) | 34 | ah->ar_pro, EBT_ARP_PTYPE)) |
| 35 | return EBT_NOMATCH; | 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 | __be32 saddr, daddr, *sap, *dap; | 38 | __be32 saddr, daddr, *sap, *dap; |
| 39 | 39 | ||
| 40 | if (ah->ar_pln != sizeof(__be32) || ah->ar_pro != htons(ETH_P_IP)) | 40 | if (ah->ar_pln != sizeof(__be32) || ah->ar_pro != htons(ETH_P_IP)) |
diff --git a/net/core/dst.c b/net/core/dst.c index 16958e64e577..03daead3592a 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
| 19 | #include <net/net_namespace.h> | 19 | #include <net/net_namespace.h> |
| 20 | 20 | ||
| 21 | #include <net/net_namespace.h> | ||
| 22 | #include <net/dst.h> | 21 | #include <net/dst.h> |
| 23 | 22 | ||
| 24 | /* | 23 | /* |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 05979e356963..29b8ee4e35d6 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
| @@ -1435,6 +1435,8 @@ int neigh_table_clear(struct neigh_table *tbl) | |||
| 1435 | kfree(tbl->phash_buckets); | 1435 | kfree(tbl->phash_buckets); |
| 1436 | tbl->phash_buckets = NULL; | 1436 | tbl->phash_buckets = NULL; |
| 1437 | 1437 | ||
| 1438 | remove_proc_entry(tbl->id, init_net.proc_net_stat); | ||
| 1439 | |||
| 1438 | free_percpu(tbl->stats); | 1440 | free_percpu(tbl->stats); |
| 1439 | tbl->stats = NULL; | 1441 | tbl->stats = NULL; |
| 1440 | 1442 | ||
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index e9f0964ce70b..3f6d37deac45 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
| @@ -64,6 +64,20 @@ static struct net *net_alloc(void) | |||
| 64 | return kmem_cache_zalloc(net_cachep, GFP_KERNEL); | 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 | struct net *copy_net_ns(unsigned long flags, struct net *old_net) | 81 | struct net *copy_net_ns(unsigned long flags, struct net *old_net) |
| 68 | { | 82 | { |
| 69 | struct net *new_net = NULL; | 83 | struct net *new_net = NULL; |
| @@ -100,20 +114,6 @@ out: | |||
| 100 | return new_net; | 114 | return new_net; |
| 101 | } | 115 | } |
| 102 | 116 | ||
| 103 | static void net_free(struct net *net) | ||
| 104 | { | ||
| 105 | if (!net) | ||
| 106 | return; | ||
| 107 | |||
| 108 | if (unlikely(atomic_read(&net->use_count) != 0)) { | ||
| 109 | printk(KERN_EMERG "network namespace not free! Usage: %d\n", | ||
| 110 | atomic_read(&net->use_count)); | ||
| 111 | return; | ||
| 112 | } | ||
| 113 | |||
| 114 | kmem_cache_free(net_cachep, net); | ||
| 115 | } | ||
| 116 | |||
| 117 | static void cleanup_net(struct work_struct *work) | 117 | static void cleanup_net(struct work_struct *work) |
| 118 | { | 118 | { |
| 119 | struct pernet_operations *ops; | 119 | struct pernet_operations *ops; |
diff --git a/net/core/sock.c b/net/core/sock.c index 12ad2067a988..8fc2f84209e4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
| @@ -1801,11 +1801,65 @@ EXPORT_SYMBOL(sk_common_release); | |||
| 1801 | static DEFINE_RWLOCK(proto_list_lock); | 1801 | static DEFINE_RWLOCK(proto_list_lock); |
| 1802 | static LIST_HEAD(proto_list); | 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 | int proto_register(struct proto *prot, int alloc_slab) | 1856 | int proto_register(struct proto *prot, int alloc_slab) |
| 1805 | { | 1857 | { |
| 1806 | char *request_sock_slab_name = NULL; | 1858 | char *request_sock_slab_name = NULL; |
| 1807 | char *timewait_sock_slab_name; | 1859 | char *timewait_sock_slab_name; |
| 1808 | int rc = -ENOBUFS; | 1860 | |
| 1861 | if (inuse_init(prot)) | ||
| 1862 | goto out; | ||
| 1809 | 1863 | ||
| 1810 | if (alloc_slab) { | 1864 | if (alloc_slab) { |
| 1811 | prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, | 1865 | prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, |
| @@ -1814,7 +1868,7 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
| 1814 | if (prot->slab == NULL) { | 1868 | if (prot->slab == NULL) { |
| 1815 | printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", | 1869 | printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", |
| 1816 | prot->name); | 1870 | prot->name); |
| 1817 | goto out; | 1871 | goto out_free_inuse; |
| 1818 | } | 1872 | } |
| 1819 | 1873 | ||
| 1820 | if (prot->rsk_prot != NULL) { | 1874 | if (prot->rsk_prot != NULL) { |
| @@ -1858,9 +1912,8 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
| 1858 | write_lock(&proto_list_lock); | 1912 | write_lock(&proto_list_lock); |
| 1859 | list_add(&prot->node, &proto_list); | 1913 | list_add(&prot->node, &proto_list); |
| 1860 | write_unlock(&proto_list_lock); | 1914 | write_unlock(&proto_list_lock); |
| 1861 | rc = 0; | 1915 | return 0; |
| 1862 | out: | 1916 | |
| 1863 | return rc; | ||
| 1864 | out_free_timewait_sock_slab_name: | 1917 | out_free_timewait_sock_slab_name: |
| 1865 | kfree(timewait_sock_slab_name); | 1918 | kfree(timewait_sock_slab_name); |
| 1866 | out_free_request_sock_slab: | 1919 | out_free_request_sock_slab: |
| @@ -1873,7 +1926,10 @@ out_free_request_sock_slab_name: | |||
| 1873 | out_free_sock_slab: | 1926 | out_free_sock_slab: |
| 1874 | kmem_cache_destroy(prot->slab); | 1927 | kmem_cache_destroy(prot->slab); |
| 1875 | prot->slab = NULL; | 1928 | prot->slab = NULL; |
| 1876 | goto out; | 1929 | out_free_inuse: |
| 1930 | inuse_fini(prot); | ||
| 1931 | out: | ||
| 1932 | return -ENOBUFS; | ||
| 1877 | } | 1933 | } |
| 1878 | 1934 | ||
| 1879 | EXPORT_SYMBOL(proto_register); | 1935 | EXPORT_SYMBOL(proto_register); |
| @@ -1884,6 +1940,7 @@ void proto_unregister(struct proto *prot) | |||
| 1884 | list_del(&prot->node); | 1940 | list_del(&prot->node); |
| 1885 | write_unlock(&proto_list_lock); | 1941 | write_unlock(&proto_list_lock); |
| 1886 | 1942 | ||
| 1943 | inuse_fini(prot); | ||
| 1887 | if (prot->slab != NULL) { | 1944 | if (prot->slab != NULL) { |
| 1888 | kmem_cache_destroy(prot->slab); | 1945 | kmem_cache_destroy(prot->slab); |
| 1889 | prot->slab = NULL; | 1946 | prot->slab = NULL; |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 01a6a808bdb7..db17b83e8d3e 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
| @@ -922,6 +922,8 @@ static struct timewait_sock_ops dccp_timewait_sock_ops = { | |||
| 922 | .twsk_obj_size = sizeof(struct inet_timewait_sock), | 922 | .twsk_obj_size = sizeof(struct inet_timewait_sock), |
| 923 | }; | 923 | }; |
| 924 | 924 | ||
| 925 | DEFINE_PROTO_INUSE(dccp_v4) | ||
| 926 | |||
| 925 | static struct proto dccp_v4_prot = { | 927 | static struct proto dccp_v4_prot = { |
| 926 | .name = "DCCP", | 928 | .name = "DCCP", |
| 927 | .owner = THIS_MODULE, | 929 | .owner = THIS_MODULE, |
| @@ -950,6 +952,7 @@ static struct proto dccp_v4_prot = { | |||
| 950 | .compat_setsockopt = compat_dccp_setsockopt, | 952 | .compat_setsockopt = compat_dccp_setsockopt, |
| 951 | .compat_getsockopt = compat_dccp_getsockopt, | 953 | .compat_getsockopt = compat_dccp_getsockopt, |
| 952 | #endif | 954 | #endif |
| 955 | REF_PROTO_INUSE(dccp_v4) | ||
| 953 | }; | 956 | }; |
| 954 | 957 | ||
| 955 | static struct net_protocol dccp_v4_protocol = { | 958 | static struct net_protocol dccp_v4_protocol = { |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 62428ff137dd..87c98fb86fa8 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
| @@ -1107,6 +1107,8 @@ static struct timewait_sock_ops dccp6_timewait_sock_ops = { | |||
| 1107 | .twsk_obj_size = sizeof(struct dccp6_timewait_sock), | 1107 | .twsk_obj_size = sizeof(struct dccp6_timewait_sock), |
| 1108 | }; | 1108 | }; |
| 1109 | 1109 | ||
| 1110 | DEFINE_PROTO_INUSE(dccp_v6) | ||
| 1111 | |||
| 1110 | static struct proto dccp_v6_prot = { | 1112 | static struct proto dccp_v6_prot = { |
| 1111 | .name = "DCCPv6", | 1113 | .name = "DCCPv6", |
| 1112 | .owner = THIS_MODULE, | 1114 | .owner = THIS_MODULE, |
| @@ -1135,6 +1137,7 @@ static struct proto dccp_v6_prot = { | |||
| 1135 | .compat_setsockopt = compat_dccp_setsockopt, | 1137 | .compat_setsockopt = compat_dccp_setsockopt, |
| 1136 | .compat_getsockopt = compat_dccp_getsockopt, | 1138 | .compat_getsockopt = compat_dccp_getsockopt, |
| 1137 | #endif | 1139 | #endif |
| 1140 | REF_PROTO_INUSE(dccp_v6) | ||
| 1138 | }; | 1141 | }; |
| 1139 | 1142 | ||
| 1140 | static struct inet6_protocol dccp_v6_protocol = { | 1143 | static struct inet6_protocol dccp_v6_protocol = { |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index d84973928033..7a3bea9c28c1 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
| @@ -1072,11 +1072,13 @@ static int __init dccp_init(void) | |||
| 1072 | } | 1072 | } |
| 1073 | 1073 | ||
| 1074 | for (i = 0; i < dccp_hashinfo.ehash_size; i++) { | 1074 | for (i = 0; i < dccp_hashinfo.ehash_size; i++) { |
| 1075 | rwlock_init(&dccp_hashinfo.ehash[i].lock); | ||
| 1076 | INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].chain); | 1075 | INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].chain); |
| 1077 | INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].twchain); | 1076 | INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].twchain); |
| 1078 | } | 1077 | } |
| 1079 | 1078 | ||
| 1079 | if (inet_ehash_locks_alloc(&dccp_hashinfo)) | ||
| 1080 | goto out_free_dccp_ehash; | ||
| 1081 | |||
| 1080 | bhash_order = ehash_order; | 1082 | bhash_order = ehash_order; |
| 1081 | 1083 | ||
| 1082 | do { | 1084 | do { |
| @@ -1091,7 +1093,7 @@ static int __init dccp_init(void) | |||
| 1091 | 1093 | ||
| 1092 | if (!dccp_hashinfo.bhash) { | 1094 | if (!dccp_hashinfo.bhash) { |
| 1093 | DCCP_CRIT("Failed to allocate DCCP bind hash table"); | 1095 | DCCP_CRIT("Failed to allocate DCCP bind hash table"); |
| 1094 | goto out_free_dccp_ehash; | 1096 | goto out_free_dccp_locks; |
| 1095 | } | 1097 | } |
| 1096 | 1098 | ||
| 1097 | for (i = 0; i < dccp_hashinfo.bhash_size; i++) { | 1099 | for (i = 0; i < dccp_hashinfo.bhash_size; i++) { |
| @@ -1121,6 +1123,8 @@ out_free_dccp_mib: | |||
| 1121 | out_free_dccp_bhash: | 1123 | out_free_dccp_bhash: |
| 1122 | free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order); | 1124 | free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order); |
| 1123 | dccp_hashinfo.bhash = NULL; | 1125 | dccp_hashinfo.bhash = NULL; |
| 1126 | out_free_dccp_locks: | ||
| 1127 | inet_ehash_locks_free(&dccp_hashinfo); | ||
| 1124 | out_free_dccp_ehash: | 1128 | out_free_dccp_ehash: |
| 1125 | free_pages((unsigned long)dccp_hashinfo.ehash, ehash_order); | 1129 | free_pages((unsigned long)dccp_hashinfo.ehash, ehash_order); |
| 1126 | dccp_hashinfo.ehash = NULL; | 1130 | dccp_hashinfo.ehash = NULL; |
| @@ -1139,6 +1143,7 @@ static void __exit dccp_fini(void) | |||
| 1139 | free_pages((unsigned long)dccp_hashinfo.ehash, | 1143 | free_pages((unsigned long)dccp_hashinfo.ehash, |
| 1140 | get_order(dccp_hashinfo.ehash_size * | 1144 | get_order(dccp_hashinfo.ehash_size * |
| 1141 | sizeof(struct inet_ehash_bucket))); | 1145 | sizeof(struct inet_ehash_bucket))); |
| 1146 | inet_ehash_locks_free(&dccp_hashinfo); | ||
| 1142 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); | 1147 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); |
| 1143 | dccp_ackvec_exit(); | 1148 | dccp_ackvec_exit(); |
| 1144 | dccp_sysctl_exit(); | 1149 | dccp_sysctl_exit(); |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 26130afd8029..66e266fb5908 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
| @@ -1439,7 +1439,7 @@ static const struct file_operations dn_dev_seq_fops = { | |||
| 1439 | 1439 | ||
| 1440 | #endif /* CONFIG_PROC_FS */ | 1440 | #endif /* CONFIG_PROC_FS */ |
| 1441 | 1441 | ||
| 1442 | static int __initdata addr[2]; | 1442 | static int addr[2]; |
| 1443 | module_param_array(addr, int, NULL, 0444); | 1443 | module_param_array(addr, int, NULL, 0444); |
| 1444 | MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); | 1444 | MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); |
| 1445 | 1445 | ||
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c index 4cce3534e408..58b22619ab15 100644 --- a/net/ieee80211/ieee80211_crypt_tkip.c +++ b/net/ieee80211/ieee80211_crypt_tkip.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #include <net/ieee80211.h> | 25 | #include <net/ieee80211.h> |
| 26 | 26 | ||
| 27 | #include <linux/crypto.h> | 27 | #include <linux/crypto.h> |
| 28 | #include <linux/scatterlist.h> | ||
| 29 | #include <linux/crc32.h> | 28 | #include <linux/crc32.h> |
| 30 | 29 | ||
| 31 | MODULE_AUTHOR("Jouni Malinen"); | 30 | MODULE_AUTHOR("Jouni Malinen"); |
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index 866fc04c44f9..3fa30c40779f 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <net/ieee80211.h> | 22 | #include <net/ieee80211.h> |
| 23 | 23 | ||
| 24 | #include <linux/crypto.h> | 24 | #include <linux/crypto.h> |
| 25 | #include <linux/scatterlist.h> | ||
| 26 | #include <linux/crc32.h> | 25 | #include <linux/crc32.h> |
| 27 | 26 | ||
| 28 | MODULE_AUTHOR("Jouni Malinen"); | 27 | MODULE_AUTHOR("Jouni Malinen"); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 60123905dbbf..732d8f088b13 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
| @@ -59,6 +59,13 @@ struct fib_table *ip_fib_main_table; | |||
| 59 | #define FIB_TABLE_HASHSZ 1 | 59 | #define FIB_TABLE_HASHSZ 1 |
| 60 | static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; | 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 | #else | 69 | #else |
| 63 | 70 | ||
| 64 | #define FIB_TABLE_HASHSZ 256 | 71 | #define FIB_TABLE_HASHSZ 256 |
| @@ -905,14 +912,8 @@ void __init ip_fib_init(void) | |||
| 905 | 912 | ||
| 906 | for (i = 0; i < FIB_TABLE_HASHSZ; i++) | 913 | for (i = 0; i < FIB_TABLE_HASHSZ; i++) |
| 907 | INIT_HLIST_HEAD(&fib_table_hash[i]); | 914 | INIT_HLIST_HEAD(&fib_table_hash[i]); |
| 908 | #ifndef CONFIG_IP_MULTIPLE_TABLES | 915 | |
| 909 | ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL); | ||
| 910 | hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]); | ||
| 911 | ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN); | ||
| 912 | hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]); | ||
| 913 | #else | ||
| 914 | fib4_rules_init(); | 916 | fib4_rules_init(); |
| 915 | #endif | ||
| 916 | 917 | ||
| 917 | register_netdevice_notifier(&fib_netdev_notifier); | 918 | register_netdevice_notifier(&fib_netdev_notifier); |
| 918 | register_inetaddr_notifier(&fib_inetaddr_notifier); | 919 | register_inetaddr_notifier(&fib_inetaddr_notifier); |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index dc429b6b0ba6..b0170732b5e9 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -747,13 +747,14 @@ skip_listen_ht: | |||
| 747 | 747 | ||
| 748 | for (i = s_i; i < hashinfo->ehash_size; i++) { | 748 | for (i = s_i; i < hashinfo->ehash_size; i++) { |
| 749 | struct inet_ehash_bucket *head = &hashinfo->ehash[i]; | 749 | struct inet_ehash_bucket *head = &hashinfo->ehash[i]; |
| 750 | rwlock_t *lock = inet_ehash_lockp(hashinfo, i); | ||
| 750 | struct sock *sk; | 751 | struct sock *sk; |
| 751 | struct hlist_node *node; | 752 | struct hlist_node *node; |
| 752 | 753 | ||
| 753 | if (i > s_i) | 754 | if (i > s_i) |
| 754 | s_num = 0; | 755 | s_num = 0; |
| 755 | 756 | ||
| 756 | read_lock_bh(&head->lock); | 757 | read_lock_bh(lock); |
| 757 | num = 0; | 758 | num = 0; |
| 758 | sk_for_each(sk, node, &head->chain) { | 759 | sk_for_each(sk, node, &head->chain) { |
| 759 | struct inet_sock *inet = inet_sk(sk); | 760 | struct inet_sock *inet = inet_sk(sk); |
| @@ -769,7 +770,7 @@ skip_listen_ht: | |||
| 769 | r->id.idiag_dport) | 770 | r->id.idiag_dport) |
| 770 | goto next_normal; | 771 | goto next_normal; |
| 771 | if (inet_csk_diag_dump(sk, skb, cb) < 0) { | 772 | if (inet_csk_diag_dump(sk, skb, cb) < 0) { |
| 772 | read_unlock_bh(&head->lock); | 773 | read_unlock_bh(lock); |
| 773 | goto done; | 774 | goto done; |
| 774 | } | 775 | } |
| 775 | next_normal: | 776 | next_normal: |
| @@ -791,14 +792,14 @@ next_normal: | |||
| 791 | r->id.idiag_dport) | 792 | r->id.idiag_dport) |
| 792 | goto next_dying; | 793 | goto next_dying; |
| 793 | if (inet_twsk_diag_dump(tw, skb, cb) < 0) { | 794 | if (inet_twsk_diag_dump(tw, skb, cb) < 0) { |
| 794 | read_unlock_bh(&head->lock); | 795 | read_unlock_bh(lock); |
| 795 | goto done; | 796 | goto done; |
| 796 | } | 797 | } |
| 797 | next_dying: | 798 | next_dying: |
| 798 | ++num; | 799 | ++num; |
| 799 | } | 800 | } |
| 800 | } | 801 | } |
| 801 | read_unlock_bh(&head->lock); | 802 | read_unlock_bh(lock); |
| 802 | } | 803 | } |
| 803 | 804 | ||
| 804 | done: | 805 | done: |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 16eecc7046a3..67704da04fc4 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
| @@ -204,12 +204,13 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row, | |||
| 204 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); | 204 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); |
| 205 | unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); | 205 | unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); |
| 206 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 206 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
| 207 | rwlock_t *lock = inet_ehash_lockp(hinfo, hash); | ||
| 207 | struct sock *sk2; | 208 | struct sock *sk2; |
| 208 | const struct hlist_node *node; | 209 | const struct hlist_node *node; |
| 209 | struct inet_timewait_sock *tw; | 210 | struct inet_timewait_sock *tw; |
| 210 | 211 | ||
| 211 | prefetch(head->chain.first); | 212 | prefetch(head->chain.first); |
| 212 | write_lock(&head->lock); | 213 | write_lock(lock); |
| 213 | 214 | ||
| 214 | /* Check TIME-WAIT sockets first. */ | 215 | /* Check TIME-WAIT sockets first. */ |
| 215 | sk_for_each(sk2, node, &head->twchain) { | 216 | sk_for_each(sk2, node, &head->twchain) { |
| @@ -239,7 +240,7 @@ unique: | |||
| 239 | BUG_TRAP(sk_unhashed(sk)); | 240 | BUG_TRAP(sk_unhashed(sk)); |
| 240 | __sk_add_node(sk, &head->chain); | 241 | __sk_add_node(sk, &head->chain); |
| 241 | sock_prot_inc_use(sk->sk_prot); | 242 | sock_prot_inc_use(sk->sk_prot); |
| 242 | write_unlock(&head->lock); | 243 | write_unlock(lock); |
| 243 | 244 | ||
| 244 | if (twp) { | 245 | if (twp) { |
| 245 | *twp = tw; | 246 | *twp = tw; |
| @@ -255,7 +256,7 @@ unique: | |||
| 255 | return 0; | 256 | return 0; |
| 256 | 257 | ||
| 257 | not_unique: | 258 | not_unique: |
| 258 | write_unlock(&head->lock); | 259 | write_unlock(lock); |
| 259 | return -EADDRNOTAVAIL; | 260 | return -EADDRNOTAVAIL; |
| 260 | } | 261 | } |
| 261 | 262 | ||
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 4e189e28f306..a60b99e0ebdc 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c | |||
| @@ -20,16 +20,16 @@ static void __inet_twsk_kill(struct inet_timewait_sock *tw, | |||
| 20 | struct inet_bind_hashbucket *bhead; | 20 | struct inet_bind_hashbucket *bhead; |
| 21 | struct inet_bind_bucket *tb; | 21 | struct inet_bind_bucket *tb; |
| 22 | /* Unlink from established hashes. */ | 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 | if (hlist_unhashed(&tw->tw_node)) { | 26 | if (hlist_unhashed(&tw->tw_node)) { |
| 27 | write_unlock(&ehead->lock); | 27 | write_unlock(lock); |
| 28 | return; | 28 | return; |
| 29 | } | 29 | } |
| 30 | __hlist_del(&tw->tw_node); | 30 | __hlist_del(&tw->tw_node); |
| 31 | sk_node_init(&tw->tw_node); | 31 | sk_node_init(&tw->tw_node); |
| 32 | write_unlock(&ehead->lock); | 32 | write_unlock(lock); |
| 33 | 33 | ||
| 34 | /* Disassociate with bind bucket. */ | 34 | /* Disassociate with bind bucket. */ |
| 35 | bhead = &hashinfo->bhash[inet_bhashfn(tw->tw_num, hashinfo->bhash_size)]; | 35 | bhead = &hashinfo->bhash[inet_bhashfn(tw->tw_num, hashinfo->bhash_size)]; |
| @@ -59,6 +59,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, | |||
| 59 | const struct inet_sock *inet = inet_sk(sk); | 59 | const struct inet_sock *inet = inet_sk(sk); |
| 60 | const struct inet_connection_sock *icsk = inet_csk(sk); | 60 | const struct inet_connection_sock *icsk = inet_csk(sk); |
| 61 | struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, sk->sk_hash); | 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 | struct inet_bind_hashbucket *bhead; | 63 | struct inet_bind_hashbucket *bhead; |
| 63 | /* Step 1: Put TW into bind hash. Original socket stays there too. | 64 | /* Step 1: Put TW into bind hash. Original socket stays there too. |
| 64 | Note, that any socket with inet->num != 0 MUST be bound in | 65 | Note, that any socket with inet->num != 0 MUST be bound in |
| @@ -71,7 +72,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, | |||
| 71 | inet_twsk_add_bind_node(tw, &tw->tw_tb->owners); | 72 | inet_twsk_add_bind_node(tw, &tw->tw_tb->owners); |
| 72 | spin_unlock(&bhead->lock); | 73 | spin_unlock(&bhead->lock); |
| 73 | 74 | ||
| 74 | write_lock(&ehead->lock); | 75 | write_lock(lock); |
| 75 | 76 | ||
| 76 | /* Step 2: Remove SK from established hash. */ | 77 | /* Step 2: Remove SK from established hash. */ |
| 77 | if (__sk_del_node_init(sk)) | 78 | if (__sk_del_node_init(sk)) |
| @@ -81,7 +82,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, | |||
| 81 | inet_twsk_add_node(tw, &ehead->twchain); | 82 | inet_twsk_add_node(tw, &ehead->twchain); |
| 82 | atomic_inc(&tw->tw_refcnt); | 83 | atomic_inc(&tw->tw_refcnt); |
| 83 | 84 | ||
| 84 | write_unlock(&ehead->lock); | 85 | write_unlock(lock); |
| 85 | } | 86 | } |
| 86 | 87 | ||
| 87 | EXPORT_SYMBOL_GPL(__inet_twsk_hashdance); | 88 | EXPORT_SYMBOL_GPL(__inet_twsk_hashdance); |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index e5f7dc2de303..fd99fbd685ea 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
| @@ -1183,6 +1183,17 @@ error: | |||
| 1183 | return err; | 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 | * Combined all pending IP fragments on the socket as one IP datagram | 1198 | * Combined all pending IP fragments on the socket as one IP datagram |
| 1188 | * and push them out. | 1199 | * and push them out. |
| @@ -1276,13 +1287,7 @@ int ip_push_pending_frames(struct sock *sk) | |||
| 1276 | } | 1287 | } |
| 1277 | 1288 | ||
| 1278 | out: | 1289 | out: |
| 1279 | inet->cork.flags &= ~IPCORK_OPT; | 1290 | ip_cork_release(inet); |
| 1280 | kfree(inet->cork.opt); | ||
| 1281 | inet->cork.opt = NULL; | ||
| 1282 | if (inet->cork.rt) { | ||
| 1283 | ip_rt_put(inet->cork.rt); | ||
| 1284 | inet->cork.rt = NULL; | ||
| 1285 | } | ||
| 1286 | return err; | 1291 | return err; |
| 1287 | 1292 | ||
| 1288 | error: | 1293 | error: |
| @@ -1295,19 +1300,12 @@ error: | |||
| 1295 | */ | 1300 | */ |
| 1296 | void ip_flush_pending_frames(struct sock *sk) | 1301 | void ip_flush_pending_frames(struct sock *sk) |
| 1297 | { | 1302 | { |
| 1298 | struct inet_sock *inet = inet_sk(sk); | ||
| 1299 | struct sk_buff *skb; | 1303 | struct sk_buff *skb; |
| 1300 | 1304 | ||
| 1301 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) | 1305 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) |
| 1302 | kfree_skb(skb); | 1306 | kfree_skb(skb); |
| 1303 | 1307 | ||
| 1304 | inet->cork.flags &= ~IPCORK_OPT; | 1308 | ip_cork_release(inet_sk(sk)); |
| 1305 | kfree(inet->cork.opt); | ||
| 1306 | inet->cork.opt = NULL; | ||
| 1307 | if (inet->cork.rt) { | ||
| 1308 | ip_rt_put(inet->cork.rt); | ||
| 1309 | inet->cork.rt = NULL; | ||
| 1310 | } | ||
| 1311 | } | 1309 | } |
| 1312 | 1310 | ||
| 1313 | 1311 | ||
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index f51f20e487c8..82817e554363 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
| @@ -437,10 +437,8 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
| 437 | 437 | ||
| 438 | /* If optlen==0, it is equivalent to val == 0 */ | 438 | /* If optlen==0, it is equivalent to val == 0 */ |
| 439 | 439 | ||
| 440 | #ifdef CONFIG_IP_MROUTE | 440 | if (ip_mroute_opt(optname)) |
| 441 | if (optname >= MRT_BASE && optname <= (MRT_BASE + 10)) | ||
| 442 | return ip_mroute_setsockopt(sk,optname,optval,optlen); | 441 | return ip_mroute_setsockopt(sk,optname,optval,optlen); |
| 443 | #endif | ||
| 444 | 442 | ||
| 445 | err = 0; | 443 | err = 0; |
| 446 | lock_sock(sk); | 444 | lock_sock(sk); |
| @@ -909,11 +907,9 @@ int ip_setsockopt(struct sock *sk, int level, | |||
| 909 | #ifdef CONFIG_NETFILTER | 907 | #ifdef CONFIG_NETFILTER |
| 910 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 908 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
| 911 | if (err == -ENOPROTOOPT && optname != IP_HDRINCL && | 909 | if (err == -ENOPROTOOPT && optname != IP_HDRINCL && |
| 912 | optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY | 910 | optname != IP_IPSEC_POLICY && |
| 913 | #ifdef CONFIG_IP_MROUTE | 911 | optname != IP_XFRM_POLICY && |
| 914 | && (optname < MRT_BASE || optname > (MRT_BASE + 10)) | 912 | !ip_mroute_opt(optname)) { |
| 915 | #endif | ||
| 916 | ) { | ||
| 917 | lock_sock(sk); | 913 | lock_sock(sk); |
| 918 | err = nf_setsockopt(sk, PF_INET, optname, optval, optlen); | 914 | err = nf_setsockopt(sk, PF_INET, optname, optval, optlen); |
| 919 | release_sock(sk); | 915 | release_sock(sk); |
| @@ -935,11 +931,9 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname, | |||
| 935 | #ifdef CONFIG_NETFILTER | 931 | #ifdef CONFIG_NETFILTER |
| 936 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 932 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
| 937 | if (err == -ENOPROTOOPT && optname != IP_HDRINCL && | 933 | if (err == -ENOPROTOOPT && optname != IP_HDRINCL && |
| 938 | optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY | 934 | optname != IP_IPSEC_POLICY && |
| 939 | #ifdef CONFIG_IP_MROUTE | 935 | optname != IP_XFRM_POLICY && |
| 940 | && (optname < MRT_BASE || optname > (MRT_BASE + 10)) | 936 | !ip_mroute_opt(optname)) { |
| 941 | #endif | ||
| 942 | ) { | ||
| 943 | lock_sock(sk); | 937 | lock_sock(sk); |
| 944 | err = compat_nf_setsockopt(sk, PF_INET, optname, | 938 | err = compat_nf_setsockopt(sk, PF_INET, optname, |
| 945 | optval, optlen); | 939 | optval, optlen); |
| @@ -967,11 +961,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, | |||
| 967 | if (level != SOL_IP) | 961 | if (level != SOL_IP) |
| 968 | return -EOPNOTSUPP; | 962 | return -EOPNOTSUPP; |
| 969 | 963 | ||
| 970 | #ifdef CONFIG_IP_MROUTE | 964 | if (ip_mroute_opt(optname)) |
| 971 | if (optname >= MRT_BASE && optname <= MRT_BASE+10) { | ||
| 972 | return ip_mroute_getsockopt(sk,optname,optval,optlen); | 965 | return ip_mroute_getsockopt(sk,optname,optval,optlen); |
| 973 | } | ||
| 974 | #endif | ||
| 975 | 966 | ||
| 976 | if (get_user(len,optlen)) | 967 | if (get_user(len,optlen)) |
| 977 | return -EFAULT; | 968 | return -EFAULT; |
| @@ -1171,11 +1162,8 @@ int ip_getsockopt(struct sock *sk, int level, | |||
| 1171 | err = do_ip_getsockopt(sk, level, optname, optval, optlen); | 1162 | err = do_ip_getsockopt(sk, level, optname, optval, optlen); |
| 1172 | #ifdef CONFIG_NETFILTER | 1163 | #ifdef CONFIG_NETFILTER |
| 1173 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 1164 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
| 1174 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS | 1165 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && |
| 1175 | #ifdef CONFIG_IP_MROUTE | 1166 | !ip_mroute_opt(optname)) { |
| 1176 | && (optname < MRT_BASE || optname > MRT_BASE+10) | ||
| 1177 | #endif | ||
| 1178 | ) { | ||
| 1179 | int len; | 1167 | int len; |
| 1180 | 1168 | ||
| 1181 | if (get_user(len,optlen)) | 1169 | if (get_user(len,optlen)) |
| @@ -1200,11 +1188,8 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname, | |||
| 1200 | int err = do_ip_getsockopt(sk, level, optname, optval, optlen); | 1188 | int err = do_ip_getsockopt(sk, level, optname, optval, optlen); |
| 1201 | #ifdef CONFIG_NETFILTER | 1189 | #ifdef CONFIG_NETFILTER |
| 1202 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 1190 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
| 1203 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS | 1191 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && |
| 1204 | #ifdef CONFIG_IP_MROUTE | 1192 | !ip_mroute_opt(optname)) { |
| 1205 | && (optname < MRT_BASE || optname > MRT_BASE+10) | ||
| 1206 | #endif | ||
| 1207 | ) { | ||
| 1208 | int len; | 1193 | int len; |
| 1209 | 1194 | ||
| 1210 | if (get_user(len, optlen)) | 1195 | if (get_user(len, optlen)) |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index ca1b5fdb8d31..2c44a94c2135 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <asm/semaphore.h> | 17 | #include <asm/semaphore.h> |
| 18 | #include <linux/crypto.h> | 18 | #include <linux/crypto.h> |
| 19 | #include <linux/err.h> | ||
| 19 | #include <linux/pfkeyv2.h> | 20 | #include <linux/pfkeyv2.h> |
| 20 | #include <linux/percpu.h> | 21 | #include <linux/percpu.h> |
| 21 | #include <linux/smp.h> | 22 | #include <linux/smp.h> |
| @@ -344,7 +345,7 @@ static struct crypto_comp **ipcomp_alloc_tfms(const char *alg_name) | |||
| 344 | for_each_possible_cpu(cpu) { | 345 | for_each_possible_cpu(cpu) { |
| 345 | struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, | 346 | struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, |
| 346 | CRYPTO_ALG_ASYNC); | 347 | CRYPTO_ALG_ASYNC); |
| 347 | if (!tfm) | 348 | if (IS_ERR(tfm)) |
| 348 | goto error; | 349 | goto error; |
| 349 | *per_cpu_ptr(tfms, cpu) = tfm; | 350 | *per_cpu_ptr(tfms, cpu) = tfm; |
| 350 | } | 351 | } |
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index 4b702f708d30..b7eeae622d9b 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c | |||
| @@ -426,6 +426,25 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest) | |||
| 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 | * Unbind a connection entry with its VS destination | 448 | * Unbind a connection entry with its VS destination |
| 430 | * Called by the ip_vs_conn_expire function. | 449 | * Called by the ip_vs_conn_expire function. |
| 431 | */ | 450 | */ |
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c index c6ed7654e839..20c884a57721 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c | |||
| @@ -979,15 +979,23 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, | |||
| 979 | ret = NF_ACCEPT; | 979 | ret = NF_ACCEPT; |
| 980 | } | 980 | } |
| 981 | 981 | ||
| 982 | /* increase its packet counter and check if it is needed | 982 | /* Increase its packet counter and check if it is needed |
| 983 | to be synchronized */ | 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 | atomic_inc(&cp->in_pkts); | 988 | atomic_inc(&cp->in_pkts); |
| 985 | if ((ip_vs_sync_state & IP_VS_STATE_MASTER) && | 989 | if ((ip_vs_sync_state & IP_VS_STATE_MASTER) && |
| 986 | (cp->protocol != IPPROTO_TCP || | 990 | (((cp->protocol != IPPROTO_TCP || |
| 987 | cp->state == IP_VS_TCP_S_ESTABLISHED) && | 991 | cp->state == IP_VS_TCP_S_ESTABLISHED) && |
| 988 | (atomic_read(&cp->in_pkts) % sysctl_ip_vs_sync_threshold[1] | 992 | (atomic_read(&cp->in_pkts) % sysctl_ip_vs_sync_threshold[1] |
| 989 | == sysctl_ip_vs_sync_threshold[0])) | 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 | ip_vs_sync_conn(cp); | 997 | ip_vs_sync_conn(cp); |
| 998 | cp->old_state = cp->state; | ||
| 991 | 999 | ||
| 992 | ip_vs_conn_put(cp); | 1000 | ip_vs_conn_put(cp); |
| 993 | return ret; | 1001 | return ret; |
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 7345fc252a23..3c4d22a468ec 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
| @@ -579,6 +579,32 @@ ip_vs_lookup_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport) | |||
| 579 | return NULL; | 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 | * Lookup dest by {svc,addr,port} in the destination trash. | 610 | * Lookup dest by {svc,addr,port} in the destination trash. |
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c index 0d4d9721cbd4..bd930efc18da 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/ipv4/ipvs/ip_vs_sync.c | |||
| @@ -284,6 +284,7 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) | |||
| 284 | struct ip_vs_sync_conn_options *opt; | 284 | struct ip_vs_sync_conn_options *opt; |
| 285 | struct ip_vs_conn *cp; | 285 | struct ip_vs_conn *cp; |
| 286 | struct ip_vs_protocol *pp; | 286 | struct ip_vs_protocol *pp; |
| 287 | struct ip_vs_dest *dest; | ||
| 287 | char *p; | 288 | char *p; |
| 288 | int i; | 289 | int i; |
| 289 | 290 | ||
| @@ -317,20 +318,34 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) | |||
| 317 | s->caddr, s->cport, | 318 | s->caddr, s->cport, |
| 318 | s->vaddr, s->vport); | 319 | s->vaddr, s->vport); |
| 319 | if (!cp) { | 320 | if (!cp) { |
| 321 | /* | ||
| 322 | * Find the appropriate destination for the connection. | ||
| 323 | * If it is not found the connection will remain unbound | ||
| 324 | * but still handled. | ||
| 325 | */ | ||
| 326 | dest = ip_vs_find_dest(s->daddr, s->dport, | ||
| 327 | s->vaddr, s->vport, | ||
| 328 | s->protocol); | ||
| 320 | cp = ip_vs_conn_new(s->protocol, | 329 | cp = ip_vs_conn_new(s->protocol, |
| 321 | s->caddr, s->cport, | 330 | s->caddr, s->cport, |
| 322 | s->vaddr, s->vport, | 331 | s->vaddr, s->vport, |
| 323 | s->daddr, s->dport, | 332 | s->daddr, s->dport, |
| 324 | flags, NULL); | 333 | flags, dest); |
| 334 | if (dest) | ||
| 335 | atomic_dec(&dest->refcnt); | ||
| 325 | if (!cp) { | 336 | if (!cp) { |
| 326 | IP_VS_ERR("ip_vs_conn_new failed\n"); | 337 | IP_VS_ERR("ip_vs_conn_new failed\n"); |
| 327 | return; | 338 | return; |
| 328 | } | 339 | } |
| 329 | cp->state = ntohs(s->state); | 340 | cp->state = ntohs(s->state); |
| 330 | } else if (!cp->dest) { | 341 | } else if (!cp->dest) { |
| 331 | /* it is an entry created by the synchronization */ | 342 | dest = ip_vs_try_bind_dest(cp); |
| 332 | cp->state = ntohs(s->state); | 343 | if (!dest) { |
| 333 | cp->flags = flags | IP_VS_CONN_F_HASHED; | 344 | /* it is an unbound entry created by |
| 345 | * synchronization */ | ||
| 346 | cp->flags = flags | IP_VS_CONN_F_HASHED; | ||
| 347 | } else | ||
| 348 | atomic_dec(&dest->refcnt); | ||
| 334 | } /* Note that we don't touch its state and flags | 349 | } /* Note that we don't touch its state and flags |
| 335 | if it is a normal entry. */ | 350 | if it is a normal entry. */ |
| 336 | 351 | ||
| @@ -342,6 +357,7 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) | |||
| 342 | p += SIMPLE_CONN_SIZE; | 357 | p += SIMPLE_CONN_SIZE; |
| 343 | 358 | ||
| 344 | atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); | 359 | atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); |
| 360 | cp->state = ntohs(s->state); | ||
| 345 | pp = ip_vs_proto_get(s->protocol); | 361 | pp = ip_vs_proto_get(s->protocol); |
| 346 | cp->timeout = pp->timeout_table[cp->state]; | 362 | cp->timeout = pp->timeout_table[cp->state]; |
| 347 | ip_vs_conn_put(cp); | 363 | ip_vs_conn_put(cp); |
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index 409d273f6f82..7456833d6ade 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile | |||
| @@ -41,27 +41,27 @@ obj-$(CONFIG_NF_NAT) += iptable_nat.o | |||
| 41 | obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o | 41 | obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o |
| 42 | 42 | ||
| 43 | # matches | 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 | obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o | 47 | obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o |
| 45 | obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o | 48 | obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o |
| 46 | obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o | ||
| 47 | obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o | 49 | obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o |
| 48 | obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o | 50 | obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o |
| 49 | obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o | ||
| 50 | obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o | 51 | obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o |
| 51 | obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o | ||
| 52 | 52 | ||
| 53 | # targets | 53 | # targets |
| 54 | obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o | 54 | obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o |
| 55 | obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o | ||
| 56 | obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.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 | 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 | 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 | ||
| 60 | obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o | 61 | 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_TOS) += ipt_TOS.o |
| 62 | obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o | ||
| 63 | obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o | ||
| 64 | obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o | 63 | obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o |
| 64 | obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o | ||
| 65 | 65 | ||
| 66 | # generic ARP tables | 66 | # generic ARP tables |
| 67 | obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o | 67 | obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 10a2ce09fd8e..14d64a383db1 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
| 23 | #include <linux/sysctl.h> | 23 | #include <linux/sysctl.h> |
| 24 | #include <linux/proc_fs.h> | 24 | #include <linux/proc_fs.h> |
| 25 | #include <linux/seq_file.h> | ||
| 25 | #include <linux/security.h> | 26 | #include <linux/security.h> |
| 26 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 27 | #include <net/net_namespace.h> | 28 | #include <net/net_namespace.h> |
| @@ -607,15 +608,11 @@ static ctl_table ipq_root_table[] = { | |||
| 607 | { .ctl_name = 0 } | 608 | { .ctl_name = 0 } |
| 608 | }; | 609 | }; |
| 609 | 610 | ||
| 610 | #ifdef CONFIG_PROC_FS | 611 | static int ip_queue_show(struct seq_file *m, void *v) |
| 611 | static int | ||
| 612 | ipq_get_info(char *buffer, char **start, off_t offset, int length) | ||
| 613 | { | 612 | { |
| 614 | int len; | ||
| 615 | |||
| 616 | read_lock_bh(&queue_lock); | 613 | read_lock_bh(&queue_lock); |
| 617 | 614 | ||
| 618 | len = sprintf(buffer, | 615 | seq_printf(m, |
| 619 | "Peer PID : %d\n" | 616 | "Peer PID : %d\n" |
| 620 | "Copy mode : %hu\n" | 617 | "Copy mode : %hu\n" |
| 621 | "Copy range : %u\n" | 618 | "Copy range : %u\n" |
| @@ -632,16 +629,21 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length) | |||
| 632 | queue_user_dropped); | 629 | queue_user_dropped); |
| 633 | 630 | ||
| 634 | read_unlock_bh(&queue_lock); | 631 | read_unlock_bh(&queue_lock); |
| 632 | return 0; | ||
| 633 | } | ||
| 635 | 634 | ||
| 636 | *start = buffer + offset; | 635 | static int ip_queue_open(struct inode *inode, struct file *file) |
| 637 | len -= offset; | 636 | { |
| 638 | if (len > length) | 637 | return single_open(file, ip_queue_show, NULL); |
| 639 | len = length; | ||
| 640 | else if (len < 0) | ||
| 641 | len = 0; | ||
| 642 | return len; | ||
| 643 | } | 638 | } |
| 644 | #endif /* CONFIG_PROC_FS */ | 639 | |
| 640 | static const struct file_operations ip_queue_proc_fops = { | ||
| 641 | .open = ip_queue_open, | ||
| 642 | .read = seq_read, | ||
| 643 | .llseek = seq_lseek, | ||
| 644 | .release = single_release, | ||
| 645 | .owner = THIS_MODULE, | ||
| 646 | }; | ||
| 645 | 647 | ||
| 646 | static struct nf_queue_handler nfqh = { | 648 | static struct nf_queue_handler nfqh = { |
| 647 | .name = "ip_queue", | 649 | .name = "ip_queue", |
| @@ -661,10 +663,11 @@ static int __init ip_queue_init(void) | |||
| 661 | goto cleanup_netlink_notifier; | 663 | goto cleanup_netlink_notifier; |
| 662 | } | 664 | } |
| 663 | 665 | ||
| 664 | proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info); | 666 | proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); |
| 665 | if (proc) | 667 | if (proc) { |
| 666 | proc->owner = THIS_MODULE; | 668 | proc->owner = THIS_MODULE; |
| 667 | else { | 669 | proc->proc_fops = &ip_queue_proc_fops; |
| 670 | } else { | ||
| 668 | printk(KERN_ERR "ip_queue: failed to create proc entry\n"); | 671 | printk(KERN_ERR "ip_queue: failed to create proc entry\n"); |
| 669 | goto cleanup_ipqnl; | 672 | goto cleanup_ipqnl; |
| 670 | } | 673 | } |
diff --git a/net/ipv4/netfilter/nf_nat_amanda.c b/net/ipv4/netfilter/nf_nat_amanda.c index 35a5aa69cd92..c31b87668250 100644 --- a/net/ipv4/netfilter/nf_nat_amanda.c +++ b/net/ipv4/netfilter/nf_nat_amanda.c | |||
| @@ -69,7 +69,7 @@ static void __exit nf_nat_amanda_fini(void) | |||
| 69 | 69 | ||
| 70 | static int __init nf_nat_amanda_init(void) | 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 | rcu_assign_pointer(nf_nat_amanda_hook, help); | 73 | rcu_assign_pointer(nf_nat_amanda_hook, help); |
| 74 | return 0; | 74 | return 0; |
| 75 | } | 75 | } |
diff --git a/net/ipv4/netfilter/nf_nat_ftp.c b/net/ipv4/netfilter/nf_nat_ftp.c index e1a16d3ea4cb..a1d5d58a58bf 100644 --- a/net/ipv4/netfilter/nf_nat_ftp.c +++ b/net/ipv4/netfilter/nf_nat_ftp.c | |||
| @@ -147,7 +147,7 @@ static void __exit nf_nat_ftp_fini(void) | |||
| 147 | 147 | ||
| 148 | static int __init nf_nat_ftp_init(void) | 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 | rcu_assign_pointer(nf_nat_ftp_hook, nf_nat_ftp); | 151 | rcu_assign_pointer(nf_nat_ftp_hook, nf_nat_ftp); |
| 152 | return 0; | 152 | return 0; |
| 153 | } | 153 | } |
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c index a868c8c41328..93e18ef114f2 100644 --- a/net/ipv4/netfilter/nf_nat_h323.c +++ b/net/ipv4/netfilter/nf_nat_h323.c | |||
| @@ -544,15 +544,15 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct, | |||
| 544 | /****************************************************************************/ | 544 | /****************************************************************************/ |
| 545 | static int __init init(void) | 545 | static int __init init(void) |
| 546 | { | 546 | { |
| 547 | BUG_ON(rcu_dereference(set_h245_addr_hook) != NULL); | 547 | BUG_ON(set_h245_addr_hook != NULL); |
| 548 | BUG_ON(rcu_dereference(set_h225_addr_hook) != NULL); | 548 | BUG_ON(set_h225_addr_hook != NULL); |
| 549 | BUG_ON(rcu_dereference(set_sig_addr_hook) != NULL); | 549 | BUG_ON(set_sig_addr_hook != NULL); |
| 550 | BUG_ON(rcu_dereference(set_ras_addr_hook) != NULL); | 550 | BUG_ON(set_ras_addr_hook != NULL); |
| 551 | BUG_ON(rcu_dereference(nat_rtp_rtcp_hook) != NULL); | 551 | BUG_ON(nat_rtp_rtcp_hook != NULL); |
| 552 | BUG_ON(rcu_dereference(nat_t120_hook) != NULL); | 552 | BUG_ON(nat_t120_hook != NULL); |
| 553 | BUG_ON(rcu_dereference(nat_h245_hook) != NULL); | 553 | BUG_ON(nat_h245_hook != NULL); |
| 554 | BUG_ON(rcu_dereference(nat_callforwarding_hook) != NULL); | 554 | BUG_ON(nat_callforwarding_hook != NULL); |
| 555 | BUG_ON(rcu_dereference(nat_q931_hook) != NULL); | 555 | BUG_ON(nat_q931_hook != NULL); |
| 556 | 556 | ||
| 557 | rcu_assign_pointer(set_h245_addr_hook, set_h245_addr); | 557 | rcu_assign_pointer(set_h245_addr_hook, set_h245_addr); |
| 558 | rcu_assign_pointer(set_h225_addr_hook, set_h225_addr); | 558 | rcu_assign_pointer(set_h225_addr_hook, set_h225_addr); |
diff --git a/net/ipv4/netfilter/nf_nat_irc.c b/net/ipv4/netfilter/nf_nat_irc.c index 766e2c16c6b9..fe6f9cef6c85 100644 --- a/net/ipv4/netfilter/nf_nat_irc.c +++ b/net/ipv4/netfilter/nf_nat_irc.c | |||
| @@ -74,7 +74,7 @@ static void __exit nf_nat_irc_fini(void) | |||
| 74 | 74 | ||
| 75 | static int __init nf_nat_irc_init(void) | 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 | rcu_assign_pointer(nf_nat_irc_hook, help); | 78 | rcu_assign_pointer(nf_nat_irc_hook, help); |
| 79 | return 0; | 79 | return 0; |
| 80 | } | 80 | } |
diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c index e1385a099079..6817e7995f35 100644 --- a/net/ipv4/netfilter/nf_nat_pptp.c +++ b/net/ipv4/netfilter/nf_nat_pptp.c | |||
| @@ -281,16 +281,16 @@ static int __init nf_nat_helper_pptp_init(void) | |||
| 281 | { | 281 | { |
| 282 | nf_nat_need_gre(); | 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 | rcu_assign_pointer(nf_nat_pptp_hook_outbound, pptp_outbound_pkt); | 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 | rcu_assign_pointer(nf_nat_pptp_hook_inbound, pptp_inbound_pkt); | 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 | rcu_assign_pointer(nf_nat_pptp_hook_exp_gre, pptp_exp_gre); | 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 | rcu_assign_pointer(nf_nat_pptp_hook_expectfn, pptp_nat_expected); | 294 | rcu_assign_pointer(nf_nat_pptp_hook_expectfn, pptp_nat_expected); |
| 295 | return 0; | 295 | return 0; |
| 296 | } | 296 | } |
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c index ce9edbcc01e3..3ca98971a1e9 100644 --- a/net/ipv4/netfilter/nf_nat_sip.c +++ b/net/ipv4/netfilter/nf_nat_sip.c | |||
| @@ -293,8 +293,8 @@ static void __exit nf_nat_sip_fini(void) | |||
| 293 | 293 | ||
| 294 | static int __init nf_nat_sip_init(void) | 294 | static int __init nf_nat_sip_init(void) |
| 295 | { | 295 | { |
| 296 | BUG_ON(rcu_dereference(nf_nat_sip_hook)); | 296 | BUG_ON(nf_nat_sip_hook != NULL); |
| 297 | BUG_ON(rcu_dereference(nf_nat_sdp_hook)); | 297 | BUG_ON(nf_nat_sdp_hook != NULL); |
| 298 | rcu_assign_pointer(nf_nat_sip_hook, ip_nat_sip); | 298 | rcu_assign_pointer(nf_nat_sip_hook, ip_nat_sip); |
| 299 | rcu_assign_pointer(nf_nat_sdp_hook, ip_nat_sdp); | 299 | rcu_assign_pointer(nf_nat_sdp_hook, ip_nat_sdp); |
| 300 | return 0; | 300 | return 0; |
diff --git a/net/ipv4/netfilter/nf_nat_tftp.c b/net/ipv4/netfilter/nf_nat_tftp.c index 0ecec701cb44..1360a94766dd 100644 --- a/net/ipv4/netfilter/nf_nat_tftp.c +++ b/net/ipv4/netfilter/nf_nat_tftp.c | |||
| @@ -43,7 +43,7 @@ static void __exit nf_nat_tftp_fini(void) | |||
| 43 | 43 | ||
| 44 | static int __init nf_nat_tftp_init(void) | 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 | rcu_assign_pointer(nf_nat_tftp_hook, help); | 47 | rcu_assign_pointer(nf_nat_tftp_hook, help); |
| 48 | return 0; | 48 | return 0; |
| 49 | } | 49 | } |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index ffdccc0972e0..ce34b281803f 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
| @@ -46,17 +46,6 @@ | |||
| 46 | #include <net/sock.h> | 46 | #include <net/sock.h> |
| 47 | #include <net/raw.h> | 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 | * Report socket allocation statistics [mea@utu.fi] | 50 | * Report socket allocation statistics [mea@utu.fi] |
| 62 | */ | 51 | */ |
| @@ -64,12 +53,12 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) | |||
| 64 | { | 53 | { |
| 65 | socket_seq_show(seq); | 54 | socket_seq_show(seq); |
| 66 | seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", | 55 | seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", |
| 67 | fold_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count), | 56 | sock_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count), |
| 68 | tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated), | 57 | tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated), |
| 69 | atomic_read(&tcp_memory_allocated)); | 58 | atomic_read(&tcp_memory_allocated)); |
| 70 | seq_printf(seq, "UDP: inuse %d\n", fold_prot_inuse(&udp_prot)); | 59 | seq_printf(seq, "UDP: inuse %d\n", sock_prot_inuse(&udp_prot)); |
| 71 | seq_printf(seq, "UDPLITE: inuse %d\n", fold_prot_inuse(&udplite_prot)); | 60 | seq_printf(seq, "UDPLITE: inuse %d\n", sock_prot_inuse(&udplite_prot)); |
| 72 | seq_printf(seq, "RAW: inuse %d\n", fold_prot_inuse(&raw_prot)); | 61 | seq_printf(seq, "RAW: inuse %d\n", sock_prot_inuse(&raw_prot)); |
| 73 | seq_printf(seq, "FRAG: inuse %d memory %d\n", | 62 | seq_printf(seq, "FRAG: inuse %d memory %d\n", |
| 74 | ip_frag_nqueues(), ip_frag_mem()); | 63 | ip_frag_nqueues(), ip_frag_mem()); |
| 75 | return 0; | 64 | return 0; |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 3916faca3afe..66b42f547bf9 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
| @@ -760,6 +760,8 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
| 760 | } | 760 | } |
| 761 | } | 761 | } |
| 762 | 762 | ||
| 763 | DEFINE_PROTO_INUSE(raw) | ||
| 764 | |||
| 763 | struct proto raw_prot = { | 765 | struct proto raw_prot = { |
| 764 | .name = "RAW", | 766 | .name = "RAW", |
| 765 | .owner = THIS_MODULE, | 767 | .owner = THIS_MODULE, |
| @@ -781,6 +783,7 @@ struct proto raw_prot = { | |||
| 781 | .compat_setsockopt = compat_raw_setsockopt, | 783 | .compat_setsockopt = compat_raw_setsockopt, |
| 782 | .compat_getsockopt = compat_raw_getsockopt, | 784 | .compat_getsockopt = compat_raw_getsockopt, |
| 783 | #endif | 785 | #endif |
| 786 | REF_PROTO_INUSE(raw) | ||
| 784 | }; | 787 | }; |
| 785 | 788 | ||
| 786 | #ifdef CONFIG_PROC_FS | 789 | #ifdef CONFIG_PROC_FS |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index c64072bb504b..8e65182f7af1 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -2456,11 +2456,11 @@ void __init tcp_init(void) | |||
| 2456 | thash_entries ? 0 : 512 * 1024); | 2456 | thash_entries ? 0 : 512 * 1024); |
| 2457 | tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size; | 2457 | tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size; |
| 2458 | for (i = 0; i < tcp_hashinfo.ehash_size; i++) { | 2458 | for (i = 0; i < tcp_hashinfo.ehash_size; i++) { |
| 2459 | rwlock_init(&tcp_hashinfo.ehash[i].lock); | ||
| 2460 | INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].chain); | 2459 | INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].chain); |
| 2461 | INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].twchain); | 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 | tcp_hashinfo.bhash = | 2464 | tcp_hashinfo.bhash = |
| 2465 | alloc_large_system_hash("TCP bind", | 2465 | alloc_large_system_hash("TCP bind", |
| 2466 | sizeof(struct inet_bind_hashbucket), | 2466 | sizeof(struct inet_bind_hashbucket), |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index d438dfb0c8f3..e566f3c67677 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -2049,8 +2049,9 @@ static void *established_get_first(struct seq_file *seq) | |||
| 2049 | struct sock *sk; | 2049 | struct sock *sk; |
| 2050 | struct hlist_node *node; | 2050 | struct hlist_node *node; |
| 2051 | struct inet_timewait_sock *tw; | 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 | sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { | 2055 | sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { |
| 2055 | if (sk->sk_family != st->family) { | 2056 | if (sk->sk_family != st->family) { |
| 2056 | continue; | 2057 | continue; |
| @@ -2067,7 +2068,7 @@ static void *established_get_first(struct seq_file *seq) | |||
| 2067 | rc = tw; | 2068 | rc = tw; |
| 2068 | goto out; | 2069 | goto out; |
| 2069 | } | 2070 | } |
| 2070 | read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); | 2071 | read_unlock_bh(lock); |
| 2071 | st->state = TCP_SEQ_STATE_ESTABLISHED; | 2072 | st->state = TCP_SEQ_STATE_ESTABLISHED; |
| 2072 | } | 2073 | } |
| 2073 | out: | 2074 | out: |
| @@ -2094,11 +2095,11 @@ get_tw: | |||
| 2094 | cur = tw; | 2095 | cur = tw; |
| 2095 | goto out; | 2096 | goto out; |
| 2096 | } | 2097 | } |
| 2097 | read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); | 2098 | read_unlock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket)); |
| 2098 | st->state = TCP_SEQ_STATE_ESTABLISHED; | 2099 | st->state = TCP_SEQ_STATE_ESTABLISHED; |
| 2099 | 2100 | ||
| 2100 | if (++st->bucket < tcp_hashinfo.ehash_size) { | 2101 | if (++st->bucket < tcp_hashinfo.ehash_size) { |
| 2101 | read_lock_bh(&tcp_hashinfo.ehash[st->bucket].lock); | 2102 | read_lock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket)); |
| 2102 | sk = sk_head(&tcp_hashinfo.ehash[st->bucket].chain); | 2103 | sk = sk_head(&tcp_hashinfo.ehash[st->bucket].chain); |
| 2103 | } else { | 2104 | } else { |
| 2104 | cur = NULL; | 2105 | cur = NULL; |
| @@ -2206,7 +2207,7 @@ static void tcp_seq_stop(struct seq_file *seq, void *v) | |||
| 2206 | case TCP_SEQ_STATE_TIME_WAIT: | 2207 | case TCP_SEQ_STATE_TIME_WAIT: |
| 2207 | case TCP_SEQ_STATE_ESTABLISHED: | 2208 | case TCP_SEQ_STATE_ESTABLISHED: |
| 2208 | if (v) | 2209 | if (v) |
| 2209 | read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); | 2210 | read_unlock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket)); |
| 2210 | break; | 2211 | break; |
| 2211 | } | 2212 | } |
| 2212 | } | 2213 | } |
| @@ -2417,6 +2418,8 @@ void tcp4_proc_exit(void) | |||
| 2417 | } | 2418 | } |
| 2418 | #endif /* CONFIG_PROC_FS */ | 2419 | #endif /* CONFIG_PROC_FS */ |
| 2419 | 2420 | ||
| 2421 | DEFINE_PROTO_INUSE(tcp) | ||
| 2422 | |||
| 2420 | struct proto tcp_prot = { | 2423 | struct proto tcp_prot = { |
| 2421 | .name = "TCP", | 2424 | .name = "TCP", |
| 2422 | .owner = THIS_MODULE, | 2425 | .owner = THIS_MODULE, |
| @@ -2451,6 +2454,7 @@ struct proto tcp_prot = { | |||
| 2451 | .compat_setsockopt = compat_tcp_setsockopt, | 2454 | .compat_setsockopt = compat_tcp_setsockopt, |
| 2452 | .compat_getsockopt = compat_tcp_getsockopt, | 2455 | .compat_getsockopt = compat_tcp_getsockopt, |
| 2453 | #endif | 2456 | #endif |
| 2457 | REF_PROTO_INUSE(tcp) | ||
| 2454 | }; | 2458 | }; |
| 2455 | 2459 | ||
| 2456 | void __init tcp_v4_init(struct net_proto_family *ops) | 2460 | void __init tcp_v4_init(struct net_proto_family *ops) |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 4bc25b46f33f..03c400ca14c5 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -1430,6 +1430,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
| 1430 | 1430 | ||
| 1431 | } | 1431 | } |
| 1432 | 1432 | ||
| 1433 | DEFINE_PROTO_INUSE(udp) | ||
| 1434 | |||
| 1433 | struct proto udp_prot = { | 1435 | struct proto udp_prot = { |
| 1434 | .name = "UDP", | 1436 | .name = "UDP", |
| 1435 | .owner = THIS_MODULE, | 1437 | .owner = THIS_MODULE, |
| @@ -1452,6 +1454,7 @@ struct proto udp_prot = { | |||
| 1452 | .compat_setsockopt = compat_udp_setsockopt, | 1454 | .compat_setsockopt = compat_udp_setsockopt, |
| 1453 | .compat_getsockopt = compat_udp_getsockopt, | 1455 | .compat_getsockopt = compat_udp_getsockopt, |
| 1454 | #endif | 1456 | #endif |
| 1457 | REF_PROTO_INUSE(udp) | ||
| 1455 | }; | 1458 | }; |
| 1456 | 1459 | ||
| 1457 | /* ------------------------------------------------------------------------ */ | 1460 | /* ------------------------------------------------------------------------ */ |
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c index 94977205abb4..f5baeb3e8b85 100644 --- a/net/ipv4/udplite.c +++ b/net/ipv4/udplite.c | |||
| @@ -44,6 +44,8 @@ static struct net_protocol udplite_protocol = { | |||
| 44 | .no_policy = 1, | 44 | .no_policy = 1, |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | DEFINE_PROTO_INUSE(udplite) | ||
| 48 | |||
| 47 | struct proto udplite_prot = { | 49 | struct proto udplite_prot = { |
| 48 | .name = "UDP-Lite", | 50 | .name = "UDP-Lite", |
| 49 | .owner = THIS_MODULE, | 51 | .owner = THIS_MODULE, |
| @@ -67,6 +69,7 @@ struct proto udplite_prot = { | |||
| 67 | .compat_setsockopt = compat_udp_setsockopt, | 69 | .compat_setsockopt = compat_udp_setsockopt, |
| 68 | .compat_getsockopt = compat_udp_getsockopt, | 70 | .compat_getsockopt = compat_udp_getsockopt, |
| 69 | #endif | 71 | #endif |
| 72 | REF_PROTO_INUSE(udplite) | ||
| 70 | }; | 73 | }; |
| 71 | 74 | ||
| 72 | static struct inet_protosw udplite4_protosw = { | 75 | static struct inet_protosw udplite4_protosw = { |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index d6f1026f1943..adc73adadfae 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
| @@ -37,9 +37,8 @@ void __inet6_hash(struct inet_hashinfo *hashinfo, | |||
| 37 | } else { | 37 | } else { |
| 38 | unsigned int hash; | 38 | unsigned int hash; |
| 39 | sk->sk_hash = hash = inet6_sk_ehashfn(sk); | 39 | sk->sk_hash = hash = inet6_sk_ehashfn(sk); |
| 40 | hash &= (hashinfo->ehash_size - 1); | 40 | list = &inet_ehash_bucket(hashinfo, hash)->chain; |
| 41 | list = &hashinfo->ehash[hash].chain; | 41 | lock = inet_ehash_lockp(hashinfo, hash); |
| 42 | lock = &hashinfo->ehash[hash].lock; | ||
| 43 | write_lock(lock); | 42 | write_lock(lock); |
| 44 | } | 43 | } |
| 45 | 44 | ||
| @@ -70,9 +69,10 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, | |||
| 70 | */ | 69 | */ |
| 71 | unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport); | 70 | unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport); |
| 72 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); | 71 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); |
| 72 | rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); | ||
| 73 | 73 | ||
| 74 | prefetch(head->chain.first); | 74 | prefetch(head->chain.first); |
| 75 | read_lock(&head->lock); | 75 | read_lock(lock); |
| 76 | sk_for_each(sk, node, &head->chain) { | 76 | sk_for_each(sk, node, &head->chain) { |
| 77 | /* For IPV6 do the cheaper port and family tests first. */ | 77 | /* For IPV6 do the cheaper port and family tests first. */ |
| 78 | if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif)) | 78 | if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif)) |
| @@ -92,12 +92,12 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, | |||
| 92 | goto hit; | 92 | goto hit; |
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | read_unlock(&head->lock); | 95 | read_unlock(lock); |
| 96 | return NULL; | 96 | return NULL; |
| 97 | 97 | ||
| 98 | hit: | 98 | hit: |
| 99 | sock_hold(sk); | 99 | sock_hold(sk); |
| 100 | read_unlock(&head->lock); | 100 | read_unlock(lock); |
| 101 | return sk; | 101 | return sk; |
| 102 | } | 102 | } |
| 103 | EXPORT_SYMBOL(__inet6_lookup_established); | 103 | EXPORT_SYMBOL(__inet6_lookup_established); |
| @@ -175,12 +175,13 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
| 175 | const unsigned int hash = inet6_ehashfn(daddr, lport, saddr, | 175 | const unsigned int hash = inet6_ehashfn(daddr, lport, saddr, |
| 176 | inet->dport); | 176 | inet->dport); |
| 177 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 177 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
| 178 | rwlock_t *lock = inet_ehash_lockp(hinfo, hash); | ||
| 178 | struct sock *sk2; | 179 | struct sock *sk2; |
| 179 | const struct hlist_node *node; | 180 | const struct hlist_node *node; |
| 180 | struct inet_timewait_sock *tw; | 181 | struct inet_timewait_sock *tw; |
| 181 | 182 | ||
| 182 | prefetch(head->chain.first); | 183 | prefetch(head->chain.first); |
| 183 | write_lock(&head->lock); | 184 | write_lock(lock); |
| 184 | 185 | ||
| 185 | /* Check TIME-WAIT sockets first. */ | 186 | /* Check TIME-WAIT sockets first. */ |
| 186 | sk_for_each(sk2, node, &head->twchain) { | 187 | sk_for_each(sk2, node, &head->twchain) { |
| @@ -216,7 +217,7 @@ unique: | |||
| 216 | __sk_add_node(sk, &head->chain); | 217 | __sk_add_node(sk, &head->chain); |
| 217 | sk->sk_hash = hash; | 218 | sk->sk_hash = hash; |
| 218 | sock_prot_inc_use(sk->sk_prot); | 219 | sock_prot_inc_use(sk->sk_prot); |
| 219 | write_unlock(&head->lock); | 220 | write_unlock(lock); |
| 220 | 221 | ||
| 221 | if (twp != NULL) { | 222 | if (twp != NULL) { |
| 222 | *twp = tw; | 223 | *twp = tw; |
| @@ -231,7 +232,7 @@ unique: | |||
| 231 | return 0; | 232 | return 0; |
| 232 | 233 | ||
| 233 | not_unique: | 234 | not_unique: |
| 234 | write_unlock(&head->lock); | 235 | write_unlock(lock); |
| 235 | return -EADDRNOTAVAIL; | 236 | return -EADDRNOTAVAIL; |
| 236 | } | 237 | } |
| 237 | 238 | ||
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 653fc0a8235b..86e1835ce4e4 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
| @@ -1339,6 +1339,19 @@ error: | |||
| 1339 | return err; | 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 | int ip6_push_pending_frames(struct sock *sk) | 1355 | int ip6_push_pending_frames(struct sock *sk) |
| 1343 | { | 1356 | { |
| 1344 | struct sk_buff *skb, *tmp_skb; | 1357 | struct sk_buff *skb, *tmp_skb; |
| @@ -1415,15 +1428,7 @@ int ip6_push_pending_frames(struct sock *sk) | |||
| 1415 | } | 1428 | } |
| 1416 | 1429 | ||
| 1417 | out: | 1430 | out: |
| 1418 | inet->cork.flags &= ~IPCORK_OPT; | 1431 | ip6_cork_release(inet, np); |
| 1419 | kfree(np->cork.opt); | ||
| 1420 | np->cork.opt = NULL; | ||
| 1421 | if (np->cork.rt) { | ||
| 1422 | dst_release(&np->cork.rt->u.dst); | ||
| 1423 | np->cork.rt = NULL; | ||
| 1424 | inet->cork.flags &= ~IPCORK_ALLFRAG; | ||
| 1425 | } | ||
| 1426 | memset(&inet->cork.fl, 0, sizeof(inet->cork.fl)); | ||
| 1427 | return err; | 1432 | return err; |
| 1428 | error: | 1433 | error: |
| 1429 | goto out; | 1434 | goto out; |
| @@ -1431,8 +1436,6 @@ error: | |||
| 1431 | 1436 | ||
| 1432 | void ip6_flush_pending_frames(struct sock *sk) | 1437 | void ip6_flush_pending_frames(struct sock *sk) |
| 1433 | { | 1438 | { |
| 1434 | struct inet_sock *inet = inet_sk(sk); | ||
| 1435 | struct ipv6_pinfo *np = inet6_sk(sk); | ||
| 1436 | struct sk_buff *skb; | 1439 | struct sk_buff *skb; |
| 1437 | 1440 | ||
| 1438 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { | 1441 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { |
| @@ -1442,14 +1445,5 @@ void ip6_flush_pending_frames(struct sock *sk) | |||
| 1442 | kfree_skb(skb); | 1445 | kfree_skb(skb); |
| 1443 | } | 1446 | } |
| 1444 | 1447 | ||
| 1445 | inet->cork.flags &= ~IPCORK_OPT; | 1448 | ip6_cork_release(inet_sk(sk), inet6_sk(sk)); |
| 1446 | |||
| 1447 | kfree(np->cork.opt); | ||
| 1448 | np->cork.opt = NULL; | ||
| 1449 | if (np->cork.rt) { | ||
| 1450 | dst_release(&np->cork.rt->u.dst); | ||
| 1451 | np->cork.rt = NULL; | ||
| 1452 | inet->cork.flags &= ~IPCORK_ALLFRAG; | ||
| 1453 | } | ||
| 1454 | memset(&inet->cork.fl, 0, sizeof(inet->cork.fl)); | ||
| 1455 | } | 1449 | } |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 85eb4798d8d2..0cd4056f9127 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <net/ipcomp.h> | 36 | #include <net/ipcomp.h> |
| 37 | #include <asm/semaphore.h> | 37 | #include <asm/semaphore.h> |
| 38 | #include <linux/crypto.h> | 38 | #include <linux/crypto.h> |
| 39 | #include <linux/err.h> | ||
| 39 | #include <linux/pfkeyv2.h> | 40 | #include <linux/pfkeyv2.h> |
| 40 | #include <linux/random.h> | 41 | #include <linux/random.h> |
| 41 | #include <linux/percpu.h> | 42 | #include <linux/percpu.h> |
| @@ -358,7 +359,7 @@ static struct crypto_comp **ipcomp6_alloc_tfms(const char *alg_name) | |||
| 358 | for_each_possible_cpu(cpu) { | 359 | for_each_possible_cpu(cpu) { |
| 359 | struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, | 360 | struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, |
| 360 | CRYPTO_ALG_ASYNC); | 361 | CRYPTO_ALG_ASYNC); |
| 361 | if (!tfm) | 362 | if (IS_ERR(tfm)) |
| 362 | goto error; | 363 | goto error; |
| 363 | *per_cpu_ptr(tfms, cpu) = tfm; | 364 | *per_cpu_ptr(tfms, cpu) = tfm; |
| 364 | } | 365 | } |
diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile index 4513eab77397..e789ec44d23b 100644 --- a/net/ipv6/netfilter/Makefile +++ b/net/ipv6/netfilter/Makefile | |||
| @@ -4,25 +4,29 @@ | |||
| 4 | 4 | ||
| 5 | # Link order matters here. | 5 | # Link order matters here. |
| 6 | obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o | 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 | obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o | 7 | obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o |
| 15 | obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o | 8 | obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o |
| 16 | obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o | ||
| 17 | obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o | 9 | obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o |
| 18 | obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o | ||
| 19 | obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o | 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 | # objects for l3 independent conntrack | 12 | # objects for l3 independent conntrack |
| 25 | nf_conntrack_ipv6-objs := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o nf_conntrack_reasm.o | 13 | nf_conntrack_ipv6-objs := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o nf_conntrack_reasm.o |
| 26 | 14 | ||
| 27 | # l3 independent conntrack | 15 | # l3 independent conntrack |
| 28 | obj-$(CONFIG_NF_CONNTRACK_IPV6) += nf_conntrack_ipv6.o | 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 | ||
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 6413a30d9f68..e273605eef85 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
| 24 | #include <linux/sysctl.h> | 24 | #include <linux/sysctl.h> |
| 25 | #include <linux/proc_fs.h> | 25 | #include <linux/proc_fs.h> |
| 26 | #include <linux/seq_file.h> | ||
| 26 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 27 | #include <net/net_namespace.h> | 28 | #include <net/net_namespace.h> |
| 28 | #include <net/sock.h> | 29 | #include <net/sock.h> |
| @@ -596,15 +597,11 @@ static ctl_table ipq_root_table[] = { | |||
| 596 | { .ctl_name = 0 } | 597 | { .ctl_name = 0 } |
| 597 | }; | 598 | }; |
| 598 | 599 | ||
| 599 | #ifdef CONFIG_PROC_FS | 600 | static int ip6_queue_show(struct seq_file *m, void *v) |
| 600 | static int | ||
| 601 | ipq_get_info(char *buffer, char **start, off_t offset, int length) | ||
| 602 | { | 601 | { |
| 603 | int len; | ||
| 604 | |||
| 605 | read_lock_bh(&queue_lock); | 602 | read_lock_bh(&queue_lock); |
| 606 | 603 | ||
| 607 | len = sprintf(buffer, | 604 | seq_printf(m, |
| 608 | "Peer PID : %d\n" | 605 | "Peer PID : %d\n" |
| 609 | "Copy mode : %hu\n" | 606 | "Copy mode : %hu\n" |
| 610 | "Copy range : %u\n" | 607 | "Copy range : %u\n" |
| @@ -621,16 +618,21 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length) | |||
| 621 | queue_user_dropped); | 618 | queue_user_dropped); |
| 622 | 619 | ||
| 623 | read_unlock_bh(&queue_lock); | 620 | read_unlock_bh(&queue_lock); |
| 621 | return 0; | ||
| 622 | } | ||
| 624 | 623 | ||
| 625 | *start = buffer + offset; | 624 | static int ip6_queue_open(struct inode *inode, struct file *file) |
| 626 | len -= offset; | 625 | { |
| 627 | if (len > length) | 626 | return single_open(file, ip6_queue_show, NULL); |
| 628 | len = length; | ||
| 629 | else if (len < 0) | ||
| 630 | len = 0; | ||
| 631 | return len; | ||
| 632 | } | 627 | } |
| 633 | #endif /* CONFIG_PROC_FS */ | 628 | |
| 629 | static const struct file_operations ip6_queue_proc_fops = { | ||
| 630 | .open = ip6_queue_open, | ||
| 631 | .read = seq_read, | ||
| 632 | .llseek = seq_lseek, | ||
| 633 | .release = single_release, | ||
| 634 | .owner = THIS_MODULE, | ||
| 635 | }; | ||
| 634 | 636 | ||
| 635 | static struct nf_queue_handler nfqh = { | 637 | static struct nf_queue_handler nfqh = { |
| 636 | .name = "ip6_queue", | 638 | .name = "ip6_queue", |
| @@ -650,10 +652,11 @@ static int __init ip6_queue_init(void) | |||
| 650 | goto cleanup_netlink_notifier; | 652 | goto cleanup_netlink_notifier; |
| 651 | } | 653 | } |
| 652 | 654 | ||
| 653 | proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info); | 655 | proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); |
| 654 | if (proc) | 656 | if (proc) { |
| 655 | proc->owner = THIS_MODULE; | 657 | proc->owner = THIS_MODULE; |
| 656 | else { | 658 | proc->proc_fops = &ip6_queue_proc_fops; |
| 659 | } else { | ||
| 657 | printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); | 660 | printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); |
| 658 | goto cleanup_ipqnl; | 661 | goto cleanup_ipqnl; |
| 659 | } | 662 | } |
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index be526ad92543..8631ed7fe8a9 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
| @@ -32,27 +32,16 @@ | |||
| 32 | 32 | ||
| 33 | static struct proc_dir_entry *proc_net_devsnmp6; | 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 | static int sockstat6_seq_show(struct seq_file *seq, void *v) | 35 | static int sockstat6_seq_show(struct seq_file *seq, void *v) |
| 47 | { | 36 | { |
| 48 | seq_printf(seq, "TCP6: inuse %d\n", | 37 | seq_printf(seq, "TCP6: inuse %d\n", |
| 49 | fold_prot_inuse(&tcpv6_prot)); | 38 | sock_prot_inuse(&tcpv6_prot)); |
| 50 | seq_printf(seq, "UDP6: inuse %d\n", | 39 | seq_printf(seq, "UDP6: inuse %d\n", |
| 51 | fold_prot_inuse(&udpv6_prot)); | 40 | sock_prot_inuse(&udpv6_prot)); |
| 52 | seq_printf(seq, "UDPLITE6: inuse %d\n", | 41 | seq_printf(seq, "UDPLITE6: inuse %d\n", |
| 53 | fold_prot_inuse(&udplitev6_prot)); | 42 | sock_prot_inuse(&udplitev6_prot)); |
| 54 | seq_printf(seq, "RAW6: inuse %d\n", | 43 | seq_printf(seq, "RAW6: inuse %d\n", |
| 55 | fold_prot_inuse(&rawv6_prot)); | 44 | sock_prot_inuse(&rawv6_prot)); |
| 56 | seq_printf(seq, "FRAG6: inuse %d memory %d\n", | 45 | seq_printf(seq, "FRAG6: inuse %d memory %d\n", |
| 57 | ip6_frag_nqueues(), ip6_frag_mem()); | 46 | ip6_frag_nqueues(), ip6_frag_mem()); |
| 58 | return 0; | 47 | return 0; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index ca24ef19cd8f..807260d03586 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
| @@ -1144,6 +1144,8 @@ static int rawv6_init_sk(struct sock *sk) | |||
| 1144 | return(0); | 1144 | return(0); |
| 1145 | } | 1145 | } |
| 1146 | 1146 | ||
| 1147 | DEFINE_PROTO_INUSE(rawv6) | ||
| 1148 | |||
| 1147 | struct proto rawv6_prot = { | 1149 | struct proto rawv6_prot = { |
| 1148 | .name = "RAWv6", | 1150 | .name = "RAWv6", |
| 1149 | .owner = THIS_MODULE, | 1151 | .owner = THIS_MODULE, |
| @@ -1166,6 +1168,7 @@ struct proto rawv6_prot = { | |||
| 1166 | .compat_setsockopt = compat_rawv6_setsockopt, | 1168 | .compat_setsockopt = compat_rawv6_setsockopt, |
| 1167 | .compat_getsockopt = compat_rawv6_getsockopt, | 1169 | .compat_getsockopt = compat_rawv6_getsockopt, |
| 1168 | #endif | 1170 | #endif |
| 1171 | REF_PROTO_INUSE(rawv6) | ||
| 1169 | }; | 1172 | }; |
| 1170 | 1173 | ||
| 1171 | #ifdef CONFIG_PROC_FS | 1174 | #ifdef CONFIG_PROC_FS |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 95f8e4a62f68..973a97abc446 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -38,12 +38,8 @@ | |||
| 38 | #include <linux/in6.h> | 38 | #include <linux/in6.h> |
| 39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
| 40 | #include <linux/if_arp.h> | 40 | #include <linux/if_arp.h> |
| 41 | |||
| 42 | #ifdef CONFIG_PROC_FS | ||
| 43 | #include <linux/proc_fs.h> | 41 | #include <linux/proc_fs.h> |
| 44 | #include <linux/seq_file.h> | 42 | #include <linux/seq_file.h> |
| 45 | #endif | ||
| 46 | |||
| 47 | #include <net/net_namespace.h> | 43 | #include <net/net_namespace.h> |
| 48 | #include <net/snmp.h> | 44 | #include <net/snmp.h> |
| 49 | #include <net/ipv6.h> | 45 | #include <net/ipv6.h> |
| @@ -2288,71 +2284,50 @@ struct rt6_proc_arg | |||
| 2288 | 2284 | ||
| 2289 | static int rt6_info_route(struct rt6_info *rt, void *p_arg) | 2285 | static int rt6_info_route(struct rt6_info *rt, void *p_arg) |
| 2290 | { | 2286 | { |
| 2291 | struct rt6_proc_arg *arg = (struct rt6_proc_arg *) p_arg; | 2287 | struct seq_file *m = p_arg; |
| 2292 | 2288 | ||
| 2293 | if (arg->skip < arg->offset / RT6_INFO_LEN) { | 2289 | seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_dst.addr), |
| 2294 | arg->skip++; | 2290 | rt->rt6i_dst.plen); |
| 2295 | return 0; | ||
| 2296 | } | ||
| 2297 | |||
| 2298 | if (arg->len >= arg->length) | ||
| 2299 | return 0; | ||
| 2300 | |||
| 2301 | arg->len += sprintf(arg->buffer + arg->len, | ||
| 2302 | NIP6_SEQFMT " %02x ", | ||
| 2303 | NIP6(rt->rt6i_dst.addr), | ||
| 2304 | rt->rt6i_dst.plen); | ||
| 2305 | 2291 | ||
| 2306 | #ifdef CONFIG_IPV6_SUBTREES | 2292 | #ifdef CONFIG_IPV6_SUBTREES |
| 2307 | arg->len += sprintf(arg->buffer + arg->len, | 2293 | seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_src.addr), |
| 2308 | NIP6_SEQFMT " %02x ", | 2294 | rt->rt6i_src.plen); |
| 2309 | NIP6(rt->rt6i_src.addr), | ||
| 2310 | rt->rt6i_src.plen); | ||
| 2311 | #else | 2295 | #else |
| 2312 | arg->len += sprintf(arg->buffer + arg->len, | 2296 | seq_puts(m, "00000000000000000000000000000000 00 "); |
| 2313 | "00000000000000000000000000000000 00 "); | ||
| 2314 | #endif | 2297 | #endif |
| 2315 | 2298 | ||
| 2316 | if (rt->rt6i_nexthop) { | 2299 | if (rt->rt6i_nexthop) { |
| 2317 | arg->len += sprintf(arg->buffer + arg->len, | 2300 | seq_printf(m, NIP6_SEQFMT, |
| 2318 | NIP6_SEQFMT, | 2301 | NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key))); |
| 2319 | NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key))); | ||
| 2320 | } else { | 2302 | } else { |
| 2321 | arg->len += sprintf(arg->buffer + arg->len, | 2303 | seq_puts(m, "00000000000000000000000000000000"); |
| 2322 | "00000000000000000000000000000000"); | ||
| 2323 | } | 2304 | } |
| 2324 | arg->len += sprintf(arg->buffer + arg->len, | 2305 | seq_printf(m, " %08x %08x %08x %08x %8s\n", |
| 2325 | " %08x %08x %08x %08x %8s\n", | 2306 | rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt), |
| 2326 | rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt), | 2307 | rt->u.dst.__use, rt->rt6i_flags, |
| 2327 | rt->u.dst.__use, rt->rt6i_flags, | 2308 | rt->rt6i_dev ? rt->rt6i_dev->name : ""); |
| 2328 | rt->rt6i_dev ? rt->rt6i_dev->name : ""); | ||
| 2329 | return 0; | 2309 | return 0; |
| 2330 | } | 2310 | } |
| 2331 | 2311 | ||
| 2332 | static int rt6_proc_info(char *buffer, char **start, off_t offset, int length) | 2312 | static int ipv6_route_show(struct seq_file *m, void *v) |
| 2333 | { | 2313 | { |
| 2334 | struct rt6_proc_arg arg = { | 2314 | fib6_clean_all(rt6_info_route, 0, m); |
| 2335 | .buffer = buffer, | 2315 | return 0; |
| 2336 | .offset = offset, | 2316 | } |
| 2337 | .length = length, | ||
| 2338 | }; | ||
| 2339 | |||
| 2340 | fib6_clean_all(rt6_info_route, 0, &arg); | ||
| 2341 | |||
| 2342 | *start = buffer; | ||
| 2343 | if (offset) | ||
| 2344 | *start += offset % RT6_INFO_LEN; | ||
| 2345 | |||
| 2346 | arg.len -= offset % RT6_INFO_LEN; | ||
| 2347 | |||
| 2348 | if (arg.len > length) | ||
| 2349 | arg.len = length; | ||
| 2350 | if (arg.len < 0) | ||
| 2351 | arg.len = 0; | ||
| 2352 | 2317 | ||
| 2353 | return arg.len; | 2318 | static int ipv6_route_open(struct inode *inode, struct file *file) |
| 2319 | { | ||
| 2320 | return single_open(file, ipv6_route_show, NULL); | ||
| 2354 | } | 2321 | } |
| 2355 | 2322 | ||
| 2323 | static const struct file_operations ipv6_route_proc_fops = { | ||
| 2324 | .owner = THIS_MODULE, | ||
| 2325 | .open = ipv6_route_open, | ||
| 2326 | .read = seq_read, | ||
| 2327 | .llseek = seq_lseek, | ||
| 2328 | .release = single_release, | ||
| 2329 | }; | ||
| 2330 | |||
| 2356 | static int rt6_stats_seq_show(struct seq_file *seq, void *v) | 2331 | static int rt6_stats_seq_show(struct seq_file *seq, void *v) |
| 2357 | { | 2332 | { |
| 2358 | seq_printf(seq, "%04x %04x %04x %04x %04x %04x %04x\n", | 2333 | seq_printf(seq, "%04x %04x %04x %04x %04x %04x %04x\n", |
| @@ -2489,22 +2464,14 @@ ctl_table ipv6_route_table[] = { | |||
| 2489 | 2464 | ||
| 2490 | void __init ip6_route_init(void) | 2465 | void __init ip6_route_init(void) |
| 2491 | { | 2466 | { |
| 2492 | #ifdef CONFIG_PROC_FS | ||
| 2493 | struct proc_dir_entry *p; | ||
| 2494 | #endif | ||
| 2495 | ip6_dst_ops.kmem_cachep = | 2467 | ip6_dst_ops.kmem_cachep = |
| 2496 | kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0, | 2468 | kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0, |
| 2497 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | 2469 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); |
| 2498 | ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep; | 2470 | ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep; |
| 2499 | 2471 | ||
| 2500 | fib6_init(); | 2472 | fib6_init(); |
| 2501 | #ifdef CONFIG_PROC_FS | 2473 | proc_net_fops_create(&init_net, "ipv6_route", 0, &ipv6_route_proc_fops); |
| 2502 | p = proc_net_create(&init_net, "ipv6_route", 0, rt6_proc_info); | ||
| 2503 | if (p) | ||
| 2504 | p->owner = THIS_MODULE; | ||
| 2505 | |||
| 2506 | proc_net_fops_create(&init_net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); | 2474 | proc_net_fops_create(&init_net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); |
| 2507 | #endif | ||
| 2508 | #ifdef CONFIG_XFRM | 2475 | #ifdef CONFIG_XFRM |
| 2509 | xfrm6_init(); | 2476 | xfrm6_init(); |
| 2510 | #endif | 2477 | #endif |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 06be2a1f2730..3aad861975a0 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -2107,6 +2107,8 @@ void tcp6_proc_exit(void) | |||
| 2107 | } | 2107 | } |
| 2108 | #endif | 2108 | #endif |
| 2109 | 2109 | ||
| 2110 | DEFINE_PROTO_INUSE(tcpv6) | ||
| 2111 | |||
| 2110 | struct proto tcpv6_prot = { | 2112 | struct proto tcpv6_prot = { |
| 2111 | .name = "TCPv6", | 2113 | .name = "TCPv6", |
| 2112 | .owner = THIS_MODULE, | 2114 | .owner = THIS_MODULE, |
| @@ -2141,6 +2143,7 @@ struct proto tcpv6_prot = { | |||
| 2141 | .compat_setsockopt = compat_tcp_setsockopt, | 2143 | .compat_setsockopt = compat_tcp_setsockopt, |
| 2142 | .compat_getsockopt = compat_tcp_getsockopt, | 2144 | .compat_getsockopt = compat_tcp_getsockopt, |
| 2143 | #endif | 2145 | #endif |
| 2146 | REF_PROTO_INUSE(tcpv6) | ||
| 2144 | }; | 2147 | }; |
| 2145 | 2148 | ||
| 2146 | static struct inet6_protocol tcpv6_protocol = { | 2149 | static struct inet6_protocol tcpv6_protocol = { |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index caebad6ee510..ee1cc3f8599f 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
| @@ -205,12 +205,11 @@ out: | |||
| 205 | return err; | 205 | return err; |
| 206 | 206 | ||
| 207 | csum_copy_err: | 207 | csum_copy_err: |
| 208 | UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite); | ||
| 208 | skb_kill_datagram(sk, skb, flags); | 209 | skb_kill_datagram(sk, skb, flags); |
| 209 | 210 | ||
| 210 | if (flags & MSG_DONTWAIT) { | 211 | if (flags & MSG_DONTWAIT) |
| 211 | UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite); | ||
| 212 | return -EAGAIN; | 212 | return -EAGAIN; |
| 213 | } | ||
| 214 | goto try_again; | 213 | goto try_again; |
| 215 | } | 214 | } |
| 216 | 215 | ||
| @@ -971,6 +970,8 @@ void udp6_proc_exit(void) { | |||
| 971 | 970 | ||
| 972 | /* ------------------------------------------------------------------------ */ | 971 | /* ------------------------------------------------------------------------ */ |
| 973 | 972 | ||
| 973 | DEFINE_PROTO_INUSE(udpv6) | ||
| 974 | |||
| 974 | struct proto udpv6_prot = { | 975 | struct proto udpv6_prot = { |
| 975 | .name = "UDPv6", | 976 | .name = "UDPv6", |
| 976 | .owner = THIS_MODULE, | 977 | .owner = THIS_MODULE, |
| @@ -992,6 +993,7 @@ struct proto udpv6_prot = { | |||
| 992 | .compat_setsockopt = compat_udpv6_setsockopt, | 993 | .compat_setsockopt = compat_udpv6_setsockopt, |
| 993 | .compat_getsockopt = compat_udpv6_getsockopt, | 994 | .compat_getsockopt = compat_udpv6_getsockopt, |
| 994 | #endif | 995 | #endif |
| 996 | REF_PROTO_INUSE(udpv6) | ||
| 995 | }; | 997 | }; |
| 996 | 998 | ||
| 997 | static struct inet_protosw udpv6_protosw = { | 999 | static struct inet_protosw udpv6_protosw = { |
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c index 766566f7de47..5a0379f71415 100644 --- a/net/ipv6/udplite.c +++ b/net/ipv6/udplite.c | |||
| @@ -40,6 +40,8 @@ static int udplite_v6_get_port(struct sock *sk, unsigned short snum) | |||
| 40 | return udplite_get_port(sk, snum, ipv6_rcv_saddr_equal); | 40 | return udplite_get_port(sk, snum, ipv6_rcv_saddr_equal); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | DEFINE_PROTO_INUSE(udplitev6) | ||
| 44 | |||
| 43 | struct proto udplitev6_prot = { | 45 | struct proto udplitev6_prot = { |
| 44 | .name = "UDPLITEv6", | 46 | .name = "UDPLITEv6", |
| 45 | .owner = THIS_MODULE, | 47 | .owner = THIS_MODULE, |
| @@ -62,6 +64,7 @@ struct proto udplitev6_prot = { | |||
| 62 | .compat_setsockopt = compat_udpv6_setsockopt, | 64 | .compat_setsockopt = compat_udpv6_setsockopt, |
| 63 | .compat_getsockopt = compat_udpv6_getsockopt, | 65 | .compat_getsockopt = compat_udpv6_getsockopt, |
| 64 | #endif | 66 | #endif |
| 67 | REF_PROTO_INUSE(udplitev6) | ||
| 65 | }; | 68 | }; |
| 66 | 69 | ||
| 67 | static struct inet_protosw udplite6_protosw = { | 70 | static struct inet_protosw udplite6_protosw = { |
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile index 93c58f973831..ad0e36ebea3d 100644 --- a/net/netfilter/Makefile +++ b/net/netfilter/Makefile | |||
| @@ -40,15 +40,15 @@ obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o | |||
| 40 | # targets | 40 | # targets |
| 41 | obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o | 41 | obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o |
| 42 | obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o | 42 | obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o |
| 43 | obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o | ||
| 43 | obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o | 44 | obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o |
| 44 | obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o | 45 | obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o |
| 45 | obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o | ||
| 46 | obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o | 46 | obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o |
| 47 | obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o | ||
| 47 | obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o | 48 | obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o |
| 48 | obj-$(CONFIG_NETFILTER_XT_TARGET_TRACE) += xt_TRACE.o | ||
| 49 | obj-$(CONFIG_NETFILTER_XT_TARGET_SECMARK) += xt_SECMARK.o | 49 | obj-$(CONFIG_NETFILTER_XT_TARGET_SECMARK) += xt_SECMARK.o |
| 50 | obj-$(CONFIG_NETFILTER_XT_TARGET_TCPMSS) += xt_TCPMSS.o | 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 | # matches | 53 | # matches |
| 54 | obj-$(CONFIG_NETFILTER_XT_MATCH_COMMENT) += xt_comment.o | 54 | obj-$(CONFIG_NETFILTER_XT_MATCH_COMMENT) += xt_comment.o |
| @@ -59,22 +59,22 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_CONNTRACK) += xt_conntrack.o | |||
| 59 | obj-$(CONFIG_NETFILTER_XT_MATCH_DCCP) += xt_dccp.o | 59 | obj-$(CONFIG_NETFILTER_XT_MATCH_DCCP) += xt_dccp.o |
| 60 | obj-$(CONFIG_NETFILTER_XT_MATCH_DSCP) += xt_dscp.o | 60 | obj-$(CONFIG_NETFILTER_XT_MATCH_DSCP) += xt_dscp.o |
| 61 | obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += xt_esp.o | 61 | obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += xt_esp.o |
| 62 | obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o | ||
| 62 | obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o | 63 | obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o |
| 63 | obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o | 64 | obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o |
| 64 | obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o | 65 | obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o |
| 65 | obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o | 66 | obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o |
| 66 | obj-$(CONFIG_NETFILTER_XT_MATCH_MARK) += xt_mark.o | 67 | obj-$(CONFIG_NETFILTER_XT_MATCH_MARK) += xt_mark.o |
| 67 | obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o | 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 | obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o | 70 | obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o |
| 71 | obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o | ||
| 70 | obj-$(CONFIG_NETFILTER_XT_MATCH_QUOTA) += xt_quota.o | 72 | obj-$(CONFIG_NETFILTER_XT_MATCH_QUOTA) += xt_quota.o |
| 71 | obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o | 73 | obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o |
| 72 | obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o | 74 | obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o |
| 73 | obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o | 75 | obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o |
| 74 | obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o | 76 | obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o |
| 75 | obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o | 77 | obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o |
| 76 | obj-$(CONFIG_NETFILTER_XT_MATCH_TIME) += xt_time.o | ||
| 77 | obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o | 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 | obj-$(CONFIG_NETFILTER_XT_MATCH_U32) += xt_u32.o | 80 | obj-$(CONFIG_NETFILTER_XT_MATCH_U32) += xt_u32.o |
| 80 | obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o | ||
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index aa2831587b82..2dfac3253569 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c | |||
| @@ -23,14 +23,13 @@ static inline int overlap(int min1, int max1, int min2, int max2) | |||
| 23 | /* Functions to register sockopt ranges (exclusive). */ | 23 | /* Functions to register sockopt ranges (exclusive). */ |
| 24 | int nf_register_sockopt(struct nf_sockopt_ops *reg) | 24 | int nf_register_sockopt(struct nf_sockopt_ops *reg) |
| 25 | { | 25 | { |
| 26 | struct list_head *i; | 26 | struct nf_sockopt_ops *ops; |
| 27 | int ret = 0; | 27 | int ret = 0; |
| 28 | 28 | ||
| 29 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 29 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
| 30 | return -EINTR; | 30 | return -EINTR; |
| 31 | 31 | ||
| 32 | list_for_each(i, &nf_sockopts) { | 32 | list_for_each_entry(ops, &nf_sockopts, list) { |
| 33 | struct nf_sockopt_ops *ops = (struct nf_sockopt_ops *)i; | ||
| 34 | if (ops->pf == reg->pf | 33 | if (ops->pf == reg->pf |
| 35 | && (overlap(ops->set_optmin, ops->set_optmax, | 34 | && (overlap(ops->set_optmin, ops->set_optmax, |
| 36 | reg->set_optmin, reg->set_optmax) | 35 | reg->set_optmin, reg->set_optmax) |
| @@ -65,7 +64,6 @@ EXPORT_SYMBOL(nf_unregister_sockopt); | |||
| 65 | static int nf_sockopt(struct sock *sk, int pf, int val, | 64 | static int nf_sockopt(struct sock *sk, int pf, int val, |
| 66 | char __user *opt, int *len, int get) | 65 | char __user *opt, int *len, int get) |
| 67 | { | 66 | { |
| 68 | struct list_head *i; | ||
| 69 | struct nf_sockopt_ops *ops; | 67 | struct nf_sockopt_ops *ops; |
| 70 | int ret; | 68 | int ret; |
| 71 | 69 | ||
| @@ -75,8 +73,7 @@ static int nf_sockopt(struct sock *sk, int pf, int val, | |||
| 75 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 73 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
| 76 | return -EINTR; | 74 | return -EINTR; |
| 77 | 75 | ||
| 78 | list_for_each(i, &nf_sockopts) { | 76 | list_for_each_entry(ops, &nf_sockopts, list) { |
| 79 | ops = (struct nf_sockopt_ops *)i; | ||
| 80 | if (ops->pf == pf) { | 77 | if (ops->pf == pf) { |
| 81 | if (!try_module_get(ops->owner)) | 78 | if (!try_module_get(ops->owner)) |
| 82 | goto out_nosup; | 79 | goto out_nosup; |
| @@ -124,7 +121,6 @@ EXPORT_SYMBOL(nf_getsockopt); | |||
| 124 | static int compat_nf_sockopt(struct sock *sk, int pf, int val, | 121 | static int compat_nf_sockopt(struct sock *sk, int pf, int val, |
| 125 | char __user *opt, int *len, int get) | 122 | char __user *opt, int *len, int get) |
| 126 | { | 123 | { |
| 127 | struct list_head *i; | ||
| 128 | struct nf_sockopt_ops *ops; | 124 | struct nf_sockopt_ops *ops; |
| 129 | int ret; | 125 | int ret; |
| 130 | 126 | ||
| @@ -135,8 +131,7 @@ static int compat_nf_sockopt(struct sock *sk, int pf, int val, | |||
| 135 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 131 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
| 136 | return -EINTR; | 132 | return -EINTR; |
| 137 | 133 | ||
| 138 | list_for_each(i, &nf_sockopts) { | 134 | list_for_each_entry(ops, &nf_sockopts, list) { |
| 139 | ops = (struct nf_sockopt_ops *)i; | ||
| 140 | if (ops->pf == pf) { | 135 | if (ops->pf == pf) { |
| 141 | if (!try_module_get(ops->owner)) | 136 | if (!try_module_get(ops->owner)) |
| 142 | goto out_nosup; | 137 | goto out_nosup; |
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c index 06cff1d13690..d7becf08a93a 100644 --- a/net/netfilter/xt_connlimit.c +++ b/net/netfilter/xt_connlimit.c | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | * (c) 2000 Gerd Knorr <kraxel@bytesex.org> | 4 | * (c) 2000 Gerd Knorr <kraxel@bytesex.org> |
| 5 | * Nov 2002: Martin Bene <martin.bene@icomedias.com>: | 5 | * Nov 2002: Martin Bene <martin.bene@icomedias.com>: |
| 6 | * only ignore TIME_WAIT or gone connections | 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 | * based on ... | 10 | * based on ... |
| 10 | * | 11 | * |
| @@ -306,7 +307,7 @@ static void __exit xt_connlimit_exit(void) | |||
| 306 | 307 | ||
| 307 | module_init(xt_connlimit_init); | 308 | module_init(xt_connlimit_init); |
| 308 | module_exit(xt_connlimit_exit); | 309 | module_exit(xt_connlimit_exit); |
| 309 | MODULE_AUTHOR("Jan Engelhardt <jengelh@gmx.de>"); | 310 | MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>"); |
| 310 | MODULE_DESCRIPTION("netfilter xt_connlimit match module"); | 311 | MODULE_DESCRIPTION("netfilter xt_connlimit match module"); |
| 311 | MODULE_LICENSE("GPL"); | 312 | MODULE_LICENSE("GPL"); |
| 312 | MODULE_ALIAS("ipt_connlimit"); | 313 | MODULE_ALIAS("ipt_connlimit"); |
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c index ef48bbd93573..ff44f86c24ce 100644 --- a/net/netfilter/xt_time.c +++ b/net/netfilter/xt_time.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * xt_time | 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 | * based on ipt_time by Fabrice MARIE <fabrice@netfilter.org> | 6 | * based on ipt_time by Fabrice MARIE <fabrice@netfilter.org> |
| 6 | * This is a module which is used for time matching | 7 | * This is a module which is used for time matching |
diff --git a/net/netfilter/xt_u32.c b/net/netfilter/xt_u32.c index bec427915b30..af75b8c3f20b 100644 --- a/net/netfilter/xt_u32.c +++ b/net/netfilter/xt_u32.c | |||
| @@ -2,7 +2,8 @@ | |||
| 2 | * xt_u32 - kernel module to match u32 packet content | 2 | * xt_u32 - kernel module to match u32 packet content |
| 3 | * | 3 | * |
| 4 | * Original author: Don Cohen <don@isis.cs3-inc.com> | 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 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| @@ -129,7 +130,7 @@ static void __exit xt_u32_exit(void) | |||
| 129 | 130 | ||
| 130 | module_init(xt_u32_init); | 131 | module_init(xt_u32_init); |
| 131 | module_exit(xt_u32_exit); | 132 | module_exit(xt_u32_exit); |
| 132 | MODULE_AUTHOR("Jan Engelhardt <jengelh@gmx.de>"); | 133 | MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>"); |
| 133 | MODULE_DESCRIPTION("netfilter u32 match module"); | 134 | MODULE_DESCRIPTION("netfilter u32 match module"); |
| 134 | MODULE_LICENSE("GPL"); | 135 | MODULE_LICENSE("GPL"); |
| 135 | MODULE_ALIAS("ipt_u32"); | 136 | MODULE_ALIAS("ipt_u32"); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 260171255576..415c97236f63 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
| @@ -752,7 +752,7 @@ struct sock *netlink_getsockbyfilp(struct file *filp) | |||
| 752 | * 1: repeat lookup - reference dropped while waiting for socket memory. | 752 | * 1: repeat lookup - reference dropped while waiting for socket memory. |
| 753 | */ | 753 | */ |
| 754 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, | 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 | struct netlink_sock *nlk; | 757 | struct netlink_sock *nlk; |
| 758 | 758 | ||
| @@ -761,7 +761,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, | |||
| 761 | if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || | 761 | if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || |
| 762 | test_bit(0, &nlk->state)) { | 762 | test_bit(0, &nlk->state)) { |
| 763 | DECLARE_WAITQUEUE(wait, current); | 763 | DECLARE_WAITQUEUE(wait, current); |
| 764 | if (!timeo) { | 764 | if (!*timeo) { |
| 765 | if (!ssk || netlink_is_kernel(ssk)) | 765 | if (!ssk || netlink_is_kernel(ssk)) |
| 766 | netlink_overrun(sk); | 766 | netlink_overrun(sk); |
| 767 | sock_put(sk); | 767 | sock_put(sk); |
| @@ -775,7 +775,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, | |||
| 775 | if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || | 775 | if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || |
| 776 | test_bit(0, &nlk->state)) && | 776 | test_bit(0, &nlk->state)) && |
| 777 | !sock_flag(sk, SOCK_DEAD)) | 777 | !sock_flag(sk, SOCK_DEAD)) |
| 778 | timeo = schedule_timeout(timeo); | 778 | *timeo = schedule_timeout(*timeo); |
| 779 | 779 | ||
| 780 | __set_current_state(TASK_RUNNING); | 780 | __set_current_state(TASK_RUNNING); |
| 781 | remove_wait_queue(&nlk->wait, &wait); | 781 | remove_wait_queue(&nlk->wait, &wait); |
| @@ -783,7 +783,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, | |||
| 783 | 783 | ||
| 784 | if (signal_pending(current)) { | 784 | if (signal_pending(current)) { |
| 785 | kfree_skb(skb); | 785 | kfree_skb(skb); |
| 786 | return sock_intr_errno(timeo); | 786 | return sock_intr_errno(*timeo); |
| 787 | } | 787 | } |
| 788 | return 1; | 788 | return 1; |
| 789 | } | 789 | } |
| @@ -877,7 +877,7 @@ retry: | |||
| 877 | if (netlink_is_kernel(sk)) | 877 | if (netlink_is_kernel(sk)) |
| 878 | return netlink_unicast_kernel(sk, skb); | 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 | if (err == 1) | 881 | if (err == 1) |
| 882 | goto retry; | 882 | goto retry; |
| 883 | if (err) | 883 | if (err) |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 9e98c6e567dd..53171029439f 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
| @@ -91,7 +91,7 @@ static struct tc_u_common *u32_list; | |||
| 91 | 91 | ||
| 92 | static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel, u8 fshift) | 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 | return h; | 96 | return h; |
| 97 | } | 97 | } |
| @@ -615,7 +615,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
| 615 | n->handle = handle; | 615 | n->handle = handle; |
| 616 | { | 616 | { |
| 617 | u8 i = 0; | 617 | u8 i = 0; |
| 618 | u32 mask = s->hmask; | 618 | u32 mask = ntohl(s->hmask); |
| 619 | if (mask) { | 619 | if (mask) { |
| 620 | while (!(mask & 1)) { | 620 | while (!(mask & 1)) { |
| 621 | i++; | 621 | i++; |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 421281d9dd1d..c0ed06d4a504 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
| @@ -252,6 +252,9 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device * | |||
| 252 | static inline int teql_resolve(struct sk_buff *skb, | 252 | static inline int teql_resolve(struct sk_buff *skb, |
| 253 | struct sk_buff *skb_res, struct net_device *dev) | 253 | struct sk_buff *skb_res, struct net_device *dev) |
| 254 | { | 254 | { |
| 255 | if (dev->qdisc == &noop_qdisc) | ||
| 256 | return -ENODEV; | ||
| 257 | |||
| 255 | if (dev->header_ops == NULL || | 258 | if (dev->header_ops == NULL || |
| 256 | skb->dst == NULL || | 259 | skb->dst == NULL || |
| 257 | skb->dst->neighbour == NULL) | 260 | skb->dst->neighbour == NULL) |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index bd6f42a15a4b..a7ecf3159e53 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -6455,6 +6455,8 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
| 6455 | } | 6455 | } |
| 6456 | 6456 | ||
| 6457 | 6457 | ||
| 6458 | DEFINE_PROTO_INUSE(sctp) | ||
| 6459 | |||
| 6458 | /* This proto struct describes the ULP interface for SCTP. */ | 6460 | /* This proto struct describes the ULP interface for SCTP. */ |
| 6459 | struct proto sctp_prot = { | 6461 | struct proto sctp_prot = { |
| 6460 | .name = "SCTP", | 6462 | .name = "SCTP", |
| @@ -6483,9 +6485,12 @@ struct proto sctp_prot = { | |||
| 6483 | .memory_pressure = &sctp_memory_pressure, | 6485 | .memory_pressure = &sctp_memory_pressure, |
| 6484 | .enter_memory_pressure = sctp_enter_memory_pressure, | 6486 | .enter_memory_pressure = sctp_enter_memory_pressure, |
| 6485 | .memory_allocated = &sctp_memory_allocated, | 6487 | .memory_allocated = &sctp_memory_allocated, |
| 6488 | REF_PROTO_INUSE(sctp) | ||
| 6486 | }; | 6489 | }; |
| 6487 | 6490 | ||
| 6488 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 6491 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 6492 | DEFINE_PROTO_INUSE(sctpv6) | ||
| 6493 | |||
| 6489 | struct proto sctpv6_prot = { | 6494 | struct proto sctpv6_prot = { |
| 6490 | .name = "SCTPv6", | 6495 | .name = "SCTPv6", |
| 6491 | .owner = THIS_MODULE, | 6496 | .owner = THIS_MODULE, |
| @@ -6513,5 +6518,6 @@ struct proto sctpv6_prot = { | |||
| 6513 | .memory_pressure = &sctp_memory_pressure, | 6518 | .memory_pressure = &sctp_memory_pressure, |
| 6514 | .enter_memory_pressure = sctp_enter_memory_pressure, | 6519 | .enter_memory_pressure = sctp_enter_memory_pressure, |
| 6515 | .memory_allocated = &sctp_memory_allocated, | 6520 | .memory_allocated = &sctp_memory_allocated, |
| 6521 | REF_PROTO_INUSE(sctpv6) | ||
| 6516 | }; | 6522 | }; |
| 6517 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | 6523 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ |
