673 Commits

Author SHA1 Message Date
glebius
9cf9c62adb MFC 1.115:
- When flushing node input queue, check whether item has a callback. If
    it does, then call it suppling ENOENT as error value.
  - Add assert, that helped to catch the above error.
2005-11-04 18:20:32 +00:00
thompsa
35a7273cfa MFC ng_ether support for if_bridge and cleanup of bridge hooks.
bridgestp.c; r1.8
 if_bridge.c; r1.25, 1.27
 if_bridgevar.h; r1.5
 if_ethersubr.c; r1.201, 1.202, 1.206
 ng_ether.c; r1.52 - 1.54

Approved by:	re (scottl)
2005-10-23 02:36:58 +00:00
tanimura
e04edc1b3f MFC 1.35: do not derefer NULL sc in ngt_input().
Approved by:	re (scottl)
2005-10-09 00:19:28 +00:00
glebius
be4f3d3a0f MFC typo fix from 1.75:
Dej'a vu of revision 1.35

  PR:		kern/86258
  Submitted by:	Hiroshi Oota <ghelp excite.co.jp>

Approved by:	re (kensmith)
2005-09-20 13:46:15 +00:00
glebius
2031716961 MFC 1.69:
When message can't fit into socket receive buffer return ENOBUFS
  to userland program instead of letting it wait until end of days.

  PR:	kern/85907

Approved by:	re (kensmith)
2005-09-20 13:42:20 +00:00
glebius
93d4651ace Merge locking of ng_pptpgre node. See 1.38, 1.39 log for longer
description.

Approved by:	re (kensmith)
2005-09-20 13:40:55 +00:00
glebius
f3983d158a MFC 1.7:
Plug item leak in case when not all hooks are connected.

  Found by:	David Vos <david.vos gmail.com>

Approved by:	re (kensmith)
2005-09-13 12:44:19 +00:00
glebius
3a2f67e4e3 MFC 1.68 by obrien:
Fix missing '=' in structure initialization.

Approved by:	re (kensmith)
2005-09-13 12:43:15 +00:00
glebius
7b7ee804e9 MFC 1.26 by ru:
Fixed parsing of unsigned integers.

Approved by:	re (kensmith)
2005-09-13 12:41:05 +00:00
glebius
a9f4fdf4f8 MFC 1.112:
Fix an item leak, that happens when some node calls ng_callout() two
  times consequently, without checking whether callout has been serviced
  or not. (ng_pptpgre and ng_ppp were catched in this behavior).

    - In ng_callout() save old item before calling callout_reset(). If the
      latter has returned 1, then free this item.
    - In ng_uncallout() clear c->c_arg.

  Problem reported by:    Alexandre Kardanev

Approved by:	re (kensmith)
2005-09-12 14:46:19 +00:00
glebius
1cb55cc44f MFC 1.57 (see original revision for full description):
- in ng_ksocket_incoming2() clear m_nextpkt on all mbufs
    read from socket.
  - restore rev. 1.54 change in ng_ksocket_incoming().

  PR:		kern/84952
  PR:		kern/82413
  In collaboration with:	rwatson

Approved by:	re (scottl)
2005-09-09 06:13:25 +00:00
glebius
0bc972befd MFC 1.109:
Raise one more bit in READER_MASK. I believe that before this change
  it was possible to have 1 reader and 1 writer thread working on
  a node simultaneously.

  Reviewed by:	julian

Approved by:	re (scottl)
2005-09-09 06:08:07 +00:00
glebius
4905127030 MFC 1.108, 1.110, 1.111:
Use non-debug macros inside debugging functions, to prevent
  important information from being rewritten.

  In INVARIANTS case also check that nodes do not pass queues of mbufs
  each other.

Approved by:	re (scottl)
2005-09-09 06:06:51 +00:00
emax
6e96afd69d MFC to RELENG 6
Fix dangling callout problem in the Bluetooth L2CAP code that leads to
panic. The panic happens when outgoing L2CAP connection descriptor is
deleted with the L2CAP command(s) pending in the queue. In this case when
the last L2CAP command is deleted (due to cleanup) and reference counter
for the L2CAP connection goes down to zero the auto disconnect timeout
is incorrectly set. pjd gets credit for tracking this down and committing
bandaid.

Reported by:	Jonatan B <onatan at gmail dot com>
Approved by:	re (scottl)
2005-09-03 03:34:23 +00:00
emax
21c9adb9b0 MFC to RELENG_6
Address minor locking issues. Use taskqueue_swi instead of taskqueue_swi_giant.

Approved by:	re (scottl)
2005-08-29 17:00:54 +00:00
emax
2b0bdd9bb3 MFC to RELENG_6
Make sure ng_fec_init() uses the same calling convention as the rest of
the code, i.e. ng_fec_init() is called with the ifp->if_softc pointer and
NOT with the ifp pointer.

PR:		kern/85239
Reviewed by:	brooks
Approved by:	re (scottl)
2005-08-29 16:23:21 +00:00
glebius
ff71da86ca MFC:
Backout revision 1.54, because it exposes a worse problem, than
  it fixes. I believe the problem lives somewhere outside ng_ksocket,
  but until it is found, let the node be working.

  PR:		kern/84952
  PR:		kern/82413

Approved by:	re (scottl)
2005-08-29 09:01:58 +00:00
emax
9547e540c3 MFC to RELENG_6
Fix multiple typos in the mutex names. This fixes false positive (and pretty
strange looking too) LORs I have seen on my system. Pointy hat to goes to me.

Approved by:	re (scottl)
2005-08-25 16:14:33 +00:00
rwatson
e13b2df854 Merge linux_ioctl.c:1.128 svr4_sockio.c:1.17 altq_cbq.c:1.3 if_oltr.c:1.38
if_pflog.c:1.14 if_pfsync.c:1.21 if_an.c:1.70 if_ar.c:1.72 if_arl.c:1.11
amrr.c:1.10 onoe.c:1.10 if_ath.c:1.101 awi.c:1.41 if_bfe.c:1.27
if_bge.c:1.93 if_cm_isa.c:1.7 smc90cx6.c:1.16 if_cnw.c:1.20 if_cp.c:1.25
if_cs.c:1.42 if_ct.c:1.26 if_cx.c:1.46 if_ed.c:1.256 if_em.c:1.68
if_en_pci.c:1.37 midway.c:1.66 if_ep.c:1.143 if_ex.c:1.58 if_fatm.c:1.20
if_fe.c:1.93 if_fwe.c:1.38 if_fwip.c:1.8 if_fxp.c:1.244 if_gem.c:1.33
if_hatm.c:1.25 if_hatm_intr.c:1.20 if_hatm_ioctl.c:1.13 if_hatm_rx.c:1.10
if_hatm_tx.c:1.14 if_hme.c:1.39 if_ie.c:1.104 if_ndis.c:1.101
if_ic.c:1.24 if_ipw.c:1.10 if_iwi.c:1.10 if_ixgb.c:1.13 if_lge.c:1.41
if_lnc.c:1.113 if_my.c:1.31 if_nge.c:1.77 if_nve.c:1.10 if_owi.c:1.12
if_patm.c:1.9 if_patm_intr.c:1.6 if_patm_ioctl.c:1.10 if_patm_tx.c:1.10
pdq_ifsubr.c:1.28 if_plip.c:1.38 if_ral.c:1.12 if_ral_pci.c:1.2
if_ray.c:1.81 if_rayvar.h:1.22 if_re.c:1.49 if_sbni.c:1.21 if_sbsh.c:1.14
if_sn.c:1.48 dp83932.c:1.21 if_snc_pccard.c:1.9 if_sr.c:1.70 if_tx.c:1.91
if_txp.c:1.33 if_aue.c:1.92 if_axe.c:1.32 if_cdce.c:1.8 if_cue.c:1.59
if_kue.c:1.66 if_rue.c:1.23 if_udav.c:1.16 if_ural.c:1.12 if_vge.c:1.16
if_vx.c:1.58 if_wi.c:1.185 if_wi_pci.c:1.26 if_wl.c:1.68 if_xe.c:1.60
if_xe_pccard.c:1.30 if_el.c:1.68 i4b_ipr.c:1.35 i4b_isppp.c:1.31
kern_poll.c:1.20 bridge.c:1.94 bridgestp.c:1.4 if_arcsubr.c:1.27
if_atm.h:1.24 if_atmsubr.c:1.40 if_bridge.c:1.16 if_ef.c:1.35
if_ethersubr.c:1.196 if_faith.c:1.37 if_fddisubr.c:1.100 if_fwsubr.c:1.14
if_gif.c:1.54 if_gre.c:1.34 if_iso88025subr.c:1.70 if_loop.c:1.107
if_ppp.c:1.106 if_spppsubr.c:1.121 if_tap.c:1.57 if_tun.c:1.154
if_vlan.c:1.80 ppp_tty.c:1.67 ieee80211_ioctl.c:1.32 atm_if.c:1.31
ng_eiface.c:1.33 ng_ether.c:1.50 ng_fec.c:1.19 ng_iface.c:1.44
ng_sppp.c:1.9 ip_carp.c:1.30 ip_fastfwd.c:1.30 in6.c:1.53 nd6_nbr.c:1.31
natm.c:1.40 if_dc.c:1.162 if_de.c:1.168 if_pcn.c:1.72 if_rl.c:1.154
if_sf.c:1.84 if_sis.c:1.135 if_sk.c:1.108 if_ste.c:1.86 if_ti.c:1.109
if_tl.c:1.101 if_vr.c:1.106 if_wb.c:1.81 if_xl.c:1.194 from HEAD to
RELENG_6:

  Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
  IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
  ifnet.if_drv_flags.  Device drivers are now responsible for
  synchronizing access to these flags, as they are in if_drv_flags.  This
  helps prevent races between the network stack and device driver in
  maintaining the interface flags field.

  Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
  some less so.

  Reviewed by:    pjd, bz

Approved by:	re (scottl)
2005-08-25 05:01:24 +00:00
julian
46484dc67f MFC: reduce warnings when compiled under -W.
Obtained from:	Sandvine inc.
Approved by:  re (ken)
2005-08-15 20:04:28 +00:00
glebius
ff5247fe56 MFC 1.10:
Check that we have first fragment before pulling up TCP/UDP header.

Approved by:	re (kensmith)
2005-08-10 15:00:57 +00:00
glebius
7943163abe MFC:
Enhance struct ng_hook - add hk_type field and bump NG_ABI_VERSION.

Approved by:	re (kensmith)
2005-08-10 14:58:18 +00:00
glebius
c3a5dea7f4 MFC 1.103, 1.105:
avoid recursion problems in netgraph(4). See 1.103 log for
more information.

Approved by:	re (kensmith)
2005-08-10 14:54:52 +00:00
emax
01e9f84530 Insta-MFC to RELENG_6
Fix typo and check correct (rsp) pointer against the NULL value.

Submitted by:	Oliver < urnenfel at tiscali dot es >
Approved by:	re (kensmith)
2005-07-29 16:42:42 +00:00
emax
d1df494821 MFC to RELENG_6 ng_ubt.c v1.25
Add support for AVM BlueFRITZ! USB Bluetooth Adapter v2.0. It appears that
there are at least two versions of the adapter. Version 1 (product ID 0x2200)
of the adapter does not work with ng_ubt(4) and require special driver and
firmware. Version 2 (product ID 0x3800) seems to work just fine, except it
does not have bDeviceClass, bDeviceSubClass and bDeviceProtocol set to required
(by specification) values. This change forces ng_ubt(4) to attach to the
version 2 adapter.

Ignore AVM BlueFRITZ! USB Bluetooth Adapter v1.0 (product ID 0x2200).
It does not work with ng_ubt(4) and require special driver and firmware.

Submitted by:	Rainer Goellner < rainer at jabbe dot de >
Approved by:	re (kensmith)
Obtained from:	Marcel Holtmann < marcel at holtmann dot org >
2005-07-25 16:22:38 +00:00
glebius
af3bb40686 Remove obsoleted sysctl interface for switching between standard and 3Com
PPPoE modes. The interface was declared obsoleted before 5.3-RELEASE.

When running as access concentrator ng_pppoe(4) supports both modes
simultanously. When running as client mode can be swicthed in ppp(8)
configuration.

Approved by:	re (scottl)
2005-07-05 17:51:02 +00:00
glebius
fcbdfd0eb4 In the splnet times, netgraph was functional and synchronous. Nowadays,
an item may be queued and processed later. While this is OK for mbufs,
this is a problem for control messages.

In the framework:
- Add optional callback function pointer to an item. When item gets
  applied the callback is executed from ng_apply_item().
- Add new flag NG_PROGRESS. If this flag is supplied, then return
  EINPROGRESS instead of 0 in case if item failed to deliver
  synchronously and was queued.
- Honor NG_PROGRESS in ng_snd_item().

In ng_socket:
- When userland sends control message add callback to the item.
- If ng_snd_item() returns EINPROGRESS, then sleep.

This change fixes possible races in ngctl(8) scripts.

Reviewed by:	julian
Approved by:	re (scottl)
2005-07-05 17:35:20 +00:00
glebius
9c25e36cc6 - After LibAlias processing check for TCP packet with th_x2 field
set. If found, then recalculate its checksum.
- Remove debugging printfs.
- Slightly rearrange code in ng_nat_rcvdata().

Approved by:	re (scottl)
2005-06-27 07:39:13 +00:00
dwmalone
f1f0123e88 Fix some long standing bugs in writing to the BPF device attached to
a DLT_NULL interface. In particular:

        1) Consistently use type u_int32_t for the header of a
           DLT_NULL device - it continues to represent the address
           family as always.
        2) In the DLT_NULL case get bpf_movein to store the u_int32_t
           in a sockaddr rather than in the mbuf, to be consistent
           with all the DLT types.
        3) Consequently fix a bug in bpf_movein/bpfwrite which
           only permitted packets up to 4 bytes less than the MTU
           to be written.
        4) Fix all DLT_NULL devices to have the code required to
           allow writing to their bpf devices.
        5) Move the code to allow writing to if_lo from if_simloop
           to looutput, because it only applies to DLT_NULL devices
           but was being applied to other devices that use if_simloop
           possibly incorrectly.

PR:		82157
Submitted by:	Matthew Luckie <mjl@luckie.org.nz>
Approved by:	re (scottl)
2005-06-26 18:11:11 +00:00
imp
8616206ff9 Eliminate unused argument in PCMCIA_CARD macro.
Provide a backwards compatible way to have the extra macro by defining
PCCARD_API_LEVEL 5 before including pccarddevs for driver writers that
want/need to have the same driver on 5 and 6 with pccard attachments.

Approved by: re (dwhite)
2005-06-24 14:36:54 +00:00
brooks
567ba9b00a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
glebius
8386a8457c - Remove redundant parenthesis in M_CHECK macro.
- Do not edit pullup_len outside M_CHECK macro.
- Do not reimplement NG_FWD_NEW_DATA().
- Remove redundant check for item being not NULL.

Submitted by:	ru
2005-06-10 12:44:21 +00:00
glebius
5e328f779e Add ng_tcpmss node, which alters MSS options of TCP packets. Useful to
hack MSS of packets outgoing via interface with small MTU, to workaround
path MTU discovery problems.

Written by Alexey Popov, with some cleanups from me. There are also plans
to improve mpd port, so that it uses this node, instead of doing MSS
hacking in userland, when 'enable tcpmssfix' option is on.

Submitted by:   Alexey Popov <lollypop@flexuser.ru>
2005-06-10 08:02:34 +00:00
ru
c8f81e4253 Refer to the mbuf header length field via the official method. 2005-06-09 10:27:27 +00:00
glebius
a7f80c758f Update statistics only in case if delivery was successfull. 2005-06-07 12:22:13 +00:00
glebius
f046c2926a MPPC node is not thread safe.
PR:		kern/79990
Reported by:	Arcadiy Ivanov
Reported by:	atckoe.zlo @ gmail.com
MFC after:	1 week
2005-06-03 09:06:00 +00:00
glebius
3a975e6c42 Fix check for leading zero, so that it does not block two zeroes
in hook name.
2005-05-29 12:20:41 +00:00
bz
d98e11da23 Fix use of uninitialized variable len in ngd_send.
Note: len gets intialized to 0 for sap == NULL case only to
make compiler on amd64 happy. This has nothing todo with the
former uninitialized use of len in sap != NULL case.

Reviewed by:	glebius
Approved by:	pjd (mentor)
2005-05-28 13:15:44 +00:00
emax
d8ef44d756 Move AVM USB Bluetooth-Adapter BlueFritz! from "broken" devices list
(where I incorrectly put it initially) to "ignored" devices list (where
it should be). Pointy hat goes to me.

MFC after:	3 days
2005-05-28 00:48:42 +00:00
glebius
54d1472c80 Remove local error variable, which leads to hiding error from return
value.

PR:		kern/81371
Submitted by:	Wojciech A. Koszek
MFC after:	1 week
2005-05-23 13:49:49 +00:00
glebius
fc2a32a0ae Return EINVAL for incorrect hook names.
PR:		kern/81349
Submitted by:	Wojciech A. Koszek
2005-05-23 13:39:20 +00:00
glebius
22196abfb6 - Unwind NG_SEND_MSG_PATH() macro and merge it with already unwinded
version under TRACE_MESSAGES.
- Pass NG_WAITOK flag to ng_package_data() in unwinded macro.
2005-05-17 12:18:13 +00:00
glebius
47fa63e791 Use NG_QUEUE instead of constant. 2005-05-16 19:52:42 +00:00
glebius
27540c786b Refactor places where ng_package_data() failed.
Suggested & reviewed by:	archie
2005-05-16 19:12:57 +00:00
glebius
206ba6ee3b - Fix build with TRACE_MESSAGES on.
- Reformat code under TRACE_MESSAGES to make it more readable.
- Move linker hackery out of #ifdef.
- Break long lines in linker hackery block.
2005-05-16 18:50:26 +00:00
glebius
30c28c4860 Close race between node being shutdown and socket being detached. To
do this, obtain netgraph locking in detach method via ng_send_fn1().

Reviewed by:	julian
MFC after:	2 weeks
2005-05-16 17:25:49 +00:00
glebius
cbf78c0d23 Catch up with new ng_package_data(). 2005-05-16 17:10:08 +00:00
glebius
697612a8ec Catch up with new ng_package_data(). Use NG_WAITOK on userland
path.
2005-05-16 17:09:35 +00:00
glebius
45938d54d3 - Catch up with new interface to ng_package_data().
- Handle errors from ng_package_data().
2005-05-16 17:08:53 +00:00
glebius
d4c770bc93 Catch up with new ng_send_fn1() interface. 2005-05-16 17:07:39 +00:00