Commit graph

566 commits

Author SHA1 Message Date
Gleb Smirnoff 810d5e89f4 Add two new netgraph messages NGM_ETHER_ADD_MULTI and NGM_ETHER_DEL_MULTI,
to join and leave Ethernet multicast membership, respectively. Messages
take MAC address as argument.

Sponsored by:	Rinet ISP
2005-02-12 11:41:32 +00:00
Ruslan Ermilov 953a8b2e6d Removed redundant MODULE_VERSION(). 2005-02-12 11:14:25 +00:00
Gleb Smirnoff 687809752d Make netgraph ISR and callout MPSAFE.
Reviewed by:	rwatson, ru
2005-02-12 09:52:36 +00:00
Gleb Smirnoff 06a411d34c style: fix indentation and spacing.
Submitted by:	ru
2005-02-11 23:17:50 +00:00
Gleb Smirnoff 8c6f962996 Do not trust ipfw: check m_len always, not only after m_dup.
Submitted by:	ru
2005-02-11 23:07:22 +00:00
Gleb Smirnoff aa4e078a04 - do m_pullup() after m_dup()
- clean style in previous commit

Suggested by:	ru
2005-02-11 22:28:58 +00:00
Gleb Smirnoff 0a1a279e93 pullup to sizeof struct ip before sending to ip_output.
Suggested by:	ru
2005-02-11 21:26:39 +00:00
Gleb Smirnoff 19b5577638 Packets from ipfw come with IP header in host byte order. Netgraph works
with net byte order. Change byte order to net in ng_ipfw_input(), change
byte order to host before ip_output(), do not change before ip_input().

In collaboration with:	ru
2005-02-11 20:53:41 +00:00
Poul-Henning Kamp b1cb412630 Make M_NETGRAPH_ETF static 2005-02-10 12:26:57 +00:00
Archie Cobbs 25b67768f0 Fix incorrect comment.
Submitted by:	James Bowman <jamesb@acelere.net>
2005-02-10 02:43:26 +00:00
Ruslan Ermilov 195cf61776 In revision 1.29 timeout() was converted to ng_callout().
The difference is that the callout function installed via the
ng_callout() method is guaranteed to NOT fire after the shutdown
method was run (when a node is marked NGF_INVALID).  Also, the
shutdown method and the callout function are guaranteed to NOT
run at the same time, as both require the writer lock.  Thus
we can safely ignore a zero return value from ng_uncallout()
(callout_stop()) in shutdown methods, and go on with freeing
the node.

The said revision broke the node shutdown -- ng_bridge_timeout()
is no longer fired after ng_bridge_shutdown() was run, resulting
in a memory leak, dead nodes, and inability to unload the module.
Fix this by cancelling the callout on shutdown, and moving part
responsible for freeing a node resources from ng_bridge_timer()
to ng_bridge_shutdown().

Noticed by:	ru
Submitted by:	glebius, ru
2005-02-09 15:14:44 +00:00
Ruslan Ermilov a921fb33b6 bzero() -> M_ZERO. 2005-02-08 10:31:55 +00:00
Gleb Smirnoff ad1376cc73 Improve parsing of hook name.
Submitted by:	ru
2005-02-07 11:16:07 +00:00
Gleb Smirnoff 2c42caf7f0 Whitespace. 2005-02-06 19:24:59 +00:00
Gleb Smirnoff 50633c3a9f Remove comment which left after removal of ng_rcvdataq_t.
MFC after:	1 week
2005-02-06 19:20:16 +00:00
Gleb Smirnoff 4feaf224b8 Increase size of arglen to uint32_t, since uint16_t proved to be
not enough (e.g. listing 911 nodes). Bump NG_VERSION.

Reviewed by:	julian, archie, ru
2005-02-05 23:23:14 +00:00
Gleb Smirnoff 670742a102 Add a ng_ipfw node, implementing a quick and simple interface between
ipfw(4) and netgraph(4) facilities.

Reviewed by:	andre, brooks, julian
2005-02-05 12:06:33 +00:00
Gleb Smirnoff d1240630b3 Expire aged flows in normal expiry thread. This fixes the problem, when
a node disconnected from all sources of traffic never purges its cache.
2005-02-05 10:00:04 +00:00
Gleb Smirnoff 020d3f61d8 Break long lines in code and comments. 2005-02-05 09:08:33 +00:00
Ruslan Ermilov 30aabc9afd Create a per-module mutex on MOD_LOAD, and destroy it on MOD_UNLOAD.
(This fixes witness_destroy() panic after module unload.)

OK'ed by:	rwatson, julian
2005-02-05 08:28:36 +00:00
Gleb Smirnoff a436589ae2 Do check that version of a message from userland matches ours.
MFC after:	3 days
2005-02-04 21:38:42 +00:00
Gleb Smirnoff 7a1725fc46 - Fix build with TRACE_MESSAGES defined
- Remove extra parenthesis
2005-02-04 16:08:20 +00:00
Ruslan Ermilov 72369c34ac Parse "getifname" using the standard parse string type.
Fixed an off-by-one error when dealing with interface name
(if_xname is NUL-terminated).

Don't waste time making a copy of if_xname in constructor.
2005-02-03 13:03:31 +00:00
Ruslan Ermilov 96f82336ba Fixed an off-by-one error when dealing with interface name
(if_xname is NUL-terminated).

Don't waste time making a copy of if_xname in attach().
2005-02-03 12:54:18 +00:00
Ruslan Ermilov bbb75d7844 Fixed an off-by-one error when dealing with interface name
(if_xname is IFNAMSIZ-sized and NUL-terminated).
2005-02-03 12:50:10 +00:00
Ruslan Ermilov c60878f0d2 Added ASCII version of the NGM_EIFACE_GET_IFNAME message, "getifname". 2005-02-03 11:52:42 +00:00
Ruslan Ermilov c266fbc2aa Removed unused includes. 2005-02-03 11:28:53 +00:00
Ruslan Ermilov fcee8ae2e5 Fix the comment. 2005-02-02 14:02:40 +00:00
Ruslan Ermilov 48039d2d1d Whitespace and "const" changes to reduce diffs to RELENG_4.
(Gives the same object when compiled without NETGRAPH_DEBUG.)
2005-02-02 13:27:03 +00:00
Gleb Smirnoff 6aa1da2917 In case of various tunneling protocols, mbuf may pass several interfaces
before entering ng_netflow. In this case it will have not NULL m_pkthdr.rcvif.
However, it will enter ng_iface soon with another index. So let in_ifIndex
value configured by user override m_pkthdr.rcvif.

Reported by:	Damir Bikmuhametov
MFC after:	1 week
2005-02-01 14:07:05 +00:00
Gleb Smirnoff 1fbb36ff80 Rename ng_callout_trapoline to ng_callout_trampoline.
Requested by:	ru
2005-01-26 09:01:50 +00:00
Gleb Smirnoff 7b26345646 With recent changes to _callout_stop_safe() we can remove a hack
in ng_uncallout().
2005-01-25 22:08:19 +00:00
Gleb Smirnoff 19724144d6 Fix an evil typo.
Submitted by:	Roselyn Lee
MFC after:	3 days
2005-01-24 13:32:19 +00:00
Gleb Smirnoff 18c54fe665 Use log() instead of printf(), to reduce flood on console.
MFC after:	1 week
2005-01-20 13:28:39 +00:00
Roman Kurakin 5e93f2e558 Ups, misprint, change and => add.
Submitted by: ru
2005-01-16 23:30:45 +00:00
Roman Kurakin 67fb03d261 Fix comment. Code 0x95 means locking shift to codeset 5 according to
T1.617 AnnexD.
Locking shift procedure is described in ANSI T1.607.

MFC after:	3 days
2005-01-16 19:22:09 +00:00
Roman Kurakin d62d2396c3 Fix variable name in comment num=>alen. (Lost part of commit rev 1.2)
MFC after:	3 days
2005-01-16 19:12:27 +00:00
Gleb Smirnoff d0aa4b3fa0 Raise & drop IFF_RUNNING upon receival of netgraph flow control
messages.
2005-01-14 11:55:07 +00:00
Gleb Smirnoff e3d0434573 Consider IFF_UP as "administratively up" flag, and IFF_RUNNING as
"operationally up" flag. Hence this, revert 1.35 to use IFF_RUNNING.
2005-01-14 11:52:45 +00:00
Gleb Smirnoff d1426d7fc5 Locking and cleanup of tty netgraph node. Tty stack is Giant-locked,
so we need to acquire Giant in netgraph methods, so that we don't
race with line discipline methods. Remove NET_NEEDS_GIANT.

- Packets coming into node from netgraph are queued in ifqueue
  attached to node private data.
- Mutex in struct ifqueue is used to lock not only the queue, but
  the whole private data, and tp->t_lsc field.
- tp->t_lsc pointer is used to indicate whether line discipline is
  attached to netgraph or not.
- Use FLG_DIE flag to indicate that node may be destroyed.
  (This protection doesn't work, and it didn't before. Must be redesigned.)
- Increment ngt_unit atomically, removing mutex.
- Acquire Giant, when executing ngt_start() from netgraph context.
- Acquire Giant, when {,de}registering line discipline.
- Uncomment forcing queue mode on peers hook, since this is reasonable.
- Force queue mode on our hook, to avoid acquiring Giant when coming from
  network stack. We may already hold some mutexes at this point.

Cleanups:
- Use callout_pending() instead of our own flag.
- Remove spl(9) calls. Now we can use return() instead of ERROUT().

style(9):
- Sort includes.
- Sparse initializer for struct linesw.
- Remove some empty lines, sort declarations.

Reviewed by:	julian, phk
MFC after:	1 month
2005-01-13 07:43:12 +00:00
Gleb Smirnoff dc2f4d7f5f Utilize callout_pending() macro 2005-01-11 12:20:28 +00:00
Gleb Smirnoff 9ce4c18856 - Use ng_callout() instead of timeout(9).
- Remove spl(9) calls.

XXX:	not tested
2005-01-11 11:59:59 +00:00
Gleb Smirnoff c00e2d15b7 - Use ng_callout() instead of home-grown implementation.
Submitted by:	emax
2005-01-11 11:55:56 +00:00
Gleb Smirnoff 0ef8db8ff2 - Use ng_callout() instead of callout_reset(9).
- Use callout_pending() instead of our own flags.
- Remove home-grown protection of node, which has a scheduled
  callout().
- Remove spl(9) calls.

Tested by:	bz
2005-01-11 11:51:17 +00:00
Maksim Yevmenkin 980b8b89eb Make default RFCOMM session MTU match default L2CAP MTU.
This is just a workaround for a know problem with Motorola E1000
phone. Something is wrong with the configuration of L2CAP/RFCOMM
channel. Even though we set L2CAP MTU to 132 bytes (default RFCOMM
MTU 127 + 5 bytes RFCOMM frame header) and the phone accepts it,
the phone still sends oversized L2CAP packets. It appears that the
phone wants to use bigger (667 bytes) RFCOMM frames, but it does
not segment them according to the configured L2CAP MTU. The 667
bytes RFCOMM frame size corresponds to the default L2CAP MTU of
672 bytes (667 + 5 bytes RFCOMM frame header).

This problem only appears if connection was initiated from the
phone. I'm not sure who is at fault here, so for now just put
workaround in place. Quick look at the spec did not reveal any
anwser.

Tested by:	Jes < jjess at freebsd dot polarhome dot com >
MFC after:	3 days
2005-01-11 01:39:53 +00:00
Gleb Smirnoff 1c7899c74e This change adds reliability for Ethernet trunks built with ng_one2many:
- Introduce another ng_ether(4) callback ng_ether_link_state_p, which
  is called from if_link_state_change(), every time link is changed.
- In ng_ether_link_state() send netgraph control message notifying
  of link state change to a node connected to "lower" hook.

Reviewed by:	sam
MFC after:	2 weeks
2005-01-08 12:42:03 +00:00
Warner Losh c398230b64 /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
Maksim Yevmenkin aa38f8f98c Introduce new startup level SI_SUB_NETGRAPH that is after
SI_SUB_INIT_IF but before SI_SUB_DRIVERS. Make Netgraph(4)
framework initialize at SI_SUB_NETGRAPH level.

This does not address the bigger problem: MODULE_DEPEND
does not seem to work when modules are compiled in the
kernel, but it fixes the problem with Netgraph Bluetooth
device drivers reported by a few folks.

PR:		i386/69876
Reviewed by:	julian, rik, scottl
MFC after:	3 days
2005-01-06 17:45:03 +00:00
Roman Kurakin a34891c667 Kill a half dead comment. It's first half was killed in rev 1.12.
MFC after:	3 days
2005-01-04 21:59:09 +00:00
Maksim Yevmenkin 6a2dbfa47f Rename 'class' field to 'uclass' in the ng_hci_inquiry_response structure.
class is a reserved word in C++

Submitted by:	Markus Brueffer < markus AT brueffer DOT de >
MFC after:	3 days
2005-01-04 20:13:48 +00:00