summaryrefslogtreecommitdiffstats
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* - Don't defer the removal of an 802.1q header for no real reason.yar2006-12-301-25/+16
| | | | | | - Micro-optimize the addition of an 802.1q header to match the removal code. - Consistently check for interfaces being up and running. - Consistently use NULL instead of 0 with pointers.
* Various bpf(4) related fixes to catch places up to the new bpf(4)jhb2006-12-291-1/+1
| | | | | | | | | | | | | semantics. - Stop testing bpf pointers for NULL. In some cases use bpf_peers_present() and then call the function directly inside the conditional block instead of the macro. - For places where the entire conditional block is the macro, remove the test and make the macro unconditional. - Use BPF_MTAP() in if_pfsync on FreeBSD instead of an expanded version of the old semantics. Reviewed by: csjp (older version)
* First cut at half/quarter-rate 11a channel support (e.g. for usesam2006-12-271-0/+9
| | | | | | | | | | | | | | | | | | | | in the Public Safety Band): o add channel flags to identify half/quarter-rate operation o add rate sets (need to check spec on 4Mb/s in 1/4 rate) o add if_media definitions for new rates o split net80211 channel setup out into ieee80211_chan_init o fixup ieee80211_mhz2ieee and ieee80211_ieee2mhz to understand half/quarter rate channels: note we temporarily use a nonstandard/hack numbering that avoids overlap with 2.4G channels because we don't (yet) have enough state to identify and/or map overlapping channel sets o fixup ieee80211_ifmedia_init so it can be called post attach and will recalculate the channel list and associated state; this enables changing channel-related state like the regulatory domain after attach (will be needed for 802.11d support too) o add ieee80211_get_suprates to return a reference to the supported rate set for a given channel o add 3, 4.5, and 27 MB/s tx rates to rate <-> media conversion routines o const-poison channel arg to ieee80211_chan2mode
* Note that rev. 1.221 introduced a local workaround for a general problem.yar2006-12-241-0/+4
| | | | | | | Add a pointer to the relevant PR for future reference. The whole comment will be OK to remove as soon as the general solution is applied. PR: kern/105943
* MFp4: 92972, 98913 + one more changebz2006-12-121-6/+10
| | | | | | | In ip6_sprintf no longer use and return one of eight static buffers for printing/logging ipv6 addresses. The caller now has to hand in a sufficiently large buffer as first argument.
* These days P2P means peer-2-peer (also well known from serveral filesharingthompsa2006-12-114-25/+25
| | | | | | | protocols) while PointToPoint has been PtP links. Change the variables accordingly while the code is still fresh and undocumented. Requested by: bz
* Fix an oscure bug triggered by a recent change in kern_socket.c.luigi2006-12-081-1/+9
| | | | | | | | | | | | | | | | | | | | | | | The symptoms were that outgoing DHCP requests for diskless kernels had the IP header corrupt. After long investigations, the source of the problem was found in ether_output() - for SIMPLEX interfaces and broadcast traffic, a copy of the packet is passed back to the kernel through if_simloop(). However if_simloop() modifies the mbuf, while the copy obtained through m_copym() is a readonly one. The bug has been there forever, but it has been triggered only recently by a change in sosend_dgram() which passed down mbufs with sufficient space to prepend the header. This fix is trivial - use m_dup() instead of m_copy() to create the copy. As an alternative, we could try and modify if_simloop() to play safely with readonly mbufs, but i don't think it is worthwhile because 1) this is a relatively infrequent code path so we do not need to worry too much about performance, and 2) the cost of doing an extra m_pullup in if_simloop() is probably the same as doing the copy of the cluster, anyways. MFC after: 1 week
* Use callout mechanism instead of timeout()/untimeout().ume2006-12-053-3/+4
| | | | MFC after: 1 week
* Add two new flags to if_bridge(4) indicating whether the edge flagsyrinx2006-12-044-3/+18
| | | | | | | | | | | | | | of the bridge port and path cost have been administratively set or calculated automatically by RSTP. Make sure to transition from non-edge to edge when the port goes down and the edge flag was manually set before. This is needed to comply with the condition ((!portEnabled && AdminEdge) || ....) in the Bridge Detection State Machine (IEE802.1D-2004, p. 171). Reviewed by: thompsa Approved by: bz (mentor)
* Fix SIOCGDRVSPEC/BRDGGIFSSTP ioctl: make it copyin() the usersyrinx2006-12-031-1/+1
| | | | | | | | provided buffer length before trying to use it. Reviewed by: thompsa Approved by: bz (mentor) MFC after: 3 days
* Remove obfuscating OpenBSD/NetBSD/BSDI/FreeBSD 2.x/FreeBSD 5.x ifdefsrwatson2006-12-011-20/+0
| | | | from around printfs and address list iteration.
* fix typo in last commitimp2006-12-011-1/+1
|
* Use FreeBDS standard __packed as opposed to the gcc centricimp2006-12-011-2/+2
| | | | __attribute__(__packed__).
* Move the __packed declarations. This makes sizeof(struct llc) 8 againimp2006-12-011-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on the arm. Add an assert to ensure that the size is 8 to prefent others from falling into this trap (we should have more of these). Why the construct: struct foo { union bar { struct { ... } __packed fred; ... } __packed wilma; } __packed; has a different packing than: struct foo { union bar { struct { ... } fred __packed; ... } wilma __packed; } __packed; is beyond my ability to ferret out of the gcc documentation. Most likely some subtle binding issue (eg before it says the struct itself is packed, while after it means that the whole struct is packed into the thing it is in). Pointers to relevant documentation would be appreciated.
* Use CTASSERT to make sure:imp2006-12-011-1/+6
| | | | | | | | | | | | sizeof ether_header is 2 * ETHER_ADDR_LEN + 2 (14) bytes long sizeof ether_addr is ETHER_ADDR_LEN bytes long On arm, this shows that struct ether_addr needs to be __packed. The first condition muts be true for the bridging code to not dump core. The second one appears to be implicitly relied upon by wi (but many of the rids it sends down likely need __packed too to be safe) and maybe others. It appears to not hurt anything.
* The recent issues with em(4) interface has shown that the old 4.4BSDglebius2006-11-301-0/+3
| | | | | | | | | | | | | if_watchdog/if_timer interface doesn't fit modern SMP network stack design. Device drivers that need watchdog to monitor their hardware should implement it theirselves. Eventually the if_watchdog/if_timer API will be removed. For now, warn that driver uses it. Reviewed by: scottl
* Change net.isr.direct from defaulting to 0 to 1 in 7-CURRENT. Thisrwatson2006-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | enables direct dispatch of the network stack from the device driver ithread, enabling input path parallelism by default when multiple interfaces are present. The strategy for network stack parallelism is something being actively discussed, and this is just one of several possible (and perfectly reasonable) strategies, but has the distinct advantage of reducing the number of context switches and preemptions significantly, resulting in higher efficiency in many cases. In some caes, this may reduce network stack parallelism due to work not being deferred from the ithread to the netisr. Therefore, the strategy may change in the future, but this offers a reasonable first pass and enabling parallelism while maintaining strong ordering. Hopefully this will trigger lots of nice new bugs. This change is not intended for MFC.
* Sync with the OpenBSD port of RSTPthompsa2006-11-274-65/+77
| | | | | | | | | - use flags rather than sperate ioctls for edge, p2p - implement p2p and autop2p flags - define large pathcost constant as ULL - show bridgeid and rootid in ifconfig Obtained from: Reyk Floeter <reyk@openbsd.org>
* Initialize the port info, this shouldnt have been removed in r1.28thompsa2006-11-261-0/+1
|
* Remove redundant setting of port state.thompsa2006-11-261-1/+0
|
* use two stage creation of stp ports, this means that the stp variables can bethompsa2006-11-263-25/+33
| | | | set before the port is marked STP and they will no longer be overwrittten
* Initialize a local variable in 2 places just before it is used, not alwaysbde2006-11-231-1/+2
| | | | | | | | | | | | at the start of rtalloc1(). This backs out part of revs 1.83 and 1.85. Profiling on an i386 showed that that for sending tiny packets using bge, -current takes 7 bzero()s where RELENG_4 takes only 1, and that bzero()ing is now the dominant overhead (10-12%, up from 1%, but profiling overestimated this a bit). This commit backs out 2 of the 6 extra bzero()s (1 in each of 2 calls per packet to rtalloc1()). They were the largest ones by byte count (48 bytes each) but perhaps not by time (small misaligned ones might take longer).
* Do not call bstp_stop() internally as it clears the running flag which causesthompsa2006-11-191-11/+3
| | | | | | the timer to never be restarted. Reported by: bz
* Fix typo in commentcsjp2006-11-181-1/+1
| | | | Pointed out by: ru
* Currently, drivers that support hardware offload of VLAN tagcsjp2006-11-182-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | processing are forced to toggle this functionality when the card is put in and out of promiscuous mode. The main reason for this is because the hardware strips the VLAN tag, making it impossible for the tag information to show up in network diagnostic tools like tcpdump(1). This change introduces ether_vlan_mtap(), which is called if the mbuf has M_VLANTAG set. VLAN information is extracted from the mbuf and inserted into a stack allocated ether vlan header which is then inserted through the bpf machinery via bpf_mtap2(). The original mbuf's data pointer and lengths are temporarily adjusted to eliminate the original Ethernet header for the duration of the tap operation. This should have no long term effects on the mbuf. Also, define a new macro, ETHER_BPF_MTAP which should be used by drivers which support hardware offload of VLAN tag processing. The fixes for the relevant drivers will follow shortly. Discussed with: rwatson, andre, jhb (and others) Much feedback from: sam, ru MFC after: 1 month [1] [1] The version that is eventually MFCed will be somewhat different then this, as there has been significant work done to the VLAN code in HEAD.
* mark struct ether_header packed so gcc honors alignmentsam2006-11-181-1/+1
| | | | | | | | constratins on arm; this fixes bridging when packets are rx'd so ip headers are 32-bit aligned Reviewed by: imp (and discussed elsewhere) MFC after: 2 weeks
* Teach an IPv6 to ppp(4).ume2006-11-112-1/+56
| | | | | Obtained from: NetBSD MFC after: 1 week
* MFp4thompsa2006-11-092-20/+44
| | | | | | | | | | | | - Each stp port is added sequentially so it was possible for our bridgeid to change every time because the new port has a lower MAC address. Instead just find the lowest MAC address from all Ethernet adapters in the machine as the value only needs to be unique, this stops a lot of churn on the protocol. - Update the states after enabling or disabling a port. - Keep tabs if we have been stopped or started by our parent bridge. - The callout only needs to be drained before destroying the mutex, move it to bstp_detach.
* Add a new address cache type called sticky. On an interface marked sticky anythompsa2006-11-092-19/+27
| | | | | | | | address learned by the bridge is made permanent, the address will not age out and most importantly will not migrate to another interface. This can be used to stop mac address poisoning or clients roaming in much the same way as static entries without the hassle of preloading the table.
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-0611-47/+141
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Fix possible leak when bridge is in monitor mode. Use m_freem() which willcsjp2006-11-051-1/+1
| | | | | | | | free the entire chain, instead of using m_free() which will free just the mbuf that was passed. Discussed with: thompsa MFC after: 3 days
* Currently, we initialize "error" to zero when it's declared, thencsjp2006-11-041-2/+1
| | | | | | | | | | | | | | | we never initialize it to anything else. However, in the case that m_uiotombuf fails, we return error (effectively reporting success). This appears to be a relic of an older revision of this file, where "error" used to be doing something useful. (See revision 1.1, where error is used in a loop with uiomove() instead of using m_uiotomubf). So instead on unconditionally reporting success in the case there is a failure in m_uiotombuf, explicitly return ENOBUFS. While we are here, garbage collect the error variable since it's no longer required. MFC after: 2 weeks
* When the packet is for the bridge then note which interface to send the replythompsa2006-11-041-0/+5
| | | | | | | | | | | to, previously it was always broadcast to all interfaces (a bug). This is useful when the bridge is the default gateway and vlans are used to isolate each client, the reply is now kept private to the vlan which the client resides. Reported by: Jon Otterholm Tested by: Jon Otterholm MFC after: 3 days
* Ok, here it is, we finally add SCTP to current. Note that thisrrs2006-11-031-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | work is not just mine, but it is also the works of Peter Lei and Michael Tuexen. They both are my two key other developers working on the project.. and they need ata-boy's too: **** peterlei@cisco.com tuexen@fh-muenster.de **** I did do a make sysent which updated the syscall's and sysproto.. I hope that is correct... without it you don't build since we have new syscalls for SCTP :-0 So go out and look at the NOTES, add option SCTP (make sure inet and inet6 are present too) and play with SCTP. I will see about comitting some test tools I have after I figure out where I should place them. I also have a lib (libsctp.a) that adds some of the missing socketapi functions that I need to put into lib's.. I will talk to George about this :-) There may still be some 64 bit issues in here, none of us have a 64 bit processor to test with yet.. Michael may have a MAC but thats another beast too.. If you have a mac and want to use SCTP contact Michael he maintains a web site with a loadable module with this code :-) Reviewed by: gnn Approved by: gnn
* Defer sending the bpdu from bstp_update_info as all code paths will test thisthompsa2006-11-031-1/+1
| | | | flag anyway.
* Rename m_getm() to m_getm2() and rewrite it to allocate up to page sizedandre2006-11-023-3/+4
| | | | | | | | | | | | | | mbuf clusters. Add a flags parameter to accept M_PKTHDR and M_EOR mbuf chain flags. Provide compatibility macro for m_getm() calling m_getm2() with M_PKTHDR set. Rewrite m_uiotombuf() to use m_getm2() for mbuf allocation and do the uiomove() in a tight loop over the mbuf chain. Add a flags parameter to accept mbuf flags to be passed to m_getm2(). Adjust all callers for the extra parameter. Sponsored by: TCP/IP Optimization Fundraise 2005 MFC after: 3 month
* Do not test all the conditions if the port is already forwarding. Also print athompsa2006-11-021-3/+7
| | | | | debug message if the port is agreed as it is an important condition of the protocol.
* Fix a resource leak when the mbuf pointer changes.thompsa2006-11-021-15/+13
| | | | | CID: 1564, 1565 Found by: Coverity Prevent (tm)
* If the port is agreed or edge then allow it go go straight to forwarding ratherthompsa2006-11-021-7/+8
| | | | than waiting another tick (1s) for the states to be checked again.
* Bring in support for the Rapid Spanning Tree Protocol (802.1w).thompsa2006-11-014-964/+2003
| | | | | | | | | | RSTP provides faster spanning tree convergence, the protocol will exchange information with neighboring switches to quickly transition to forwarding without creating loops. The code will default to RSTP mode but will downgrade any port connected to a legacy STP network so is fully backward compatible. Reviewed by: syrinx Tested by: syrinx
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-2212-12/+24
| | | | | | | | | | | | | begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
* Fix error in rev. 1.68. The intention was to break out the switch(){},glebius2006-10-211-1/+1
| | | | | | | | but actually exited from the for(){} loop. This fixes the PPPIOCSCOMPRESS ioctl. PR: kern/101333 Submitted by: Igor Popov <igorpopov newmail.ru>
* - Update the baudrate every time the parent changes its link state.glebius2006-10-111-3/+4
| | | | | - Rearrange the curly braces so that this piece of code is more readable.
* Use LIST_FOREACH_SAFE instead of a hand rolled version.thompsa2006-10-091-8/+4
|
* Remove licence clauses 3 & 4thompsa2006-10-011-5/+0
| | | | OKed by: Jason L. Wright
* Fix our ioctl(2) implementation when the argument is "int". Newru2006-09-272-2/+14
| | | | | | | | | | | | | ioctls passing integer arguments should use the _IOWINT() macro. This fixes a lot of ioctl's not working on sparc64, most notable being keyboard/syscons ioctls. Full ABI compatibility is provided, with the bonus of fixing the handling of old ioctls on sparc64. Reviewed by: bde (with contributions) Tested by: emax, marius MFC after: 1 week
* Revert r1.80 as the ethernet header was inadvertently stripped from ARPthompsa2006-09-221-14/+36
| | | | | | | packets. Reimplement this correctly and use a sysctl that defaults to off so the user doesnt get any suprises if ipfw blocks the ARP packet. MFC after: 3 days
* fixed a bug that local IPv6 traffic (to an address configured on ansuz2006-09-221-9/+25
| | | | | | | | interface other than lo0) does not show up properly on any bpf. Reported by: mlaier Reviewed by: gnn, csjp MFC after: 1 week
* Move ethernet VLAN tags from mtags to its own mbuf packet header fieldandre2006-09-172-56/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf signifies the presence and validity of its content. Drivers that support hardware VLAN tag stripping fill in the received VLAN tag (containing both vlan and priority information) into the ether_vtag mbuf packet header field: m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */ m->m_flags |= M_VLANTAG; to mark the packet m with the specified VLAN tag. On output the driver should check the mbuf for the M_VLANTAG flag to see if a VLAN tag is present and valid: if (m->m_flags & M_VLANTAG) { ... = m->m_pkthdr.ether_vtag; /* htons()? */ ... pass tag to hardware ... } VLAN tags are stored in host byte order. Byte swapping may be necessary. (Note: This driver conversion was mechanic and did not add or remove any byte swapping in the drivers.) Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag memory allocation have to be done. Reviewed by: thompsa, yar Sponsored by: TCP/IP Optimization Fundraise 2005
* Rearrange things so that ARP packets can be filtered or rate limited with IPFW.thompsa2006-09-171-30/+14
| | | | | Requested by: Jon Otterholm Tested by: Jon Otterholm
OpenPOWER on IntegriCloud