aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet6
Commit message (Collapse)AuthorAgeFilesLines
* MFC r342884:Hans Petter Selasky2019-01-181-30/+50
| | | | | | | | | | | | | | | | | | | | | | | | Fix loopback traffic when using non-lo0 link local IPv6 addresses. The loopback interface can only receive packets with a single scope ID, namely the scope ID of the loopback interface itself. To mitigate this packets which use the scope ID are appearing as received by the real network interface, see "origifp" in the patch. The current code would drop packets which are designated for loopback which use a link-local scope ID in the destination address or source address, because they won't match the lo0's scope ID. To fix this restore the network interface pointer from the scope ID in the destination address for the problematic cases. See comments added in patch for a more detailed description. This issue was introduced with route caching by karels@ . Reviewed by: bz (network) Differential Revision: https://reviews.freebsd.org/D18769 Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=343139
* There are various cases where we modify the inp_vflag and inp_inc.inc_flagsGordon Tetlow2018-09-272-7/+37
| | | | | | | | | | | | | | | | | | | | | | fields during a syscall, but don't restore those fields if the operation fails. This can leave the inp structure in an inconsistent state and cause various problems. Restore the inp_vflag and inp_inc.inc_flags fields when the underlying operation fails and the inp could be in an inconsistent state. This is a direct commit to the branch as the code is different enough in the other branches to make it difficult to resolve a merge. Submitted by: jtl@ Reported by: Jakub Jirasek, Secunia Research at Flexera Reviewed by: jhb@ Approved by: so Security: FreeBSD-EN-18:11.listen Security: CVE-2018-6925 Notes: svn path=/stable/10/; revision=338985
* MFC r328876:Andrey V. Elsukov2018-02-124-44/+30
| | | | | | | | | | | | | | | | | | Modify ip6_get_prevhdr() to be able use it safely. Instead of returning pointer to the previous header, return its offset. In frag6_input() use m_copyback() and determined offset to store next header instead of accessing to it by pointer and assuming that the memory is contiguous. In rip6_input() use offset returned by ip6_get_prevhdr() instead of calculating it from pointers arithmetic, because IP header can belong to another mbuf in the chain. Reported by: Maxime Villard <max at m00nbsd dot net> Notes: svn path=/stable/10/; revision=329158
* MFC r328770:Andrey V. Elsukov2018-02-051-1/+1
| | | | | | | | | | | | Merge r1.120 from NetBSD: Fix a pretty simple, yet pretty tragic typo: we should return IPPROTO_DONE, not IPPROTO_NONE. With IPPROTO_NONE we will keep parsing the header chain on an mbuf that was already freed. Reported by: Maxime Villard <max at m00nbsd dot net> Notes: svn path=/stable/10/; revision=328878
* MFC r327295:Pedro F. Giffuni2018-01-041-6/+3
| | | | | | | | | | | | | | Start syncing changes from OpenBSD's ip6_id.c instead of ip_id.c. correct non-repetitive ID code, based on comments from niels provos. - seed2 is necessary, but use it as "seed2 + x" not "seed2 ^ x". - skipping number is not needed, so disable it for 16bit generator (makes the repetition period to 30000) Obtained from: OpenBSD (CVS rev. 1.2) Notes: svn path=/stable/10/; revision=327550
* MFC r318255:Enji Cooper2017-07-181-1/+2
| | | | | | | | | | | | | | Add missing braces around MCAST_EXCLUDE check when KTR support is compiled into the kernel This ensures that .iss_asm (the number of ASM listeners) isn't incorrectly decremented for MLD-layer source datagrams when inspecting im*s_st[1] (the second state in the structure). PR: 217509 [1] Notes: svn path=/stable/10/; revision=321134
* MFC r317186Kristof Provost2017-04-231-0/+2
| | | | | | | | | | | | | | | | | | | | | pf: Fix possible incorrect IPv6 fragmentation When forwarding pf tracks the size of the largest fragment in a fragmented packet, and refragments based on this size. It failed to ensure that this size was a multiple of 8 (as is required for all but the last fragment), so it could end up generating incorrect fragments. For example, if we received an 8 byte and 12 byte fragment pf would emit a first fragment with 12 bytes of payload and the final fragment would claim to be at offset 8 (not 12). We now assert that the fragment size is a multiple of 8 in ip6_fragment(), so other users won't make the same mistake. Reported by: Antonios Atlasis <aatlasis at secfu net> Notes: svn path=/stable/10/; revision=317335
* MFC r314430:Andrey V. Elsukov2017-03-071-0/+9
| | | | | | | | | | When IPv6 fragments reassembly is complete, update mbuf's csum_data and csum_flags using information from all fragments. This fixes dropping of reassembled packets due to wrong checksum when the IPv6 checksum offloading is enabled on a network card. Notes: svn path=/stable/10/; revision=314829
* MFC r283291: don't use CALLOUT_MPSAFE with callout_init()Andriy Gapon2017-03-041-1/+1
| | | | | | | | The main purpose of this MFC is to reduce conflicts for other merges. Parts of the original change have already "trickled down" via individual MFCs. Notes: svn path=/stable/10/; revision=314667
* MFC r286227, r286443:Julien Charbon2016-11-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r286227: Decompose TCP INP_INFO lock to increase short-lived TCP connections scalability: - The existing TCP INP_INFO lock continues to protect the global inpcb list stability during full list traversal (e.g. tcp_pcblist()). - A new INP_LIST lock protects inpcb list actual modifications (inp allocation and free) and inpcb global counters. It allows to use TCP INP_INFO_RLOCK lock in critical paths (e.g. tcp_input()) and INP_INFO_WLOCK only in occasional operations that walk all connections. PR: 183659 Differential Revision: https://reviews.freebsd.org/D2599 Reviewed by: jhb, adrian Tested by: adrian, nitroboost-gmail.com Sponsored by: Verisign, Inc. r286443: Fix a kernel assertion issue introduced with r286227: Avoid too strict INP_INFO_RLOCK_ASSERT checks due to tcp_notify() being called from in6_pcbnotify(). Reported by: Larry Rosenman <ler@lerctr.org> Submitted by: markj, jch Notes: svn path=/stable/10/; revision=309108
* MFC r299829Sean Bruno2016-07-281-1/+3
| | | | | | | Use Node Information flag names instead of hard-coding their values. Notes: svn path=/stable/10/; revision=303459
* MFC r296063 r297397 r299213Sean Bruno2016-07-285-133/+300
| | | | | | | | | | | | | | | | | | | | | | | | | | | 296063: Lock the NDP default router list and count defrouter references. This addresses a number of race conditions that can cause crashes as a result of unsynchronized access to the list. 297397 Modify nd6_llinfo_timer() to acquire the nd6 lock before the LLE lock. When expiring a neighbour cache entry we may need to look up the associated default router, which requires the nd6 read lock. To avoid an LOR, the nd6 lock should be acquired first. 299213 Clean up callers of nd6_prelist_add(). nd6_prelist_add() sets *newp if and only if it is successful, so there's no need for code that handles the case where the return value is 0 and *newp == NULL. Fix some style bugs in nd6_prelist_add() while here. Submitted by: Jason Wolfe <j@nitrology.com> Notes: svn path=/stable/10/; revision=303458
* MFC r295583, r295584, r295729, r295730:Mark Johnston2016-05-055-15/+15
| | | | | | | | | | NDP code cleanup changes. MFC r295732: Fix an IPv6 DAD reference count leak. Notes: svn path=/stable/10/; revision=299145
* MFC r295575, r295576, r295578, r295579, r295580:Mark Johnston2016-05-033-54/+29
| | | | | | | Various NDP cleanups. No functional change intended. Notes: svn path=/stable/10/; revision=299014
* MFC r296984:Andrey V. Elsukov2016-03-311-10/+18
| | | | | | | | Change in6_selectsrc() to allow usage of non-local IPv6 addresses in IPV6_PKTINFO ancillary data when IPV6_BINDANY socket option is set. Notes: svn path=/stable/10/; revision=297445
* MFC r295549:Michael Tuexen2016-02-251-25/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Loopback addresses are 127.0.0.0/8, not 127.0.0.1/32. MFC r295668: Improve the teardown of the SCTP stack. MFC r295670: Whitespace changes. MFC r295708: Address a warning reported by D5245 / PVS. MFC r295709: Code cleanup which will silence a warning in PVS / D5245. MFC r295710: Add protection code for issues reported by PVS / D5245. MFC r295771: Fix reporting of mapped addressed in getpeername() and getsockname() for IPv6 SCTP sockets. This bugs were found because of an issue reported by PVS / D5245. MFC r295772: Add some protection code. MFC r295773: Add protection code. MFC r295805: Use the SCTP level pointer, not the interface level. MFC r295929: Don't leak an address in an error path. Approved by: re (marius) Notes: svn path=/stable/10/; revision=296052
* MFC r292601,292654:Bjoern A. Zeeb2016-02-081-1/+1
| | | | | | | | | | | | | | | Since r256624 (head) we have been leaking routing table allocations on vnet enabled jail shutdown. Call the provided cleanup routines for IP versions 4 and 6 to plug these leaks. Sponsored by: The FreeBSD Foundation Reviewed by: gnn Differential Revision:https://reviews.freebsd.org/D4530 Approved by: re (gjb) Notes: svn path=/stable/10/; revision=295389
* MFC 292953:Bjoern A. Zeeb2016-01-211-2/+2
| | | | | | | | | This code is not in modules that need KPI stability so no need to use the wrapper functions as used in r252511 (head). We can directly use the locking macros. Notes: svn path=/stable/10/; revision=294503
* MFC r291904:Michael Tuexen2016-01-171-1/+1
| | | | | | | | | | | | Fix the allocation of outgoing streams: * When processing a cookie, use the number of streams announced in the INIT-ACK. * When sending an INIT-ACK for an existing association, use the value from the association, not from the end-point. Notes: svn path=/stable/10/; revision=294215
* MFC r285877:Michael Tuexen2016-01-161-4/+1
| | | | | | | | | Move including netinet/icmp6.h around to avoid a problem when including netinet/icmp6.h and net/netmap.h. Both use ni_flags... This allows to build multistack with SCTP support. Notes: svn path=/stable/10/; revision=294142
* o Fix SCTP ICMPv6 error message vulnerability. [SA-16:01.sctp]Gleb Smirnoff2016-01-141-1/+4
| | | | | | | | | | | | | | | | o Fix Linux compatibility layer incorrect futex handling. [SA-16:03.linux] o Fix Linux compatibility layer setgroups(2) system call. [SA-16:04.linux] o Fix TCP MD5 signature denial of service. [SA-16:05.tcp] o Fix insecure default bsnmpd.conf permissions. [SA-16:06.bsnmpd] Security: FreeBSD-SA-16:01.sctp, CVE-2016-1879 Security: FreeBSD-SA-16:03.linux, CVE-2016-1880 Security: FreeBSD-SA-16:04.linux, CVE-2016-1881 Security: FreeBSD-SA-16:05.tcp, CVE-2016-1882 Security: FreeBSD-SA-16:06.bsnmpd, CVE-2015-5677 Notes: svn path=/stable/10/; revision=293897
* MFH r292836:Garrett Wollman2016-01-071-0/+1
| | | | | | | | | | | | | | in6_if2idlen: treat bridge(4) interfaces like other Ethernet interfaces bridge(4) interfaces have an if_type of IFT_BRIDGE, rather than IFT_ETHER, even though they only support Ethernet-style links. This caused in6_if2idlen to emit an "unknown link type (209)" warning to the console every time it was called. Add IFT_BRIDGE to the case statement in the appropriate place, indicating that it uses the same IPv6 address format as other Ethernet-like interfaces. Notes: svn path=/stable/10/; revision=293358
* MFC r292219:Kristof Provost2015-12-211-0/+2
| | | | | | | | | | | | | | | | inet6: Do not assume every interface has ip6 enabled. Certain interfaces (e.g. pfsync0) do not have ip6 addresses (in other words, ifp->if_afdata[AF_INET6] is NULL). Ensure we don't panic when the MTU is updated. pfsync interfaces will never have ip6 support, because it's explicitly disabled in in6_domifattach(). PR: 205194 Notes: svn path=/stable/10/; revision=292566
* Fix typo in r291986.Andrey V. Elsukov2015-12-081-1/+1
| | | | | | | (this is derect commit to stable/10) Notes: svn path=/stable/10/; revision=291987
* MFC r291578:Andrey V. Elsukov2015-12-081-0/+10
| | | | | | | | | | | | | | | | | | | mld_v2_dispatch_general_query() is used by mld_fasttimo_vnet() to send a reply to the MLDv2 General Query. In case when router has a lot of multicast groups, the reply can take several packets due to MTU limitation. Also we have a limit MLD_MAX_RESPONSE_BURST == 4, that limits the number of packets we send in one shot. Then we recalculate the timer value and schedule the remaining packets for sending. The problem is that when we call mld_v2_dispatch_general_query() to send remaining packets, we queue new reply in the same mbuf queue. And when number of packets is bigger than MLD_MAX_RESPONSE_BURST, we get endless reply of MLDv2 reports. To fix this, add the check for remaining packets in the queue. PR: 204831 Notes: svn path=/stable/10/; revision=291986
* MFC r288600:Hiroki Sato2015-11-042-19/+47
| | | | | | | | | | | | | | | - Schedule DAD for IN6_IFF_TENTATIVE addresses in nd6_timer(). This catches cases that DAD probes cannot be sent because of IFF_UP && !IFF_DRV_RUNNING. - nd6_dad_starttimer() now calls nd6_dad_ns_output(), instead of calling it before nd6_dad_starttimer(). - Do not release an entry in dadq when a duplicate entry is being added. Notes: svn path=/stable/10/; revision=290348
* Remove extra space introduced in r287734. This is a stable/10 only fixRenato Botelho2015-09-221-1/+1
| | | | | | | | | | since original commit (r287094) is correct. Approved by: loos Sponsored by: Rubicon Communications (Netgate) Notes: svn path=/stable/10/; revision=288109
* MFC 287094:Hiroki Sato2015-09-134-18/+19
| | | | | | | | | | | | | | | | | | | | | | - Deprecate IN6_IFF_NODAD. It was used to prevent DAD on a loopback interface but in6if_do_dad() already had a check for IFF_LOOPBACK. - Remove in6if_do_dad() check in in6_broadcast_ifa(). An address which needs DAD always has IN6_IFF_TENTATIVE there. - in6if_do_dad() now returns EAGAIN when the interface is not ready since DAD callout handler ignores such an interface. - In DAD callout handler, mark an address as IN6_IFF_TENTATIVE when the interface has ND6_IFF_IFDISABLED. And Do IFF_UP and IFF_DRV_RUNNING check consistently when DAD is required. - draft-ietf-6man-enhanced-dad is now published as RFC 7527. - Fix some typos. Notes: svn path=/stable/10/; revision=287734
* MFC 287095, 287610, 287611, 287617:Hiroki Sato2015-09-133-114/+22
| | | | | | | Remove obsolete API (SIOCGDRLST_IN6 and SIOCGPRLST_IN6) support. Notes: svn path=/stable/10/; revision=287733
* MFC 287609:Hiroki Sato2015-09-131-4/+6
| | | | | | | Do not add IN6_IFF_TENTATIVE when ND6_IFF_NO_DAD. Notes: svn path=/stable/10/; revision=287732
* MFC 287608:Hiroki Sato2015-09-132-6/+0
| | | | | | | Remove IN6_IFF_NOPFX. This flag was no longer used. Notes: svn path=/stable/10/; revision=287731
* MFC r285710:Andrey V. Elsukov2015-08-051-0/+1
| | | | | | | Invoke LLE event handler when entry is deleted. Notes: svn path=/stable/10/; revision=286316
* MFC r282805:Hiroki Sato2015-07-232-16/+4
| | | | | | | | | | | | | - Remove ND6_IFF_IGNORELOOP. This functionality was useless in practice because a link where looped back NS messages are permanently observed does not work with either NDP or ARP for IPv4. - draft-ietf-6man-enhanced-dad is now RFC 7527. Approved by: re (gjb) Notes: svn path=/stable/10/; revision=285825
* MFC r273992:Hiroki Sato2015-07-231-25/+23
| | | | | | | | | | Fix a bug which prevented ND6_IFF_IFDISABLED flag from clearing when the newly-added IPv6 address was /128. Approved by: re (gjb) Notes: svn path=/stable/10/; revision=285822
* MFC r284515:Michael Tuexen2015-06-201-1/+3
| | | | | | | | | | Add FIB support for SCTP. This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200379 PR: 200379 Notes: svn path=/stable/10/; revision=284633
* Merge r281234Kristof Provost2015-06-181-40/+41
| | | | | | | | | | | | | | Evaluate packet size after the firewall had its chance Defer the packet size check until after the firewall has had a look at it. This means that the firewall now has the opportunity to (re-)fragment an oversized packet. Differential Revision: https://reviews.freebsd.org/D2821 Reviewed by: gnn Notes: svn path=/stable/10/; revision=284576
* Merge r281165Kristof Provost2015-06-181-15/+2
| | | | | | | | | | | | | | Remove duplicate code We'll just fall into the same local delivery block under the 'if (m->m_flags & M_FASTFWD_OURS)'. Suggested by: ae Differential Revision: https://reviews.freebsd.org/D2820 Reviewed by: gnn Notes: svn path=/stable/10/; revision=284575
* Merge r280955Kristof Provost2015-06-182-4/+6
| | | | | | | | | | | | | | | | | | Preserve IPv6 fragment IDs accross reassembly and refragmentation When forwarding fragmented IPv6 packets and filtering with PF we reassemble and refragment. That means we generate new fragment headers and a new fragment ID. We already save the fragment IDs so we can do the reassembly so it's straightforward to apply the incoming fragment ID on the refragmented packets. Differential Revision: https://reviews.freebsd.org/D2817 Reviewed by: gnn Notes: svn path=/stable/10/; revision=284572
* Merge r278842Kristof Provost2015-06-182-48/+64
| | | | | | | | | | Factor out ip6_fragment() function, to be used in IPv6 stack and pf(4). Differential Revision: https://reviews.freebsd.org/D2815 Reviewed by: gnn Notes: svn path=/stable/10/; revision=284570
* Merge r278828, r278832Kristof Provost2015-06-182-19/+33
| | | | | | | | | | | - Factor out ip6_deletefraghdr() function, to be shared between IPv6 stack and pf(4). - Move ip6_deletefraghdr() to frag6.c. (Suggested by bz) Differential Revision: https://reviews.freebsd.org/D2813 Reviewed by: gnn Notes: svn path=/stable/10/; revision=284568
* MFC r276148:Andrey V. Elsukov2015-06-063-53/+5
| | | | | | | | | | | | | Remove in_gif.h and in6_gif.h files. They only contain function declarations used by gif(4). Instead declare these functions in C files. Also make some variables static. MFC r276215: Extern declarations in C files loses compile-time checking that the functions' calls match their definitions. Move them to header files. Notes: svn path=/stable/10/; revision=284072
* MFC r274246:Andrey V. Elsukov2015-06-062-0/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Overhaul if_gre(4). Split it into two modules: if_gre(4) for GRE encapsulation and if_me(4) for minimal encapsulation within IP. gre(4) changes: * convert to if_transmit; * rework locking: protect access to softc with rmlock, protect from concurrent ioctls with sx lock; * correct interface accounting for outgoing datagramms (count only payload size); * implement generic support for using IPv6 as delivery header; * make implementation conform to the RFC 2784 and partially to RFC 2890; * add support for GRE checksums - calculate for outgoing datagramms and check for inconming datagramms; * add support for sending sequence number in GRE header; * remove support of cached routes. This fixes problem, when gre(4) doesn't work at system startup. But this also removes support for having tunnels with the same addresses for inner and outer header. * deprecate support for various GREXXX ioctls, that doesn't used in FreeBSD. Use our standard ioctls for tunnels. me(4): * implementation conform to RFC 2004; * use if_transmit; * use the same locking model as gre(4); PR: 164475 MFC r274289 (by bz): gcc requires variables to be initialised in two places. One of them is correctly used only under the same conditional though. For module builds properly check if the kernel supports INET or INET6, as otherwise various mips kernels without IPv6 support would fail to build. MFC r274964: Add ip_gre.h to ObsoleteFiles.inc. Notes: svn path=/stable/10/; revision=284066
* Rework r281868 to not skip RTM announces for tunneling interfaces.Andrey V. Elsukov2015-06-051-22/+21
| | | | | | | | | This is direct commit to stable/10. Tested by: tuexen@ Notes: svn path=/stable/10/; revision=284016
* MFC r275392:Andrey V. Elsukov2015-06-022-10/+0
| | | | | | | | | | | | | Remove route chaching support from ipsec code. It isn't used for some time. * remove sa_route_union declaration and route_cache member from struct secashead; * remove key_sa_routechange() call from ICMP and ICMPv6 code; * simplify ip_ipsec_mtu(); * remove #include <net/route.h>; Sponsored by: Yandex LLC Notes: svn path=/stable/10/; revision=283901
* MFC r282965:Andrey V. Elsukov2015-05-311-3/+9
| | | | | | | | | | | | | Add an ability accept encapsulated packets from different sources by one gif(4) interface. Add new option "ignore_source" for gif(4) interface. When it is enabled, gif's encapcheck function requires match only for packet's destination address. Differential Revision: https://reviews.freebsd.org/D2004 Sponsored by: Yandex LLC Notes: svn path=/stable/10/; revision=283852
* MFC r283650:Michael Tuexen2015-05-311-2/+4
| | | | | | | | Fix and cleanup the debug information. This has no user-visible changes. Thanks to Irene Ruengeler for proving a patch. Notes: svn path=/stable/10/; revision=283822
* MFC r276914:Michael Tuexen2015-05-291-7/+1
| | | | | | | | Minimize the usage of SCTP_BUF_IS_EXTENDED. This should help Robert... Notes: svn path=/stable/10/; revision=283708
* MFC r275868:Michael Tuexen2015-05-291-1/+4
| | | | | | | | | | Plug a memory leak in an error code path. Reported by: Coverity CID: 1018936 Notes: svn path=/stable/10/; revision=283703
* MFC r282578:Andrey V. Elsukov2015-05-141-9/+5
| | | | | | | | | | | Mark data checksum as valid for multicast packets, that we send back to myself via simloop. Also remove duplicate check under #ifdef DIAGNOSTIC. PR: 180065 Notes: svn path=/stable/10/; revision=282894
* MFC r274223 (by glebius):Hiroki Sato2015-05-121-4/+0
| | | | | | | | | | Remove VNET_SYSCTL_ARG(). The generic sysctl(9) code handles that. A panic could occur by "sysctl -a" when using VIMAGE-enabled stable/10 kernel after r262734 because of this missing MFC. Notes: svn path=/stable/10/; revision=282807