summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
Commit message (Collapse)AuthorAgeFilesLines
* Remove defunct email address from header as well.emaste2010-07-061-1/+1
|
* Remove email address that no longer exists.emaste2010-07-061-1/+1
|
* Fix a double-free bug which can occur if both bit error rate and packetzec2010-07-061-2/+3
| | | | | | | duplication probability are configured on a ng_pipe node. Submitted by: Jeffrey Ahrenholtz MFC after: 3 days
* Avoid double-free. In error cases ipfw(4) frees the mbuf(4), we don'tglebius2010-07-061-4/+1
| | | | | | need to. PR: kern/145462
* The struct ipfw_rule_ref follows the struct m_tag. Deal with thisglebius2010-07-011-4/+5
| | | | | | correctly. This fixes breakage of ng_ipfw(4) in r201527. Submitted by: Alexander Zagrebin <alexz visp.ru>
* * Include sys/systm.h for KASSERT()ae2010-06-151-6/+3
| | | | | | | | * Remove unneeded includes and comment * Replace home made OFFSETOF() macro with standard offsetof() Pointed out by: bde Approved by: kib (mentor)
* Style(9) fixes:ae2010-06-102-38/+50
| | | | | | | | | | | * Sort includes * Replace #define<SPACE> to #define<TAB> * Split declarations and initializations * Split long lines Requested by: kib Approved by: kib (mentor) MFC after: 1 month
* New netgraph node ng_patch(4). It performs data modification of packetsae2010-06-092-0/+673
| | | | | | | | | | | | | | | | passing through. Modifications are restricted to a subset of C language operations on unsigned integers of 8, 16, 32 or 64 bit size. These are: set to new value (=), addition (+=), subtraction (-=), multiplication (*=), division (/=), negation (= -), bitwise AND (&=), bitwise OR (|=), bitwise eXclusive OR (^=), shift left (<<=), shift right (>>=). Several operations are all applied to a packet sequentially in order they were specified by user. Submitted by: Maxim Ignatenko <gelraen.ua at gmail.com> Vadim Goncharov <vadimnuclight at tpu.ru> Discussed with: net@ Approved by: mav (mentor) MFC after: 1 month
* Remove some dead and incorrect code.mav2010-06-051-1/+1
| | | | | Found with: Coverity Prevent(tm) CID: 4562
* Fix a race between ngs_rcvmsg() and soclose() which closes the controlattilio2010-05-191-6/+26
| | | | | | | | | | | | | socket while it is still in use. priv->ctlsock is checked at the top of the function but without any lock held, which means the control socket state may certainly change. Add a similar protection to ngs_shutdown() even if a race is unlikely to be experienced there. Sponsored by: Sandvine Incorporated Obtained from: Nima Misaghian @ Sandvine Incorporated <nmisaghian at sandvine dot com> MFC after: 10 days
* Increase the target buffer for performing NGM_ASCII2BINARY conversionzec2010-05-131-1/+1
| | | | | | | | | | | from 2000 bytes to 20 Kbytes, which now matches the buffer size used for NGM_BINARY2ASCII conversions. The aim of this change is to allow for bigger binary structures to be managed via netgraph ASCII messages, until we come up with an API improvement which would get rid of such arbitrary hardcoded limits. MFC after: 3 days
* Fix an invalid parameter detected by INVARIANT and confirmed by r193272.fabient2010-05-061-1/+1
|
* Add an optional "persistent" flag to ng_hub and ng_bridge, which if set,zec2010-05-054-3/+95
| | | | | | disables automatic node shutdown when the last hook gets disconnected. Reviewed by: julian
* When destroying a vnet, shut down all netgraph nodes tied to that vnetzec2010-05-031-19/+33
| | | | | | | | | before proceeding with dismantling other protocol domains. This change only affects options VIMAGE builds. Reviewed by: julian, bz MFC after: 3 days
* Add new tunable 'net.link.ifqmaxlen' to set default send interfacesobomax2010-05-034-5/+5
| | | | | | | | | | queue length. The default value for this parameter is 50, which is quite low for many of today's uses and the only way to modify this parameter right now is to edit if_var.h file. Also add read-only sysctl with the same name, so that it's possible to retrieve the current value. MFC after: 1 month
* Avoid undefined behaviour.trasz2010-04-301-8/+11
| | | | Reviewed by: zec@
* Start copyright notice with /*-joel2010-04-072-2/+2
|
* Remove alignment constraints.mav2010-04-011-11/+11
|
* Remove alignment constraints.mav2010-04-011-4/+5
|
* Remove alignment constraints.mav2010-04-011-8/+11
|
* Remove some more alignment constraints.mav2010-03-312-7/+8
|
* Make ng_ksocket fulfill lower protocol stack layers alignment requirementsmav2010-03-311-1/+13
| | | | | | | on platforms with strict alignment constraints. This fixes kernel panics on arm and probably other architectures. PR: sparc64/80410
* Make ng_l2tp irrelevant to data alignment.mav2010-03-311-15/+31
|
* Make ng_ppp fulfill upper protocol stack layers alignment requirementsmav2010-03-311-0/+14
| | | | | | | on platforms with strict alignment constraints. This fixes kernel panics on arm and probably other architectures. PR: sparc64/80410
* Remove disabled code. In 99% cases exports are send to ng_ksocket(4), whichglebius2010-03-251-9/+0
| | | | | already forces queued mode, so what was suggested in disabled code is already done.
* Now fix functionality of 'netstat -f netgraph' that hasn't workedglebius2010-03-122-0/+4
| | | | | | | | | | | | starting from netgraph import in 1999. netstat(8) used pointer to node as node address, oops. That didn't work, we need the node ID in brackets to successfully address a node. We can't look into ng_node, due to inability to include netgraph/netgraph.h in userland code. So let the node make a hint for a userland, storing the node ID in its private data. MFC after: 2 weeks
* Fix 'netstat -f netgraph', which I had broken in r163463 ling timeglebius2010-03-121-0/+18
| | | | | | | ago in 2006. This linked list is actually needed for userland. PR: kern/140446 Submitted by: Adrian Steinmann <ast marabu.ch>
* Declare a new EVENTHANDLER called iflladdr_event which signals that the L2thompsa2010-01-183-0/+3
| | | | | | | | | | | | | address on an interface has changed. This lets stacked interfaces such as vlan(4) detect that their lower interface has changed and adjust things in order to keep working. Previously this situation broke at least vlan(4) and lagg(4) configurations. The EVENTHANDLER_INVOKE call was not placed within if_setlladdr() due to the risk of a loop. PR: kern/142927 Submitted by: Nikolay Denev
* Send link state change control messages to "orphans" hook as well.fjoe2010-01-091-6/+10
| | | | MFC after: 1 week
* ip_var.h now needs to be before ip_fw_private.hluigi2010-01-071-1/+1
|
* Various cleanup done in ipfw3-head branch including:luigi2010-01-041-30/+19
| | | | | | | | | | | | | | | | | | | | | | | | | - use a uniform mtag format for all packets that exit and re-enter the firewall in the middle of a rulechain. On reentry, all tags containing reinject info are renamed to MTAG_IPFW_RULE so the processing is simpler. - make ipfw and dummynet use ip_len and ip_off in network format everywhere. Conversion is done only once instead of tracking the format in every place. - use a macro FREE_PKT to dispose of mbufs. This eases portability. On passing i also removed a few typos, staticise or localise variables, remove useless declarations and other minor things. Overall the code shrinks a bit and is hopefully more readable. I have tested functionality for all but ng_ipfw and if_bridge/if_ethersubr. For ng_ipfw i am actually waiting for feedback from glebius@ because we might have some small changes to make. For if_bridge and if_ethersubr feedback would be welcome (there are still some redundant parts in these two modules that I would like to remove, but first i need to check functionality).
* (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.antoine2009-12-282-11/+11
| | | | | | | | | Fix some wrong usages. Note: this does not affect generated binaries as this argument is not used. PR: 137213 Submitted by: Eygene Ryabinkin (initial version) MFC after: 1 month
* bring the NGM_IPFW_COOKIE back into ng_ipfw.h, libnetgraph expectsluigi2009-12-281-0/+1
| | | | | to find it there. Unfortunately this reintroduces the dependency on ip_fw_pfil.c
* bring in several cleanups tested in ipfw3-head branch, namely:luigi2009-12-282-26/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r201011 - move most of ng_ipfw.h into ip_fw_private.h, as this code is ipfw-specific. This removes a dependency on ng_ipfw.h from some files. - move many equivalent definitions of direction (IN, OUT) for reinjected packets into ip_fw_private.h - document the structure of the packet tags used for dummynet and netgraph; r201049 - merge some common code to attach/detach hooks into a single function. r201055 - remove some duplicated code in ip_fw_pfil. The input and output processing uses almost exactly the same code so there is no need to use two separate hooks. ip_fw_pfil.o goes from 2096 to 1382 bytes of .text r201057 (see the svn log for full details) - macros to make the conversion of ip_len and ip_off between host and network format more explicit r201113 (the remaining parts) - readability fixes -- put braces around some large for() blocks, localize variables so the compiler does not think they are uninitialized, do not insist on precise allocation size if we have more than we need. r201119 - when doing a lookup, keys must be in big endian format because this is what the radix code expects (this fixes a bug in the recently-introduced 'lookup' option) No ABI changes in this commit. MFC after: 1 week
* merge code from ipfw3-head to reduce contention on the ipfw lockluigi2009-12-222-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and remove all O(N) sequences from kernel critical sections in ipfw. In detail: 1. introduce a IPFW_UH_LOCK to arbitrate requests from the upper half of the kernel. Some things, such as 'ipfw show', can be done holding this lock in read mode, whereas insert and delete require IPFW_UH_WLOCK. 2. introduce a mapping structure to keep rules together. This replaces the 'next' chain currently used in ipfw rules. At the moment the map is a simple array (sorted by rule number and then rule_id), so we can find a rule quickly instead of having to scan the list. This reduces many expensive lookups from O(N) to O(log N). 3. when an expensive operation (such as insert or delete) is done by userland, we grab IPFW_UH_WLOCK, create a new copy of the map without blocking the bottom half of the kernel, then acquire IPFW_WLOCK and quickly update pointers to the map and related info. After dropping IPFW_LOCK we can then continue the cleanup protected by IPFW_UH_LOCK. So userland still costs O(N) but the kernel side is only blocked for O(1). 4. do not pass pointers to rules through dummynet, netgraph, divert etc, but rather pass a <slot, chain_id, rulenum, rule_id> tuple. We validate the slot index (in the array of #2) with chain_id, and if successful do a O(1) dereference; otherwise, we can find the rule in O(log N) through <rulenum, rule_id> All the above does not change the userland/kernel ABI, though there are some disgusting casts between pointers and uint32_t Operation costs now are as follows: Function Old Now Planned ------------------------------------------------------------------- + skipto X, non cached O(N) O(log N) + skipto X, cached O(1) O(1) XXX dynamic rule lookup O(1) O(log N) O(1) + skipto tablearg O(N) O(1) + reinject, non cached O(N) O(log N) + reinject, cached O(1) O(1) + kernel blocked during setsockopt() O(N) O(1) ------------------------------------------------------------------- The only (very small) regression is on dynamic rule lookup and this will be fixed in a day or two, without changing the userland/kernel ABI Supported by: Valeria Paoli MFC after: 1 month
* add ip_fw_private.h to ng_ipfw.c, forgotten in previous commit;luigi2009-12-152-1/+3
| | | | | | comment out remove ip_fw.h from ng_bridge.c, as it seems unused. MFC after: 1 month
* Take a step towards removing if_watchdog/if_timer. Don't explicitly setjhb2009-11-064-4/+0
| | | | | if_watchdog/if_timer to NULL/0 when initializing an ifnet. if_alloc() sets those members to NULL/0 already.
* Spell DIAGNOSTIC correctly.ru2009-10-241-2/+2
|
* Virtualize the pfil hooks so that different jails may chose differentjulian2009-10-111-1/+1
| | | | | | | | packet filters. ALso allows ipfw to be enabled on on ejail and disabled on another. In 8.0 it's a global setting. Sitting aroung in tree waiting to commit for: 2 months MFC after: 2 months
* Get those pesky RFCOMM RPM data bits right. This is likely a noop.emax2009-09-101-2/+2
| | | | MFC after: 1 month
* Rework global locks for interface list and index management, correctingrwatson2009-08-231-2/+2
| | | | | | | | | | | | | | several critical bugs, including race conditions and lock order issues: Replace the single rwlock, ifnet_lock, with two locks, an rwlock and an sxlock. Either can be held to stablize the lists and indexes, but both are required to write. This allows the list to be held stable in both network interrupt contexts and sleepable user threads across sleeping memory allocations or device driver interactions. As before, writes to the interface list must occur from sleepable contexts. Reviewed by: bz, julian MFC after: 3 days
* Merge the remainder of kern_vimage.c and vimage.h into vnet.c andrwatson2009-08-019-9/+7
| | | | | | | | | | vnet.h, we now use jails (rather than vimages) as the abstraction for virtualization management, and what remained was specific to virtual network stacks. Minor cleanups are done in the process, and comments updated to reflect these changes. Reviewed by: bz Approved by: re (vimage blanket)
* Introduce and use a sysinit-based initialization scheme for virtualrwatson2009-07-237-113/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | network stacks, VNET_SYSINIT: - Add VNET_SYSINIT and VNET_SYSUNINIT macros to declare events that will occur each time a network stack is instantiated and destroyed. In the !VIMAGE case, these are simply mapped into regular SYSINIT/SYSUNINIT. For the VIMAGE case, we instead use SYSINIT's to track their order and properties on registration, using them for each vnet when created/ destroyed, or immediately on module load for already-started vnets. - Remove vnet_modinfo mechanism that existed to serve this purpose previously, as well as its dependency scheme: we now just use the SYSINIT ordering scheme. - Implement VNET_DOMAIN_SET() to allow protocol domains to declare that they want init functions to be called for each virtual network stack rather than just once at boot, compiling down to DOMAIN_SET() in the non-VIMAGE case. - Walk all virtualized kernel subsystems and make use of these instead of modinfo or DOMAIN_SET() for init/uninit events. In some cases, convert modular components from using modevent to using sysinit (where appropriate). In some cases, do minor rejuggling of SYSINIT ordering to make room for or better manage events. Portions submitted by: jhb (VNET_SYSINIT), bz (cleanup) Discussed with: jhb, bz, julian, zec Reviewed by: bz Approved by: re (VIMAGE blanket)
* Reimplement and/or implement vnet list locking by replacing a mostlyrwatson2009-07-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | unused custom mutex/condvar-based sleep locks with two locks: an rwlock (for non-sleeping use) and sxlock (for sleeping use). Either acquired for read is sufficient to stabilize the vnet list, but both must be acquired for write to modify the list. Replace previous no-op read locking macros, used in various places in the stack, with actual locking to prevent race conditions. Callers must declare when they may perform unbounded sleeps or not when selecting how to lock. Refactor vnet sysinits so that the vnet list and locks are initialized before kernel modules are linked, as the kernel linker will use them for modules loaded by the boot loader. Update various consumers of these KPIs based on whether they may sleep or not. Reviewed by: bz Approved by: re (kib)
* Remove unused VNET_SET() and related macros; only VNET_GET() isrwatson2009-07-163-5/+5
| | | | | | | | | ever actually used. Rename VNET_GET() to VNET() to shorten variable references. Discussed with: bz, julian Reviewed by: bz Approved by: re (kensmith, kib)
* Build on Jeff Roberson's linker-set based dynamic per-CPU allocatorrwatson2009-07-147-101/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (DPCPU), as suggested by Peter Wemm, and implement a new per-virtual network stack memory allocator. Modify vnet to use the allocator instead of monolithic global container structures (vinet, ...). This change solves many binary compatibility problems associated with VIMAGE, and restores ELF symbols for virtualized global variables. Each virtualized global variable exists as a "reference copy", and also once per virtual network stack. Virtualized global variables are tagged at compile-time, placing the in a special linker set, which is loaded into a contiguous region of kernel memory. Virtualized global variables in the base kernel are linked as normal, but those in modules are copied and relocated to a reserved portion of the kernel's vnet region with the help of a the kernel linker. Virtualized global variables exist in per-vnet memory set up when the network stack instance is created, and are initialized statically from the reference copy. Run-time access occurs via an accessor macro, which converts from the current vnet and requested symbol to a per-vnet address. When "options VIMAGE" is not compiled into the kernel, normal global ELF symbols will be used instead and indirection is avoided. This change restores static initialization for network stack global variables, restores support for non-global symbols and types, eliminates the need for many subsystem constructors, eliminates large per-subsystem structures that caused many binary compatibility issues both for monitoring applications (netstat) and kernel modules, removes the per-function INIT_VNET_*() macros throughout the stack, eliminates the need for vnet_symmap ksym(2) munging, and eliminates duplicate definitions of virtualized globals under VIMAGE_GLOBALS. Bump __FreeBSD_version and update UPDATING. Portions submitted by: bz Reviewed by: bz, zec Discussed with: gnn, jamie, jeff, jhb, julian, sam Suggested by: peter Approved by: re (kensmith)
* Fix infinite loop in ng_iface, that happens when packet passes out viamav2009-07-011-1/+2
| | | | | | | | | two different ng interfaces sequentially due to tunnelling. PR: kern/134557 Submitted by: Mikolaj Golub Approved by: re (kensmith) MFC after: 3 days
* - Turn the third (islocked) argument of the knote call into flags parameter.stas2009-06-281-1/+1
| | | | | | | | | | | Introduce the new flag KNF_NOKQLOCK to allow event callers to be called without KQ_LOCK mtx held. - Modify VFS knote calls to always use KNF_NOKQLOCK flag. This is required for ZFS as its getattr implementation may sleep. Approved by: re (rwatson) Reviewed by: kib MFC after: 2 weeks
* Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/rwatson2009-06-261-2/+2
| | | | | | | | | | | | | IF_ADDR_UNLOCK() across network device drivers when accessing the per-interface multicast address list, if_multiaddrs. This will allow us to change the locking strategy without affecting our driver programming interface or binary interface. For two wireless drivers, remove unnecessary locking, since they don't actually access the multicast address list. Approved by: re (kib) MFC after: 6 weeks
* Update Netgraph nodes to use if_addr_rlock()/if_addr_runlock() insteadrwatson2009-06-262-5/+5
| | | | | | of IF_ADDR_LOCK()/IF_ADDR_UNLOCK() when iterating ifp->if_addrhead. MFC after: 6 weeks
OpenPOWER on IntegriCloud