1753 Commits

Author SHA1 Message Date
thompsa
b7b016a19f MFC r1.35, set IFF_BROADCAST on the interface 2005-12-07 03:10:42 +00:00
glebius
b7866a6d78 MFC 1.51:
Force this interface to be RUNNING.
2005-11-25 14:41:31 +00:00
glebius
5baa2f368f MFC 1.89:
- Do not raise IFF_DRV_OACTIVE flag in vlan_start, because this
    can lead to stalled interface
  - Explain this fact in a comment.

  Reviewed by:    rwatson, thompsa, yar
2005-11-25 14:34:05 +00:00
ru
539591f019 MFC: Use sparse initializers for "struct domain" and "struct protosw". 2005-11-16 10:31:23 +00:00
thompsa
f012cfe982 MFC: Sync bridge code up with HEAD
- plug mbuf and refcnt leak
 - make funtions static
2005-11-16 10:17:15 +00:00
ru
c474afb088 MFC: 1.203: Remove a stale comment. 2005-11-16 08:49:22 +00:00
csjp
516e77bfa8 MFC Log:
Before we export network interface data through the ifmibdata structure,
  OR the flags bits with the driver managed status flags.
2005-11-08 16:38:21 +00:00
ume
d87e40fcf5 MFC: scope cleanup. with this change
- most of the kernel code will not care about the actual encoding of
  scope zone IDs and won't touch "s6_addr16[1]" directly.
- similarly, most of the kernel code will not care about link-local
  scoped addresses as a special case.
- scope boundary check will be stricter.  For example, the current
  *BSD code allows a packet with src=::1 and dst=(some global IPv6
  address) to be sent outside of the node, if the application do:
    s = socket(AF_INET6);
    bind(s, "::1");
    sendto(s, some_global_IPv6_addr);
  This is clearly wrong, since ::1 is only meaningful within a single
  node, but the current implementation of the *BSD kernel cannot
  reject this attempt.

	sys/net/if_gif.c:		1.53
	sys/net/if_spppsubr.c:		1.120
	sys/netinet/icmp6.h:		1.19
	sys/netinet/ip_carp.c:		1.28,1.29
	sys/netinet/ip_fw2.c:		1.107
	sys/netinet/tcp_subr.c:		1.230,1.231,1.235
	sys/netinet/tcp_usrreq.c:	1.125
	sys/netinet6/ah_core.c:		1.26
	sys/netinet6/icmp6.c:		1.63,1.64
	sys/netinet6/in6.c:		1.52
	sys/netinet6/in6.h:		1.38
	sys/netinet6/in6_cksum.c:	1.11
	sys/netinet6/in6_ifattach.c:	1.27
	sys/netinet6/in6_pcb.c:		1.63
	sys/netinet6/in6_proto.c:	1.33
	sys/netinet6/in6_src.c:		1.31,1.32
	sys/netinet6/in6_var.h:		1.22
	sys/netinet6/ip6_forward.c:	1.29
	sys/netinet6/ip6_input.c:	1.83
	sys/netinet6/ip6_mroute.c:	1.30
	sys/netinet6/ip6_output.c:	1.95
	sys/netinet6/ip6_var.h:		1.33
	sys/netinet6/ipsec.c:		1.43
	sys/netinet6/mld6.c:		1.21
	sys/netinet6/nd6.c:		1.50
	sys/netinet6/nd6_nbr.c:		1.30
	sys/netinet6/nd6_rtr.c:		1.27
	sys/netinet6/raw_ip6.c:		1.54
	sys/netinet6/route6.c:		1.12
	sys/netinet6/scope6.c:		1.13,1.14,1.15
	sys/netinet6/scope6_var.h:	1.5
	sys/netinet6/udp6_output.c:	1.23
	sys/netinet6/udp6_usrreq.c:	1.55
	sys/netkey/key.c:		1.72,1.73
2005-11-04 20:26:16 +00:00
avatar
07ad715e98 MFC: (1.16) Fixing a name collision in module declaration by renaming
"firewire" to "if_firewire."  According to the PR originator and Cai's
test, this bug prevents a RELENG_6 GENERIC kernel from loading if_fwip.ko
and will panic the kernel if users compile "device fwip" into their
GENERIC kernel.

Approved by:	re (scottl)
2005-10-28 22:45:52 +00:00
thompsa
5fa108d1d5 MFC if_bridge r1.30
> If we have been called from ether_ifdetach() then do not try and clear the
> promisc flag from the member interface, this is a no-op anyway since the
> interface is disappearing. The driver may have already released
> its resources such as miibus and this is likely to panic the kernel.

Approved by:	re (scottl)
2005-10-27 19:41:43 +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
thompsa
73007defbe MFC: if_bridge.c r1.26, if_ethersubr.c r1.205
>   Use bridge_ifdetach() to notify the bridge that a member has been detached.
>   The bridge can then remove it from its interface list and not try to send
>   out via a dead pointer.

Approved by:	re (scottl)
2005-10-19 20:46:16 +00:00
glebius
97d261903e Big overall MFC of polling(4) cleanup:
o First attempt on removing Giant from polling. Details:
  http://lists.freebsd.org/pipermail/cvs-src/2005-September/051848.html
o Second attempt, and big polling cleanup including:
  - Functinal approach to turning polling on/off
  - Deprecating of poll_in_trap
  - Removal of ifnet knowledge from kern_poll.c
  Details:
  http://lists.freebsd.org/pipermail/cvs-src/2005-October/053267.html
o Improved checking of user configurable sysctls. Details:
  http://lists.freebsd.org/pipermail/cvs-src/2005-October/053351.html
o Moving DEVICE_POLLING from opt_global.h to opt_device_polling.h:
  http://lists.freebsd.org/pipermail/cvs-src/2005-October/053479.html

o All related documentation fixes.

Approved by:	re (kensmith)
Thanks to:	everyone, who helped with testing
2005-10-07 14:00:06 +00:00
thompsa
28e5001029 MFC: if_bridge.c r1.23
> Do not packet filter in the bridge_start() routine, locally generated packets
> are already filtered by the higher layers.

Approved by:	re (kensmith)
2005-10-06 20:43:24 +00:00
rwatson
9e61878b2e Merge netisr.c:1.16 from HEAD to RELENG_6:
Rename net.isr.enable to net.isr.direct.

  No compatibility code is provided, as this will be the production name
  as of 6.0.  Previously this has been an experimental and unsupported
  feature.

  Requested by:	scottl

Approved by:	re (kensmith)
2005-10-05 12:32:23 +00:00
csjp
0fcc9c347d MFC bpf.c v1.159
Make stats a bit more accurate by refreshing the PID after each
descriptor operation.

Approved by:	re (scottl)
2005-10-01 18:43:16 +00:00
csjp
a49552acda MFC privilege separation enhancements for bpf(4)
Introduce BIOCLOCK and BIOCSETWF

Revision(s)
    1.158     +81 -23    src/sys/net/bpf.c
    1.40      +2 -0      src/sys/net/bpf.h
    1.31      +4 -1      src/sys/net/bpfdesc.h

Approved by:	re (scottl)
2005-09-29 23:48:04 +00:00
rwatson
a15c06842e Merge if.c:1.247, in.c:1.88, in.h:1.92 from HEAD to RELENG_6:
Take a first cut at cleaning up ifnet removal and multicast socket
  panics, which occur when stale ifnet pointers are left in struct
  moptions hung off of inpcbs:

  - Add in_ifdetach(), which matches in6_ifdetach(), and allows the
    protocol to perform early tear-down on the interface early in
    if_detach().

  - Annotate that if_detach() needs careful consideration.

  - Remove calls to in_pcbpurgeif0() in the handling of SIOCDIFADDR --
    this is not the place to detect interface removal!  This also
    removes what is basically a nasty (and now unnecessary) hack.

  - Invoke in_pcbpurgeif0() from in_ifdetach(), in both raw and UDP
    IPv4 sockets.

  It is now possible to run the msocket_ifnet_remove regression test
  using HEAD without panicking.

  Reported by:	Gavin Atkinson <gavin dot atkinson at ury dot york dot ac dot uk>

Approved by:	re (scottl)
2005-09-29 20:57:07 +00:00
glebius
eea24f1858 MFC 1.113:
Several fixes to rt_setgate(), that fix problems with route changing:

  - Rearrange code so that in a case of failure the affected
    route is not changed. Otherwise, a bogus rtentry will be
    left and later rt_check() can recurse on its lock. [1]
  - Remove comment about protocol cloning.
  - Fix two places where rtentry mutex was recursed on, because
    accessed via two different pointers, that were actually pointing
    to the same rtentry in some cases. [1]
  - Return EADDRINUSE instead of bogus EDQUOT, in case when gateway
    uses the same route. [2]

  Reported & tested by:	ps, Andrej Zverev <az inec.ru> [1]
  PR:			kern/64090 [2]

Approved by:	re (scottl)
2005-09-26 14:59:12 +00:00
andre
3fe532433d MFC 1.160: Undo optimization which broke BIOCGSEESENT handling.
Approved by:	re (scottl)
2005-09-26 12:06:18 +00:00
thompsa
1d1e4f1a56 MFC: if_bridge.c, r1.22
> Fix an alignment panic my preserving the 2byte padding (ETHER_ALIGN) on our
> copied mbuf, which keeps the IP header 32-bit aligned. This copied mbuf is
> reinjected back into ether_input and off to the IP routines.
>
> Reported and tested by: Peter van Dijk

Approved by:	re (scottl), mlaier (mentor)
2005-09-25 20:36:02 +00:00
glebius
ea4e44a4c6 MFC 1.84 by yar:
Test the new M_VLANTAG packet flag before calling
  m_tag_locate().  This adds little overhead of a simple
  bitwise operation in case hardware VLAN acceleration
  is on, yet saves the more expensive function call if
  the acceleration is off.

  Reviewed by:	ru, glebius

Approved by:	re (kensmith)
2005-09-20 13:44:36 +00:00
csjp
79bee3e493 MFC v1.129 src/sys/net/rtsock.c
Make sysctl_rtsock MP safe.

Approved by:	re (scottl)
2005-09-20 01:59:54 +00:00
rwatson
6f1fd55954 Merge if.c:1.246 from HEAD to RELENG_6:
In netkqfilter(), return EINVAL instead of 1 (EPERM) when a filter type
  is requested on a network interface file descriptor that is
  non-applicable.

Approved by:	re (kensmith)
2005-09-15 20:53:22 +00:00
thompsa
12b6d396b7 MFC: if_bridge.c, r1.21; if_ethersubr.c, r1.198; in6_ifattach.c, r1.28;
nd6.c, r1.55; nd6_nbr.c, r1.33

> Add support for multicast to the bridge and allow inet6 addresses to be
> assigned to the interface.
>
> IPv6 auto-configuration is disabled. An IPv6 link-local address has a
> link-local scope within one link, the spec is unclear for the bridge case and
> it may cause scope violation.
>
> An address can be assigned in the usual way;
>   ifconfig bridge0 inet6 xxxx:...
>
> Tested by:      bmah
> Reviewed by:    ume (netinet6)
> Approved by:    mlaier (mentor)

Approved by:	re (kensmith), mlaier (mentor)
2005-09-13 18:02:39 +00:00
sam
fd987c5315 MFC 1.245: reclaim sbuf and clear lock on error in ifconf
Approved by:	re (scottl)
2005-09-08 22:43:10 +00:00
glebius
9015847fb5 Merge 1.82:
Fix fallout from revision 1.77, mark outgoing packets with M_VLANTAG flag.

  PR:		kern/80646
  Reviewed by:	yar

Approved by:	re (scottl)
2005-09-02 14:06:26 +00:00
thompsa
b24c9f9f85 MFC: if_bridge, r1.20
> Fix a panic in softclock() if the interface is destroyed with a bpf consumer
> attached.
>
> This is caused by bpf_detachd clearing IFF_PROMISC on the interface which does
> a SIOCSIFFLAGS ioctl. The problem here is that while the interface has been
> stopped, IFF_UP has not been cleared so IFF_UP != IFF_DRV_RUNNING, this causes
> the ioctl function to init() the interface which resets the callouts.
>
> The destroy then completes and frees the softc but softclock will panic on a
> dead callout pointer.
>
> Ensure ifp->if_flags matches reality by clearing IFF_UP when we destroy.

Approved by:	re (kensmith), mlaier (mentor)
2005-08-30 20:30:44 +00:00
thompsa
707f7071f3 MFC: bridgestp.c, r1.6; if_bridge.c, r1.18
> Mark the callouts as MPSAFE as if_bridge has been giant-free since day 1.
>
> Use the SMP friendly callout_init_mtx() while we are here.
>

Approved by:	re (kensmith), mlaier (mentor)
2005-08-30 20:26:53 +00:00
mlaier
9ffdae0a26 MFC: if_ethersubr.c, 1.197:
Don't loop back packets that have been routed by pf.  This fixes an
  endless loop where the same packet is sent over and over again.

  Obtained from:  OpenBSD
  Reported by:    Sergey Lapin
  Tested by:      Sergey Lapin

Approved by:	re (scottl)
2005-08-30 16:43:24 +00:00
rwatson
07d5c1227b Merge rtsock.c:1.127 from HEAD to RELENG_6:
De-spl parts of the routing socket code now generally protected
  through locking; leave some spl references around code where there
  are open questions about global variable references.  Also, add
  an XXX regarding locking in sysctl.

Approved by:	re (scottl)
2005-08-28 04:31:40 +00:00
thompsa
146f71c102 MFC: if_bridge.c, r1.19
> The mtu check in bridge_enqueue is bogus as the maximum Ethernet frame is
> actually 1514, so comparing the mbuf length which includes the Ethernet
> header
> to the interface MTU is wrong.
>
> The check was a little over the top so just remove it.

Approved by:	re (scottl), mlaier (mentor)
2005-08-26 20:00:25 +00:00
rwatson
1ee6a590fa White space sync: add missing line break.
Approved by:	re (kensmith - earlier whitespace fixes)
2005-08-25 05:44:06 +00:00
rwatson
03e9f7fc13 Merge if.h:1.98 from HEAD to RELENG_6:
For each interface flag, indicate whether or not it is owned by the
  device driver, owned by the network stack, or initialized by the device
  driver before attach and read-only from then on.

  Not all device drivers and network stack components currently follow
  these rules, especially with respect to IFF_UP, and a few exceptions
  with IFF_ALLMULTI.

Approved by:	re (scottl)
2005-08-25 05:02:28 +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
rwatson
8f8fa61d9b Merge if.c:1.242, if.h:1.97, if_var.h:1.102, rtsock.c:1.125 from HEAD
to RELENG_6:

  Rename IFF_RUNNING to IFF_DRV_RUNNING, IFF_OACTIVE to IFF_DRV_OACTIVE,
  and move both flags from ifnet.if_flags to ifnet.if_drv_flags, making
  and documenting the locking of these flags the responsibility of the
  device driver, not the network stack.  The flags for these two fields
  will be mutually exclusive so that they can be exposed to user space as
  though they were stored in the same variable.

  Provide #defines to provide the old names #ifndef _KERNEL, so that user
  applications (such as ifconfig) can use the old flag names.  Using the
  old names in a device driver will result in a compile error in order to
  help device driver writers adopt the new model.

  When exposing the interface flags to user space, via interface ioctls
  or routing sockets, or the two fields together.  Since the driver flags
  cannot currently be set for user space, no new logic is currently
  required to handle this case.

  Add some assertions that general purpose network stack routines, such
  as if_setflags(), are not improperly used on driver-owned flags.

  With this change, a large number of very minor network stack races are
  closed, subject to correct device driver locking.  Most were likely
  never triggered.

  Driver sweep to follow; many thanks to pjd and bz for the line-by-line
  review they gave this patch.

  Reviewed by:    pjd, bz

Approved by:	re (scottl)
2005-08-25 04:55:48 +00:00
rwatson
605eed31ef Merge if_atmsubr.c:1.38 from HEAD to RELENG_6:
Lock down netnatm and mark as MPSAFE:

  - Introduce a subsystem mutex, natm_mtx, manipulated with accessor macros
    NATM_LOCK_INIT(), NATM_LOCK(), NATM_UNLOCK(), NATM_LOCK_ASSERT().  It
    protects the consistency of pcb-related data structures.  Finer grained
    locking is possible, but should be done in the context of specific
    measurements (as very little work is done in netnatm -- most is in the
    ATM device driver or socket layer, so there's probably not much
    contention).

  - Remove GIANT_REQUIRED, mark as NETISR_MPSAFE, remove
    NET_NEEDS_GIANT("netnatm").

  - Conditionally acquire Giant when entering network interfaces for
    ifp->if_ioctl() using IFF_LOCKGIANT(ifp)/IFF_UNLOCKGIANT(ifp) in order
    to coexist with non-MPSAFE atm ifnet drivers..

  - De-spl.

  Reviewed by:    harti, bms (various versions)

Approved by:	re (hrs)
2005-08-24 18:10:51 +00:00
rwatson
5ff1ab3e14 Merge if_arcsubr.c:1.26, if_ethersubr.c:1.195, if_fddisubr.c:1.99,
if_iso88025subr.c:1.68 from HEAD to RELENG_6:

  When allocating link layer ifnet address list entries in
  ifp->if_resolvemulti(), do so with M_NOWAIT rather than M_WAITOK, so
  that a mutex can be held over the call.  In the FDDI code, add a
  missing M_ZERO.  Consumers are already aware that if_resolvemulti()
  can fail.

Approved by:	re (scottl)
2005-08-24 13:51:55 +00:00
rwatson
c5a05437c6 Merge if_var.h:1.101 from HEAD to RELENG_6:
- Rename ifmaof_ifpforaddr() to if_findmulti(); assert if_addr_mtx.
    Staticize.

  Problem reported by:    Ed Maste <emaste at phaedrus dot sandvine dot ca>

Approved by:	re (scottl)
2005-08-24 13:26:14 +00:00
rwatson
3f3866054d Merge if.c:1.240, if.c:1.241, if.c:1.242 from HEAD to RELENG_6, which
correct nits in the addition of if_addr_mtx:

if.c:1.240:
  Initialize the if_addr mutex in if_alloc() rather than waiting until
  if_attach().  This allows ethernet drivers to use it in their routines
  to program their MAC filters before ether_ifattach() is called (de(4) is
  one such driver).  Also, the if_addr mutex is destroyed in if_free()
  rather than if_detach(), so there was another potential bug in that a
  driver that failed during attach and called if_free() without having
  called ether_ifattach() would have tried to destroy an uninitialized
  mutex.

  Reported by:    Holm Tiffe holm at freibergnet dot de
  Discussed with: rwatson

if.c:1.241:
  destroy lock _before_ free'ing the structure it resides in

if.c:1.242:
  - Move IF_ADDR_LOCK_DESTROY(ifp) from if_free to if_free_type.
  - Add a note that additions should be made to if_free_type and not
    if_free to help avoid this in the future.

  This apparently fixes a use after free in if_bridge and may fix bugs
  in other direct if_free_type consumers.

  Reported by:    thompsa

Approved by:	re (hrs)
2005-08-24 04:45:02 +00:00
rwatson
b44c9e8aef Merge if.c:1.239, if_var.h:1.101 from HEAD to RELENG_6:
Protect link layer network interface multicast address list manipulation
  using ifp->if_addr_mtx:

  - Initialize if_addr_mtx when ifnet is initialized.

  - Destroy if_addr_mtx when ifnet is torn down.

  - Rename ifmaof_ifpforaddr() to if_findmulti(); assert if_addr_mtx.
    Staticize.

  - Extract ifmultiaddr allocation and initialization into if_allocmulti();
    accept a 'mflags' argument to indicate whether or not sleeping is
    permitted.  This centralizes error handling and address duplication.

  - Extract ifmultiaddr tear-down and deallocation in if_freemulti().

  - Re-structure if_addmulti() to hold if_addr_mtx around manipulation of
    the ifnet multicast address list and reference count manipulation.
    Make use of non-sleeping allocations.  Annotate the fact that we only
    generate routing socket events for explicit address addition, not
    implicit link layer address addition.

  - Re-structure if_delmulti() to hold if_addr_mtx around manipulation of
    the ifnet multicast address list and reference count manipulation.
    Annotate the lack of a routing socket event for implicit link layer
    address removal.

  - De-spl all and sundry.

  Problem reported by:    Ed Maste <emaste at phaedrus dot sandvine dot ca>

Approved by:	re (hrs)
2005-08-24 04:42:03 +00:00
rwatson
fb6d446f5c Merge if.c:1.235 from HEAD to RELENG_6:
- Introduce a helper function if_setflag() containing the code common
    to ifpromisc() and if_allmulti() instead of duplicating the code poorly,
    with different bugs.
  - Call ifp->if_ioctl() in a consistent way: always use more compatible C
    syntax and check whether ifp->if_ioctl is not NULL prior to the call.

Discussed with:	yar
Approved by:	re (scottl)
2005-08-24 04:19:48 +00:00
rwatson
487c3ba9fb Merge if_var.h:1.99 from HEAD to RELENG_6:
Allocate one of the spare ifnet integer fields to hold if_drv_flags,
  which in the future will hold IFF_OACTIVE and IFF_RUNNING, and have
  its access synchronized by the device driver rather than the
  protocol stack.  This will avoid potential races in the management
  of flags in if_flags.

  Discussed with: various (scottl, jhb, ...)

Approved by:	re (kensmith)
2005-08-20 13:38:22 +00:00
brooks
0ad36e7cf7 MFC rev 1.81, use if_free_type to avoid leaking struct arpcoms.
Approved by:	re (kensmith)
2005-08-20 04:34:11 +00:00
brooks
453f516d46 MFC rev 1.244, removal of if_findindex and correction of two if_alloc
calls before an if_attach.

Partial MFC of 1.243.  The change it was a response to has not been
MFCd, but the comment is relevent without it.

Approved by:	re (kensmith)
2005-08-20 04:32:54 +00:00
glebius
f367659d48 MFC:
Axe ppp_for_tty(). Use tty->t_lsc pointer to store sc. This
  also eliminates recursive use of ppp_softc_list_mtx.
  PR:		kern/84686
  Reviewed by:	phk

Approved by:	re (kensmith)
2005-08-19 14:52:21 +00:00
csjp
9c24f2345e MFC revision 1.157
date: 2005/08/18 22:30:52;  author: csjp;  state: Exp;  lines: +4 -2
Add missing braces around bpf_filter which were missed when I
merged the bpfstat code.

Approved by:	re (kensmith)
2005-08-19 04:52:02 +00:00
thompsa
44ed345e28 MFC: if_bridge.c, r1.17; bridgestp.c, r1.5
>   Ensure that we are holding the lock when initialising the bridge interface. We
>   could initialise while unlocked if the bridge is not up when setting the inet
>   address, ether_ioctl() would call bridge_init.
>
>   Change it so bridge_init is always called unlocked and then locks before
>   calling bstp_initialization().

Approved by:	re (kensmith), mlaier (mentor)
2005-08-19 02:43:07 +00:00
rwatson
b7201f0455 Merge if.c:1.238 from HEAD to RELENG_6:
In multicast routines:

  Compare pointers with NULL rather than treating them as booleans.

  Compare pointers with NULL rather than 0 to make it more clear
  they are pointers.

  Assign pointers value of NULL rather than 0 to make it more clear
  they are pointers.

Approved by:	re (kensmith)
2005-08-18 18:36:53 +00:00
rwatson
82b242b793 Merge if.c:1.237 from HEAD to RELENG_6:
Rename equal() macro to sa_equal(), which matches the definitions
  of sa_equal() in other files, and makes it more clear what equal()
  is comparing.

Approved by:	re (kensmith)
2005-08-18 18:34:23 +00:00