summaryrefslogtreecommitdiffstats
path: root/sys/netinet (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixup the case where an mbuf cluster is used. Correctly offset the data toclaudio2018-11-051-3/+5
| | | | | | | | the end of the cluster (there is no M_ALIGN version for clusters so it is hard coded). Also make the sanity check more general by using m_leadingspace. Not a security issue since the cluster code is not reachable, there is enough space in an mbuf. OK bluhm@
* The change of the sb_mbmax calculation in sbreserve() broke settingbluhm2018-11-041-3/+4
| | | | | | a fixed socket send buffer size for TCP. tcp_update_sndspace() could overwrite the value as the algorithms were not in sync. OK benno@ claudio@
* ipsec: use monotonic clock for SA creation/lookup timestamps; ok dlg@cheloha2018-10-222-5/+5
|
* Partial revert of previous. Only the queue(3) stuff should have gone in.cheloha2018-10-181-38/+7
|
* igmp, struct router_info: use queue(3)cheloha2018-10-182-26/+52
| | | | | | | | | | In particular, use LIST_* to preserve O(n) removal in rti_delete(). While here, clean up two malloc(9) calls. Suggested by mpi@. ok visa@
* Expose net.inet.ip.arpq.drops to help debug what's going on when a lotflorian2018-10-132-4/+13
| | | | | | | of packets are being dropped but non of the other counters are increasing. From Daniel Hokka Zakrisson (daniel AT hozac DOT com), thanks! OK florian, phessler
* RT_TABLEID_MAX is 255, fix places that assumed that it is less than 255.reyk2018-10-101-5/+5
| | | | | | | | | | rtable 255 is a valid routing table or domain id that wasn't handled by the ip[6]_mroute code or by snmpd. The arrays in the ip[6]_mroute code where off by one and didn't allocate space for rtable 255; snmpd simply ignored rtable 255. All other places in the tree seem to handle RT_TABLEID_MAX correctly. OK florian@ benno@ henning@ deraadt@
* Revert the inpcb table mutex commit. It triggers a witness panicbluhm2018-10-046-84/+21
| | | | | | | in raw IP delivery and UDP broadcast loops. There inpcbtable_mtx is held and sorwakeup() is called within the loop. As sowakeup() grabs the kernel lock, we have a lock ordering problem. found by Hrvoje Popovski; OK deraadt@ mpi@
* Turn carp_ourether() mp-safe, this is a requirement for taking bridge(4)mpi2018-09-241-16/+15
| | | | | | out of the KERNEL_LOCK(). ok visa@, bluhm@
* As a step towards per inpcb or socket locks, remove the net lockbluhm2018-09-206-22/+85
| | | | | | | | | | | | 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@
* Do not acknowledge a received ack-only tcp packet that we would drop due tofriehm2018-09-171-2/+4
| | | | | | | | | 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
* 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