Commit Graph

610 Commits

Author SHA1 Message Date
Gleb Smirnoff
77a58296d8 - sort includes
- remove duplicate include sys/sysctl.h
2004-12-23 10:48:10 +00:00
Gleb Smirnoff
d58e678f22 Assert queue mutex in ng_dequeue() and ng_queue_rw(). 2004-12-19 14:58:13 +00:00
Gleb Smirnoff
e0d32af754 - Use ng_callout() instead of timeout.
- Schedule next timeout *after* finishing job of the current one.
- Remove spl(9) calls.

Tested by:	ru
Reviewed by:	julian
2004-12-14 08:05:29 +00:00
Gleb Smirnoff
089323f30d Use ng_callout() and ng_uncallout() instead of home-grown
implementation.

Tested by:	Savchuk Taras
Reviewed by:	archie
Approved by:	julian (mentor)
2004-12-09 07:49:02 +00:00
Gleb Smirnoff
ef237c7faf - Use ng_callout() instead of timeout()
- remove spl(9) calls

Tested by:	Ilya Pizik
Approved by:	julian (mentor)
2004-12-08 13:27:54 +00:00
Gleb Smirnoff
9d952bd3fd - Use ng_callout() instead of timeout(9).
- Do not put/remove node references, since this no longer
  needed.
- Remove timerActive flag, use callout flags.
- Schedule next callout after doing current one.

Reviewed by:	archie
Approved by:	julian (mentor)
2004-12-06 19:49:55 +00:00
Gleb Smirnoff
9f3a2adc36 Use ng_callout() instead of timeout(9).
Approved by:	julian (mentor)
2004-12-05 22:58:13 +00:00
Gleb Smirnoff
176119c455 - Use uint16_t to pass argument for NGM_NETFLOW_IFINFO, bump cookie.
- Always check that index number passed from userland
  is <= NG_NETFLOW_MAXIFACES. [1]
- Increase NG_NETFLOW_MAXIFACES up to 512. [2]

Noticed by:	Roman Palagin [1]
Requested by:	Yuri Y. Bushmelev [2]
MFC after:	1 week
2004-12-05 14:30:38 +00:00
Gleb Smirnoff
f9d9e1b4ec Mechanically rename s/ng_timeout/ng_callout/g, s/ng_untimeout/ng_uncallout/g.
This is done to keep both versions in RELENG_5 and support both APIs.

Reviewed by:	scottl
Approved by:	julian (mentor), implicitly
2004-12-01 11:56:32 +00:00
Max Laier
4f240aff01 Move ng_socket and ng_btsocket initialization to SI_SUB_PROTO_DOMAIN as they
call net_add_domain(). Calling this function too early (or late) breaks
assertations about the global domains list.
Actually it should be forbidden to call net_add_domain() outside of
SI_SUB_PROTO_DOMAIN completely as there are many places where we traverse
the domains list unprotected, but for now we allow late calls (mostly to
support netgraph). In order to really fix this we have to lock the domains
list in all places or find another way to ensure that we can safely walk the
list while another thread might be adding a new domain.

Spotted by:	se
Reviewed by:	julian, glebius
PR:		kern/73321	(partly)
2004-11-30 22:28:50 +00:00
Archie Cobbs
2adb8d6ab0 Disable protocol field compression on the inner PPP frame when also doing
normal PPP compression, as a workaround for certain (arguably) broken
Linux PPP implementations that can't handle this particular case.

MFC after:	1 week
2004-11-27 20:29:00 +00:00
Gleb Smirnoff
28b24b7b1a Netgraph flow control: change interface status when node receive
LINK_IS_UP/LINK_IS_DOWN messages.

Approved by:	julian (mentor), implicitly
MFC after:	1 week
2004-11-23 09:48:13 +00:00
Gleb Smirnoff
129353b81c Introduce new failure detection algorithm, called NG_ONE2MANY_FAIL_NOTIFY.
It means, that node listens to flow control messages from downstreams
and removes link from list of active links whenever a LINK_IS_DOWN message
is received. If LINK_IS_UP message is received, then links is put
back into list of active links.

Approved by:	julian (mentor), implicitly
MFC after:	1 week
2004-11-23 09:45:47 +00:00
Gleb Smirnoff
ea9a9044b1 o Use ng_timeout() instead of timeout(9).
o Implement some netgraph flow control:
- Whenever status of HDLC heartbeat from pear is timed out,
  send NGM_LINK_IS_DOWN message.
- If HDLC link changes status from down to up, send
  NGM_LINK_IS_UP message.

Approved by:	julian (mentor), implicitly
MFC after:	1 week
2004-11-23 09:30:27 +00:00
Gleb Smirnoff
654ec77877 Remove unused macro.
Approved by:	julian (mentor)
2004-11-19 22:35:53 +00:00
Gleb Smirnoff
92947dc698 Cancel pending timeout before scheduling a new one. This fixes
item leak, I've introduced with previous change.

Approved by:	julian (mentor)
2004-11-19 20:23:46 +00:00
Maksim Yevmenkin
bb50f99e30 Correct typo. Return ENXIO instead of EIO. 2004-11-19 18:54:54 +00:00
Gleb Smirnoff
81755e6eb6 Add myself to copyright.
Approved by:	marks
2004-11-10 11:18:05 +00:00
Poul-Henning Kamp
756d52a195 Initialize struct pr_userreqs in new/sparse style and fill in common
default elements in net_init_domain().

This makes it possible to grep these structures and see any bogosities.
2004-11-08 14:44:54 +00:00
Gleb Smirnoff
3eadb26df8 Partically backout previous commit. Since _callout_stop_safe() clears
out c->c_func, we can't take it after callout_stop(). To take it before
we need to acquire callout_lock, to avoid race. This commit narrows
down area where lock is held, but hack is still present.

This should be redesigned.

Approved by:	julian (mentor)
2004-11-04 21:30:18 +00:00
Hartmut Brandt
a6fd48812e Adapt to the new ng_timeout/ng_untimeout arguments. These now use
the callout instead of the timeout interface.

Submitted by:	glebius
2004-11-04 12:33:55 +00:00
Maksim Yevmenkin
b81d7730f3 Fix kernel build (caused by recent ng_{un}timeout API change)
Submitted by:	glebius
2004-11-03 18:00:49 +00:00
Gleb Smirnoff
30bef41b8a - Make ng_timeout() to use callout() interface instead of timeout().
- Remove callout-hacking from ng_untimeout().

Approved by:	julian (mentor)
MFC after:	1 month
2004-11-02 21:24:30 +00:00
Gleb Smirnoff
d312eaf5ca Fix a harmless error in order of ng_timeout() arguments.
Approved by:	julian (mentor)
2004-11-02 20:26:41 +00:00
Maksim Yevmenkin
cff5b6df1c Fix broken ng_h4(4). Basically, do not abuse t_sc field and use new t_lsc
field created for line disciplne drivers private use. Also add NET_NEEDS_GIANT
warning. For whatever reason ng_tty(4) was fixed but ng_h4(4) was not :(
2004-11-02 20:01:42 +00:00
Gleb Smirnoff
08e2a38eda Removed bogus comment. 2004-11-01 20:52:24 +00:00
Gleb Smirnoff
440df10b41 o style changes:
- tabs after defines
- tabs instead of many spaces
- sort local variables by size

o remove spl(9) calls

Approved by:	julian (mentor)
2004-11-01 20:12:03 +00:00
Gleb Smirnoff
ec774932ba Since last change moved ';' from macro to code, we need to embrace
macros with 'do {} while (0)' to avoid error in case macro is
not defined.

Prodded by:	julian, archie
Pointy hat to:	glebius
2004-10-31 17:32:51 +00:00
Gleb Smirnoff
f2b9562c53 Rename debug macro to DBG and indent it properly.
Requested by:	maxim
Approved by:	julian (mentor)
2004-10-28 18:23:44 +00:00
Robert Watson
81158452be Push acquisition of the accept mutex out of sofree() into the caller
(sorele()/sotryfree()):

- This permits the caller to acquire the accept mutex before the socket
  mutex, avoiding sofree() having to drop the socket mutex and re-order,
  which could lead to races permitting more than one thread to enter
  sofree() after a socket is ready to be free'd.

- This also covers clearing of the so_pcb weak socket reference from
  the protocol to the socket, preventing races in clearing and
  evaluation of the reference such that sofree() might be called more
  than once on the same socket.

This appears to close a race I was able to easily trigger by repeatedly
opening and resetting TCP connections to a host, in which the
tcp_close() code called as a result of the RST raced with the close()
of the accepted socket in the user process resulting in simultaneous
attempts to de-allocate the same socket.  The new locking increases
the overhead for operations that may potentially free the socket, so we
will want to revise the synchronization strategy here as we normalize
the reference counting model for sockets.  The use of the accept mutex
in freeing of sockets that are not listen sockets is primarily
motivated by the potential need to remove the socket from the
incomplete connection queue on its parent (listen) socket, so cleaning
up the reference model here may allow us to substantially weaken the
synchronization requirements.

RELENG_5_3 candidate.

MFC after:	3 days
Reviewed by:	dwhite
Discussed with:	gnn, dwhite, green
Reported by:	Marc UBM Bocklet <ubm at u-boot-man dot de>
Reported by:	Vlad <marchenko at gmail dot com>
2004-10-18 22:19:43 +00:00
Gleb Smirnoff
547d34736b Major overhaul.
List of functional changes:
   - Make a single device per single node with a single hook.
     This gives us parrallelizm, which can't be achieved on a single
     node with many devices/hooks. This also gives us flexibility - we
     can play with a particular device node, not affecting others.
   - Remove read queue as it is. Use struct ifqueue instead. This change
     removes a lot of extra memcpy()ing, m_devget()ting and m_copymem()ming.
     In ng_device_receivedata() we enqueue an mbuf and wake readers.
     In ngdread() we take one mbuf from qeueue and uiomove() it to
     userspace. If no mbuf is present we optionally block. [1]
   - In ngdwrite() we create an mbuf from uio using m_uiotombuf().
     This is faster then uiomove() into buffer, and then m_copydata(),
     and this is much better than huge m_pullup().
   - Perform locking of device
   - Perform locking of connection list.
   - Clear out _rcvmsg method, since it does nothing good yet.
   - Implement NGM_DEVICE_GET_DEVNAME message.
   - #if 0 ioctl method, while nothing is done here yet.
   - Return immediately from ngdwrite() if uio_resid == 0.

 List of tidyness changes:
   - Introduce device2priv(), to remove cut'n'paste.
   - Use MALLOC/FREE, instead of malloc/free.
   - Use unit2minor().
   - Use UID_ROOT/GID_WHEEL instead of 0/0.
   - Define NGD_DEVICE_DEVNAME, use it.
   - Use more nice macros for debugging. [2]
   - Return Exxx, not -1.

 style(9) changes:
   - No "#endif" after short block.
   - Break long lines.
   - Remove extra spaces, add needed spaces.

[1] Obtained from:      if_tun.c
[2] Obtained from:      ng_pppoe.c
Reviewed by:		marks
Approved by:		julian (mentor)
MFC after:		1 month
2004-10-18 20:13:57 +00:00
Maksim Yevmenkin
01c5ea585c Get rid of device nodes interface. It is useless and confusing.
The original idea was to use it for firmware upgrading and similar
operations. In real life almost all Bluetooth USB devices do not
need firmware download. If device does require firmware download
then ugen(4) (or specialized driver like ubtbcmfw(8)) should be
used instead.

MFC after:	3 days
2004-10-12 23:33:46 +00:00
Gleb Smirnoff
a176c2aeaf Fix packet flow when both ng_ether(4) and bridge(4) are in use:
- push all bridge logic from if_ethersubr.c into bridge.c
  make bridge_in() return mbuf pointer (or NULL).
- call only bridge_in() from ether_input(), after ng_ether_input()
  was optinally called.
- call bridge_in() from ng_ether_rcv_upper().

Long description:	http://lists.freebsd.org/mailman/htdig/freebsd-net/2004-May/003881.html
Reported by:		Jian-Wei Wang <jwwang at FreeBSD.csie.NCTU.edu.tw>
Tested by:		myself, Sergey Lyubka
Reviewed by:		sam
Approved by:		julian (mentor)
MFC after:		2 months
2004-10-12 10:33:42 +00:00
Dag-Erling Smørgrav
7ea5573cd8 Return 0, not NULL, from a function declared as returning int. 2004-10-09 14:20:18 +00:00
Poul-Henning Kamp
08d79b63f6 Fix an issue with ng_tty which (ab)used the tty->t_sc field which is
reserved for the device drivers:

Add a t_lsc field for line discipline private use.
2004-09-17 22:26:27 +00:00
Gleb Smirnoff
0b7925df73 - Remove advertising clause from copyright [1]
- Change my email to glebius@FreeBSD.org

Requested by:	ru [1]
2004-09-17 19:58:03 +00:00
Gleb Smirnoff
a752e82d3a A netgraph node implementing Netflow version 5.
Supported by:	Bestcom ISP, Rinet ISP
Approved by:	julian (mentor)
2004-09-16 20:24:23 +00:00
Gleb Smirnoff
5d67845f3e Remove orphaned comment about Meta data. 2004-09-11 08:59:06 +00:00
Gleb Smirnoff
0306463aa0 Increase PPTP_MAX_TIMEOUT up to 3 seconds. 10 prooved too much for high packet
loss links, and 1 second appeared to be too small for high latency links.

If we will receive more complaints, we should make this parameter configurable.

PR:		kern/69536
Approved by:	archie, julian (mentor)
MFC after:	3 days
2004-09-06 19:53:58 +00:00
Robert Watson
42ec1da481 In FreeBSD 5.x, curthread is always defined, so we don't need to to test
and optionally use &thread0 if it's NULL.

Spotted by:	julian
2004-09-02 19:53:13 +00:00
Robert Watson
c6bfdc5d32 Acquire Giant arounds calls into the linker from Netgraph sockets.
We now no longer hold Giant in send(), so it isn't inheritted by the
linker, which calls into VFS.

Reported by:	glebius
Discussed with:	glebius, bz
2004-08-30 14:41:25 +00:00
Robert Watson
98f6a62499 Mark Netgraph TTY, KAME IPSEC, and IPX/SPX as requiring Giant for correct
operation using NET_NEEDS_GIANT().  This will result in a boot-time
restoration of Giant-enabled network operation, or run-time warning on
dynamic load (applicable only to the Netgraph component).  Additional
components will likely need to be marked with this in the future.
2004-08-28 15:24:53 +00:00
Andre Oppermann
3161f583ca Apply error and success logic consistently to the function netisr_queue() and
its users.

netisr_queue() now returns (0) on success and ERRNO on failure.  At the
moment ENXIO (netisr queue not functional) and ENOBUFS (netisr queue full)
are supported.

Previously it would return (1) on success but the return value of IF_HANDOFF()
was interpreted wrongly and (0) was actually returned on success.  Due to this
schednetisr() was never called to kick the scheduling of the isr.  However this
was masked by other normal packets coming through netisr_dispatch() causing the
dequeueing of waiting packets.

PR:		kern/70988
Found by:	MOROHOSHI Akihiko <moro@remus.dti.ne.jp>
MFC after:	3 days
2004-08-27 18:33:08 +00:00
Julian Elischer
f036d4081d Align netgraph message fields ready for 64-bit (and 128 bit :-) machines.
requires a recompile of netgraph users.
Also change the size of a field in the bluetooth code
that was waiting for the next change that needed recompiles so
it could piggyback its way in.

Submitted by:	jdp, maksim
MFC after:	2 days
2004-08-20 01:24:23 +00:00
Andre Oppermann
9b932e9e04 Convert ipfw to use PFIL_HOOKS. This is change is transparent to userland
and preserves the ipfw ABI.  The ipfw core packet inspection and filtering
functions have not been changed, only how ipfw is invoked is different.

However there are many changes how ipfw is and its add-on's are handled:

 In general ipfw is now called through the PFIL_HOOKS and most associated
 magic, that was in ip_input() or ip_output() previously, is now done in
 ipfw_check_[in|out]() in the ipfw PFIL handler.

 IPDIVERT is entirely handled within the ipfw PFIL handlers.  A packet to
 be diverted is checked if it is fragmented, if yes, ip_reass() gets in for
 reassembly.  If not, or all fragments arrived and the packet is complete,
 divert_packet is called directly.  For 'tee' no reassembly attempt is made
 and a copy of the packet is sent to the divert socket unmodified.  The
 original packet continues its way through ip_input/output().

 ipfw 'forward' is done via m_tag's.  The ipfw PFIL handlers tag the packet
 with the new destination sockaddr_in.  A check if the new destination is a
 local IP address is made and the m_flags are set appropriately.  ip_input()
 and ip_output() have some more work to do here.  For ip_input() the m_flags
 are checked and a packet for us is directly sent to the 'ours' section for
 further processing.  Destination changes on the input path are only tagged
 and the 'srcrt' flag to ip_forward() is set to disable destination checks
 and ICMP replies at this stage.  The tag is going to be handled on output.
 ip_output() again checks for m_flags and the 'ours' tag.  If found, the
 packet will be dropped back to the IP netisr where it is going to be picked
 up by ip_input() again and the directly sent to the 'ours' section.  When
 only the destination changes, the route's 'dst' is overwritten with the
 new destination from the forward m_tag.  Then it jumps back at the route
 lookup again and skips the firewall check because it has been marked with
 M_SKIP_FIREWALL.  ipfw 'forward' has to be compiled into the kernel with
 'option IPFIREWALL_FORWARD' to enable it.

 DUMMYNET is entirely handled within the ipfw PFIL handlers.  A packet for
 a dummynet pipe or queue is directly sent to dummynet_io().  Dummynet will
 then inject it back into ip_input/ip_output() after it has served its time.
 Dummynet packets are tagged and will continue from the next rule when they
 hit the ipfw PFIL handlers again after re-injection.

 BRIDGING and IPFW_ETHER are not changed yet and use ipfw_chk() directly as
 they did before.  Later this will be changed to dedicated ETHER PFIL_HOOKS.

More detailed changes to the code:

 conf/files
	Add netinet/ip_fw_pfil.c.

 conf/options
	Add IPFIREWALL_FORWARD option.

 modules/ipfw/Makefile
	Add ip_fw_pfil.c.

 net/bridge.c
	Disable PFIL_HOOKS if ipfw for bridging is active.  Bridging ipfw
	is still directly invoked to handle layer2 headers and packets would
	get a double ipfw when run through PFIL_HOOKS as well.

 netinet/ip_divert.c
	Removed divert_clone() function.  It is no longer used.

 netinet/ip_dummynet.[ch]
	Neither the route 'ro' nor the destination 'dst' need to be stored
	while in dummynet transit.  Structure members and associated macros
	are removed.

 netinet/ip_fastfwd.c
	Removed all direct ipfw handling code and replace it with the new
	'ipfw forward' handling code.

 netinet/ip_fw.h
	Removed 'ro' and 'dst' from struct ip_fw_args.

 netinet/ip_fw2.c
	(Re)moved some global variables and the module handling.

 netinet/ip_fw_pfil.c
	New file containing the ipfw PFIL handlers and module initialization.

 netinet/ip_input.c
	Removed all direct ipfw handling code and replace it with the new
	'ipfw forward' handling code.  ip_forward() does not longer require
	the 'next_hop' struct sockaddr_in argument.  Disable early checks
	if 'srcrt' is set.

 netinet/ip_output.c
	Removed all direct ipfw handling code and replace it with the new
	'ipfw forward' handling code.

 netinet/ip_var.h
	Add ip_reass() as general function.  (Used from ipfw PFIL handlers
	for IPDIVERT.)

 netinet/raw_ip.c
	Directly check if ipfw and dummynet control pointers are active.

 netinet/tcp_input.c
	Rework the 'ipfw forward' to local code to work with the new way of
	forward tags.

 netinet/tcp_sack.c
	Remove include 'opt_ipfw.h' which is not needed here.

 sys/mbuf.h
	Remove m_claim_next() macro which was exclusively for ipfw 'forward'
	and is no longer needed.

Approved by:	re (scottl)
2004-08-17 22:05:54 +00:00
Hartmut Brandt
a2931871f7 This is the netgraph node framework for the user side call control
node for ATM. This node implements the API to the signalling services.
2004-08-12 14:22:00 +00:00
Maksim Yevmenkin
b25877a384 Introduce ng_hci_inquiry_response structure and use it in the hccontrol(8) 2004-08-10 00:38:50 +00:00
Bjoern A. Zeeb
4807330cff Implement minimalistic L2TP sessions statistics and correct man page
for L2TP tunnel statistics (which do not take an argument sessionID).

Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:52:55 +00:00
Bjoern A. Zeeb
1e0313242d add a new control message to set sequence numbers on an uninitialized node.
Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:45:38 +00:00
Bjoern A. Zeeb
ddb7229415 Correct L2TP header offset handling:
- according to RFC2661 an offset size of 0 is allowed.
- when skipping offset padding do not forget to also skip
  the 2 octets of the offset size field.

Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:37:46 +00:00
Bjoern A. Zeeb
49728ffc2f Do not change link[n].conf.latency for internal usage but have
link[n].latency calculated from user supplied value.
This prevents repeated NGM_PPP_SET_CONFIG/NGM_PPP_GET_CONFIG
from failing because of link[n].conf.latency being out of range.

Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:34:55 +00:00
Gleb Smirnoff
c0451ac3d9 Another stupid error from my side. PPPOE_NONSTANDARD was first defined
in enum {}, and then redefined with #define.
No warnings from compiler, though.

Submitted by:	bz
Pointy hat to:	glebius
2004-08-01 20:39:33 +00:00
Gleb Smirnoff
6c97c0e45e Fix a stupid error in my previous commit, which broke operation
of many nodes.

Pointy hat to:	glebius
2004-07-31 21:32:55 +00:00
Gleb Smirnoff
bb3e8b0bd1 Address node in a less complex way.
Approved by:	julian (mentor)
2004-07-29 08:05:02 +00:00
Alexander Kabaev
445e045b0d Avoid casts as lvalues. 2004-07-28 06:59:55 +00:00
Gleb Smirnoff
7610f57454 When making a peer of unknown type framework tries to load module
using linker_load_module(). This works OK if NGM_MKPEER message came
from userland and we have process associated with thread. But when
NGM_MKPEER was queued because target node was busy, linker_load_module()
is called from netisr thread leading to panic.
To workaround that we do not load modules by framework, instead ng_socket
loads module (if this is required) before sending NGM_MKPEER.
However, the race condition between return from NgSendMsg() and actual
creation of node still exist and needs to be solved.

PR:		kern/62789
Approved by:	julian
2004-07-27 20:30:56 +00:00
Gleb Smirnoff
fdc755d162 When node is server serve both standard RFC2516 and non-standard 3Com
clients simultaneously. When node is client its mode is configured
with a control message.

sysctl net.graph.nonstandard_pppoe is deprecated but kept for
backward compatibility for some time.

Approved by:	julian
2004-07-27 19:47:13 +00:00
Julian Elischer
be4252b367 Slight cosmetic changes.
Also introduce a macro to be called by persistent nodes to signal their
persistence during shutdown to hide this mechanism from the node author.

Make node flags have a consistent style in naming.

Document the change.
2004-07-20 17:15:38 +00:00
Gleb Smirnoff
c1eec6c589 In ng_device_newhook():
- Return meaningful return errorcodes.
  - Free previously allocated connection in error cases.

In ng_device_rcvdata():
  - Return meaningful return errorcodes.
  - Detach mbuf from netgraph item, and free the item before
    doing any other actions that may return from method.
  - Do not call strange malloc() for buffer. [1]
  - In case of any error jump to end, where mbuf is freed.

In ng_device_disconnect():
  - Return meaningful return errorcodes.
  - Free disconnected connection.

style(9) in mentioned above functions:
  - Remove '/* NGD_DEBUG */', when only one line is ifdef'ed.
  - Remove extra braces to easier reading.
  - Add space after comma in function calls.

PR:		kern/41881 (part)
Reviewed by:	marks
Approved by:	julian (mentor)
2004-07-20 13:16:17 +00:00
Gleb Smirnoff
b3e3ef9836 1. Make ng_device.h system include. This fixes module build.
2. Sort includes, while here.
3. s/NULL/0/ in NG_SEND_MSG_HOOK(), since ng_ID_t is integer.

PR:		kern/41881 (part)
Reviewed by:	marks
Approved by:	julian (mentor)
2004-07-20 11:19:46 +00:00
Julian Elischer
505fad52f7 Reverse a lock/unlock pair that were the wrong way around in some code that
is obviously not run a lot. (but is in some test cases).
This code is not usually run because it covers a case that doesn't
happen a lot (removing a node that has data traversing it).
2004-07-18 22:57:46 +00:00
Gleb Smirnoff
8250de8330 Use qsort_r() instead of qsort() when sorting links by latency
This helps us to remove a global variable and a mutex protecting it.

Reviewed by:	rwatson
Approved by:	julian (mentor)
2004-07-16 00:07:44 +00:00
Poul-Henning Kamp
3e019deaed Do a pass over all modules in the kernel and make them return EOPNOTSUPP
for unknown events.

A number of modules return EINVAL in this instance, and I have left
those alone for now and instead taught MOD_QUIESCE to accept this
as "didn't do anything".
2004-07-15 08:26:07 +00:00
Robert Watson
6f7d64c44a Add a note indicating that the eh_prototype field used to construct
ethernet headers is unsynchronized.
2004-07-14 20:31:37 +00:00
Robert Watson
c61340f374 Add a mutex ng_tty_mtx to protect the global variable ngt_unit. Note
that the locking of globals here isn't complete, and there's also a
locking issue relating to calling into and out of the tty code.
2004-07-14 20:31:05 +00:00
Robert Watson
489264ddae Add ng_ppp_latencies_mtx, a global mutex to protect the latency list.
Note that the table is a hack, and so is this mutex.

Reviewed by:	glebius
2004-07-14 20:29:54 +00:00
Robert Watson
544fc3d562 Introduce a new mutex, ng_fec_mtx, to protect the global unit list to
synchronization allocation of FEC unit numbers.

Reviewed by:	glebius
2004-07-14 20:27:33 +00:00
Robert Watson
dffa5be1a4 Introduce a new mutex, ng_eiface_mtx, to protect the global unit list
lock used to synchronize allocation of unit numbers for new netgraph
ethernet interfaces.

Reviewed by:	glebius
2004-07-14 20:26:29 +00:00
Robert Watson
9a668fa4d8 Introduce a new mutex, ng_iface_mtx, to protect the global unit list
lock used to synchronize allocation of unit numbers for new netgraph
interfaces.

Reviewed by:	glebius
Tested by:	glebius
2004-07-14 20:24:21 +00:00
Robert Watson
943bb929af Introduce a global mtx 'ngsocketlist_mtx' to protect the global
ng_socket list during insert/delete.
2004-07-12 04:45:46 +00:00
Robert Watson
f011f4041a Mark 'makeup' in ng_frame_relay as const, as its values are immutable. 2004-07-12 04:35:42 +00:00
Marcel Moolenaar
f33ca0c961 Update for the KDB framework:
o  Call kdb_enter() instead of Debugger().
o  Change comments accordingly.
2004-07-10 21:45:58 +00:00
Stefan Farfeleder
5908d366fb Consistently use __inline instead of __inline__ as the former is an empty macro
in <sys/cdefs.h> for compilers without support for inline.
2004-07-04 16:11:03 +00:00
Julian Elischer
8ed370fd90 Remove the home-grown metadata facility in favour of the now generic
mbuf tags facility. Netgraph modules will all need a recompile.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
2004-06-30 22:51:29 +00:00
Mark Santcroos
84333769ed Remove 3rd clause from the licence.
Approved by:	njl
2004-06-29 15:46:12 +00:00
Warner Losh
107af8f9eb MFp4: Last references to dev/usb/usbdevs.h converted. 2004-06-27 16:51:01 +00:00
Julian Elischer
3ca24c284d Having moved metadata usage to mbuf tags, remove code that supports
the old way of doing it.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
2004-06-26 22:24:16 +00:00
Lukas Ertl
f3617a3396 Catch up with usbd_get_string_desc() change.
Spotted by:  Tai-hwa Liang <avatar@mmlab.cse.yzu.edu.tw>
2004-06-26 13:24:29 +00:00
Poul-Henning Kamp
4776c07426 Fix line discipline switching issues: If opening a new ldisc fails,
we have to revert to TTYDISC which we know will successfully open
rather than try the previous ldisc which might also fail to open.

Do not let ldisc implementations muck about with ->t_line, and remove
code which checks for reopens, it should never happen.

Move ldisc->l_hotchar to tty->t_hotchar and have ldisc implementation
initialize it in their open routines.  Reset to zero when we enter
TTYDISC.  ("no" should really be -1 since zero could be a valid
hotchar for certain old european mainframe protocols.)
2004-06-26 08:44:04 +00:00
Julian Elischer
1020444971 Not quite sure how that one got past me.. 2004-06-26 01:22:29 +00:00
Maksim Yevmenkin
21da572743 Add '#include <sys/mbuf.h>' to fix the kernel build. 2004-06-25 23:03:33 +00:00
Julian Elischer
601c644f46 oops from Gleb..
This shouldn't be visible from userland.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
2004-06-25 22:59:59 +00:00
Julian Elischer
1cf3fa7934 Make the frameworkl responsible for not passing the nodes a NULL mbuf pointer.
this allows the nodes to not test for this..

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
2004-06-25 21:11:14 +00:00
Julian Elischer
327b288e5c Convert Netgraph to use mbuf tags to pass its meta information around.
Thanks to Sam for importing tags in a way that allowed this to be done.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
Also allow the sr and ar drivers to create netgraph versions of their modules.
Document the change to the ksocket node.
2004-06-25 19:22:05 +00:00
Robert Watson
53f9c5e988 Clean up use of ng_hdhasb_mtx a little:
- Assert the mutex in NG_IDHASH_FIND() since the mutex is required to
  safely walk the node lists in the ng_ID_hash table.

- Acquire the ng_nodelist_mtx when walking ng_allnodes or ng_allhooks
  to generate state dump output from the netgraph sysctls.
2004-06-24 01:47:31 +00:00
Archie Cobbs
669bb973c4 Avoid calling bpf_filter() with len == 0, which causes a change in semantics
(it treats the buffer pointer as an mbuf pointer) and subsequent panic.

MFC after:	3 days
Reported by:	Tony Hariman <tony@cbn.net.id>
2004-06-23 02:37:10 +00:00
Brian Feldman
114bf09149 Fix a problem with multiple-delivery (i.e. broadcast) in ng_bridge.
Only the first link0..link$NLINKS hooks would be utilized, whereas
the link hooks may be connected sparsely.

Add a counter variable so that the link hook array is only traversed
while there is still work to do, but that it continues up to the end
if it has to.
2004-06-22 18:56:47 +00:00
Bill Paul
15a646e411 Remove one more unneeded reference to arpcom.ac_netgraph.
Tweak things so that ng_fec has a chance of working with things
other than ethernet. Use ifp->if_output of the underlying interfaces
and use IF_HANDOFF() rather than depending on ether_output() and
ether_output_frame() explicitly. Also, don't insist that underlying
devices be IFM_ETHER when checking their link states in the link
monitor code.

With these changes, I was able to create a two channel bundle
consisting of one ethernet interface and one 802.11 wireless
device (via ndis). Note that this only works because both devices
use the same if_output vector: ng_fec will not let you bundle
devices with different output vectors together (it really doesn't
make sense to do that).
2004-06-20 21:08:58 +00:00
Bill Paul
cafb9261fd Stash our node context pointer somewhere else within struct ifnet of
underlying interfaces rather than using ac_netgraph in struct arpcom.
The latter is meant only for use by ng_ether, and using it breaks
interoperability with the rest of netgraph.
2004-06-20 19:22:22 +00:00
Robert Watson
68548aa4c6 Correct merge-o: make sure to unlock symmetrically socket buffer
locks on bluetooth sockets when clearing upcall flags.

Submitted by:	emax
2004-06-18 05:09:42 +00:00
Robert Watson
9535efc00d Merge additional socket buffer locking from rwatson_netperf:
- Lock down low hanging fruit use of sb_flags with socket buffer
  lock.

- Lock down low hanging fruit use of so_state with socket lock.

- Lock down low hanging fruit use of so_options.

- Lock down low-hanging fruit use of sb_lowwat and sb_hiwat with
  socket buffer lock.

- Annotate situations in which we unlock the socket lock and then
  grab the receive socket buffer lock, which are currently actually
  the same lock.  Depending on how we want to play our cards, we
  may want to coallesce these lock uses to reduce overhead.

- Convert a if()->panic() into a KASSERT relating to so_state in
  soaccept().

- Remove a number of splnet()/splx() references.

More complex merging of socket and socket buffer locking to
follow.
2004-06-17 22:48:11 +00:00
Poul-Henning Kamp
f3732fd15b Second half of the dev_t cleanup.
The big lines are:
	NODEV -> NULL
	NOUDEV -> NODEV
	udev_t -> dev_t
	udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.
2004-06-17 17:16:53 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Robert Watson
c0b99ffa02 The socket field so_state is used to hold a variety of socket related
flags relating to several aspects of socket functionality.  This change
breaks out several bits relating to send and receive operation into a
new per-socket buffer field, sb_state, in order to facilitate locking.
This is required because, in order to provide more granular locking of
sockets, different state fields have different locking properties.  The
following fields are moved to sb_state:

  SS_CANTRCVMORE            (so_state)
  SS_CANTSENDMORE           (so_state)
  SS_RCVATMARK              (so_state)

Rename respectively to:

  SBS_CANTRCVMORE           (so_rcv.sb_state)
  SBS_CANTSENDMORE          (so_snd.sb_state)
  SBS_RCVATMARK             (so_rcv.sb_state)

This facilitates locking by isolating fields to be located with other
identically locked fields, and permits greater granularity in socket
locking by avoiding storing fields with different locking semantics in
the same short (avoiding locking conflicts).  In the future, we may
wish to coallesce sb_state and sb_flags; for the time being I leave
them separate and there is no additional memory overhead due to the
packing/alignment of shorts in the socket buffer structure.
2004-06-14 18:16:22 +00:00
Julian Elischer
a974ba0b70 Add the capacity for the rfc1490 node to handle cisco style encasulation
which is often used alongside rfc1490 in frame relay links.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
2004-06-13 15:44:00 +00:00
Robert Watson
395a08c904 Extend coverage of SOCK_LOCK(so) to include so_count, the socket
reference count:

- Assert SOCK_LOCK(so) macros that directly manipulate so_count:
  soref(), sorele().

- Assert SOCK_LOCK(so) in macros/functions that rely on the state of
  so_count: sofree(), sotryfree().

- Acquire SOCK_LOCK(so) before calling these functions or macros in
  various contexts in the stack, both at the socket and protocol
  layers.

- In some cases, perform soisdisconnected() before sotryfree(), as
  this could result in frobbing of a non-present socket if
  sotryfree() actually frees the socket.

- Note that sofree()/sotryfree() will release the socket lock even if
  they don't free the socket.

Submitted by:	sam
Sponsored by:	FreeBSD Foundation
Obtained from:	BSD/OS
2004-06-12 20:47:32 +00:00
Julian Elischer
a65d0dc8f2 Now that mbufs are allocated using uma,
don't check for accidental usage of mbuf 'how' flags as
they are the same thing.
2004-06-07 22:11:12 +00:00
Robert Watson
2658b3bb8e Integrate accept locking from rwatson_netperf, introducing a new
global mutex, accept_mtx, which serializes access to the following
fields across all sockets:

          so_qlen          so_incqlen         so_qstate
          so_comp          so_incomp          so_list
          so_head

While providing only coarse granularity, this approach avoids lock
order issues between sockets by avoiding ownership of the fields
by a specific socket and its per-socket mutexes.

While here, rewrite soclose(), sofree(), soaccept(), and
sonewconn() to add assertions, close additional races and  address
lock order concerns.  In particular:

- Reorganize the optimistic concurrency behavior in accept1() to
  always allocate a file descriptor with falloc() so that if we do
  find a socket, we don't have to encounter the "Oh, there wasn't
  a socket" race that can occur if falloc() sleeps in the current
  code, which broke inbound accept() ordering, not to mention
  requiring backing out socket state changes in a way that raced
  with the protocol level.  We may want to add a lockless read of
  the queue state if polling of empty queues proves to be important
  to optimize.

- In accept1(), soref() the socket while holding the accept lock
  so that the socket cannot be free'd in a race with the protocol
  layer.  Likewise in netgraph equivilents of the accept1() code.

- In sonewconn(), loop waiting for the queue to be small enough to
  insert our new socket once we've committed to inserting it, or
  races can occur that cause the incomplete socket queue to
  overfill.  In the previously implementation, it was sufficient
  to simply tested once since calling soabort() didn't release
  synchronization permitting another thread to insert a socket as
  we discard a previous one.

- In soclose()/sofree()/et al, it is the responsibility of the
  caller to remove a socket from the incomplete connection queue
  before calling soabort(), which prevents soabort() from having
  to walk into the accept socket to release the socket from its
  queue, and avoids races when releasing the accept mutex to enter
  soabort(), permitting soabort() to avoid lock ordering issues
  with the caller.

- Generally cluster accept queue related operations together
  throughout these functions in order to facilitate locking.

Annotate new locking in socketvar.h.
2004-06-02 04:15:39 +00:00
Ruslan Ermilov
58acf05ade Removed a leftover from the previous change.
Submitted by:	Gleb Smirnoff
2004-06-01 13:15:32 +00:00
Robert Watson
36568179e3 The SS_COMP and SS_INCOMP flags in the so_state field indicate whether
the socket is on an accept queue of a listen socket.  This change
renames the flags to SQ_COMP and SQ_INCOMP, and moves them to a new
state field on the socket, so_qstate, as the locking for these flags
is substantially different for the locking on the remainder of the
flags in so_state.
2004-06-01 02:42:56 +00:00
Poul-Henning Kamp
5dba30f15a add missing #include <sys/module.h> 2004-05-30 20:27:19 +00:00
Julian Elischer
991fc65a92 Add a new netgraph method to allow restoration of some
behaviour lost in the change from 4.x style netgraph tee nodes.
Alter the tee node to use the new method. Document the behaviour.

Step the ABI version number... old netgraph klds will refuse to load.
Better than just crashing.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
2004-05-29 07:21:46 +00:00
Julian Elischer
3eb483729e Missed these in the last commit.
Change to C99 structure initialisation for the type method structure.
2004-05-29 07:16:49 +00:00
Julian Elischer
f8aae7776f Switch to using C99 sparse initialisers for the type methods array.
Should make no binary difference.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
Reviewed by:	Harti Brandt <harti@freebsd.org>
MFC after:	1 week
2004-05-29 00:51:19 +00:00
Warner Losh
dba6dd177b Move to generating pccarddevs.h on the fly, both for the kernel and
the modules.

Also generate usbdevs.h automatically now, but a non-kernel file is
stopping that at the moment.
2004-05-26 00:53:10 +00:00
Julian Elischer
bac74dea2f Use NG_HOOKSIZ instead of the deprecated (NG_HOOKLEN + 1) 2004-05-24 20:41:40 +00:00
Ruslan Ermilov
9573c7e9cf Whitespace nit. 2004-05-19 11:35:03 +00:00
Ruslan Ermilov
171e08dc7f Maintain statistics about the received frames. 2004-05-19 11:26:33 +00:00
Archie Cobbs
1a292b8015 Allow ng_ether "lower" and "orphans" hooks to be connected at the same time.
Reviewed by:	julian
PR:		kern/63317
2004-05-16 19:31:35 +00:00
Maksim Yevmenkin
73a4a9a759 Mode few Bluetooth defines into system include files
Reviewed by:	imp
2004-05-10 02:24:56 +00:00
John Polstra
0a4a8041ba Fix a memory leak in ng_get_string_token. A dynamically-allocated
buffer wasn't freed if the function failed.

MFC after:	3 days
2004-04-29 01:37:11 +00:00
Maksim Yevmenkin
b84b10f92f Address few style issues pointed out by bde
Reviewed by:	bde, ru
2004-04-27 16:38:15 +00:00
Archie Cobbs
922ee196d9 Add 'enableWindowing' configuration knob to the ng_pptpgre(4) netgraph node.
Submitted by:	Michael Bretterklieber <mbretter@a-quadrat.at>
MFC after:	2 weeks
2004-04-26 14:26:54 +00:00
Maksim Yevmenkin
48bd0712bc Make sure RFCOMM multiplexor channel does not hang in DISCONNECTING
state. Apparently it happens when both devices try to disconnect RFCOMM
multiplexor channel at the same time.

The scenario is as follows:

- local device initiates RFCOMM connection to the remote device. This
  creates both RFCOMM multiplexor channel and data channel;

- remote device terminates RFCOMM data channel (inactivity timeout);

- local device acknowledges RFCOMM data channel termination. Because
  there is no more active data channels and local device has initiated
  connection it terminates RFCOMM multiplexor channel;

- remote device does not acknowledges RFCOMM multiplexor channel
  termination. Instead it sends its own request to terminate RFCOMM
  multiplexor channel. Even though local device acknowledges RFCOMM
  multiplexor channel termination the remote device still keeps
  L2CAP connection open.

Because of hanging RFCOMM multiplexor channel subsequent RFCOMM
connections between local and remote devices will fail.

Reported by:	Johann Hugo <jhugo@icomtek.csir.co.za>
2004-04-23 20:21:17 +00:00
Luigi Rizzo
212b6d5244 + rename and document an unused field in struct arpcom (field is still
there so there are no ABI changes);
+ replace 5 redefinitions of the IPF2AC macro with one in if_arp.h

Eventually (but before freezing the ABI) we need to get rid of
struct arpcom (initially with the help of some smart #defines
to avoid having to touch each and every driver, see below).

Apart from the struct ifnet, struct arpcom now only stores a copy
of the MAC address (ac_enaddr, but we already have another copy in
the struct ifnet -- if_addrhead), and a netgraph-specific field
which is _always_ accessed through the ifp, so it might well go
into the struct ifnet too (where, besides, there is already an entry
for AF_NETGRAPH data...)

Too bad ac_enaddr is widely referenced by all drivers. But
this can be fixed as follows:

#define ac_enaddr       ac_if.the_original_ac_enaddr_in_struct_ifnet

(note that the right hand side would likely be a pointer rather than
the base address of an array.)
2004-04-18 01:15:32 +00:00
Ruslan Ermilov
dfa515f294 Don't give up if sending to one link fails, continue.
Suggested by:	jmallett
2004-04-17 23:52:57 +00:00
Ruslan Ermilov
b462702f94 A simple packet distribution node type that acts like an Ethernet hub. 2004-04-17 12:42:17 +00:00
Luigi Rizzo
7affdebea2 Consistently use ifaddr_byindex() to access the link-level address
of an interface. No functional change.

On passing, comment an useless invocation of TAILQ_INIT(&ifp->if_addrhead)
which could probably be removed in the interest of clarity.
2004-04-16 08:15:37 +00:00
Maksim Yevmenkin
4ae439a316 Make sure Bluetooth stuff can be compiled on amd64
Submitted by:	ps
2004-04-09 23:01:42 +00:00
Archie Cobbs
2c9027fcba Rename internal structure to fix cut & paste error.
Submitted by:	Bjoern A. Zeeb <bzeeb+freebsd@zabbadoz.net>
MFC After:	3 days
2004-04-04 21:33:09 +00:00
Roman Kurakin
8b96678536 sppp (4) to netgraph (4) node. As always: I'l connect it to the
system after extra check.

Approved by:	imp (mentor)
Approved by:	julian (in general)
2004-03-24 17:24:01 +00:00
Julian Elischer
ba9c6c61b2 Don't duplicate a packet, just to throw it away when we discover the
duplicat hook is not connected.
2004-03-24 08:53:45 +00:00
Julian Elischer
0598ef01ee Dont count bytes being sent to a disconnected hook.
MFC after:	3 days
2004-03-22 01:15:28 +00:00
David Malone
f6fee71d57 Make the vaule of PTT_RELAY_SID match the RFC. This should help PPPoE
users that are working with relayed PPPoE.

Submitted by:	Bodo Rüskamp <jordbaer@mac.com>
PR:		44936
Approved by:	julian
MFC after:	1 week
2004-03-18 12:34:14 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Benno Rice
bde778e9f2 Add a netgraph node to handle ATM LLC encapsulation. This currently handles
ethernet (tested) and FDDI (not tested).  The main use for this is on ADSL (or
other ATM) connections where bridged ethernet is used, PPPoE being a prime
example.

There is no manual page as yet, I will write one shortly.

Reviewed by:	harti
2004-03-08 10:54:35 +00:00
Ruslan Ermilov
1164db57e4 Implemented the "getifindex" control message.
PR:		kern/63864
Submitted by:	Gleb Smirnoff
2004-03-07 23:00:44 +00:00
Ruslan Ermilov
407ea29095 Netgraph node type for IEEE 802.1Q VLAN tagging. 2004-03-01 17:22:16 +00:00
Robert Watson
746e5bf09b Rename dup_sockaddr() to sodupsockaddr() for consistency with other
functions in kern_socket.c.

Rename the "canwait" field to "mflags" and pass M_WAITOK and M_NOWAIT
in from the caller context rather than "1" or "0".

Correct mflags pass into mac_init_socket() from previous commit to not
include M_ZERO.

Submitted by:	sam
2004-03-01 03:14:23 +00:00
Poul-Henning Kamp
917a7daac3 Unconst. Somebody didn't compile LINT. 2004-02-24 22:16:40 +00:00
Colin Percival
3f54070bd2 Check that a pointer is non-NULL before dereferencing it, not after.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-24 18:01:43 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
c9c7976f7f Device megapatch 1/6:
Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.
2004-02-21 19:42:58 +00:00
Pawel Jakub Dawidek
3c976c3f95 Backout previous change, it breaks build and it is not needed
layering violation. As pointed out, there is much better way to do this.
Sorry guys, I need to find a better way to force reviews.

Requested by:	harti, julian, scottl (mentor)
Pointy hat to:	pjd
2004-02-20 08:26:27 +00:00
Pawel Jakub Dawidek
51e9da0539 Add new failure detection algorithm.
It works as follows:
In every 'interval' seconds defined links are checked.
If they are non-active they will not be used by to data transfer.

No response from:	julian, archie
Silent on:		net@
Approved by:		scottl (mentor)
2004-02-19 17:04:23 +00:00
Pawel Jakub Dawidek
d592e95ba7 Export private structure owned by ng_ether(4) module outside.
It'll is required by new failure detection algorithm for ng_one2many(4).

No response from:	julian, archie
Silent on:		net@
Approved by:		scottl (mentor)
2004-02-19 16:58:01 +00:00
Hartmut Brandt
a1adb510b2 Use the official ng_timeout function to trigger sending. This means,
that we can get rid of of all the spl*() calls, because ng_timeout
handles the locking issues.
2004-01-30 15:34:57 +00:00
Ruslan Ermilov
4296e6f8b8 Correct the description of the net.graph.recvspace sysctl. 2004-01-27 22:02:01 +00:00
Hartmut Brandt
4e0dea9a30 Don't confuse NULL and 0, use 0 where an integer is expected. 2004-01-27 10:46:33 +00:00
Hartmut Brandt
76bd585721 Style: add __FBSDID, relocate some { that were on the wrong line,
correct some indendation, change __FUNCTION__ to __func__ and remove
a local KASSERT definition.
2004-01-27 10:45:37 +00:00
Hartmut Brandt
bbee16c0b9 Replace deprecated NG_NODELEN with the new NG_NODESIZ. There is one
problem here still to be solved: the sockaddr_hci has still a 16 byte
field for the node name. The code currently does not correctly use the
length field in the sockaddr to handle the address length, so
node names get truncated to 15 characters when put into a sockaddr_hci.
2004-01-26 15:19:43 +00:00
Hartmut Brandt
211326affc Get rid of the old *LEN constants in favour of the new *SIZ constants
that also include the trailing \0 byte.
2004-01-26 14:57:49 +00:00
Hartmut Brandt
46005fe0eb Define the new command NGM_SOURCE_START_NOW to allow generation of
traffic for non-ethernet hooks. This commit should have been packaged
with the commit to ng_source.c.
2004-01-26 14:54:39 +00:00
Hartmut Brandt
f5d15522f7 Make ng_source to work with non-ethernet interfaces. We do this by
introducing a START_NOW command. This command does not send
and GET_IFINDEX message downstream (to wait for the response from
the ETHERNET node), but directly starts the sending process. This allows
one to generate traffic as input for any hook on any node.
2004-01-26 14:53:16 +00:00
Hartmut Brandt
2cafef3ea4 Declare a function to silence a warning. 2004-01-26 14:48:21 +00:00
Hartmut Brandt
81a4ef8131 Should use the non-locking versions of the ifqueue macros to
fiddle around with private queues, because their mutex is not
needed. All this processing should be protected by the netgraph
locking.
2004-01-26 14:46:35 +00:00
Hartmut Brandt
b1b70498ba Replace a call to bzero() with an M_ZERO flag. Replace the MALLOC() with
malloc().
2004-01-26 14:44:36 +00:00
Hartmut Brandt
4321c5077c The version in the type description must be the ABI version, not
the netgraph version.

Correct the return type of a function: it wants to return an error
code, so it cannot be void.
2004-01-26 14:14:09 +00:00
Hartmut Brandt
87e2c66a6a Get rid of the deprecated *LEN constants in favour of the new
*SIZ constants that include the trailing \0 byte.
2004-01-26 14:05:31 +00:00
Hartmut Brandt
2c858ebee0 Get rid of the deprecated *LEN constants and use the new *SIZ
(that include the trailing \0) constants instead.
2004-01-26 12:24:07 +00:00