Commit Graph

195 Commits

Author SHA1 Message Date
julian
c56dd3a94c Allow a changed MAC address to show up in ifconfig by changing it
in the ifaddr list as well. Also change an error return in the base system.
2001-02-26 09:31:54 +00:00
julian
8ea865c7af slight cleanups during testing. 2001-02-25 16:49:04 +00:00
julian
d072c65fa7 Add a node that looks to all the word like an ethernet but delivers its
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.
2001-02-25 05:46:52 +00:00
julian
11c11012a0 Make the sample netgraph node compileable again.
Makes it easier for people if they can start with something
that actually compiles.
2001-02-25 05:36:25 +00:00
julian
3ca1bdc9e0 Add knowledge of the netgraph spinlocks into the Witness code.
Well, at least I think that's how it's done.
2001-02-24 14:29:47 +00:00
julian
f25c733a9b Shuffle sysctls a bit (thankyou whoever made them dynamic for modules)
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.
2001-02-23 16:34:22 +00:00
julian
c98177cc0f Add a 'splitter' node to separate a bidirectional
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>
2001-02-22 17:14:36 +00:00
asmodai
d8144cf92b Preceed/preceeding are not english words. Use precede and preceding. 2001-02-18 10:43:53 +00:00
archie
afc2a11f46 Fix an erroneous comment and two style(9) bugs. 2001-02-16 17:37:31 +00:00
bmilekic
e67bcfcaf3 Change and clean the mutex lock interface.
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)
2001-02-09 06:11:45 +00:00
julian
7334e5e710 Add a dummy disconnect function so that the socket code doesn't leap into
space when it calls the disconnect PRU function without checking that it
there.
2001-02-05 20:48:04 +00:00
julian
47594b44e9 Make netgraph modules refuse to link with modules of a different ABI version.
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.
2001-02-05 18:57:11 +00:00
julian
b7388ce2fc Change the kernel internal ABI number as the HOOK structure has changed.
Forgotten by: me
2001-02-01 21:25:06 +00:00
julian
4c094778a3 Clean up reference counting with relation to queued packets and the worklist,
and while I'm there, clean up the worklist insertion and removal.

Inspired by: Harti Brandt <brandt@fokus.gmd.de>
2001-02-01 20:51:23 +00:00
julian
bdfa33eb06 Add the ability to declare ore-ride methods on a per-hook basis
for the rcvdata() and rcvmsg() methods.

Also bring the man page up to sync with my last commit. (and this one)
2001-01-31 20:46:00 +00:00
julian
6c5047eda2 Implement direct support for semipersistant nodes.
(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.
2001-01-30 20:51:52 +00:00
julian
fa01e8b98b Fix cut and paste error in a comment.
Submitted by: Peter Wemm <peter@freebsd.org>
2001-01-30 07:58:30 +00:00
julian
8f85fcd191 Add a new distribution algorythm to the 'one2many' node type.
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 )
2001-01-28 15:37:06 +00:00
julian
49e27f0a8b Swap egress hooks for packets entering from the monitor hooks. 2001-01-26 11:35:36 +00:00
julian
102ce4d3f9 Only clear the 'free' bit if we were successful in getting a queue item off the free list.
Found by: Harti Brandt (address unknown)
2001-01-25 19:48:57 +00:00
julian
d039536316 Don't crash the kernel if the user tries to load a netgraph
module with the wrong version number.
2001-01-24 21:29:57 +00:00
julian
84c301f7b0 Add MTX_SPIN to an mtx_init( 2001-01-22 17:51:48 +00:00
julian
b776a74a2a remove stupid braino (recursive mutex)
tripped over by: PHK
2001-01-21 23:32:00 +00:00
julian
5c148d65ef Add a generic "queued function callin" mechanism
Use it to implement (hopefully) SMP safe node/hook addition
and removal.
Fix some debug stuff.
2001-01-14 23:25:54 +00:00
julian
8d00672315 remove debug sysctl
slight tweek to hook removal. (or is that tweak?)
2001-01-11 23:05:34 +00:00
julian
fe6839a105 Make hook deletion SMP safe. 2001-01-11 22:22:52 +00:00
julian
05f3698e1a Add an exported function ng_rmhook_self() that removes a hook
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)
2001-01-11 19:27:54 +00:00
julian
c04920f17e Another brian fix, luckily not in live code. 2001-01-11 15:44:41 +00:00
julian
e2936221a5 Fix uninitialised pointer.
Found by: Brian Sommers
2001-01-11 15:42:22 +00:00
archie
c3248759d5 Unbreak compilation. 2001-01-11 04:13:46 +00:00
julian
35141a7095 Only free items that are not already free or passed to other nodes.
Clever work by: Brian Sommers (Brian@freeBSD.org)
2001-01-10 23:49:03 +00:00
julian
61af67e410 Changes to stop zombie nodes showing up in active node lists.
Also some changes resulting from debug work done earlier.
2001-01-10 23:19:32 +00:00
julian
7f90c1db95 Fix some memory leaks
Add memory leak detection assitance.
2001-01-10 07:13:58 +00:00
julian
5e49ca0fcc Missing FREE(). 2001-01-09 00:49:31 +00:00
julian
573cbe6f57 Bad julian.. forgot to destroy mutex before freeing the
structure it was part of!
2001-01-08 06:28:30 +00:00
julian
d3e08032f6 Part 2 of the netgraph rewrite.
This is mostly cosmetic changes, (though I caught a bug or two while
makeing them)
Reviewed by:	archie@freebsd.org
2001-01-08 05:34:06 +00:00
julian
6de76ea239 Rewrite of netgraph to start getting ready for SMP.
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.
2001-01-06 00:46:47 +00:00
julian
1ab8a4da8a Divorce the kernel binary ABI version number from the message
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)
2000-12-18 20:03:32 +00:00
archie
045c3506b2 Use "node->ID" for the node's ID, instead of "(long)node".
Reported by:	julian
2000-12-18 17:18:35 +00:00
julian
24c247b6f1 Impossible to see typo.. |= instead of != 2000-12-18 13:41:46 +00:00
archie
bcd28a8024 Fix bug in parse type for struct ng_one2many_config.
Reported by:	Yian Zhu <Yian.Zhu@qobra.com>
2000-12-12 23:12:22 +00:00
julian
00ca91bd91 I have no idea at all why this file was not included in the last commit. 2000-12-12 22:35:36 +00:00
julian
30848aa939 oops that commit included a local hack... take it out.. 2000-12-12 18:59:09 +00:00
julian
6fc6411b80 Reviewed by: Archie@freebsd.org
This clears out my outstanding netgraph changes.
There is a netgraph change of design in the offing and this is to some
extent a superset of soem of the new functionality and some of the old
functionality that may be removed.

This code works as before, but allows some new features that I want to
work with and evaluate. It is the basis for a version of netgraph
with integral locking for SMP use.

This is running on my test machine with no new problems :-)
2000-12-12 18:52:14 +00:00
archie
0672c80d25 Fix a bug where if the interface was in promiscuous mode when the
last hook was disconnected, the interface would not get reset to
non-promiscuous mode.

Reported by:	jdp
2000-12-11 03:36:26 +00:00
julian
79d1337c05 Add splhigh()s to protect against a race condition
that shows up when running with ethernet bridging
at high speed.

Submitted by: Chris Csanady <ccsanady@iastate.edu>
(and extended by me)
2000-12-02 13:27:58 +00:00
jlemon
1a8953db4c Fix another callout_init() that I missed. 2000-11-26 21:59:30 +00:00
dwmalone
88173fb55b Add the use of M_ZERO to netgraph.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Submitted by:	archie
Approved by:	archie
2000-11-18 15:17:43 +00:00
brian
e4b0b74d23 Go back to using data_len in struct ngpppoe_init_data after discussions
with Julian and Archie.

Implement a new ``sizedstring'' parse type for dealing with field pairs
consisting of a uint16_t followed by a data field of that size, and use
this to deal with the data_len and data fields.

Written by:		Archie with some input by me
Agreed in principle by:	julian
2000-11-16 23:14:53 +00:00
archie
449bf4e5ca New netgraph node type ng_one2many(4). 2000-11-16 05:58:33 +00:00