summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
Commit message (Collapse)AuthorAgeFilesLines
* Use correct order of source and destination address and port.tuexen2016-04-291-3/+3
|
* Complete the UDP tunneling of ICMP msgs to those protocolsrrs2016-04-281-0/+23
| | | | | | | | interested in having tunneled UDP and finding out about the ICMP (tested by Michael Tuexen with SCTP.. soon to be using this feature). Differential Revision: http://reviews.freebsd.org/D5875
* in_lltable_alloc and in6 copy: Don't leak LLE in error pathcem2016-04-261-4/+15
| | | | | | | | Fix a memory leak in error conditions introduced in r292978. Reported by: Coverity CIDs: 1347009, 1347010 Sponsored by: EMC / Isilon Storage Division
* Fixes the comment to reflect the code.loos2016-04-251-2/+1
| | | | Sponsored by: Rubicon Communications (Netgate)
* Indentation issues.pfg2016-04-201-2/+1
| | | | | | Contract some lines leftover from r298310. Mea culpa.
* kernel: use our nitems() macro when it is available through param.h.pfg2016-04-191-1/+1
| | | | | | No functional change, only trivial cases are done in this sweep, Discussed in: freebsd-current
* Address issues found by the XCode code analyzer.tuexen2016-04-181-2/+1
|
* Fix the ICMP6 handling for SCTP.tuexen2016-04-162-198/+168
| | | | | | Keep the IPv4 code in sync. MFC after: 1 week
* sys/net* : for pointers replace 0 with NULL.pfg2016-04-155-10/+10
| | | | | | Mostly cosmetical, no functional change. Found with devel/coccinelle.
* Fix regression introduced in r296986.ae2016-04-081-1/+1
| | | | | | | | | | | | | Currently we don't keep zoneid in in6_ifaddr structure, because there is still some code, that doesn't properly initialize sin6_scope_id, but some functions use sa_equal() for addresses comparison. sa_equal() compares full sockaddr_in6 structures and such comparison will fail. For now use zero zoneid in in6ifa_ifwithaddr(). It is safe, because used address is in embedded form. In future we will use zoneid, so mark it with XXX comment. Reported by: kp Tested by: kp
* Unbreak the RSS/PCBGROUp build.gnn2016-03-311-0/+1
|
* Fix the lladdr copy in in6_lltable_dump_entry() after r292978.markj2016-03-301-1/+1
| | | | | | | This bug caused "ndp -a" to show the wrong link layer address for neighbour cache entries. PR: 208067
* Modify nd6_llinfo_timer() to acquire the nd6 lock before the LLE lock.markj2016-03-291-24/+32
| | | | | | | | | 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. X-MFC-With: r296063 Tested by: Larry Rosenman <ler@lerctr.org> (previous revision)
* FreeBSD previously provided route caching for TCP (and UDP). Re-addgnn2016-03-243-11/+27
| | | | | | | | | | route caching for TCP, with some improvements. In particular, invalidate the route cache if a new route is added, which might be a better match. The cache is automatically invalidated if the old route is deleted. Submitted by: Mike Karels Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D4306
* Mfp4 @180378:bz2016-03-225-38/+33
| | | | | | | | | | | | Factor out nd6 and in6_attach initialization to their own files. Also move destruction into those files though still called from the central initialization. Sponsored by: CK Software GmbH Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D5033
* Modify defrouter_remove() to perform the router lookup before removal.markj2016-03-173-54/+39
| | | | | | | | This allows some simplification of its callers. No functional change intended. Tested by: Larry Rosenman (as part of a larger change) MFC after: 1 month
* Reduce the number of local variables. Remove redundant check that inpae2016-03-171-19/+11
| | | | | | pointer isn't NULL, it is safe, because we are handling IPV6_PKTINFO socket option in this block of code. Also, use in6ifa_withaddr() instead of ifa_withaddr().
* Change in6_selectsrc() to allow usage of non-local IPv6 addresses inae2016-03-171-10/+18
| | | | | | | IPV6_PKTINFO ancillary data when IPV6_BINDANY socket option is set. Submitted by: n_hibma MFC after: 2 weeks
* New way to manage reference counting of mbuf external storage.glebius2016-03-012-2/+2
| | | | | | | | | | | | | | | | | | | | | | The m_ext.ext_cnt pointer becomes a union. It can now hold the refcount value itself. To tell that m_ext.ext_flags flag EXT_FLAG_EMBREF is used. The first mbuf to attach a cluster stores the refcount. The further mbufs to reference the cluster point at refcount in the first mbuf. The first mbuf is freed only when the last reference is freed. The benefit over refcounts stored in separate slabs is that now refcounts of different, unrelated mbufs do not share a cache line. For EXT_EXTREF mbufs the zone_ext_refcnt is no longer needed, and m_extadd() becomes void, making widely used M_EXTADD macro safe. For EXT_SFBUF mbufs the sf_ext_ref() is removed, which was an optimization exactly against the cache aliasing problem with regular refcounting. Discussed with: rrs, rwatson, gnn, hiren, sbruno, np Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D5396 Sponsored by: Netflix
* Lock the NDP default router list and count defrouter references.markj2016-02-254-71/+260
| | | | | | | | | | | This addresses a number of race conditions that can cause crashes as a result of unsynchronized access to the list. PR: 206904 Tested by: Larry Rosenman <ler@lerctr.org>, Kevin Bowling <kevin.bowling@kev009.com> MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D5315
* Don't leak an address in an error path.tuexen2016-02-231-0/+2
| | | | | CID: 1351729 MFC after: 3 days
* Fix reporting of mapped addressed in getpeername() and getsockname() fortuexen2016-02-181-25/+24
| | | | | IPv6 SCTP sockets. This bugs were found because of an issue reported by PVS / D5245.
* Release the ref acquired in nd6_dad_find() if DAD is already in progress.markj2016-02-181-2/+3
| | | | MFC after: 1 week
* Use pfxrtr_del() instead of freeing advertising routers directly.markj2016-02-171-2/+2
| | | | MFC after: 1 week
* Remove a prototype for the non-existent prelist_del().markj2016-02-171-1/+0
| | | | MFC after: 1 week
* Ternary operator has lower priority than OR.glebius2016-02-171-1/+1
| | | | Found by: PVS-Studio
* Add a missing newline to a log message.markj2016-02-121-1/+1
| | | | MFC after: 1 week
* Rename the flags field of struct nd_defrouter to "raflags".markj2016-02-123-9/+9
| | | | | | | This field contains the flags inherited from the corresponding router advertisement message and is not for storing private state. MFC after: 1 week
* Simplify defrtrlist_update() slightly in preparation for future changes.markj2016-02-121-28/+23
| | | | | | No functional change intended. MFC after: 1 week
* Remove a bogus comment from nd6_na_input().markj2016-02-121-6/+0
| | | | | | | The splnet() call that it refers to has been removed, and a lock for the default router list is in fact needed. MFC after: 1 week
* Remove superfluous return statements from the neighbour discovery code.markj2016-02-123-6/+0
| | | | MFC after: 1 week
* Fix style around allocations from M_IP6NDP.markj2016-02-122-9/+6
| | | | | | | - Don't cast the return value of malloc(9). - Use M_ZERO instead of explicitly calling bzero(9). MFC after: 1 week
* Remove some unreferenced NDP debug variable definitions.markj2016-02-121-5/+0
| | | | MFC after: 1 week
* Merge SVN r295220 (bz) from projects/vnet/dteske2016-02-111-1/+3
| | | | | | | Fix a panic that occurs when a vnet interface is unavailable at the time the vnet jail referencing said interface is stopped. Sponsored by: FIS Global, Inc.
* These files were getting sys/malloc.h and vm/uma.h with header pollutionglebius2016-02-012-0/+2
| | | | via sys/mbuf.h
* MFP r287070,r287073: split radix implementation and route table structure.melifaro2016-01-253-24/+25
| | | | | | | | | | | | | | | | | | | | | | | There are number of radix consumers in kernel land (pf,ipfw,nfs,route) with different requirements. In fact, first 3 don't have _any_ requirements and first 2 does not use radix locking. On the other hand, routing structure do have these requirements (rnh_gen, multipath, custom to-be-added control plane functions, different locking). Additionally, radix should not known anything about its consumers internals. So, radix code now uses tiny 'struct radix_head' structure along with internal 'struct radix_mask_head' instead of 'struct radix_node_head'. Existing consumers still uses the same 'struct radix_node_head' with slight modifications: they need to pass pointer to (embedded) 'struct radix_head' to all radix callbacks. Routing code now uses new 'struct rib_head' with different locking macro: RADIX_NODE_HEAD prefix was renamed to RIB_ (which stands for routing information base). New net/route_var.h header was added to hold routing subsystem internal data. 'struct rib_head' was placed there. 'struct rtentry' will also be moved there soon.
* Fix rte refcount leak in ip6_forward().melifaro2016-01-201-2/+5
| | | | | | Reviewed by: ae MFC after: 2 weeks Sponsored by: Yandex LLC
* Verify the packet length in sctp6_input().glebius2016-01-141-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The sctp6_ctlinput() function does not properly check the length of the packet it receives from the ICMP6 input routine. This means that an attacker can craft a packet that will cause a kernel panic. When the kernel receives an ICMP6 error message with one of the types/codes it handles, it calls icmp6_notify_error() to deliver it to the upper-level protocol. icmp6_notify_error() cycles through the extension headers (if any) to find the protocol number of the first non-extension header. It does NOT verify the length of the non-extension header. It passes information about the packet (including the actual packet) to the upper-level protocol's pr_ctlinput function. In the case of SCTP for IPv6, icmp6_notify_error() calls sctp6_ctlinput(). sctp6_ctlinput() assumes that the incoming packet contains a sufficiently-long SCTP header and calls m_copydata() to extract a copy of that header. In turn, m_copydata() assumes that the caller has already verified that the offset and length parameters are correct. If they are incorrect, it will dereference a NULL pointer and cause a kernel panic. In short, no one is sufficiently verifying the input, and the result is a kernel panic. Submitted by: jtl Security: SA-16:01.sctp
* Bring RADIX_MPATH support to new routing KPI to ease migration.melifaro2016-01-111-0/+7
| | | | | | Move actual rte selection process from rtalloc_mpath_fib() to the rt_path_selectrte() function. Add public rt_mpath_select() to use in fibX_lookup_ functions.
* Split in6_selectsrc() into in6_selectsrc_addr() and in6_selectsrc_socket().melifaro2016-01-107-88/+121
| | | | | | | | | | | | | | | | in6_selectsrc() has 2 class of users: socket-based one (raw/udp/pcb/etc) and socket-less (ND code). The main reason for that change is inability to specify non-default FIB for callers w/o socket since (internally) inpcb is used to determine fib. As as result, add 2 wrappers for in6_selectsrc() (making in6_selectsrc() static): 1) in6_selectsrc_socket() for the former class. Embed scope_ambiguous check along with returning hop limit when needed. 2) in6_selectsrc_addr() for the latter case. Add 'fibnum' argument and pass IPv6 address w/ explicitly specified scope as separate argument. Reviewed by: ae (previous version)
* Do not hold ifaddr reference for the whole icmp6_reflect() exec time.melifaro2016-01-101-16/+21
| | | | Copy source address, calculate hlim and release refcount instead.
* Remove prefix check from in6_addroute().melifaro2016-01-091-29/+1
| | | | | | | | | | | | | This check was added in initial? netinet6/ import back in 1999 (r53541). It effectively became unnecessary after 'address/prefix clean-ups' KAME commit 90ff8792e676132096a440dd787f99a5a5860ee8 (github) in 2001 (merged to FreeBSD in r78064) where prefix check was added to nd6_prefix_onlink(). Similar IPv4 check (in_addroute() was added in r137628). Additionally, the right plance for this (or similar) check is the prefix addition code (nd6_prefix_onlink(), nd6_prefix_onlink_rtrequest(), in_addprefix() or rtinit()), but not the generic radix insert routine.
* Remove sys/eventhandler.h from net/route.hmelifaro2016-01-091-0/+1
| | | | Reviewed by: ae
* Finish r293098: make ip6_getpmtu() and ip6_getpmtu_ctl() use new routing APImelifaro2016-01-041-20/+22
|
* Add rib_lookup_info() to provide API for retrieving individual routemelifaro2016-01-042-36/+43
| | | | | | | | | | | | | | | | | | | | | | | entries data in unified format. There are control plane functions that require information other than just next-hop data (e.g. individual rtentry fields like flags or prefix/mask). Given that the goal is to avoid rte reference/refcounting, re-use rt_addrinfo structure to store most rte fields. If caller wants to retrieve key/mask or gateway (which are sockaddrs and are allocated separately), it needs to provide sufficient-sized sockaddrs structures w/ ther pointers saved in passed rt_addrinfo. Convert: * lltable new records checks (in_lltable_rtcheck(), nd6_is_new_addr_neighbor(). * rtsock pre-add/change route check. * IPv6 NS ND-proxy check (RADIX_MPATH code was eliminated because 1) we don't support RTF_ANNOUNCE ND-proxy for networks and there should not be multiple host routes for such hosts 2) if we have multiple routes we should inspect them (which is not done). 3) the entire idea of abusing KRT as storage for ND proxy seems odd. Userland programs should be used for that purpose).
* Remove 'struct route_int6' argument from in6_selectsrc() andmelifaro2016-01-037-53/+29
| | | | | | | | | | | | | | | in6_selectif(). The main task of in6_selectsrc() is to return IPv6 SAS (along with output interface used for scope checks). No data-path code uses route argument for caching. The only users are icmp6 (reflect code), ND6 ns/na generation code. All this fucntions are control-plane, so there is no reason to try to 'optimize' something by passing cached route into to ip6_output(). Given that, simplify code by eliminating in6_selectsrc() 'struct route_in6' argument. Since in6_selectif() is used only by in6_selectsrc(), eliminate its 'struct route_in6' argument, too. While here, reshape rte-related code inside in6_selectif() to free lookup result immediately after saving all the needed fields.
* Handle IPV6_PATHMTU option by spliting ip6_getpmtu_ctl() from ip6_getpmtu().melifaro2016-01-032-32/+96
| | | | | | | | | | | | | | | | | | | | | | | Add ro_mtu field to 'struct route' to be able to pass lookup MTU back to the caller. Currently, ip6_getpmtu() has 2 totally different use cases: 1) control plane (IPV6_PATHMTU req), where we just need to calculate MTU and return it, w/o any reusability. 2) Actual ip6_output() data path where we (nearly) always use the provided route lookup data. If this data is not 'valid' we need to perform another lookup and save the result (which cannot be re-used by ip6_output()). Given that, handle 1) by calling separate function doing rte lookup itself. Resulting MTU is calculated by (newly-added) ip6_calcmtu() used by both ip6_getpmtu_ctl() and ip6_getpmtu(). For 2) instead of storing ref'ed rte, store mtu (the only needed data from the lookup result) inside newly-added ro_mtu field. 'struct route' was shrinked by 8(or 4 bytes) in r292978. Grow it again by 4 bytes. New ro_mtu field will be used in other places like ip/tcp_output (EMSGSIZE handling from output routines). Reviewed by: ae
* Use lltable_get_ifp() instead of direct access to lltable fields.melifaro2016-01-011-2/+4
|
* Implement interface link header precomputation API.melifaro2015-12-316-26/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add if_requestencap() interface method which is capable of calculating various link headers for given interface. Right now there is support for INET/INET6/ARP llheader calculation (IFENCAP_LL type request). Other types are planned to support more complex calculation (L2 multipath lagg nexthops, tunnel encap nexthops, etc..). Reshape 'struct route' to be able to pass additional data (with is length) to prepend to mbuf. These two changes permits routing code to pass pre-calculated nexthop data (like L2 header for route w/gateway) down to the stack eliminating the need for other lookups. It also brings us closer to more complex scenarios like transparently handling MPLS nexthops and tunnel interfaces. Last, but not least, it removes layering violation introduced by flowtable code (ro_lle) and simplifies handling of existing if_output consumers. ARP/ND changes: Make arp/ndp stack pre-calculate link header upon installing/updating lle record. Interface link address change are handled by re-calculating headers for all lles based on if_lladdr event. After these changes, arpresolve()/nd6_resolve() returns full pre-calculated header for supported interfaces thus simplifying if_output(). Move these lookups to separate ether_resolve_addr() function which ether returs error or fully-prepared link header. Add <arp|nd6_>resolve_addr() compat versions to return link addresses instead of pre-calculated data. BPF changes: Raw bpf writes occupied _two_ cases: AF_UNSPEC and pseudo_AF_HDRCMPLT. Despite the naming, both of there have ther header "complete". The only difference is that interface source mac has to be filled by OS for AF_UNSPEC (controlled via BIOCGHDRCMPLT). This logic has to stay inside BPF and not pollute if_output() routines. Convert BPF to pass prepend data via new 'struct route' mechanism. Note that it does not change non-optimized if_output(): ro_prepend handling is purely optional. Side note: hackish pseudo_AF_HDRCMPLT is supported for ethernet and FDDI. It is not needed for ethernet anymore. The only remaining FDDI user is dev/pdq mostly untouched since 2007. FDDI support was eliminated from OpenBSD in 2013 (sys/net/if_fddisubr.c rev 1.65). Flowtable changes: Flowtable violates layering by saving (and not correctly managing) rtes/lles. Instead of passing lle pointer, pass pointer to pre-calculated header data from that lle. Differential Revision: https://reviews.freebsd.org/D4102
* Add the appropriate case statement for IPV6_BINDMULTI so the option can bejtl2015-12-301-0/+1
| | | | | | | | | retrieved with getsockopt(). CID: 1229928 Differential Revision: https://reviews.freebsd.org/D4737 Reviewed by: adrian Sponsored by: Juniper Networks
OpenPOWER on IntegriCloud