summaryrefslogtreecommitdiffstats
path: root/sys/netinet
Commit message (Collapse)AuthorAgeFilesLines
* Change incorrect stale cookie detection in syncookie_lookup() that prematurelyups2008-06-161-1/+1
| | | | | | | declared a cookie as expired. Reviewed by: andre@, silby@ Reported by: Yahoo!
* Fix a check in SYN cache expansion (syncache_expand()) to accept packets ↵ups2008-06-161-4/+7
| | | | | | | | | | | that arrive in the receive window instead of just on the left edge of the receive window. This is needed for correct behavior when packets are lost or reordered. PR: kern/123950 Reviewed by: andre@, silby@ Reported by: Yahoo!, Wang Jin MFC after: 1 week
* More prep for Vimage:rrs2008-06-154-19/+17
| | | | | | - only one functino to destroy an SCTP stack sctp_finish() - Make it so this function also arranges for any threads created by the image to do a kthread_exit()
* - Fixes foobar on my part. Some missing virtualization macros fromrrs2008-06-142-7/+7
| | | | specific logging cases.
* - Macro-izes the packed declaration in all headers.rrs2008-06-1422-1191/+1332
| | | | | | | | | | | | | | | | | | - Vimage prep - these are major restructures to move all global variables to be accessed via a macro or two. The variables all go into a single structure. - Asconf address addition tweaks (add_or_del Interfaces) - Fix rwnd calcualtion to be more conservative. - Support SACK_IMMEDIATE flag to skip delayed sack by demand of peer. - Comment updates in the sack mapping calculations - Invarients panic added. - Pre-support for UDP tunneling (we can do this on MAC but will need added support from UDP to get a "pipe" of UDP packets in. - clear trace buffer sysctl added when local tracing on. Note the majority of this huge patch is all the vimage prep stuff :-)
* Add generic TCP LOR into netinetjfv2008-06-112-0/+464
|
* Sort IP addresses before hashing them for the signature. Otherwise carp ismlaier2008-06-021-13/+39
| | | | | | | | | sensitive to address configuration order. PR: kern/121574 Reported by: Douglas K. Rand, Wouter de Jong Obtained from: OpenBSD (rev 1.114 + fixes) MFC after: 2 weeks
* When allocating temporary storage to hold a TCP/IP packet headerrwatson2008-06-022-11/+7
| | | | | | | | template, use an M_TEMP malloc(9) allocation rather than an mbuf with mtod(9) and dtom(9). This eliminates the last use of dtom(9) in TCP. MFC after: 3 weeks
* Increase LINK_TABLE_OUT_SIZE from 101 to 4001 like LINK_TABLE_IN_SIZEmav2008-06-012-70/+23
| | | | | | | | | | | | | to reduce performance degradation under heavy outgoing scan/flood. Scalability is now much more important then several kilobytes of RAM. Remove unneded TCP-specific expiration handeling. Before this connected TCP sessions could never expire. Now connected TCP sessions will expire after 24hours of inactivity. Simplify HouseKeeping() to avoid several mul/div-s per packet. Taking into account increased LINK_TABLE_OUT_SIZE, precision is still much more then required.
* Make m_megapullup() more intelligent:mav2008-06-011-12/+32
| | | | | | - to increase performance do not reallocate mbuf when possible, - to support up to 16K packets (was 2K max) use mbuf cluster of proper size. This change depends on recent ng_nat and ip_fw_nat changes.
* PKT_ALIAS_FOUND_HEADER_FRAGMENT result is not an error, so pass that packet.mav2008-06-011-3/+4
| | | | | | | | This fixes packet fragmentation handeling. Pass really available buffer size to libalias instead of MCLBYTES constant. MCLBYTES constant were used with believe that m_megapullup() always moves date into a fresh cluster that sometimes may become not so.
* Fix packet fragmentation support broken by copy/paste error in rev.1.60.mav2008-06-011-2/+2
| | | | ip_id should be u_short, but not u_char.
* Read lock rather than write lock TCP inpcbs in monitoring sysctls. Inrwatson2008-05-291-35/+31
| | | | | | | | some cases, add explicit inpcb locking rather than relying on the global lock, as we dereference inp_socket, but also allowing us to drop the global lock more quickly. MFC after: 1 week
* Employ read locks on UDP inpcbs, rather than write locks, whenrwatson2008-05-291-13/+18
| | | | | | | | monitoring UDP connections using sysctls. In some cases, add previously missing locking of inpcbs, as inp_socket is followed, which also allows us to drop global locks more quickly. MFC after: 1 week
* Factor out the v4-only vs. the v6-only inp_flags processing inbz2008-05-241-8/+3
| | | | | | | | | ip6_savecontrol in preparation for udp_append() to no longer need an WLOCK as we will no longer be modifying socket options. Requested by: rwatson Reviewed by: gnn MFC after: 10 days
* Consistently check IPFW and DUMMYNET privileges in the configurationrwatson2008-05-222-19/+5
| | | | | | | | | routines for those modules, rather than in the raw socket code. This each privilege check to occur in exactly once place and avoids duplicate checks across layers. MFC after: 3 weeks Sponsored by: nCircle Network Security, Inc.
* - sctputil.c - If debug is on, the INPKILL timer can deref a freed value.rrs2008-05-212-94/+99
| | | | | | | | | | | | | | Change so that we save off a type field for display and NULL inp just for good measure. - sctp_output.c - Fix it so in sending to the loopback we use the src address of the inbound INIT. We don't want to do this for non local addresses since otherwise we might be ingressed filtered so we need to use the best src address and list the address sent to. Obtained from: time bug - Neil Wilson MFC after: 1 week
* - Adds support for the multi-asconf (From Kozuka-san)rrs2008-05-2022-552/+1301
| | | | | | | | | | | | | | | | | | - Adds some prepwork (Not all yet) for vimage in particular support the delete the sctppcbinfo.xx structs. There is still a leak in here if it were to be called plus we stil need the regrouping (From Me and Michael Tuexen) - Adds support for UDP tunneling. For BSD there is no socket yet setup so its disabled, but major argument changes are in here to emcompass the passing of the port number (zero when you don't have a udp tunnel, the default for BSD). Will add some hooks in UDP here shortly (discussed with Robert) that will allow easy tunneling. (Mainly from Peter Lei and Michael Tuexen with some BSD work from me :-D) - Some ease for windows, evidently leave is reserved by their compile move label leave: -> out: MFC after: 1 week
* - Define changes in sctp.hrrs2008-05-205-44/+35
| | | | | | | | | - Bug in CA that does not get us incrementing the PBA properly which made us more conservative. - comment updated in sctp_input.c - memsets added before we log - added arg to hmac id's MFC after: 2 weeks
* Fix the loopback interface. Cleaning up some code with new macrosgnn2008-05-121-1/+0
| | | | | | | | was a tad too aggressive. PR: kern/123568 Submitted by: Vladimir Ermakov <samflanker at gmail dot com> Obtained from: antoine
* Add code to allow the system to handle multiple routing tables.julian2008-05-0923-180/+430
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This particular implementation is designed to be fully backwards compatible and to be MFC-able to 7.x (and 6.x) Currently the only protocol that can make use of the multiple tables is IPv4 Similar functionality exists in OpenBSD and Linux. From my notes: ----- One thing where FreeBSD has been falling behind, and which by chance I have some time to work on is "policy based routing", which allows different packet streams to be routed by more than just the destination address. Constraints: ------------ I want to make some form of this available in the 6.x tree (and by extension 7.x) , but FreeBSD in general needs it so I might as well do it in -current and back port the portions I need. One of the ways that this can be done is to have the ability to instantiate multiple kernel routing tables (which I will now refer to as "Forwarding Information Bases" or "FIBs" for political correctness reasons). Which FIB a particular packet uses to make the next hop decision can be decided by a number of mechanisms. The policies these mechanisms implement are the "Policies" referred to in "Policy based routing". One of the constraints I have if I try to back port this work to 6.x is that it must be implemented as a EXTENSION to the existing ABIs in 6.x so that third party applications do not need to be recompiled in timespan of the branch. This first version will not have some of the bells and whistles that will come with later versions. It will, for example, be limited to 16 tables in the first commit. Implementation method, Compatible version. (part 1) ------------------------------- For this reason I have implemented a "sufficient subset" of a multiple routing table solution in Perforce, and back-ported it to 6.x. (also in Perforce though not always caught up with what I have done in -current/P4). The subset allows a number of FIBs to be defined at compile time (8 is sufficient for my purposes in 6.x) and implements the changes needed to allow IPV4 to use them. I have not done the changes for ipv6 simply because I do not need it, and I do not have enough knowledge of ipv6 (e.g. neighbor discovery) needed to do it. Other protocol families are left untouched and should there be users with proprietary protocol families, they should continue to work and be oblivious to the existence of the extra FIBs. To understand how this is done, one must know that the current FIB code starts everything off with a single dimensional array of pointers to FIB head structures (One per protocol family), each of which in turn points to the trie of routes available to that family. The basic change in the ABI compatible version of the change is to extent that array to be a 2 dimensional array, so that instead of protocol family X looking at rt_tables[X] for the table it needs, it looks at rt_tables[Y][X] when for all protocol families except ipv4 Y is always 0. Code that is unaware of the change always just sees the first row of the table, which of course looks just like the one dimensional array that existed before. The entry points rtrequest(), rtalloc(), rtalloc1(), rtalloc_ign() are all maintained, but refer only to the first row of the array, so that existing callers in proprietary protocols can continue to do the "right thing". Some new entry points are added, for the exclusive use of ipv4 code called in_rtrequest(), in_rtalloc(), in_rtalloc1() and in_rtalloc_ign(), which have an extra argument which refers the code to the correct row. In addition, there are some new entry points (currently called rtalloc_fib() and friends) that check the Address family being looked up and call either rtalloc() (and friends) if the protocol is not IPv4 forcing the action to row 0 or to the appropriate row if it IS IPv4 (and that info is available). These are for calling from code that is not specific to any particular protocol. The way these are implemented would change in the non ABI preserving code to be added later. One feature of the first version of the code is that for ipv4, the interface routes show up automatically on all the FIBs, so that no matter what FIB you select you always have the basic direct attached hosts available to you. (rtinit() does this automatically). You CAN delete an interface route from one FIB should you want to but by default it's there. ARP information is also available in each FIB. It's assumed that the same machine would have the same MAC address, regardless of which FIB you are using to get to it. This brings us as to how the correct FIB is selected for an outgoing IPV4 packet. Firstly, all packets have a FIB associated with them. if nothing has been done to change it, it will be FIB 0. The FIB is changed in the following ways. Packets fall into one of a number of classes. 1/ locally generated packets, coming from a socket/PCB. Such packets select a FIB from a number associated with the socket/PCB. This in turn is inherited from the process, but can be changed by a socket option. The process in turn inherits it on fork. I have written a utility call setfib that acts a bit like nice.. setfib -3 ping target.example.com # will use fib 3 for ping. It is an obvious extension to make it a property of a jail but I have not done so. It can be achieved by combining the setfib and jail commands. 2/ packets received on an interface for forwarding. By default these packets would use table 0, (or possibly a number settable in a sysctl(not yet)). but prior to routing the firewall can inspect them (see below). (possibly in the future you may be able to associate a FIB with packets received on an interface.. An ifconfig arg, but not yet.) 3/ packets inspected by a packet classifier, which can arbitrarily associate a fib with it on a packet by packet basis. A fib assigned to a packet by a packet classifier (such as ipfw) would over-ride a fib associated by a more default source. (such as cases 1 or 2). 4/ a tcp listen socket associated with a fib will generate accept sockets that are associated with that same fib. 5/ Packets generated in response to some other packet (e.g. reset or icmp packets). These should use the FIB associated with the packet being reponded to. 6/ Packets generated during encapsulation. gif, tun and other tunnel interfaces will encapsulate using the FIB that was in effect withthe proces that set up the tunnel. thus setfib 1 ifconfig gif0 [tunnel instructions] will set the fib for the tunnel to use to be fib 1. Routing messages would be associated with their process, and thus select one FIB or another. messages from the kernel would be associated with the fib they refer to and would only be received by a routing socket associated with that fib. (not yet implemented) In addition Netstat has been edited to be able to cope with the fact that the array is now 2 dimensional. (It looks in system memory using libkvm (!)). Old versions of netstat see only the first FIB. In addition two sysctls are added to give: a) the number of FIBs compiled in (active) b) the default FIB of the calling process. Early testing experience: ------------------------- Basically our (IronPort's) appliance does this functionality already using ipfw fwd but that method has some drawbacks. For example, It can't fully simulate a routing table because it can't influence the socket's choice of local address when a connect() is done. Testing during the generating of these changes has been remarkably smooth so far. Multiple tables have co-existed with no notable side effects, and packets have been routes accordingly. ipfw has grown 2 new keywords: setfib N ip from anay to any count ip from any to any fib N In pf there seems to be a requirement to be able to give symbolic names to the fibs but I do not have that capacity. I am not sure if it is required. SCTP has interestingly enough built in support for this, called VRFs in Cisco parlance. it will be interesting to see how that handles it when it suddenly actually does something. Where to next: -------------------- After committing the ABI compatible version and MFCing it, I'd like to proceed in a forward direction in -current. this will result in some roto-tilling in the routing code. Firstly: the current code's idea of having a separate tree per protocol family, all of the same format, and pointed to by the 1 dimensional array is a bit silly. Especially when one considers that there is code that makes assumptions about every protocol having the same internal structures there. Some protocols don't WANT that sort of structure. (for example the whole idea of a netmask is foreign to appletalk). This needs to be made opaque to the external code. My suggested first change is to add routing method pointers to the 'domain' structure, along with information pointing the data. instead of having an array of pointers to uniform structures, there would be an array pointing to the 'domain' structures for each protocol address domain (protocol family), and the methods this reached would be called. The methods would have an argument that gives FIB number, but the protocol would be free to ignore it. When the ABI can be changed it raises the possibilty of the addition of a fib entry into the "struct route". Currently, the structure contains the sockaddr of the desination, and the resulting fib entry. To make this work fully, one could add a fib number so that given an address and a fib, one can find the third element, the fib entry. Interaction with the ARP layer/ LL layer would need to be revisited as well. Qing Li has been working on this already. This work was sponsored by Ironport Systems/Cisco Reviewed by: several including rwatson, bz and mlair (parts each) Obtained from: Ironport systems/Cisco
* Always bump tcpstat.tcps_badrst if we get a RST for a connection in thejhb2008-05-081-4/+5
| | | | | | | | syncache that has an invalid SEQ instead of only doing it when we suceed in mallocing space for the log message. MFC after: 1 week Reviewed by: sam, bz
* replace spaces added in last change with tabskmacy2008-05-051-5/+5
|
* add rcv_nxt, snd_nxt, and toe offload id to FreeBSD-specifickmacy2008-05-052-2/+12
| | | | extension fields for tcp_info
* Fix build, together with a bit of style breakage.marck2008-05-021-1/+1
|
* Fix a comment typo.rwatson2008-04-291-1/+1
| | | | MFC after: 3 days
* With IPv4 raw sockets, read lock rather than write lock the inpcb whenrwatson2008-04-211-15/+15
| | | | | | | | | | receiving or transmitting. With IPv6 raw sockets, read lock rather than write lock the inpcb when receiving. Unfortunately, IPv6 source address selection appears to require a write lock on the inpcb for the time being. MFC after: 3 months
* Read lock, rather than write lock, the inpcb when transmitting with orrwatson2008-04-211-11/+11
| | | | | | delivering to an IP divert socket. MFC after: 3 months
* Revert to rev. 1.161 - switch back to optimized TCP options ordering.bz2008-04-201-5/+2
| | | | | | | | | | | | A lot of testing has shown that the problem people were seeing was due to invalid padding after the end of option list option, which was corrected in tcp_output.c rev. 1.146. Thanks to: anders@, s3raphi, Matt Reimer Thanks to: Doug Hardie and Randy Rose, John Mayer, Susan Guzzardi Special thanks to: dwhite@ and BitGravity Discussed with: silby MFC after: 1 day
* Teach pf and ipfw to use read locks in inpcbs write than write locksrwatson2008-04-201-3/+3
| | | | | | | | | | | | | | when reading credential data from sockets. Teach pf to unlock the pcbinfo more quickly once it has acquired an inpcb lock, as the inpcb lock is sufficient to protect the reference. Assert locks, rather than read locks or write locks, on inpcbs in subroutines--this is necessary as the inpcb may be passed down with a write lock from the protocol, or may be passed down with a read lock from the firewall lookup routine, and either is sufficient. MFC after: 3 months
* In ip_output(), allow a read lock as well as a write lock when assertingrwatson2008-04-191-1/+1
| | | | | | a lock on the passed inpcb. MFC after: 3 months
* When querying the local or foreign address from an IP socket, acquirerwatson2008-04-191-6/+6
| | | | | | | | only a read lock on the inpcb. When an external module requests a read lock, acquire only a read lock. MFC after: 3 months
* move tcbinfo lock acquisition in to syncachekmacy2008-04-191-0/+3
|
* move cxgb_lt2.[ch] from NIC to TOEkmacy2008-04-191-2/+8
| | | | | | move most offload functionality from NIC to TOE factor out all socket and inpcb direct access factor out access to locking in incpb, pcbinfo, and sockbuf
* Add in check for loopback as well, which was missing from the original patch.gnn2008-04-171-0/+1
| | | | | | PR: 120958 Submitted by: James Snow <snow at teardrop.org> MFC after: 2 weeks
* Convert pcbinfo and inpcb mutexes to rwlocks, and modify macros torwatson2008-04-1718-332/+353
| | | | | | | | | | | | | | | explicitly select write locking for all use of the inpcb mutex. Update some pcbinfo lock assertions to assert locked rather than write-locked, although in practice almost all uses of the pcbinfo rwlock main exclusive, and all instances of inpcb lock acquisition are exclusive. This change should introduce (ideally) little functional change. However, it lays the groundwork for significantly increased parallelism in the TCP/IP code. MFC after: 3 months Tested by: kris (superset of committered patch)
* Clean up the code that checks the types of address so that it isgnn2008-04-172-3/+6
| | | | | | | | | | | done by understandable macros. Fix the bug that prevented the system from responding on interfaces with link local addresses assigned. PR: 120958 Submitted by: James Snow <snow at teardrop.org> MFC after: 2 weeks
* Allow SCTP to compile without INET6.rrs2008-04-1612-958/+1530
| | | | | | PR: 116816 Obtained from tuexen@fh-muenster.de: MFC after: 2 weeks
* Use the pru_flush infrastructure to avoid a panicrrs2008-04-143-3/+65
| | | | | PR: 122710 MFC after: 1 week
* Protection against errant sender sending a streamrrs2008-04-141-1/+7
| | | | | | | seq number out of order with no missing TSN's (a cisco box has this problem which will make a ssn be held forever). MFC after: 1 week
* New logging values.rrs2008-04-141-29/+30
|
* 1) adds some additional loggingrrs2008-04-141-1/+106
| | | | | 2) changes to use a inqueue_bytes calculated value in max_len calc's. MFC after: 1 week
* This patch provides the back end support for equal-cost multi-pathqingli2008-04-132-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (ECMP) for both IPv4 and IPv6. Previously, multipath route insertion is disallowed. For example, route add -net 192.103.54.0/24 10.9.44.1 route add -net 192.103.54.0/24 10.9.44.2 The second route insertion will trigger an error message of "add net 192.103.54.0/24: gateway 10.2.5.2: route already in table" Multiple default routes can also be inserted. Here is the netstat output: default 10.2.5.1 UGS 0 3074 bge0 => default 10.2.5.2 UGS 0 0 bge0 When multipath routes exist, the "route delete" command requires a specific gateway to be specified or else an error message would be displayed. For example, route delete default would fail and trigger the following error message: "route: writing to routing socket: No such process" "delete net default: not in table" On the other hand, route delete default 10.2.5.2 would be successful: "delete net default: gateway 10.2.5.2" One does not have to specify a gateway if there is only a single route for a particular destination. I need to perform more testings on address aliases and multiple interfaces that have the same IP prefixes. This patch as it stands today is not yet ready for prime time. Therefore, the ECMP code fragments are fully guarded by the RADIX_MPATH macro. Include the "options RADIX_MPATH" in the kernel configuration to enable this feature. Reviewed by: robert, sam, gnn, julian, kmacy
* Take the route mtu into account, if available, when sending anbz2008-04-093-7/+28
| | | | | | | | | | | | | | | | ICMP unreach, frag needed. Up to now we only looked at the interface MTU. Make sure to only use the minimum of the two. In case IPSEC is compiled in, loop the mtu through ip_ipsec_mtu() to avoid any further conditional maths. Without this, PMTU was broken in those cases when there was a route with a lower MTU than the MTU of the outgoing interface. PR: kern/122338 Tested by: Mark Cammidge mark peralex.com Reviewed by: silence on net@ MFC after: 2 weeks
* Remove TCP options ordering assumptions in tcp_addoptions(). Orderingandre2008-04-071-1/+11
| | | | | | | | | was changed in rev. 1.161 of tcp_var.h. All option now test for sufficient space in TCP header before getting added. Reported by: Mark Atkinson <atkin901-at-yahoo.com> Tested by: Mark Atkinson <atkin901-at-yahoo.com> MFC after: 1 week
* Remove now unnecessary comment.andre2008-04-071-2/+0
|
* Use #defines for TCP options padding after EOL to be consistent.andre2008-04-072-2/+4
| | | | Reviewed by: bz
* Add further TCP inpcb locking assertions to some TCP input code paths.rwatson2008-04-071-0/+11
| | | | MFC after: 1 month
* In in_pcbnotifyall() and in6_pcbnotify(), use LIST_FOREACH_SAFE() andrwatson2008-04-061-5/+2
| | | | | | | eliminate unnecessary local variable caching of the list head pointer, making the code a bit easier to read. MFC after: 3 weeks
* Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.ru2008-03-251-1/+1
| | | | | | | | | | Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true since the advent of MBUMA. Reviewed by: arch There are ongoing disputes as to whether we want to switch to directly using UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.
OpenPOWER on IntegriCloud