summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_input.c
AgeCommit message (Collapse)Author
2016-06-09Fix typo in comment. From Kapetanakis GiannisAlexander Bluhm
2016-03-31If one of the TCP syn cache buckets overflow, it might be a collisionAlexander Bluhm
attack against our hash function. In this case, switch to the passive syn cache as soon as possible. It will start with a new random seed for the hash. input and OK mpi@
2016-03-29Allow to adjust tcp_syn_use_limit with sysctl net.inet.tcp.synuselimit.Alexander Bluhm
This is convenient to test the feature and may be useful to defend against syn flooding in a denial of service condition. It is consistent to the existing syn cache sysctls. Move some declarations to tcp_var.h to access the syn cache sets from tcp_sysctl(). OK mpi@
2016-03-27To prevent attacks on the hash buckets of the syn cache, our TCPAlexander Bluhm
stack reseeds the hash function every time the cache is empty. Unfortunatly the attacker can prevent the reseeding by sending unanswered SYN packes periodically. Fix this by having an active syn cache that gets new entries and a passive one that is idling out. When the passive one is empty and the active one has been used 100000 times, they switch roles and the hash function is reseeded with new random. tedu@ agrees; OK mpi@
2016-03-21Add a tcps_sc_seedrandom counter in TCP SYN cache and netstat -s.Alexander Bluhm
This shows how often the hash function is reseeded and the random bucket distribution changes. OK mpi@ claudio@
2016-03-07Sync no-argument function declaration and definition by adding (void).Christian Weisgerber
ok mpi@ millert@
2016-01-22fix a missing if_put() in the default af path of tcp_mss()Jonathan Gray
ok mpi@
2015-12-05upgrade tcp/ip to use the latest in C89 technology: memcpy.Ted Unangst
ok henning
2015-12-03To avoid that the stack manipules the pf statekeys directly, introduceAlexander Bluhm
pf_inp_...() lookup, link and unlink functions as an interface. Locking can be added to them later. Remove the first linking at the beginning of tcp_input() and udp_input() as it is not necessary. It will be done later anyway. That code was a relict, from the time before I had added the second linking. Input from mikeb@ and sashan@; OK sashan@
2015-11-29Fix an hypotetical NULL dereference which might become true once the TCPMartin Pieuchot
layer will be turned mpsafe. We're not there yet. Reported by David Hill, ok florian@
2015-11-20Make use if_get() and get rid of rt_ifp.Martin Pieuchot
Tested by and ok sthen@, ok visa@
2015-11-06Change nd6_nud_hint() to no longer manipulate rt_ifp directly.Martin Pieuchot
While here remove unused argument and convert the route check to rtisvalid(9). ok bluhm@
2015-10-28Remove linkmtu and maxmtu from struct nd_ifinfo. IN6_LINKMTU can nowFlorian Obser
die and ifp->if_mtu is the one true mtu. Suggested by and OK mpi@
2015-10-24Ignore Router Advertisment's current hop limit.Martin Pieuchot
Appart from the usual inet6 axe murdering exercise to keep you fit, this allows us to get rid of a lot of layer violation due to the use of per- ifp variables to store the current hop limit. Imputs from bluhm@, ok phessler@, florian@, bluhm@
2015-09-11Kill yet another argument to functions in IPv6. This time ip6_output'sClaudio Jeker
ifpp - XXX: just for statistics ifpp is always NULL in all callers so that statistic confirms ifpp is dying OK mpi@
2015-09-10Only half of the IPv6 source address was used as input for the synAlexander Bluhm
cache hash. That makes it trivial to create syn cache collisions. Take the full address, xor it with random data and put it into the hash function. OK markus@
2015-09-10if_put added to the if_get calls. Reshuffle some code to make this easier.Claudio Jeker
OK dlg@
2015-08-27The syn cache is completely implemented in tcp_input.c. So all itsAlexander Bluhm
global variables should also live there. OK markus@
2015-08-24Set the required IPL at the syn-cache pool instead of doing aAlexander Bluhm
splsoftnet() explicitly. The function syn_cache_lookup() is always called at IPL_SOFTNET so a splsoftassert() is better than a needless splsoftnet(). OK markus@ dlg@
2015-08-24Rename the syn cache counter into tcp_syn_cache_count to have theAlexander Bluhm
same prefix for all variables. Convert the counter type to int, the limit is also int. Before searching the cache, check that it is not empty. Do not access the counter outside of the syn cache from tcp_ctlinput(), let the syn_cache_lookup() function handle it. OK dlg@
2015-08-13Use foreach queue macros in tcp syn cache.Alexander Bluhm
OK markus@
2015-08-13In tcp syn cache convert the struct sockaddr casts to satosin()Alexander Bluhm
inline functions. They have the advantage to check the old type before casting. OK dlg@
2015-07-16Expand ancient NTOHL/NTOHS/HTONS/HTONL macros.Martin Pieuchot
ok guenther@, henning@
2015-07-15m_freem() can handle NULL, do not check for this condition beforehands.Theo de Raadt
ok stsp mpi
2015-07-10Make KASSERT in tcp_input() less strict, tcpcb may be NULL.Alexander Bluhm
OK deraadt@
2015-07-09Remove unused arguments and the associated code from nd6_nud_hint().Martin Pieuchot
ok claudio@
2015-06-16Store a unique ID, an interface index, rather than a pointer to theMartin Pieuchot
receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
2015-06-07Introduce unhandled_af() for cases where code conditionally doesJonathan Gray
something based on an address family and later assumes one of the paths was taken. This was initially just calls to panic until guenther suggested a function to reduce the amount of strings needed. This reduces the amount of noise with static analysers and acts as a sanity check. ok guenther@ bluhm@
2015-06-07Replace a bunch of == 0 with == NULL in pointer tests. Nuke someKenneth R Westerback
annoying trailing, leading and embedded whitespace. No change to .o files. ok deraadt@
2015-05-13test mbuf pointers against NULL not 0Jonathan Gray
ok krw@ miod@
2015-04-16remove unfinished/unused support for socket-attached ipsec-policiesMarkus Friedl
ok mikeb
2015-04-14Remove support for storing credentials and auth information in the kernel.Mike Belopuhov
This code is largely unfinished and is not used for anything. The change leaves identities as only objects referenced by ipsec_ref structure and their handling requires some changes to support more advanced matching of IPsec connections. No objections from reyk and hshoexer, with and OK markus.
2015-02-08Count dropped SYN packets on the tcpstat. They are dropped due to theYASUOKA Masahiko
listen queue (backlog) limit or the memory shortage in syn-cache. ok henning reyk claudio
2014-12-19unifdef INET in net code as a precursor to removing the pretend option.Ted Unangst
long live the one true internet. ok henning mikeb
2014-12-05Explicitly include <net/if_var.h> instead of pulling it in <net/if.h>.Martin Pieuchot
ok mikeb@, krw@, bluhm@, tedu@
2014-11-20In TCP and UDP layers do not (ab)use the receiving interface to checkMartin Pieuchot
for a multicast/broadcast destination address. These checks have already been done in the Ethernet and IP layers and the mbuf(9) should contain all the required information at this point. But since we cannot trust this spaghetti stack, be paranoid and make sure to set the flags in the IP input routines. Use explicit comments, requested by deraadt@. ok claudio@
2014-11-18move arc4random prototype to systm.h. more appropriate for most codeTed Unangst
to include that than rdnvar.h. ok deraadt dlg
2014-11-04Remove "pl" suffix on pool names.Martin Pieuchot
ok dlg@, uebayasi@, mikeb@
2014-10-24Fix indentation of closing brace.Alexander Bluhm
From Florian Riehm
2014-10-14Use rtfree() instead of RTFREE(), NULLify some free'd route pointers andMartin Pieuchot
kill the macro. ok mikeb@, henning@
2014-10-08Remove #ifdef SO_OOBINLINE, it is always defined.Alexander Bluhm
OK henning@
2014-07-22Fewer <netinet/in_systm.h> !Martin Pieuchot
2014-07-11There is a use-after-free somewhere in the code that links the pfAlexander Bluhm
state to the socket pcb. Add an additional assert to narrow down the panics. OK henning@
2014-04-25Kill in_localaddr(), one less usage of the global list of IPv4 addresses.Martin Pieuchot
This function is used only once in our tree to optimize the size of the MSS if the forward address correspond to a host on one of our subnets, but only if ip.mutdisc is disable, which is not the default! While here get rid of the "#ifdef RTV_MTU", it is here. ok henning@, mikeb@, bluhm@
2014-04-21ip_output() using varargs always struck me as bizarre, esp since it's onlyHenning Brauer
ever used to pass on uint32 (for ipsec). stop that madness and just pass the uint32, 0 in all cases but the two that pass the ipsec flowinfo. ok deraadt reyk guenther
2014-04-21we'll do fine without casting NULL to struct foo * / void *Henning Brauer
ok gcc & md5 (alas, no binary change)
2014-04-14"struct pkthdr" holds a routing table ID, not a routing domain one.Martin Pieuchot
Avoid the confusion by using an appropriate name for the variable. Note that since routing domain IDs are a subset of the set of routing table IDs, the following idiom is correct: rtableid = rdomain But to get the routing domain ID corresponding to a given routing table ID, you must call rtable_l2(9). claudio@ likes it, ok mikeb@
2014-01-24clearing the _CSUM_IN_OK flags is now utterly pointless, was only done forHenning Brauer
statistics sideeffects before. ok lteo naddy
2014-01-23since the cksum rewrite the counters for hardware checksummed packetsHenning Brauer
are are lie, since the software engine emulates hardware offloading and that is later indistinguishable. so kill the hw cksummed counters. introduce software checksummed packet counters instead. tcp/udp handles ip & ipvshit, ip cksum covered, 6 has no ip layer cksum. as before we still have a miscounting bug for inbound with pf on, to be fixed in the next step. found by, prodding & ok naddy
2014-01-07Propagate an rdomain number to the nd6_lookup independently fromMike Belopuhov
the ifp pointer which can be NULL. This prevents a crash reported by David Hill <dhill at mindcry ! org>. OK bluhm