summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
Commit message (Collapse)AuthorAgeFilesLines
* Fix a range checking bug in ng_int32_parse which affected 64-bitjdp2001-05-191-4/+5
| | | | | | | | | | | | | | | | | | | | | machines. The code formerly read: long val; if (val < (long)-0x80000000 || ...) return EINVAL; The constant 0x80000000 has type unsigned int. The unary `-' operator does not change the type (or the value, in this case). Therefore the promotion to long is done by 0-extension, giving 0x0000000080000000 instead of the desired 0xffffffff80000000. I got rid of the `-' and changed the cast to (int32_t) to give proper sign-extension on all architectures and to better reflect the fact that we are range-checking a 32-bit value. This commit also makes the analogous changes to ng_int{8,16}_parse for consistency. MFC after: 3 days
* Remove unneeded includes in the i386 case.jhb2001-05-151-5/+0
|
* Don't reference a node after we dropped a reference to itarchie2001-04-111-1/+2
| | | | (same as in previous checkin, but in a different function).
* Catch up to header include changes:jhb2001-03-281-0/+1
| | | | | - <sys/mutex.h> now requires <sys/systm.h> - <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
* netgraph.h:julian2001-03-103-24/+65
| | | | | | | | | | | | | | | | | | | Change a prototype. Add a function version of ng_ref_node() when debugging so a breakpoint can be set on it. ng_base.c: add 'node' as an argument to ng_apply_item so that it is up to the caller to take over and release the item's reference on the node. If the release reports back that the node went away due to the reference going to 0, the caller should cease referencing the now defunct node. (e.g. the item was a 'kill node' message). Alter ng_unref_node to report back the residual references as a result. ng_pptpgre.c: Don't reference a node after we dropped a reference to it. (What if it was the last?) Fixes a node leak reported by Harti Brandt <brandt@fokus.gmd.de> which was due to an incorrect earlier attempt to fix the "accessing node after dropping the last reference" problem.
* Fix potential crash caused by packets with bogus ACK's.archie2001-03-081-1/+2
| | | | Reported by: Fabien THOMAS <fabient@netasq.com>
* Cleanups to Macros for sending data between netgraph nodes.julian2001-03-032-63/+32
|
* Add parenthesis to a macro.julian2001-03-031-1/+1
| | | | This took me 2 whole days to track down. (bleah)
* Shuffle netgraph mutexes a bit and hold a reference on a nodejulian2001-02-281-2/+4
| | | | from the function that is calling the destructor.
* Allow a changed MAC address to show up in ifconfig by changing itjulian2001-02-262-1/+14
| | | | in the ifaddr list as well. Also change an error return in the base system.
* slight cleanups during testing.julian2001-02-252-20/+46
|
* Add a node that looks to all the word like an ethernet but delivers itsjulian2001-02-252-0/+733
| | | | | | | | | | ehternet frames to a netgraph hook. Submitted by: "Vitaly V. Belekhov" <vitaly@riss-telecom.ru> translated to 5.0 by me. man page not yet written. This node still needs a little work.. don't use yet. Not yet linked into the build.
* Make the sample netgraph node compileable again.julian2001-02-251-6/+3
| | | | | Makes it easier for people if they can start with something that actually compiles.
* Add knowledge of the netgraph spinlocks into the Witness code.julian2001-02-241-5/+12
| | | | Well, at least I think that's how it's done.
* Shuffle sysctls a bit (thankyou whoever made them dynamic for modules)julian2001-02-235-7/+59
| | | | | | | | | | | | and add a sysctl to pppoe to activate non standard ethertypes so that idiot ISPs (apparently in France) who use equipment from idiot suppliers (rumour says 3com) who use nonstandard ethertypes can still connect. "yep, sure we do pppoe, we use a different identifier to that dictated in the standard, but sure it's pppoe!" sysctl -w net.graph.stupid_isp=1 enables the changeover.
* Add a 'splitter' node to separate a bidirectionaljulian2001-02-222-0/+272
| | | | | | | | | | packet flow into two unidirectional flows. Part of a suite of nodes developed for packet flow control. More to follow as I have time to port them to 5.x or as others do so. The ipfw node will be the hardest.. Submitted by: "Vitaly V. Belekhov" <vitaly@riss-telecom.ru>
* Preceed/preceeding are not english words. Use precede and preceding.asmodai2001-02-181-1/+1
|
* Fix an erroneous comment and two style(9) bugs.archie2001-02-161-3/+5
|
* Change and clean the mutex lock interface.bmilekic2001-02-091-67/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* Add a dummy disconnect function so that the socket code doesn't leap intojulian2001-02-051-2/+7
| | | | | space when it calls the disconnect PRU function without checking that it there.
* Make netgraph modules refuse to link with modules of a different ABI version.julian2001-02-053-39/+75
| | | | | | also try implement teh documented behaviour in socket nodes so that when there is only one hook, an unaddressed write/send will DTRT and send the data to that hook.
* Change the kernel internal ABI number as the HOOK structure has changed.julian2001-02-011-1/+1
| | | | Forgotten by: me
* Clean up reference counting with relation to queued packets and the worklist,julian2001-02-012-138/+107
| | | | | | and while I'm there, clean up the worklist insertion and removal. Inspired by: Harti Brandt <brandt@fokus.gmd.de>
* Add the ability to declare ore-ride methods on a per-hook basisjulian2001-01-312-26/+70
| | | | | | for the rcvdata() and rcvmsg() methods. Also bring the man page up to sync with my last commit. (and this one)
* Implement direct support for semipersistant nodes.julian2001-01-307-277/+298
| | | | | | | | | | | | | (e.g. ethernet nodes are persistent until you rip out the hardware) Use this support in the ethernet and sample nodes. Add some more abstraction on the 'item's so that node and hook reference counting can be checked easier. Slight man page correction. Make pppoe type dependent on ethernet type. Clean up node shutdown a little. Move a mutex from MTX_SPIN to MTX_DEF (oops) Fix small ref-counting bug. remove warning on one2many type.
* Fix cut and paste error in a comment.julian2001-01-302-2/+2
| | | | Submitted by: Peter Wemm <peter@freebsd.org>
* Add a new distribution algorythm to the 'one2many' node type.julian2001-01-282-3/+54
| | | | | | | | | The new method is 'flood' (in addition to the old round-robin) in which incoming packets are sent to more than one outgoing hook. (I'm not sure what Rogier is using this for but it seems generally useful and isn't much extra) Submitted by: Rogier R. Mulhuijzen (drwilco@drwilco.net )
* Swap egress hooks for packets entering from the monitor hooks.julian2001-01-261-2/+2
|
* Only clear the 'free' bit if we were successful in getting a queue item off ↵julian2001-01-251-2/+6
| | | | | | the free list. Found by: Harti Brandt (address unknown)
* Don't crash the kernel if the user tries to load a netgraphjulian2001-01-241-4/+10
| | | | module with the wrong version number.
* Add MTX_SPIN to an mtx_init(julian2001-01-221-1/+1
|
* remove stupid braino (recursive mutex)julian2001-01-211-16/+20
| | | | tripped over by: PHK
* Add a generic "queued function callin" mechanismjulian2001-01-143-197/+430
| | | | | | Use it to implement (hopefully) SMP safe node/hook addition and removal. Fix some debug stuff.
* remove debug sysctljulian2001-01-111-1/+4
| | | | slight tweek to hook removal. (or is that tweak?)
* Make hook deletion SMP safe.julian2001-01-111-52/+88
|
* Add an exported function ng_rmhook_self() that removes a hookjulian2001-01-113-7/+106
| | | | | | | | from a node, but does it via the locking queue, thus ensuring that the node is locked when it's hook is removed. Add 'deadnode' and 'deadhook' structures for when a node or hook is invalidated but not yet freed. (not yet freed)
* Another brian fix, luckily not in live code.julian2001-01-112-4/+3
|
* Fix uninitialised pointer.julian2001-01-111-0/+1
| | | | Found by: Brian Sommers
* Unbreak compilation.archie2001-01-112-2/+2
|
* Only free items that are not already free or passed to other nodes.julian2001-01-101-1/+2
| | | | Clever work by: Brian Sommers (Brian@freeBSD.org)
* Changes to stop zombie nodes showing up in active node lists.julian2001-01-101-21/+34
| | | | Also some changes resulting from debug work done earlier.
* Fix some memory leaksjulian2001-01-1013-110/+192
| | | | Add memory leak detection assitance.
* Missing FREE().julian2001-01-091-0/+1
|
* Bad julian.. forgot to destroy mutex before freeing thejulian2001-01-081-0/+1
| | | | structure it was part of!
* Part 2 of the netgraph rewrite.julian2001-01-0825-914/+1548
| | | | | | This is mostly cosmetic changes, (though I caught a bug or two while makeing them) Reviewed by: archie@freebsd.org
* Rewrite of netgraph to start getting ready for SMP.julian2001-01-0627-1620/+3045
| | | | | | | | This version is functional and is aproaching solid.. notice I said APROACHING. There are many node types I cannot test I have tested: echo hole ppp socket vjc iface tee bpf async tty The rest compile and "Look" right. More changes to follow. DEBUGGING is enabled in this code to help if people have problems.
* Divorce the kernel binary ABI version number from the messagejulian2000-12-1826-37/+70
| | | | | | | | | format version number. (userland programs should not need to be recompiled when the netgraph kernel internal ABI is changed. Also fix modules that don;t handle the fact that a caller may not supply a return message pointer. (benign at the moment because the calling code checks, but that will change)
* Use "node->ID" for the node's ID, instead of "(long)node".archie2000-12-181-5/+1
| | | | Reported by: julian
* Impossible to see typo.. |= instead of !=julian2000-12-181-1/+1
|
* Fix bug in parse type for struct ng_one2many_config.archie2000-12-121-2/+2
| | | | Reported by: Yian Zhu <Yian.Zhu@qobra.com>
OpenPOWER on IntegriCloud