summaryrefslogtreecommitdiff
path: root/sys/netinet
AgeCommit message (Collapse)Author
2018-09-24Turn carp_ourether() mp-safe, this is a requirement for taking bridge(4)Martin Pieuchot
out of the KERNEL_LOCK(). ok visa@, bluhm@
2018-09-20As a step towards per inpcb or socket locks, remove the net lockAlexander Bluhm
for netstat -a. Introduce a global mutex that protects the tables and hashes for the internet PCBs. To detect detached PCB, set its inp_socket field to NULL. This has to be protected by a per PCB mutex. The protocol pointer has to be protected by the mutex as netstat uses it. Always take the kernel lock in in_pcbnotifyall() and in6_pcbnotify() before the table mutex to avoid lock ordering problems in the notify functions. OK visa@
2018-09-17Do not acknowledge a received ack-only tcp packet that we would drop due tofriehm
PAWS. Otherwise we could trigger a retransmit of the opposite party with another wrong timestamp and produce loop. I have seen this with a buggy server which messed up tcp timestamps. Suggested by Prof. Jacobson for FreeBSD. ok krw, bluhm, henning, mpi
2018-09-14Initialize the TDB to NULL in ipsec_common_input() andRicardo Mestre
ipsec_{input,output}_cb() so that in the case of sending or receiving a bogus mbuf (NULL) we don't end up trying to dereference the TDB, while being an uninitialized pointer, to increase the drops. Coverity IDs 1473312, 1473313 and 1473317. OK mpi@ visa@
2018-09-14In general it is a bad idea to use one random secret for two things.Alexander Bluhm
The inet PCB uses one hash with local and foreign addresses, and one with local port numbers. Give both hashes separate keys. Also document the struct fields. OK visa@
2018-09-14unbreak userland uses of in_pcb.h by including sys/refcnt.hJonathan Gray
ok visa@
2018-09-13Add reference counting for inet pcb, this will be needed when weAlexander Bluhm
start locking the socket. An inp can be referenced by the PCB queue and hashes, by a pf mbuf header, or by a pf state key. OK visa@
2018-09-13Include the size of IPCOMP header when checking for compression.Martin Pieuchot
Problem found and anaylyzed by Romain Gabet, ok markus@
2018-09-11Convert inetctlerrmap to u_char like inet6ctlerrmap. That is alsoAlexander Bluhm
what FreeBSD does. Remove old #if 0 version of inet6ctlerrmap. OK mpi@
2018-09-11Make the distribution of in_ and in6_ functions in in_pcb.c andAlexander Bluhm
in6_pcb.c consistent, to ease comparing the code. Move all inet6 functions to in6_. Bring functions in both source files in same order. Cleanup the include section. Now in_pcb.c is a superset of in6_pcb.c. The latter contains all the special implementations. Just moving arround, no code change intended. OK mpi@
2018-09-10Remove useless INPCBHASH() macros. Just expand them.Alexander Bluhm
OK stsp@
2018-09-10Instead of calculating the mbuf packet header length here and there,Alexander Bluhm
put the algorithm into a new function m_calchdrlen(). Also set an uninitialized m_len to 0 in NFS code. OK claudio@
2018-09-10During fragment reassembly, mbuf chains with packet headers wereAlexander Bluhm
created. Add a new function m_removehdr() do convert packet header mbufs within the chain to regular mbufs. Assert that the mbuf at the beginning of the chain has a packet header. found by Maxime Villard in NetBSD; from markus@; OK claudio@
2018-09-07Explain the special case for redirect to localhost in a comment.Alexander Bluhm
input and OK claudio@
2018-09-06sync icmp_mtudisc_clone() with icmp6_mtudisc_clone(); prompted by bluhm@miko
2018-08-28Add per-TDB counters and a new SADB extension to export them toMartin Pieuchot
userland. Inputs from markus@, ok sthen@
2018-07-23Coverity CID 1470233 complainst that the m != NULL check inAlexander Bluhm
syn_cache_get() is not neccessary. Also make the abort label consistent to resetandabort and free the mbuf there. OK mpi@
2018-07-16Fix for uninitialized variables.Martin Pieuchot
Found by and ok jsg@, ok markus@
2018-07-12Introduce ipsec_output_cb() to merge duplicate code and account forMartin Pieuchot
dropped packets in the output path. While here fix a memory leak when compression is not needed w/ IPcomp. ok markus@
2018-07-11Disambiguate the source of panics in sys/net* by adding __func__Nayden Markatchev
magic constant to panic() calls. ok benno@ henning@ tb@
2018-07-11Retire RTM_LOSING, it no longer makes sense and on busy servers theClaudio Jeker
route socket is flooded with those messages. Instead maek sure that the removal of the dynamic route that can happen is actually also sent to the routing socket. OK mpi@ henning@
2018-07-11rtm_send() the cloned routes because of ICMP mtu changes. Until nowClaudio Jeker
these changes to the routing table have not been visible whereas the RTM_DELETE of those routes have been. Remove this inconsistency. Input and OK mpi@ OK henning@
2018-07-11Convert AH & IPcomp to ipsec_input_cb() and count drops on input.Martin Pieuchot
ok markus@
2018-07-10Introduce new IPsec (per-CPU) statistics and refactor ESP inputMartin Pieuchot
callbacks to be able to count dropped packet. Having more generic statistics will help troubleshooting problems with specific tunnels. Per-TDB counters are coming once all the refactoring bits are in. ok markus@
2018-07-10Remove DELAY(1000) from carp_send_arp() / carp_send_na() since it is not clearfriehm
why it was necessary. OK bluhm@ 'ok but watch for fallouts' mpi@
2018-07-05It was possible to leak the control mbuf in raw ip user requestAlexander Bluhm
with sendmsg(2) and MSG_OOB. Sync the code in udp, rip, and rip6_usrreq. Add an inp NULL check in rip6_usrreq for consistency. OK benno@ mpi@
2018-07-04Prevent a mbuf double free by not freeing it along the error-path inanton
rip{6,}_usrreq() since soreceive() will free it. ok bluhm@
2018-06-25Assert that the NET_LOCK() is held when iterating over `ipsec_acquire_head'.Martin Pieuchot
ok visa@ as part of a larger bigger diff
2018-06-14In in_pcballoc() finish the inp initialization before adding it toAlexander Bluhm
the global inpcb queue and hashes. OK visa@ mpi@ as part of a larger diff
2018-06-14Assert that the INP_IPV6 in in6_pcbconnect() is correct. Just callAlexander Bluhm
in_pcbconnect() to avoid the address family maze in syn_cache_get(). input claudio@; OK mpi@
2018-06-14Use mbuf (not cluster) always for t_template of tcpcb.YASUOKA Masahiko
ok bluhm
2018-06-11Fix RAMDISK build by removing an #ifdef INET6 in tcp_trace().Alexander Bluhm
found the hard way by krw@
2018-06-11Do not unlock the KERNEL_LOCK() unconditionally in sounlock().Martin Pieuchot
Instead introduce two flags to deal with global lock recursion. This is necessary until we get per-socket lock. Req. by and ok visa@
2018-06-11Push the KERNEL_LOCK() inside route_input().Martin Pieuchot
ok visa@, tb@
2018-06-11The output from tcp debug sockets was incomplete. After detach tpAlexander Bluhm
was NULL and nothing was traced. So save the old tcpcb and use that to retrieve some information. Note that otb may be freed and must not be dereferenced. Use a heuristic for cases where the address family is in the IP header but not provided in the PCB. OK visa@
2018-06-08The udp control option processing was implemented three times.Alexander Bluhm
Multicast lacked receive destination port. Better use a function and do it all in one place. The pipex chunk does not use the options, so it can happen before. Adding the udp header length to the ip header length was done inconsistently. Do it explicitly when needed. OK mpi@ visa@
2018-06-07The global zero addresses must not change, mark them constant.Alexander Bluhm
OK tb@ visa@
2018-06-06Pass the socket to sounlock(), this prepare the terrain for per-socketMartin Pieuchot
locking. ok visa@, bluhm@
2018-06-04Cleanup IPsec output error handling with consistent goto drop.Alexander Bluhm
from markus@; OK mpi@
2018-06-03Use variable names for rtable and rdomain consistently in the in_pcbAlexander Bluhm
functions. discussed with and OK mpi@ visa@
2018-06-03Rename the incpb table field inpt_hash to inpt_mask as it containsAlexander Bluhm
the hashmask. For the resize calculations it is clearer to use the field inpt_size. OK visa@ mpi@
2018-06-03SIOCSIFNETMASK takes a 'struct ifreq', so use 'ifr' for it and drop theTheo Buehler
now unused 'ifra' from in_ioctl(). Discussed with mpi and visa
2018-06-03Better version of the refactoring attempted in r1.154. Move SIOCSIFADDRTheo Buehler
to its own function and merge the two switches in in_ioctl_change_ifaddr(). Finally: each ioctl has its own case and privilege check. ok visa As an aside, an audit of the ports tree has shown that we should continue to support the legacy ioctls SIOCSIF{,BRD,DST}ADDR, SIOCSIFNETMASK despite the fact that they have been deprecated for the better part of two decades and FreeBSD dropped support 7 years ago. Too many ports still rely on them. Thanks to sthen and visa for their help with that.
2018-06-02Move the declarations of the raw ip and ip6 pcb tables into theAlexander Bluhm
in_pcb.h header file. OK mpi@ visa@
2018-06-02Cleanup the in_pcbnotifymiss diagnostic printfs. Always print theAlexander Bluhm
rdomain. Move the printf to the end of the pcb lookup functions. OK tb@ mpi@ visa@
2018-06-02The function in_pcbrehash() does not modify the pcb table queue.Alexander Bluhm
So in in_pcbresize() the variant without _SAFE of the TAILQ_FOREACH macro is sufficient. OK tb@ mpi@ visa@
2018-05-31zap trailing whitespaceTheo Buehler
2018-05-31Re-commit the correct half of revision 1.154:Theo Buehler
Some more code shuffling to get rid of one switch in in_ioctl(). This way there is one case for each of SIOCSIFBRDADDR, SIOCSIFDSTADDR and SIOCSIFNETMASK, starting with a privilege check before any global data is modified. ok visa
2018-05-31Back out previous. The handling of SIOCSIFADDR is now wrong.Theo Buehler
2018-05-31Some more code shuffling to get rid of one switch in each, in_ioctl()Theo Buehler
and in_ioctl_change_ifaddr(). This way there is one case per ioctl starting with a privilege check before any global data is modified. The code paths are now straightforward. Some code duplication between SIOCSIFADDR and SIOCAIFADDR, but that can be addressed later. tested by hrvoje ok visa