summaryrefslogtreecommitdiffstats
path: root/sys/netinet
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate MAC entry point mac_create_mbuf_from_mbuf(), which isrwatson2005-07-051-1/+1
| | | | | | | | | | | redundant with respect to existing mbuf copy label routines. Expose a new mac_copy_mbuf() routine at the top end of the Framework and use that; use the existing mpo_copy_mbuf_label() routine on the bottom end. Obtained from: TrustedBSD Project Sponsored by: SPARTA, SPAWAR Approved by: re (scottl)
* Fix for a bug in newreno partial ack handling where if a large amountps2005-07-052-2/+10
| | | | | | | of data is partial acked, snd_cwnd underflows, causing a burst. Found, Submitted by: Noritoshi Demizu Approved by: re
* Remove ambiguity from hlen. IPv4 is now indicated by is_ipv4 and we need amlaier2005-07-031-20/+17
| | | | | | | proper hlen value for IPv6 to implement O_REJECT and O_LOG. Reviewed by: glebius, brooks, gnn Approved by: re (scottl)
* Check the alignment of the IP header before passing the packet up to thethompsa2005-07-021-0/+6
| | | | | | | | | | | | | | | | | | | packet filter. This would cause a panic on architectures that require strict alignment such as sparc64 (tier1) and ia64/ppc (tier2). This adds two new macros that check the alignment, these are compile time dependent on __NO_STRICT_ALIGNMENT which is set for i386 and amd64 where alignment isn't need so the cost is avoided. IP_HDR_ALIGNED_P() IP6_HDR_ALIGNED_P() Move bridge_ip_checkbasic()/bridge_ip6_checkbasic() up so that the alignment is checked for ipfw and dummynet too. PR: ia64/81284 Obtained from: NetBSD Approved by: re (dwhite), mlaier (mentor)
* Fix for a bug in the change that defers sack option processing untilps2005-07-014-8/+10
| | | | | | | | | | after PAWS checks. The symptom of this is an inconsistency in the cached sack state, caused by the fact that the sack scoreboard was not being updated for an ACK handled in the header prediction path. Found by: Andrey Chernov. Submitted by: Noritoshi Demizu, Raja Mukerji. Approved by: re
* Fix for a SACK crash caused by a bug in tcp_reass(). tcp_reass()ps2005-07-012-2/+6
| | | | | | | | | | | | does not clear tlen and frees the mbuf (leaving th pointing at freed memory), if the data segment is a complete duplicate. This change works around that bug. A fix for the tcp_reass() bug will appear later (that bug is benign for now, as neither th nor tlen is referenced in tcp_input() after the call to tcp_reass()). Found by: Pawel Jakub Dawidek. Submitted by: Raja Mukerji, Noritoshi Demizu. Approved by: re
* When doing ARP load balancing source IP is taken in network byte order,glebius2005-07-011-1/+1
| | | | | | | | so residue of division for all hosts on net is the same, and thus only one VHID answers. Change source IP in host byte order. Reviewed by: mlaier Approved by: re (scottl)
* Fix ipfw packet matching errors with address tables.simon2005-06-293-19/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ipfw tables lookup code caches the result of the last query. The kernel may process multiple packets concurrently, performing several concurrent table lookups. Due to an insufficient locking, a cached result can become corrupted that could cause some addresses to be incorrectly matched against a lookup table. Submitted by: ru Reviewed by: csjp, mlaier Security: CAN-2005-2019 Security: FreeBSD-SA-05:13.ipfw Correct bzip2 permission race condition vulnerability. Obtained from: Steve Grubb via RedHat Security: CAN-2005-0953 Security: FreeBSD-SA-05:14.bzip2 Approved by: obrien Correct TCP connection stall denial of service vulnerability. A TCP packets with the SYN flag set is accepted for established connections, allowing an attacker to overwrite certain TCP options. Submitted by: Noritoshi Demizu Reviewed by: andre, Mohan Srinivasan Security: CAN-2005-2068 Security: FreeBSD-SA-05:15.tcp Approved by: re (security blanket), cperciva
* - Postpone SACK option processing until after PAWS checks. SACK optionps2005-06-274-115/+70
| | | | | | | | | | | processing is now done in the ACK processing case. - Merge tcp_sack_option() and tcp_del_sackholes() into a new function called tcp_sack_doack(). - Test (SEG.ACK < SND.MAX) before processing the ACK. Submitted by: Noritoshi Demizu Reveiewed by: Mohan Srinivasan, Raja Mukerji Approved by: re
* Libalias incorrectly applies proxy rules to the global divertphk2005-06-271-1/+5
| | | | | | | socket: it should only look for existing translation entries, not create new ones (no matter how it got the idea). Approved by: re(scottl)
* Disable checksum processing in LibAlias, when it works as aglebius2005-06-277-12/+50
| | | | | | | | | | | | | | | kernel module. LibAlias is not aware about checksum offloading, so the caller should provide checksum calculation. (The only current consumer is ng_nat(4)). When TCP packet internals has been changed and it requires checksum recalculation, a cookie is set in th_x2 field of TCP packet, to inform caller that it needs to recalculate checksum. This ugly hack would be removed when LibAlias is made more kernel friendly. Incremental checksum updates are left as is, since they don't conflict with offloading. Approved by: re (scottl)
* Fix some long standing bugs in writing to the BPF device attached todwmalone2005-06-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | 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)
* Fix a timer ticks wrap around bug for minmssoverload processing.ups2005-06-252-2/+2
| | | | | Approved by: re (scottl,dwhite) MFC after: 4 weeks
* Add back missing copyright and license statement. This is identicalimp2005-06-231-0/+35
| | | | | | | | | | | | | | | | to the statement in ip_mroute.h, as well as being the same as what OpenBSD has done with this file. It matches the copyright in NetBSD's 1.1 through 1.14 versions of the file as well, which they subsequently added back. It appears to have been lost in the 4.4-lite1 import for FreeBSD 2.0, but where and why I've not investigated further. OpenBSD had the same problem. NetBSD had a copyright notice until Multicast 3.5 was integrated verbatim back in 1995. This appears to be the version that made it into 4.4-lite1. Approved by: re (scottl) MFC after: 3 days
* Fix for a bug in tcp_sack_option() causing crashes.ps2005-06-231-2/+1
| | | | | Submitted by: Noritoshi Demizu, Mohan Srinivasan. Approved by: re (scottl blanket SACK)
* Fix IP(v6) over IP tunneling most likely broken with ifnet changes.bz2005-06-201-1/+8
| | | | | Reviewed by: gnn Approved by: re (dwhite), rwatson (mentor)
* - Don't use legacy function in a non-legacy one. This gives usglebius2005-06-201-4/+3
| | | | | | | possibility to compile libalias without legacy support. - Use correct way to mark variable as unused. Approved by: re (dwhite)
* In verify_rev_path6():mlaier2005-06-161-18/+52
| | | | | | | | | | | | - do not use static memory as we are under a shared lock only - properly rtfree routes allocated with rtalloc - rename to verify_path6() - implement the full functionality of the IPv4 version Also make O_ANTISPOOF work with IPv6. Reviewed by: gnn Approved by: re (blanket)
* Fix indentation in INET6 section in preperation of more serious work.mlaier2005-06-161-49/+49
| | | | Approved by: re (blanket ip6fw removal)
* When doing matching based on dst_ip/src_ip make sure we are really lookingmlaier2005-06-121-10/+13
| | | | | | | | | | | | on an IPv4 packet as these variables are uninitialized if not. This used to allow arbitrary IPv6 packets depending on the value in the uninitialized variables. Some opcodes (most noteably O_REJECT) do not support IPv6 at all right now. Reviewed by: brooks, glebius Security: IPFW might pass IPv6 packets depending on stack contents. Approved by: re (blanket)
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-104-112/+117
| | | | | | | | | | | | | | | | | | | | 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
* Modify send_pkt() to return the generated packet and have the callergreen2005-06-101-8/+32
| | | | | | | | | | | | | do the subsequent ip_output() in IPFW. In ipfw_tick(), the keep-alive packets must be generated from the data that resides under the stateful lock, but they must not be sent at that time, as this would cause a lock order reversal with the normal ordering (interface's lock, then locks belonging to the pfil hooks). In practice, this caused deadlocks when using IPFW and if_bridge(4) together to do stateful transparent filtering. MFC after: 1 week
* Add dummynet(4) support to if_bridge, this code is largely based on bridge.c.thompsa2005-06-102-0/+11
| | | | | | | This is the final piece to match bridge.c in functionality, we can now be a drop-in replacement. Approved by: mlaier (mentor)
* Fix a mis-merge. Remove a redundant call to tcp_sackhole_insertps2005-06-091-1/+0
| | | | Submitted by: Mohan Srinivasan
* Fix for a crash in tcp_sack_option() caused by hitting the limit onps2005-06-091-0/+5
| | | | | | | | the number of sack holes. Reported by: Andrey Chernov Submitted by: Noritoshi Demizu Reviewed by: Raja Mukerji
* Fix for a bug in the change that walks the scoreboard backwards fromps2005-06-061-4/+9
| | | | | | | | the tail (in tcp_sack_option()). The bug was caused by incorrect accounting of the retransmitted bytes in the sackhint. Reported by: Kris Kennaway. Submitted by: Noritoshi Demizu.
* Add hooks into the networking layer to support if_bridge. This changes structthompsa2005-06-051-4/+8
| | | | | | | ifnet so a buildworld is necessary. Approved by: mlaier (mentor) Obtained from: NetBSD
* Better explain, then actually implement the IPFW ALTQ-rule first-matchgreen2005-06-041-0/+3
| | | | | | | | policy. It may be used to provide more detailed classification of traffic without actually having to decide its fate at the time of classification. MFC after: 1 week
* Changes to tcp_sack_option() thatps2005-06-042-91/+118
| | | | | | | | | | - Walks the scoreboard backwards from the tail to reduce the number of comparisons for each sack option received. - Introduce functions to add/remove sack scoreboard elements, making the code more readable. Submitted by: Noritoshi Demizu Reviewed by: Raja Mukerji, Mohan Srinivasan
* Add support for IPv4 only rules to IPFW2 now that it supports IPv6 as well.mlaier2005-06-032-0/+9
| | | | | | | | This is the last requirement before we can retire ip6fw. Reviewed by: dwhite, brooks(earlier version) Submitted by: dwhite (manpage) Silence from: -ipfw
* Use IFF_LOCKGIANT/IFF_UNLOCKGIANT around calls to the interfaceiedowse2005-06-021-14/+26
| | | | | | if_ioctl routine. This should fix a number of code paths through soo_ioctl() that could call into Giant-locked network drivers without first acquiring Giant.
* When aborting tcp_attach() due to a problem allocating or attaching therwatson2005-06-011-0/+2
| | | | | | | tcpcb, lock the inpcb before calling in_pcbdetach() or in6_pcbdetach(), as they expect the inpcb to be passed locked. MFC after: 7 days
* Assert tcbinfo lock, inpcb lock in tcp_disconnect().rwatson2005-06-011-1/+8
| | | | | | Assert tcbinfo lock, inpcb lock in in tcp_usrclosed(). MFC after: 7 days
* Assert tcbinfo lock in tcp_drop() due to its call of tcp_close()rwatson2005-06-012-0/+12
| | | | | | | Assert tcbinfo lock in tcp_close() due to its call to in{,6}_detach() Assert tcbinfo lock in tcp_drop_syn_sent() due to its call to tcp_drop() MFC after: 7 days
* Assert that tcbinfo is locked in tcp_input() before calling intorwatson2005-06-012-2/+18
| | | | | | tcp_drop(). MFC after: 7 days
* Assert the tcbinfo lock whenever tcp_close() is to be called byrwatson2005-06-012-0/+22
| | | | | | tcp_input(). MFC after: 7 days
* Assert tcbinfo lock in tcp_attach(), as it is required; the callerrwatson2005-06-011-0/+2
| | | | | | (tcp_usr_attach()) currently grabs it. MFC after: 7 days
* Commit correct version of previous commit (in_pcb.c:1.164). Use therwatson2005-06-011-2/+2
| | | | | | local variables as currently named. MFC after: 7 days
* Assert pcbinfo lock in in_pcbdisconnect() and in_pcbdetach(), as therwatson2005-06-011-0/+3
| | | | | | global pcb lists are modified. MFC after: 7 days
* Slight white space tweak.rwatson2005-06-011-0/+1
| | | | MFC after: 7 days
* De-spl UDP.rwatson2005-06-011-31/+5
| | | | MFC after: 3 days
* Let OSPFv3 go through ipfw. Some more additional checks would betanimura2005-05-281-0/+5
| | | | desirable, though.
* This is conform with the terminology inps2005-05-254-20/+18
| | | | | | | | M.Mathis and J.Mahdavi, "Forward Acknowledgement: Refining TCP Congestion Control" SIGCOMM'96, August 1996. Submitted by: Noritoshi Demizu, Raja Mukerji
* Rewrite of tcp_sack_option(). Kentaro Kurahone (NetBSD) pointed outps2005-05-232-64/+109
| | | | | | | | | | | | that if we sort the incoming SACK blocks, we can update the scoreboard in one pass of the scoreboard. The added overhead of sorting upto 4 sack blocks is much lower than traversing (potentially) large scoreboards multiple times. The code was updating the scoreboard with multiple passes over it (once for each sack option). The rewrite fixes that, reducing the complexity of the main loop from O(n^2) to O(n). Submitted by: Mohan Srinivasan, Noritoshi Demizu. Reviewed by: Raja Mukerji.
* Replace t_force with a t_flag (TF_FORCEDATA).ps2005-05-214-11/+13
| | | | | Submitted by: Raja Mukerji. Reviewed by: Mohan, Silby, Andre Opperman.
* Introduce routines to alloc/free sack holes. This cleans up the codeps2005-05-161-56/+60
| | | | | | | considerably. Submitted by: Noritoshi Demizu. Reviewed by: Raja Mukerji, Mohan Srinivasan.
* - When carp interface is destroyed, and it affects global preemptionglebius2005-05-151-1/+12
| | | | | | | | | suppresion counter, decrease the latter. [1] - Add sysctl to monitor preemption suppression. PR: kern/80972 [1] Submitted by: Frank Volf [1] MFC after: 1 week
* Fix for a bug where the "nexthole" sack hint is out of sync with theps2005-05-131-0/+2
| | | | | | | | | real next hole to retransmit from the scoreboard, caused by a bug which did not update the "nexthole" hint in one case in tcp_sack_option(). Reported by: Daniel Eriksson Submitted by: Mohan Srinivasan
* In div_output() explicitly set m->m_nextpkt to NULL. If divert socketglebius2005-05-131-0/+5
| | | | | is not userland, but ng_ksocket, then m->m_nextpkt may be non-NULL. In this case we would panic in sbappend.
* When looking for the next hole to retransmit from the scoreboard,ps2005-05-115-82/+134
| | | | | | | | | | | | | | | | | | or to compute the total retransmitted bytes in this sack recovery episode, the scoreboard is traversed. While in sack recovery, this traversal occurs on every call to tcp_output(), every dupack and every partial ack. The scoreboard could potentially get quite large, making this traversal expensive. This change optimizes this by storing hints (for the next hole to retransmit and the total retransmitted bytes in this sack recovery episode) reducing the complexity to find these values from O(n) to constant time. The debug code that sanity checks the hints against the computed value will be removed eventually. Submitted by: Mohan Srinivasan, Noritoshi Demizu, Raja Mukerji.
OpenPOWER on IntegriCloud