Commit Graph

267 Commits

Author SHA1 Message Date
archie
4f3c325b7d - Add new control message NGM_VJC_GET_CONFIG
- Implement control message ASCII'fication for all control messages
2000-08-10 22:48:03 +00:00
archie
91912098c3 Take advantage of the new unsigned and hex integer types. 2000-08-10 22:45:54 +00:00
archie
16765ea997 - Make statistics unsigned.
- Add new control message to atomically get and clear statistics.
2000-08-10 22:44:41 +00:00
archie
2b894febdd - Add new unsigned and hex integer parse types
- Fix bug in commented example code
2000-08-10 22:43:38 +00:00
archie
126052eaab - Add new unsigned and hex integer parse types; this allows simplifying
the bytearray parse type.
- Allocate (larger) temporary work buffer dynamically instead of on the
  stack when comparing to the default value.
2000-08-10 22:42:25 +00:00
archie
36af4d0d2a RFC 1661 requires that all LCP packets are sent with no address and
control field compression. The ng_ppp(4) node correctly follows this
rule. However, PPPoE is an exception: when doing PPPoE *all* frames
are sent with address and control field compression.

Alter this node's behavior so that when an outgoing frame is received,
any leading address and control field bytes are removed. This makes
this node compatible with ng_ppp(4).
2000-08-10 20:05:12 +00:00
archie
7c1fac0cb6 In a struct sockaddr, sa->sa_len can be zero if uninitialized.
Make sure that this doesn't cause a problem when parsing.
2000-08-09 23:57:44 +00:00
archie
7dc4fea48b Fix bug where bundle-level receive statistics were not getting updated. 2000-08-09 01:43:21 +00:00
archie
abc93090fb Fix a bug where we were accessing already free'd memory during node shutdown.
Detected via:	0xdeadc0de
2000-08-07 22:41:12 +00:00
archie
ee875aa6c2 Add three new control messages to the ng_ether(4) netgraph node type:
NGM_ETHER_GET_ENADDR:	Get the device's Ethernet address
    NGM_ETHER_SET_PROMISC:	Enable/disable promiscuous mode
    NGM_ETHER_SET_AUTOSRC:	Enable/disable packet source address override
2000-08-07 18:52:26 +00:00
archie
03d498eb80 Fix misspelling. 2000-08-05 20:17:04 +00:00
archie
044c01152e Followup to previous commit..
- It's worthwhile to use untimeout(9), even though we must still protect
  against "false" timeouts, because most of the time it saves having to
  handle a dummy timeout event.
- Slight tweaks to the delayed ACK algorithm paramters.
2000-07-25 18:57:20 +00:00
archie
02b7ccf840 Several fixes:
- Fix slowness when operating over fast connections, where the timeout(9)
  granularity is on the same order of magnitude as the round trip time.
  timeout(9) can happen up to 1 tick early, which was causing receive
  ack timeouts to happen too early, causing bogus "lost" packets.
- Increase the local time counter to 64 bits to avoid roll-over.
- Keep statistics on memory allocation failures.
- Add a new option to always include the ack when sending data packets.
  Might be useful in high packet loss situations. Might not.
2000-07-25 00:23:19 +00:00
archie
add7c59d4f Allocate memory with M_NOWAIT instead of M_WAITOK, because it's possible
for these routines to be called from an interrupt context.

PR:		kern/20057
2000-07-20 17:23:49 +00:00
archie
32c8825fe1 Remove node's name reference when the interface is detached;
otherwise, the ng_ether.ko KLD will never be unloadable after
all Ethernet interfaces are detached, as it should be, because
of the lingering extra reference.

Submitted by:	"Yevmenkin, Maksim N, CSCIO" <myevmenkin@att.com>
2000-07-19 17:33:53 +00:00
archie
c7fb04c331 Set NG_INVALID flag when destroying node. 2000-07-14 22:35:13 +00:00
asmodai
492e7a5ec0 Fix typo, teh -> the. 2000-07-14 11:17:16 +00:00
archie
e713486f3b Fix race condition caused by using NG_SEND_DATAQ() where we meant
to use ng_queue_data().

Reported by:	Udo Erdelhoff <ue@nathan.ruhr.de>
2000-07-12 23:55:07 +00:00
julian
8c0bd98e14 Don't forget to set our MAC address into packets we wre sending out via
netgraph. Eventually we may need to have a separate hook for packets
that already have a source AMC address but for now just drop it in.
Should fix PPPoE.
2000-07-06 15:35:59 +00:00
phk
aec15566c7 Experiemntal ascii based device configuration mechanism.
This may or may not survive, decision will be made well before 5.0-R
2000-07-03 13:34:18 +00:00
archie
9997aef57d Fix incorrectly implemented receive ACK timeout algorithm:
instead of bumping the recvAck counter by one, pretend that
all outstanding xmit packets are acknowleged, and restart
transmitting anew, with an empty (but halved) transmit window.

Put a lower bound on the adaptive timeout value.
2000-06-28 19:43:34 +00:00
archie
9af816e946 Make the ng_ether(4) node type dynamically loadable like the rest.
This means 'options NETGRAPH' is no longer necessary in order to get
netgraph-enabled Ethernet interfaces. This supports loading/unloading
the ng_ether.ko and attaching/detaching the Ethernet interface in any
order.

Add two new hooks 'upper' and 'lower' to allow access to the protocol
demux engine and the raw device, respectively. This enables bridging
to be defined as a netgraph node, if so desired.

Reviewed by:	freebsd-net@freebsd.org
2000-06-26 23:34:54 +00:00
archie
90a17e36f6 - Start sequence numbers at zero instead of one; the rest of the
world seems to interpret the spec this way
- Initialize transmit window to two instead of one; helps get things
  going initially when the first packet may get dropped
- Really fix the shutdown + timeout race condition this time
2000-06-26 19:43:24 +00:00
archie
b9592ca040 Fix bug where receive statistics for the bundle were not getting updated. 2000-06-01 01:29:49 +00:00
jake
961b97d434 Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
jake
d93fbc9916 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
archie
284ada4222 Add hook for IPv6. 2000-05-10 16:54:00 +00:00
archie
67e7422842 Fix a couple of bugs:
- Properly handle 32 bit sequence numbers when they wrap around
- Don't drop GRE packets with stale ACK numbers, just ignore the ACK
- Close race between node being shutdown and timer going off
Also add support for lots of statistics, and control message ASCIIfication
2000-05-05 01:11:39 +00:00
archie
022b0d5f39 Don't assume *lasthook is initialized in ng_path2node(). 2000-05-02 17:09:46 +00:00
archie
a5995cfe12 Fix broken multi-link fragment reassembly algorithm.
Add hook for IPv6. Misc cleanups.

PR:		kern/16335
2000-05-02 00:09:18 +00:00
archie
d814513ee0 Macro call to ng_send_dataq() should have been to ng_send_data() instead. 2000-05-01 23:34:15 +00:00
archie
abe77c5239 Use 'type_name' structure field instead of 'typename', which is
a C++ reserved work.

Add a ng_copy_meta() function.
2000-05-01 23:29:19 +00:00
peter
0748b102ed A temporary band-aid for ng_base. It works for some people, a better
fix will follow.

Submitted by:   Gary Jennejohn <garyj@muc.de>
2000-05-01 21:26:50 +00:00
peter
0caafaec1c Minimal tweak to make the ng_XXX modules depend on netgraph so that they
see its symbols and link ok.
2000-04-29 13:36:07 +00:00
julian
49604b4259 Two simple changes to the kernel internal API for netgraph modules,
to support future work in flow-control and 'packet reject/replace'
processing modes.

reviewed by: phk, archie
2000-04-28 17:09:00 +00:00
phk
6be1308ad1 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00
archie
cdd2982e88 Fix uninitialized variable.
PR:		kern/17911
Submitted by:	Tom Pavel <pavel@alum.mit.edu>
2000-04-12 17:29:33 +00:00
archie
322f08278e A netgraph node that implements Microsoft Point-to-Point compression
(MPPC) and Microsoft Point-to-Point encryption (MPPE) protocols.

Note: the MPPC part is disabled as it requires proprietary files.

Obtained from:	Whistle source tree
2000-04-09 21:04:55 +00:00
archie
1773c43543 Call bpfdetach() before going away. 2000-03-21 01:42:56 +00:00
phk
77129d8b98 Newer ciscos have become more picky, and will not accept the MULTICAST bit
being set for unicast packets.
2000-03-17 17:06:33 +00:00
archie
6c3f33821c Updates to the ng_iface(8) netgraph node type:
- Make iface nodes removable on shutdown since FreeBSD now supports
    removable interfaces
  - Simplify supporting new protocols using family_enqueue(); add a
    few new ones including IPv6
  - Add support for configurable interface mode using new
    NGM_IFACE_POINT2POINT and NGM_IFACE_BROADCAST control messages
  - Remove NGM_IFACE_GET_IFADDRS control message; it just duplicates
    the functionality of SIOCGIFCONF
2000-03-13 19:18:10 +00:00
archie
7cd2627429 Some minor prototype tweaks. 2000-03-13 19:05:11 +00:00
archie
293fdc5216 Use snprintf() instead of sprintf(). 2000-03-13 18:54:10 +00:00
archie
ea3525dea4 Fix typo: "ng_parse_fixedsstring_info" -> "ng_parse_fixedstring_info" 2000-03-13 18:50:38 +00:00
archie
f966bf838f Add control message ASCII conversion for this node type. 2000-01-27 01:32:53 +00:00
archie
76f0b8f007 Fix a few obscure memory leaks. 2000-01-05 20:36:07 +00:00
archie
4f702e355c Fix race condition caused by missing splnet()'s. 2000-01-04 22:06:08 +00:00
peter
15b9bcb121 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 04:46:21 +00:00
archie
abf915c20a Fix bugs in the MP fragment reassembly code that can cause a panic. 1999-12-17 23:29:04 +00:00
archie
086ca8f5bd New netgraph node type 'pptpgre': this performs GRE encapsulation
for the PPTP protocol as specified in RFC 2637.
1999-12-08 18:55:39 +00:00
julian
4efb279718 Remove a bunch of un-needed includes.
Submitted by: phk@freebsd.org
1999-12-07 05:50:48 +00:00
archie
046ee838bb Change definition of NG_BPF_HOOKPROG_SIZE() so as not to require
a structure pointer, just the number of BPF instructions.
1999-12-06 18:43:32 +00:00
archie
1edd13e295 New netgraph node type, ng_bpf(8). This node type allows you to
apply bpf(4) filters to data travelling through a netgraph network.
1999-12-03 21:21:49 +00:00
archie
2bb264d4df Add a new function ng_findhook() for finding a node's hook;
if the node type provides a more efficient implementation than
the normal linear scan, use it.

Reviewed by:	julian
1999-12-03 21:17:30 +00:00
archie
97f1907fc7 Fix bug parsing 32 bit integers on machines where sizeof(long) == 4. 1999-12-03 20:27:33 +00:00
archie
25b8ac3c90 Use m_dup() instead of m_copypacket() to duplicate the mbuf chain.
This fixes a bug where if the original packet was modified downstream
of the tee node, then the copy could get modified too.
1999-12-01 23:11:58 +00:00
archie
abcc28c7f8 Add more comments describing how to use parse types and how they work. 1999-12-01 19:41:15 +00:00
archie
a5c64fe8bb Show how to supply a struct ng_cmdlist for (de)asciification
of control messages.

Suggested by:	julian
1999-12-01 19:40:37 +00:00
julian
918bd93bf8 change intial timeout for session negotiation from 1 to 2 seconds.
One second was being hit too many times in normal situations.
1999-12-01 08:05:56 +00:00
archie
81fceb37a9 Add two new generic control messages, NGM_ASCII2BINARY and
NGM_BINARY2ASCII, which convert control messages to ASCII and back.
This allows control messages to be sent and received in ASCII form
using ngctl(8), which makes ngctl a lot more useful.

This also allows all the type-specific debugging code in libnetgraph
to go away -- instead, we just ask the node itself to do the ASCII
translation for us.

Currently, all generic control messages are supported, as well as
messages associated with the following node types: async, cisco,
ksocket, and ppp.

See /usr/share/examples/netgraph/ngctl for an example of using this.

Also give ngctl(8) the ability to print out incoming data and
control messages at any time.  Eventually nghook(8) may be subsumed.

Several other misc. bug fixes.

Reviewed by:	julian
1999-11-30 02:45:32 +00:00
archie
d6eae9ff98 Change the prototype of the strto* routines to make the second
parameter a char ** instead of a const char **.  This make these
kernel routines consistent with the corresponding libc userland
routines.

Which is actually 'correct' is debatable, but consistency and
following the spec was deemed more important in this case.

Reviewed by (in concept):	phk, bde
1999-11-24 01:03:08 +00:00
julian
a852549753 oops cut-n-paste error 1999-11-21 23:11:52 +00:00
julian
2d7f08ef2e It's time to only allow root to manipulate netgraph nodes.
(I meant to do this before checking in to FreeBSD and forgot)
1999-11-21 23:06:30 +00:00
julian
16320b0093 Hopefully the last patch from Brian to get server side PPPoE working.
remove a 'free' that is no longer needed.
1999-11-21 22:18:54 +00:00
julian
ff227a07ea Fixes from brian. With some changes from me.
Allows FreeBSD to run as a PPPOE server
One patch still not included.
1999-11-21 10:43:05 +00:00
archie
0c40ec2d4c Revert previous commit now that 'acfcomp' has been removed from
libnetgraph/debug.c to fix make world.
1999-11-19 20:42:14 +00:00
julian
a3d8413300 Add a field archie forgot to merge in from out sources. 1999-11-19 20:32:46 +00:00
archie
5c00903171 Use 'struct ng_xxx_private' instead of 'struct private' to help gdb
disambiguate when debugging.
1999-11-19 05:50:29 +00:00
archie
fa49e42d18 Fix bug where hook pointers were not getting updated on disconnection. 1999-11-19 05:49:54 +00:00
archie
1a2092dbb8 Move misplaced #define. 1999-11-19 05:49:18 +00:00
archie
6b77b6cb6e Add some safety using KASSERT() and splnet(). 1999-11-19 05:45:11 +00:00
archie
456bd56ad3 Use KASSERT() instead of old #ifdef DIAGNOSTICS.
Add more INVARIANTS-enabled sanity checking.
1999-11-19 05:43:33 +00:00
archie
8d7c2cb60d Remove the address and control field compression functionality of this
node type.  ACF is device independent and therefore belongs in ng_ppp.c
(which already implements it).
1999-11-19 04:27:53 +00:00
archie
b91c249236 Rename 'struct private' to 'struct ng_xxx_private' to allow gdb
to disambiguate when debugging.
1999-11-19 04:25:39 +00:00
archie
925919a689 When allocating a new PKTHDR mbuf, always set m->m_pkthdr.rcvif = NULL. 1999-11-17 17:41:22 +00:00
archie
8c037b25b4 New netgraph node type "ksocket".
Obtained from:	Whistle source tree
1999-11-16 23:25:11 +00:00
archie
ac2cbe7bd7 More bug fixes for the VJ Compression node. Seems to work now (really). 1999-11-15 20:02:58 +00:00
julian
3b8d09a9f9 Small fixes from Brian for the Server side of PPPoE. 1999-11-15 04:03:34 +00:00
julian
1adef4ea81 Rework some tag handling, prompted by Brian Somers. 1999-11-14 17:26:58 +00:00
julian
775125a062 Try handle missing packet tags better.
Inspired by changes suggested by brian Somers.
1999-11-14 10:21:26 +00:00
brian
30ceb7c670 Provide an empty name to getsockname() if one hasn't been set up.
Ok'd (for now) by: julian
1999-11-11 20:08:04 +00:00
archie
51e564d911 More bug fixes. 1999-11-10 23:56:57 +00:00
archie
7af6ddb015 Minor change to the configuration of number of slots. 1999-11-10 23:56:19 +00:00
archie
9c0f6dbefe Fix some bugs; seems to work now. Minor change to the configuration field
to make the number of compression slots parameter consistent with what
IPCP negotiates (ie, the number of slots - 1).
1999-11-10 06:17:14 +00:00
archie
371524a338 Move handling of the address and control fields into the PPP node;
they belong there because they are device independent.
Also some other misc. fixes.
1999-11-10 06:15:22 +00:00
julian
c173e32dd2 Remove a null pointer reference
Submitted by: Brian Somers (brian@freebsd.org)
1999-11-09 00:31:04 +00:00
archie
2f772ace57 Fix crash when trying to duplicate a NULL meta. 1999-11-08 03:11:22 +00:00
archie
4336de9993 Get rid of the 'sync2' hook, which was a hack. Instead, just
directly detect outgoing LCP frames and do the right thing.
1999-11-08 03:10:20 +00:00
archie
4ada2ddb7d Add support for the IFF_MULTICAST flag. There's not
much to do because we are a point-to-point interface.

Submitted by:	phk
1999-11-08 03:08:59 +00:00
julian
ce5e8ccdd8 Be more accepting about the format of node IDs.
Submitted by: Brian Somers <brian@Awfulhak.org>
1999-11-07 04:18:20 +00:00
julian
648f67c414 Move a structure Netstat needs back out to ng_socketvar.h (yech) 1999-11-06 19:27:04 +00:00
archie
b974ee813c Fix several bugs found in the first bit of testing. 1999-11-06 02:09:17 +00:00
julian
aa2c36581b Re-add this till I can fix netstat to not need it. 1999-11-05 20:04:00 +00:00
julian
f3be8b4e84 Add the option for a socket node to shut down when the last hook
to an adjoining node is removed. Also move file scope definitions back
within the file, and remove un-needed include file.
1999-11-05 02:18:08 +00:00
phk
487a9d07d6 Move isfoo() and friends to the newly created sys/ctype.h.
Urged by:       bde
1999-11-03 17:54:26 +00:00
archie
ef92fd8274 Add statistics counters to "tee" netgraph node type. 1999-11-02 23:31:49 +00:00
archie
a481e1e52b Simplify checking/parsing of strings using strtoul(), isdigit(), etc. 1999-11-02 23:18:01 +00:00
archie
4ede940c75 Fix some bugs in MP allocation routine when links are non-equivalent. 1999-11-01 19:44:28 +00:00
julian
3127cac2f7 Add typedefs for node methods
Suggested by phk.
1999-11-01 10:00:40 +00:00
julian
e105baa7c1 braino in sample code.
picked up by phk.
1999-11-01 05:27:44 +00:00
julian
58e6bf41a6 Start making the contents of the generic framework opaque to the nodes.
This step: IDs are no-longer the address of the node.
Reviewd by: Archie@freebsd.org
1999-11-01 00:31:14 +00:00
archie
6f20b456fb Revamped and more useful PPP node type, supporting multi-link PPP directly.
This is one piece of the grand unified PPP daemon concept, whereby using
netgraph nodes enables PPP data to be handled completely in kernel land,
while leaving negotiation/control to be handled by a single user land
daemon, no matter what the link type(s).

This is a safety checkin only; it compiles, but is utterly untested.

Concept reviewed by:	julian, brian
1999-10-29 22:30:03 +00:00
julian
a754b84f1e When the session is running, don't include the ethernet header in the length of the payload. 1999-10-29 04:32:27 +00:00
julian
a7375e191d fix typo 1999-10-27 11:53:53 +00:00
julian
d65bad1ec7 The node goes away when last session disconnects or when disconnected from
the ethernet node.
1999-10-27 11:48:35 +00:00
julian
144be1740d change PPPoE occurences to pppoe. Not JUST a cosmeting change.
some occurrances needed to be the same as the filenmnae which was pppoe
 not PPPoE.
1999-10-27 11:29:51 +00:00
julian
1e37349d12 cleanups regarding misused m_pullup() and similar. 1999-10-26 22:33:54 +00:00
julian
48eeb0662d Send the negotiated session ID on our packets (DUH!). 1999-10-26 11:26:23 +00:00
julian
a3c8d605bb Send a PADT message to the peer when a session is closed down. 1999-10-26 11:04:25 +00:00
julian
9ed030c4d1 This one actually gets session data to the waiting ppp daemon
(well, my test program  at least).
1999-10-26 09:25:18 +00:00
julian
debb714cef This one actually negotiated it's way into a session.
still tuning to be done.
1999-10-26 08:08:48 +00:00
julian
f963ed1eaf Bring ng_iface up-to-date with what has happenned to the bpf code. 1999-10-25 22:36:39 +00:00
julian
48db5a679e more fixes, braino's, typo's, etc. 1999-10-23 22:46:38 +00:00
julian
732f8d1ced A version of the pppoe code ellicits a response from the ISP end
(but still not quite right)
1999-10-23 15:15:42 +00:00
julian
41ef3662ca dang, deleted a line 1999-10-23 04:52:54 +00:00
julian
bd67127489 Now that Netgraph is in the system there are some cleanups we can do.
Also save a slightly closer to completion version of the PPPOE code.

Submitted by: Archie Cobbs <archie@freebsd.org>
1999-10-23 04:28:11 +00:00
julian
c5c63975d5 Whistle's Netgraph link-layer (sometimes more) networking infrastructure.
Been in production for 3 years now. Gives Instant Frame relay to if_sr
and if_ar drivers, and PPPOE support soon. See:
ftp://ftp.whistle.com/pub/archie/netgraph/index.html
for on-line manual pages.

Reviewed by: Doug Rabson (dfr@freebsd.org)
Obtained from:  Whistle CVS tree
1999-10-21 09:06:11 +00:00