summaryrefslogtreecommitdiffstats
path: root/sys/netinet (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Initialize the TDB to NULL in ipsec_common_input() andmestre2018-09-142-5/+5
| | | | | | | | | | 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@
* In general it is a bad idea to use one random secret for two things.bluhm2018-09-142-12/+15
| | | | | | | 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@
* unbreak userland uses of in_pcb.h by including sys/refcnt.hjsg2018-09-141-1/+2
| | | | ok visa@
* Add reference counting for inet pcb, this will be needed when webluhm2018-09-135-9/+40
| | | | | | 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@
* Include the size of IPCOMP header when checking for compression.mpi2018-09-131-2/+2
| | | | Problem found and anaylyzed by Romain Gabet, ok markus@
* Convert inetctlerrmap to u_char like inet6ctlerrmap. That is alsobluhm2018-09-112-5/+5
| | | | | what FreeBSD does. Remove old #if 0 version of inet6ctlerrmap. OK mpi@
* Make the distribution of in_ and in6_ functions in in_pcb.c andbluhm2018-09-112-162/+11
| | | | | | | | | 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@
* Remove useless INPCBHASH() macros. Just expand them.bluhm2018-09-101-31/+24
| | | | OK stsp@
* Instead of calculating the mbuf packet header length here and there,bluhm2018-09-101-9/+2
| | | | | | put the algorithm into a new function m_calchdrlen(). Also set an uninitialized m_len to 0 in NFS code. OK claudio@
* During fragment reassembly, mbuf chains with packet headers werebluhm2018-09-101-3/+5
| | | | | | | 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@
* Explain the special case for redirect to localhost in a comment.bluhm2018-09-071-1/+14
| | | | input and OK claudio@
* sync icmp_mtudisc_clone() with icmp6_mtudisc_clone(); prompted by bluhm@miko2018-09-061-17/+12
|
* Add per-TDB counters and a new SADB extension to export them tompi2018-08-289-34/+97
| | | | | | userland. Inputs from markus@, ok sthen@
* Coverity CID 1470233 complainst that the m != NULL check inbluhm2018-07-231-4/+3
| | | | | | syn_cache_get() is not neccessary. Also make the abort label consistent to resetandabort and free the mbuf there. OK mpi@
* Fix for uninitialized variables.mpi2018-07-161-4/+4
| | | | Found by and ok jsg@, ok markus@
* Introduce ipsec_output_cb() to merge duplicate code and account formpi2018-07-126-176/+135
| | | | | | | | dropped packets in the output path. While here fix a memory leak when compression is not needed w/ IPcomp. ok markus@
* Disambiguate the source of panics in sys/net* by adding __func__nayden2018-07-111-4/+4
| | | | | magic constant to panic() calls. ok benno@ henning@ tb@
* Retire RTM_LOSING, it no longer makes sense and on busy servers theclaudio2018-07-111-18/+6
| | | | | | | 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@
* rtm_send() the cloned routes because of ICMP mtu changes. Until nowclaudio2018-07-111-1/+2
| | | | | | | 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@
* Convert AH & IPcomp to ipsec_input_cb() and count drops on input.mpi2018-07-115-119/+37
| | | | ok markus@
* Introduce new IPsec (per-CPU) statistics and refactor ESP inputmpi2018-07-105-73/+181
| | | | | | | | | | 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@
* Remove DELAY(1000) from carp_send_arp() / carp_send_na() since it is not clearfriehm2018-07-101-3/+1
| | | | | | | why it was necessary. OK bluhm@ 'ok but watch for fallouts' mpi@
* It was possible to leak the control mbuf in raw ip user requestbluhm2018-07-052-4/+5
| | | | | | 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@
* Prevent a mbuf double free by not freeing it along the error-path inanton2018-07-041-3/+5
| | | | | | rip{6,}_usrreq() since soreceive() will free it. ok bluhm@
* Assert that the NET_LOCK() is held when iterating over `ipsec_acquire_head'.mpi2018-06-251-1/+3
| | | | ok visa@ as part of a larger bigger diff
* In in_pcballoc() finish the inp initialization before adding it tobluhm2018-06-141-12/+13
| | | | | the global inpcb queue and hashes. OK visa@ mpi@ as part of a larger diff
* Assert that the INP_IPV6 in in6_pcbconnect() is correct. Just callbluhm2018-06-142-25/+6
| | | | | in_pcbconnect() to avoid the address family maze in syn_cache_get(). input claudio@; OK mpi@
* Use mbuf (not cluster) always for t_template of tcpcb.yasuoka2018-06-141-14/+4
| | | | ok bluhm
* Fix RAMDISK build by removing an #ifdef INET6 in tcp_trace().bluhm2018-06-111-4/+2
| | | | found the hard way by krw@
* Do not unlock the KERNEL_LOCK() unconditionally in sounlock().mpi2018-06-111-2/+2
| | | | | | | Instead introduce two flags to deal with global lock recursion. This is necessary until we get per-socket lock. Req. by and ok visa@
* Push the KERNEL_LOCK() inside route_input().mpi2018-06-112-6/+2
| | | | ok visa@, tb@
* The output from tcp debug sockets was incomplete. After detach tpbluhm2018-06-116-92/+107
| | | | | | | | 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@
* The udp control option processing was implemented three times.bluhm2018-06-081-77/+44
| | | | | | | | | 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@
* The global zero addresses must not change, mark them constant.bluhm2018-06-072-6/+6
| | | | OK tb@ visa@
* Pass the socket to sounlock(), this prepare the terrain for per-socketmpi2018-06-061-3/+8
| | | | | | locking. ok visa@, bluhm@
* Cleanup IPsec output error handling with consistent goto drop.bluhm2018-06-041-45/+61
| | | | from markus@; OK mpi@
* Use variable names for rtable and rdomain consistently in the in_pcbbluhm2018-06-031-19/+26
| | | | | functions. discussed with and OK mpi@ visa@
* Rename the incpb table field inpt_hash to inpt_mask as it containsbluhm2018-06-032-16/+15
| | | | | | the hashmask. For the resize calculations it is clearer to use the field inpt_size. OK visa@ mpi@
* SIOCSIFNETMASK takes a 'struct ifreq', so use 'ifr' for it and drop thetb2018-06-031-3/+2
| | | | | | now unused 'ifra' from in_ioctl(). Discussed with mpi and visa
* Better version of the refactoring attempted in r1.154. Move SIOCSIFADDRtb2018-06-031-35/+78
| | | | | | | | | | | | | 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.
* Move the declarations of the raw ip and ip6 pcb tables into thebluhm2018-06-021-1/+2
| | | | | in_pcb.h header file. OK mpi@ visa@
* Cleanup the in_pcbnotifymiss diagnostic printfs. Always print thebluhm2018-06-021-17/+16
| | | | | rdomain. Move the printf to the end of the pcb lookup functions. OK tb@ mpi@ visa@
* The function in_pcbrehash() does not modify the pcb table queue.bluhm2018-06-021-4/+4
| | | | | | So in in_pcbresize() the variant without _SAFE of the TAILQ_FOREACH macro is sufficient. OK tb@ mpi@ visa@
* zap trailing whitespacetb2018-05-311-3/+3
|
* Re-commit the correct half of revision 1.154:tb2018-05-311-23/+27
| | | | | | | | | 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
* Back out previous. The handling of SIOCSIFADDR is now wrong.tb2018-05-311-71/+45
|
* Some more code shuffling to get rid of one switch in each, in_ioctl()tb2018-05-311-45/+71
| | | | | | | | | | 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
* Next step in disentangling the switches in in_ioctl(). Split out thetb2018-05-281-43/+75
| | | | | | | | handling of SIOCAIFADDR, SIOCDIFADDR, SIOCSIFADDR into a separate function, analogously to what was done in in6_ioctl(). tested by hrvoje ok visa
* Prepare in_ioctl() for further refactoring with the goal of merging thetb2018-05-251-10/+15
| | | | | | | | two big switches in this function. Error out early in the default case without grabbing the NET_LOCK() and move SIOCSIFNETMASK a bit up. This will reduce the noise in an upcoming diff. ok visa
* All places that call carp_lsdrop() use the interface pointer already.bluhm2018-05-214-33/+23
| | | | | | | | It does not make sense to call if_get() again, just pass ifp as parameter. Move the IFT_CARP check into the function instead of doing it everywhere. Replace the inverted match variable logic with simple returns. OK mpi@ friehm@