Commit Graph

1799 Commits

Author SHA1 Message Date
rwatson
f0d5053aa6 Merge if_arc.h:1.9, if_arcsubr.c:1.30 from HEAD to RELENG_6:
Use ANSI C function protypes and declarations for if_arcsubr.
2006-06-11 16:31:19 +00:00
hsu
85416acdd7 Merge rev 1.41 from current: correct test for fragmented packet. 2006-06-09 18:19:16 +00:00
marius
a0d42b4ae0 MFC: 1.61
Revert the (int *) -> (intptr_t *) conversion done as part of rev. 1.59
(MFC'ed in rev. 1.55.2.3) for IOCTLs where casting data to intptr_t *
isn't the right thing to do, fixing tap(4) on big-endian LP64 machines.
2006-06-06 20:03:37 +00:00
thompsa
71c1a44223 MFC r1.61: Fix style(9) nits, whitespace and parentheses. 2006-05-29 00:40:16 +00:00
thompsa
55ff2b99b0 MFC r1.59, 1.60
- Add support for fragmenting ipv4 packets
 - Recalculate the IP checksum after pfil(9)

Together these allow NFS to work over the bridge
2006-05-29 00:36:27 +00:00
emax
6eafc67c7f MFC v1.59 and v1.60
Add kqueue(2) support on if_tap(4) interfaces. While I'm here, replace
K&R style function declarations with ANSI style. Also fix endian bugs
accessing ioctl arguments that are passed by value.

Do not call knlist_destroy() in tapclose(). Instead call it when device is
actually destroyed. Also move call to knlist_init() into tapcreate(). This
should fix panic described in kern/95357.

PR:		kern/93897, kern/95357
Submitted by:	Vilmos Nebehaj < vili at huwico dot hu >
2006-05-20 00:44:00 +00:00
csjp
993ca372a6 MFC revision 1.56
date: 2006/03/03 09:12:21;  author: thompsa;  state: Exp;  lines: +22 -7
Since we are using random ethernet addresses for the bridge, it is possible
that we might have address collisions, so make sure that this hardware address
isn't already in use on another bridge.
2006-05-17 00:18:57 +00:00
csjp
583cf67217 MFC revision 1.55
Slightly re-worked bpf(4) code associated with bridging: if we have a
  destination interface as a member of our bridge or this is a unicast packet,
  push it through the bpf(4) machinery.

  For broadcast or multicast packets, don't bother with the bpf(4) because it will
  be re-injected into ether_input. We do this before we pass the packets through
  the pfil(9) framework, as it is possible that pfil(9) will drop the packet or
  possibly modify it, making it very difficult to debug firewall issues on the
  bridge.

  Further, implemented IFF_MONITOR for bridge interfaces. This does much the same
  thing that it does for regular network interfaces: it pushes the packet to any
  bpf(4) peers and then returns. This bypasses all of the bridge machinery,
  saving mutex acquisitions, list traversals, and other operations performed by
  the bridging code.

  This change to the bridging code is useful in situations where individuals use a
  bridge to multiplex RX/TX signals from two interfaces, as is required by some
  network taps for de-multiplexing links and transmitting the RX/TX signals
  out through two separate interfaces. This behaviour is quite common for network
  taps monitoring links, especially for certain manufacturers.
2006-05-17 00:11:27 +00:00
csjp
d6b220b7f2 MFC revision 1.215
Unbreak byte counters when network interfaces are in monitor mode by
  re-organizing the monitor return logic. We perform interface monitoring
  checks after we have determined if the CRC is still on the packet, if
  it is, m_adj() is called which will adjust the packet length. This
  ensures that we are not including CRC lengths in the byte counters for
  each packet.
2006-05-17 00:09:24 +00:00
csjp
d77d83825c MFC revision 1.164
Pickup locks for the BPF interface structure. It's quite possible that
bpf(4) descriptors can be added and removed on this interface while we
are processing stats.
2006-05-17 00:07:42 +00:00
andre
e4ab72006f MFC rev. 1.32: Add link status descriptions and related structures for userland
applications.

Approved by:	re
2006-04-04 20:24:19 +00:00
andre
81064650ad MFC route.h rev. 1.65 and rtsock.c rev. 1.133:
- Fill in the correct rtm_index for RTM_ADD and RTM_CHANGE messages.

  - Allow RTM_CHANGE to change a number of route flags as specified by
    RTF_FMASK.

  - The unused rtm_use field in struct rt_msghdr is redesignated as
    rtm_fmask field to communicate route flag changes in RTM_CHANGE
    messages from userland.  The use count of a route was moved to
    rtm_rmx a long time ago.  For source code compatibility reasons
    a define of rtm_use to rtm_fmask is provided.

Approved by:	re
2006-04-04 20:07:23 +00:00
rwatson
6a98808155 Merge if_ppp.c:1.113 from HEAD to RELENG_6:
Add IFF_NEEDSGIANT to kernel PPP support.  I have no idea why this wasn't
  here, but it should have been.

Approved by:	re (hrs)
2006-04-02 11:10:38 +00:00
thompsa
79570b4c5e MFC r1.57-58
Use m_dup rather than m_copypacket as we need a writable mbuf

On behalf of:	rik
Approved by:	re (hrs)
2006-04-02 04:41:53 +00:00
glebius
d2f4d3f55d MFC:
- Introduce ifmedia_baudrate(), which returns correct baudrate of the
    given media status. [1]
  - Utilize ifmedia_baudrate() in miibus_statchg() to update ifp->if_baudrate.

  Obtained from:  NetBSD [1]

Approved by:	re (scottl)
2006-03-17 20:17:43 +00:00
thompsa
fba5f61aed MFC bridgestp.c r1.12, if_bridgevar.h r1.11
Add a timer to periodically check the interface state.

Approved by:	re (scottl)
2006-03-09 08:21:19 +00:00
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