Commit Graph

1783 Commits

Author SHA1 Message Date
oleg
53a66e4fcb MFC if_ethersubr.c rev. 1.214, if_bridge.c rev. 1.54
Properly initialize args structure before passing it to ipfw_chk(): having
uninitialized args.inp is unhealthy for uid/gid/jail ipfw rules.

PR:		kern/92589
Approved by:	re (scottl)
2006-03-04 09:24:30 +00:00
thompsa
9602c362ca MFC r1.11: Fix up the Bridge Identifier field in the BPDU packet.
Approved by:	re (scottl)
2006-03-03 21:36:26 +00:00
wkoszek
8f5b501262 MFC:
Connect zlib to the build.

  This patch fixes a problem, which exists if you have IPSEC in your kernel
  and want to have crypto support loaded as KLD. By moving zlib to separate
  module and adding MODULE_DEPEND directives, it is possible to use such
  configuration without complication. Otherwise, since IPSEC is linked with
  zlib (just like crypto.ko) you'll get following error:

          interface zlib.1 already present in the KLD 'kernel'!

  Approved by:    cognet (mentor)

Approved by:	re (scottl)
2006-03-01 21:40:14 +00:00
yar
4af5fcaf38 MFC 1.98: Avoid toggling IFF_UP from the driver because
it's an administrative flag.

Approved by:	re (scottl)
2006-02-18 22:48:16 +00:00
qingli
e776a57c39 MFC: rev 1.38
Approved by:	re (scottl)
2006-02-16 01:10:44 +00:00
qingli
0e3ee9900c MFC: rev 1.40
Approved by:	re (scottl)
2006-02-16 01:08:40 +00:00
ps
f2d6dfc1f8 MFC:
Implement SIOCGIFCONF for 32bit binaries.

Approved by:	re
2006-02-15 03:37:15 +00:00
rwatson
f6557302f2 Merge if_ef.c:1.38 from HEAD to RELENG_6:
Check the right ifnet pointer to see if if_alloc() failed or not in
  ef_clone(); we were testing the original ifnet, not the one allocated.

  When aborting ef_clone() due to if_alloc() failing, free the allocated
  efnet structure rather than leaking it.

  Noticed by:     Coverity Prevent analysis tool

Approved by:	re (scottl)
2006-02-14 21:11:19 +00:00
rwatson
bcc6ac0035 Merge if_ef.c:1.37 from HEAD to RELENG_6:
When freeing the chain of if_ef devices on an aborted load, use
  SLIST_FOREACH_SAFE() rather than SLIST_FOREACH(), as elements are
  freed on each iteration of the loop.  This prevents use-after-free.

  Noticed by:     Coverity Prevent analysis tool

Approved by:	re (scottl)
2006-02-14 21:09:46 +00:00
yar
da071e483e MFC rev. 1.95:
Set IFF_BROADCAST and IFF_MULTICAST on vlan interfaces from the
  beginning and simply refuse to attach to a parent without either
  flag.  Our network stack doesn't like those flags changing and
  there is no need in them doing so.

Approved by:	re (scottl)
2006-02-12 12:19:06 +00:00
thompsa
3a707b5728 MFC r1.52, fix inconsistencies with the bridge route table.
Approved by:	re (scottl)
2006-02-03 08:06:11 +00:00
glebius
c625a74834 MFC:
Add some initial locking to gif(4), that covers output path.
2006-01-31 15:56:47 +00:00
bz
42bcb0a389 MFC:
rev. 1.39 sys/net/if_gre.c
  rev. 1.21 sys/netinet/ip_gre.c      rev. 1.4  sys/netinet/ip_gre.h
  rev. 1.12 sys/netipsec/keysock.c    rev. 1.3  sys/netipsec/keysock.h
  rev. 1.32 sys/netkey/keysock.c      rev. 1.9  sys/netkey/keysock.h

  Fix stack corruptions on amd64.

  Vararg functions have a different calling convention than regular
  functions on amd64. Casting a varag function to a regular one to
  match the function pointer declaration will hide the varargs from
  the caller and we will end up with an incorrectly setup stack.

  Entirely remove the varargs from these functions and change the
  functions to match the declaration of the function pointers.
  Remove the now unnecessary casts.

  Lots of explanations and help from:     peter
  PR:                                     amd64/89261
2006-01-27 21:50:11 +00:00
oleg
a8c9b6ffde MFC 1.211:
1) remove useless check of loop_copy
2) convert loop_copy to "non-negative" flag
2006-01-26 23:18:11 +00:00
glebius
06cfdf6652 MFC 1.85 - 1.87: Some diagnostic nitpicking and cleanup.
MFC 1.88:
  Improve handling flags that must be propagated
  to the parent interface, such as IFF_PROMISC and
  IFF_ALLMULTI.  In addition, vlan(4) gains ability
  to migrate from one parent to another w/o losing
  its own flags.

  PR:             kern/81978
2006-01-26 22:21:37 +00:00
harti
f67a055541 MFC: IFDATA_DRIVERNAME support.
if_mib.h: 1.8
	if_mib.c: 1.18
2006-01-26 07:46:28 +00:00
cperciva
5648502507 Make sure buffers in if_bridge are fully initialized before copying
them to userland. [1]

MFC rev. 1.16 of sys/contrib/pf/net/pf_norm.c: Correct an error in pf
handling of IP packet fragments which could result in a kernel panic.
[2]

Security:	FreeBSD-SA-06:06.kmem [1]
Security:	FreeBSD-SA-06:07.pf [2]
2006-01-25 10:00:59 +00:00
brooks
28e24b4843 Backout ill considered MFC of 1.20. It doesn't compile.
Pointy hat:	brooks
2006-01-24 06:30:51 +00:00
brooks
d13e981617 MFC revs:
1.17: convert from network byte order to host byte order not to reverse.
  1.19: Get rid of the bogus IFP2FC() macro and use IFP2FWC().
  1.20: Fix ip_fastforward() return handling.

PR:		kern/91307 (1.19)
Found by:	Coverity Prevent(tm) (1.20)
2006-01-24 06:28:22 +00:00
thompsa
07a0a1ec64 MFC: if_bridge.c, r1.50; if_bridgevar.h, r1.10
Clear IFCAP_TXCSUM from member interfaces while bridging.
2006-01-18 20:49:21 +00:00
glebius
03bc08061d - Restore VLAN_INPUT_TAG() macro to preserve API compatibility for
third party drivers.
- Fix bugs destribed in previous revision using macro with
  another name.
2006-01-13 19:21:45 +00:00
glebius
ed67dec936 MFC:
- Use VLAN_TAG_VALUE() not only to read a dot1q tag
    value from an m_tag, but also to set it.  This reduces
    complex code duplication and improves its readability.
  - Fix VLAN_INPUT_TAG() macro, so that it doesn't touch mtag in
    case if memory allocation failed.
  - Remove fourth argument from VLAN_INPUT_TAG(), that was used
    incorrectly in almost all drivers. Indicate failure with
    mbuf value of NULL.
2006-01-13 11:51:11 +00:00
glebius
102e170e76 Merge rev. 1.130 that I though was merged long time ago. Thanks to emaste
for noticing this.

  Drop current rtentry lock before calling rt_getifa(). This fixes a LOR
  and a possible recursive use of rtentry mutex.
2006-01-12 00:22:12 +00:00
thompsa
6c8496e9b7 MFC: sync code to HEAD
- whitespace
 - add net.link.bridge.pfil_onlyip
 - use time_uptime
2006-01-03 21:47:34 +00:00
thompsa
d2572297a0 MFC: EtherIP support, adding gif interfaces to bridges. 2006-01-03 08:15:33 +00:00
thompsa
d5df7ef24c MFC r1.39-40, whitespace and M_ZERO fixes 2005-12-28 06:27:52 +00:00
thompsa
a48e8794fd MFC: Add support for creating span ports
sbin/ifconfig/ifbridge.c	r1.3
 sbin/ifconfig/ifconfig.8	r1.109
 sys/net/if_bridge.c		r1.36, 1.38
 sys/net/if_bridgevar.h		r1.7, 1.8
 sys/net/if_ethersubr.c		r1.210
2005-12-28 04:12:58 +00:00
thompsa
911c4e7496 MFC r1.41, do not BPF_MTAP the packet twice 2005-12-24 01:13:17 +00:00
thompsa
9bc985ef4d MFC r1.37: use m_dup rather than m_copypacket 2005-12-21 22:52:48 +00:00
glebius
25cfadb32a MFC 1.93:
Take if_baudrate from the parent. This fixes problem with SNMP
  daemons reporting zero speed for vlan(4) interfaces.
2005-12-12 11:18:15 +00:00
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