summaryrefslogtreecommitdiff
path: root/sys/netinet
AgeCommit message (Collapse)Author
2017-05-18Merge the content of <netinet/tcpip.h> and <netinet6/tcpipv6.h> inMartin Pieuchot
<netinet/tcp_debug.h>. The IPv6 variant was always included and the IPv4 version is not present on all systems. Most of the offending ports are already fixed, thanks to sthen@!
2017-05-18The function name ip4_input() is confusing as it also handles IPv6Alexander Bluhm
packets. This is the IP in IP protocol input function, so call it ipip_input(). Rename the existing ipip_input() to ipip_input_gif() as it is the input function used by the gif interface. Pass the address family to make it consistent with pr_input. Use __func__ in debug print and panic messages. Move all ipip prototypes to the ip_ipip.h header file. OK dhill@ mpi@
2017-05-17The large and nested GIF #ifdef in protosw made it hard to figureAlexander Bluhm
out what is going on. There were also some inconsistencies that seem to be oversights. Use more specific the #ifdefs. OK mpi@
2017-05-16Sync three changes that were caught by IPv6 multicast routing review:Rafael Zalamena
* use a variable to allow disabling debugs on run-time * fix a potential memory leak on copyout() failure * don't just blindly use the first address provided by ifalist ok bluhm@
2017-05-16Make return values more meaningful by using errno instead of -1 or 1.Rafael Zalamena
ok bluhm@
2017-05-16Replace remaining splsoftassert(IPL_SOFTNET) by NET_ASSERT_LOCKED().Martin Pieuchot
ok visa@
2017-05-16Let malloc() block when the caller of the add route function isRafael Zalamena
setsockopt(), otherwise use non-blocking malloc() for network stack calls. ok bluhm@
2017-05-16Call rtfree() after each use of routes and make sure the route is validRafael Zalamena
when finding one. Since rtfree() is being called and rt_llinfo being removed, add checks everywhere to make sure we are using a route that is not being removed. ok bluhm@
2017-05-13Do not check for mapped addresses in tcp_usrreq(PRU_CONNECT),Alexander Bluhm
this is done in in6_pcbconnect(). OK mpi@
2017-05-12IPsec packets were passed through ip_input() a second time afterAlexander Bluhm
they have been decrypted. That means that all the IP header fields were checked twice. Also fragment reassembly was tried twice. At pf incoming packets in tunnel mode appeared twice on the enc0 interface, once as IP-in-IP and once as the inner packet. In the outgoing path pf only sees the inner packet. Asymmetry is bad for stateful filtering. IPv6 shows that IPsec works without that. After decrypting immediately continue with local delivery. In tunnel mode the IP-in-IP protocol functions pass the inner header to ip6_input(). In transport mode only pf_test() has to be called for the enc0 device. Introduce ip_local() to avoid needless processing and cleaner pf behavior in IPv4 IPsec. OK mikeb@
2017-05-12Use the common switch(af) construct for address family specificAlexander Bluhm
code in tcp_usrreq(PRU_CONNECT). Do not access sockaddr_in before checking the address family. Return EAFNOSUPPORT error in the default case. OK mikeb@
2017-05-12Instead of printing a debug message at the end of processing, panicAlexander Bluhm
early if the IPsec security protocol is unknown. ipsec_common_input() and ipsec_common_input_cb() can only be called with the IP protocols ESP, AH, or IPComp. Everything else is a programming mistake. OK claudio@
2017-05-12Use the IPsec policy check from ipv4_input() also when forwardingAlexander Bluhm
in ip6_input(). While there avoid an ugly #ifdef in ipv4_input(). OK mikeb@
2017-05-11IPv6 IPsec transport mode did not work if pf is enabled. TheAlexander Bluhm
decrypted packets in the input path were not checked with pf. So with stateful filtering on enc0, direction aware protocols like ping or TCP did not pass. Add an explicit pf_test() in ipsec_common_input_cb() for IPv6 transport mode to fix this. OK mikeb@
2017-05-11Fix white spaces and wrap long line. No binary change.Alexander Bluhm
2017-05-09Remove rip_output() and rip6_output() from inetsw and inet6sw. TheAlexander Bluhm
rip_output() function is never called via the pr_output pointer. rip_usrreq(PRU_SEND) calls rip_output() directly. raw_usrreq() is never called from inetsw. Situation in inet and inet6 is analog. OK claudio@ mikeb@
2017-05-09Convert diagnostic panic to compile time assert in tcp6_ctlinput().Alexander Bluhm
No binary change. OK mpi@
2017-05-06Checking for IPv4 mapped addreses and dropping the packet is doneAlexander Bluhm
in ip6_input(). Do not check that again in the protocol input functions. OK mpi@
2017-05-06Convert the xformsw definition to C99 style initializer. Also fixAlexander Bluhm
the function declaration of ipe4_input() and avoid a wrong cast. OK mikeb@ dhill@
2017-05-05Expand SA_LEN(), there is no benefit for using the macro in theAlexander Bluhm
kernel. It was only used in IPsec sources. No binary change OK deraadt@
2017-05-04If m is not a continuous mbuf cluster, m_pullup() in pr_input mayAlexander Bluhm
change the pointer. Then *mp keeps the invalid pointer and it might be used. Fix the potential use after free and also reset *mp in other places to have less dangling pointers to freed mbufs. OK mpi@ mikeb@
2017-05-04Introduce sstosa() for converting sockaddr_storage with a type safeAlexander Bluhm
inline function instead of casting it to sockaddr. While there, use inline instead of __inline for all these conversions. Some struct sockaddr casts can be avoided completely. OK dhill@ mpi@
2017-05-03Back out rev 1.185 (which made the code match the comment) andTodd C. Miller
adjust the comment to match reality (or at least rfc7323) instead. This brings us back in line with the behavior of Net and Free. From Lauri Tirkkonen. OK bluhm@
2017-05-02Switch OCF and IPsec over to the new AESMike Belopuhov
ok djm
2017-04-19Use the rt_rmx defines that hide the struct rt_kmetrics indirection.Alexander Bluhm
No binary change. OK mpi@
2017-04-17The raw ip input functions are called from several places. Use theAlexander Bluhm
address family passed down with pr_input to check that the correct one is used. OK florian@
2017-04-17Use the address family passed down with pr_input to simplifyAlexander Bluhm
tcp_input(). OK florian@
2017-04-17Use the address family passed down with pr_input to simplifyAlexander Bluhm
udp_input(). OK florian@
2017-04-14Pass down the address family through the pr_input calls. ThisAlexander Bluhm
allows to simplify code used for both IPv4 and IPv6. OK mikeb@ deraadt@
2017-04-11Partially revert previous mallocarray conversions that containDavid Hill
constants. The consensus is that if both operands are constant, we don't need mallocarray. Reminded by tedu@ ok deraadt@
2017-04-09Use mallocarray to allocate multicast group memberships.David Hill
ok deraadt@
2017-04-06Convert bcopy to memcpy where the memory does not overlap, otherwise,David Hill
use memmove. While here, change some previous conversions to a simple assignment. ok deraadt@
2017-04-06Replace bcopy with a simple assignment where both variables areDavid Hill
properly aligned and sockaddr_union fields, or with memcpy when the memory doesn't overlap. OK bluhm@
2017-04-05Replace 2 bcopy()'s with a simple assignment as both variables areDavid Hill
properly aligned malloc(9)d data and sockaddr_union fields. While here, convert the remaining bcopy() to memmove(). with and ok @bluhm
2017-04-05When building counter memory in preparation to copy to userland, alwaysTheo de Raadt
zero the buffers first. All the current objects appear to be safe, however future changes might introduce structure pads. Discussed with guenther, ok bluhm
2017-04-02Fix tcp stats reportingJeremie Courreges-Anglas
Return the sum of per-cpu counters instead of the current cpu's counters. Brainfart on my side. Analysis and fix by Andrei-Marius Radu.
2017-03-27Fix the prefixlen sent by RTM_NEWADDR on new addresses without masks:Rafael Zalamena
calculate the prefixlen using the address before sending the RTM_NEWADDR message. ok claudio@
2017-03-23Replace manual loop with SRPL_FOREACH_SAFE_LOCKED macro.Alexander Bluhm
OK mpi@
2017-03-17carp(4) code is always executed in the 'softnet' thread, so removeMartin Pieuchot
unneeded splnet()/splx() dance. ok mikeb@, bluhm@
2017-03-17Be more strict on all route iterations, lets always make sure that weRafael Zalamena
are not going to get a unicast route by accident. ok mpi@
2017-03-14Make mfc_find() more strict when looking for routes, fixes a problemRafael Zalamena
causing ip_mforward() not to send packets to the userland multicast routing daemon. Reported and tested by Paul de Weerd. ok bluhm@, claudio@
2017-03-13Move PRU_ATTACH out of the pr_usrreq functions into pr_attach.Claudio Jeker
Attach is quite a different thing to the other PRU functions and this should make locking a bit simpler. This also removes the ugly hack on how proto was passed to the attach function. OK bluhm@ and mpi@ on a previous version
2017-03-10percpu counters for ip_ipip.cJeremie Courreges-Anglas
ok bluhm@ dhill@ mpi@
2017-03-07Rename struct etheripstat members for consistency, move them all to 64bitsJeremie Courreges-Anglas
Will make transition to percpu counters easier. ok bluhm@
2017-03-07When the inpcb queue and hash lists are traversed or modified weAlexander Bluhm
need netlock. Remove the obsolete splnet. OK mpi@
2017-03-07Initially in_pcballoc() hooked all new inpcb, including the IPv6Alexander Bluhm
ones, into the IPv4 hash. They cannot be used before bind(2) anyway and then they are rehashed and rehooked, so this was not noticed. Nevertheless put IPv6 PCBs into the IPv6 hash from the beginning. OK jca@ mpi@
2017-03-06Kill global list of IPv6 addresses.Martin Pieuchot
ok bluhm@
2017-03-06Prefix functions dealing with routing messages with 'rtm_' and keepMartin Pieuchot
them all in net/rtsock.c. This allows to easily spot which functions are doing a copyout(9) when dealing with the routing midlayer. ok phessler@, bluhm@, dhill@, krw@, claudio@
2017-03-03Convert the variable argument list of the pr_output functions toAlexander Bluhm
fixed parameters. OK mpi@ claudio@ dhill@
2017-03-02Convert domain declarations to C99 initializers.Martin Pieuchot
ok dhill@, florian@, bluhm@