summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/ip6_input.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* M_LEADINGSPACE() and M_TRAILINGSPACE() are just wrappers forclaudio2018-11-091-2/+2
| | | | | | m_leadingspace() and m_trailingspace(). Convert all callers to call directly the functions and remove the defines. OK krw@, mpi@
* All places that call carp_lsdrop() use the interface pointer already.bluhm2018-05-211-5/+4
| | | | | | | | 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@
* Remove almost unused `flags' argument of suser().mpi2018-02-191-2/+2
| | | | | | | The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
* Use IP6_SOIIKEY_LEN instead of hardcoded value.mpi2018-02-121-2/+2
| | | | from semarie@, ok benno@
* Implement RFC 7217: "A Method for Generating Semantically Opaqueflorian2018-02-101-1/+36
| | | | | | | | | | | | Interface Identifiers with IPv6 Stateless Address Autoconfiguration." "An IPv6 address configured using this method is stable within each subnet, but the corresponding Interface Identifier changes when the host moves from one network to another. This method is meant to be an alternative to generating Interface Identifiers based on hardware addresses." OK naddy, sthen
* The function ip6_get_prevhdr() did return a pointer into a mbuf.bluhm2018-02-011-25/+19
| | | | | | It was not guaranteed that the mbuf data was not somewhere else in the chain. So return an offset and do a proper mbuf pulldown. found by Maxime Villard; from NetBSD; with markus@; OK deraadt@
* Constify protocol tables and remove an assert now that ip_deliver() ismpi2017-11-231-2/+2
| | | | | | mp-safe. ok bluhm@, visa@
* Sprinkle some NET_ASSERT_LOCKED(), const and co to prepare runningmpi2017-11-201-2/+2
| | | | | | pr_input handlers without KERNEL_LOCK(). ok visa@
* Introduce a reader version of the NET_LOCK().mpi2017-11-101-3/+3
| | | | | | | | This will be used to first allow read-only ioctl(2) to be executed while the softnet taskq is running. Then it will allows us to execute multiple softnet taskq in parallel. Tested by Hrvoje Popovski, ok kettenis@, sashan@, visa@, tb@
* Fix typo in previous resulting in a NULL dereference.mpi2017-11-011-2/+2
|
* - add one more softnet taskqsashan2017-10-311-2/+2
| | | | | | | NOTE: code still runs with single softnet task. change definition of SOFTNET_TASKS in net/if.c, if you want to have more than one softnet task OK mpi@, OK phessler@
* Stop grabbing the KERNEL_LOCK() in network tasks when `ipsec_in_use'mpi2017-10-261-26/+1
| | | | | | | | | is set. Accesses to IPsec global data structure are now serialized by the NET_LOCK(). Tested by many, ok visa@, bluhm@
* Setting the IPV6_MINMTU flag in the call to ip6_output() was movedbluhm2017-10-181-1/+8
| | | | | | | from icmp6_reflect() to ip6_send_dispatch() when ip6_send() was introduced. Move the comment that explains this flag also to the place where it is used. from sashan@
* Reduces the scope of the NET_LOCK() in sysctl(2) path.mpi2017-10-091-10/+23
| | | | | | Exposes per-CPU counters to real parrallelism. ok visa@, bluhm@, jca@
* Prevent a race against ipsec_in_use.mpi2017-08-221-2/+5
| | | | | | Problem reported and fix tested by Hrvoje Popovski. ok bluhm@, visa@
* Remove NET_LOCK()'s argument.mpi2017-08-111-4/+3
| | | | Tested by Hrvoje Popovski, ok bluhm@
* Increase the limit of the IP protocol queues from 256 to 2048 mbufs.bluhm2017-08-081-2/+2
| | | | | | The interface congestion algorithm kills performance at this place, with the large queues it never triggers. OK mpi@ claudio@
* We do have SO_TIMESTAMP since some time and there is other code in theflorian2017-08-041-3/+1
| | | | | kernel that uses it without the #ifdef guard. OK bluhm
* The IP in IP input function strips the outer header and reinsertsbluhm2017-07-051-66/+19
| | | | | | | | | | | | | | | the inner IP packet into the internet queue. The IPv6 local delivery code has a loop to deal with header chains. The idea is to use this loop and avoid the queueing and rescheduling. The IPsec packet will be processed in a single flow. Merge the IP deliver loop from both IP versions into a single ip_deliver() function that can handle both addresss families. This allows to process an IP in IP header like a normal extension header. If af != AF_UNSPEC, we are already in a deliver loop and have the kernel look. Then we can just return the next protocol. Otherwise we enqueue. The dequeue thread has the kernel lock and starts an IP delivery loop. OK mpi@
* Convert ip6_input() to a pr_input style function. Goal is to processbluhm2017-06-271-39/+65
| | | | | IPsec packets without additional enqueueing. OK mpi@
* When dealing with mbuf pointers passed down as function parameters,bluhm2017-06-191-2/+2
| | | | | | | bugs could easily result in use-after-free or double free. Introduce m_freemp() which automatically resets the pointer before freeing it. So we have less dangling pointers in the kernel. OK krw@ mpi@ claudio@
* The IP multicast forward functions return an errno, call the variablebluhm2017-06-191-8/+14
| | | | | | error. Make the ip_mforward() return value consistent. Simplify the caller logic in ipv6_input() like in IPv4. OK mpi@
* Move IPv4 & IPv6 incoming/forwarding path, PIPEX ppp processing andmpi2017-05-311-18/+41
| | | | | | | | | | | | | | | | | | | | | IPv4 & IPv6 dispatch functions outside the KERNEL_LOCK(). We currently rely on the NET_LOCK() serializing access to most global data structures for that. IP input queues are no longer used in the forwarding case. They still exist as boundary between the network and transport layers because TCP/UDP & friends still need the KERNEL_LOCK(). Since we do not want to grab the NET_LOCK() for every packet, the softnet thread will do it once before processing a batch. That means the L2 processing path, which is currently running without lock, will now run with the NET_LOCK(). IPsec isn't ready to run without KERNEL_LOCK(), so the softnet thread will grab the KERNEL_LOCK() as soon as ``ipsec_in_use'' is set. Tested by Hrvoje Popovski. ok visa@, bluhm@, henning@
* Carp balancing ip does not work since there is a mac filter infriehm2017-05-301-4/+4
| | | | | | | ether_input(). Now we use mbuf tags instead of modifying the MAC address. ok mpi@
* Introduce ipv{4,6}_input(), two wrappers around IP queues.mpi2017-05-301-1/+7
| | | | | | | This will help transitionning to an un-KERNEL_LOCK()ed IP forwarding path. Disucssed with bluhm@, ok claudio@
* Per-interface list of addresses, both multicast and unicast, arempi2017-05-291-3/+2
| | | | | | | | | | | | | currently protected by the NET_LOCK(). They are not accessed in the hot path, so protecting them with a mutex could be an option. However since we're now going to run with a NET_LOCK() for some time, assert that it is held. IPsec is not yet ready to run without KERNEL_LOCK(), so assert it is held, even in the forwarding path. Tested by sthen@, ok visa@, claudio@, bluhm@
* Rename ip_local() to ip_deliver() and give it the same parametersbluhm2017-05-281-19/+17
| | | | | | | as the pr_input functions. Add an assert that IPv4 delivery ends in IP proto done to assure that IPv4 protocol functions work like IPv6. OK mpi@
* Bump the right counters. One of these was caught by clang because of akettenis2017-05-231-3/+3
| | | | | | mismatched enum. ok bluhm@
* Move IPsec forward and local policy check functions to ipsec_input.cbluhm2017-05-221-4/+3
| | | | | and give them better names. input and OK mikeb@
* Use the IPsec policy check from IPv4 also when doing local deliverybluhm2017-05-221-1/+13
| | | | | in ip6_local() to our IPv6 stack. OK mikeb@
* Use the IPsec policy check from ipv4_input() also when forwardingbluhm2017-05-121-1/+19
| | | | | in ip6_input(). While there avoid an ugly #ifdef in ipv4_input(). OK mikeb@
* Fix white spaces and wrap long line. No binary change.bluhm2017-05-111-6/+6
|
* Added initial IPv6 multicast routing support for multiple rdomains:rzalamena2017-05-081-2/+2
| | | | | | | | * don't share mifs (multicast interface) between rdomains * allow multiple routing sockets connected at the same time if they are in different rdomains. ok bluhm@
* Pass down the address family through the pr_input calls. Thisbluhm2017-04-141-2/+3
| | | | | allows to simplify code used for both IPv4 and IPv6. OK mikeb@ deraadt@
* Convert bcopy to memcpy as the memory does not overlap.dhill2017-04-061-5/+5
| | | | ok deraadt@
* Kill global list of IPv6 addresses.mpi2017-03-061-3/+1
| | | | ok bluhm@
* Some refactoring in ip6_input() needed to un-KERNEL_LOCK() the IPv6mpi2017-02-281-22/+35
| | | | | | | | | | | | | | forwarding path. Rename ip6_ours() in ip6_local() as this function dispatches packets to the upper layer. Introduce ip6_ours() and get rid of 'goto hbhcheck'. This function will be later used to enqueue local packets. As a bonus this reduces differences with IPv4. Inputs and ok bluhm@
* Remove the ipsec protocol callbacks which all do the same. Implementbluhm2017-02-081-2/+1
| | | | | | it in ipsec_common_input_cb() instead. The code that was copied to ah6_input_cb() is now in ip6_ours() so we can call it directly. OK mpi@
* Make ip6_input() more like ipv4_input() and introduce ip6_ours().bluhm2017-02-061-38/+31
| | | | OK mpi@
* Always allocate counters memory using type M_COUNTERS.jca2017-02-051-2/+2
| | | | | | | This makes the API simpler, and is probably more useful than spreading counters memory other several types, making it harder to track. Prodded by mpi, ok mpi@ stsp@
* Use percpu counters for ip6statjca2017-02-051-60/+58
| | | | | | | | | Try to follow the existing examples. Some notes: - don't implement counters_dec() yet, which could be used in two similar chunks of code. Let's see if there are more users first. - stop incrementing IPv6-specific mbuf stats, IPv4 has no equivalent. Input from mpi@, ok bluhm@ mpi@
* Change the IPv4 pr_input function to the way IPv6 is implemented,bluhm2017-01-291-7/+7
| | | | | | | to get rid of struct ip6protosw and some wrapper functions. It is more consistent to have less different structures. The divert_input functions cannot be called anyway, so remove them. OK visa@ mpi@
* Move nd6 timer initialisation to nd6_init() and call timeout_set()bluhm2016-12-271-13/+1
| | | | | only once during init. OK mpi@
* Typo, "more then" -> "more than"jca2016-12-261-2/+2
|
* A NET_LOCK() was is missing in tcp_sysctl() which shows up as splbluhm2016-12-201-6/+5
| | | | | | | | | | softnet assert failures. It is better to place the lock into net_sysctl() where all the protocol sysctls are called via pr_sysctl. As calling sysctl(2) is in the slow path, doing fine grained locking has no benefit. Many sysctl cases copy out a struct. Having a lock around that keeps the struct consistent. Put assertions in the protocol sysctls that need it. OK mpi@
* Introduce the NET_LOCK() a rwlock used to serialize accesses to the partsmpi2016-12-191-3/+6
| | | | | | | | | | | of the network stack that are not yet ready to be executed in parallel or where new sleeping points are not possible. This first pass replace all the entry points leading to ip_output(). This is done to not introduce new sleeping points when trying to acquire ART's write lock, needed when a new L2 entry is created via the RT_RESOLVE. Inputs from and ok bluhm@, ok dlg@
* Merge two "#ifdef MROUTING" blocks.mpi2016-11-281-26/+33
| | | | | | | It's one more step towards splitting ip6_input() in two and it reduces differences with v4. ok bluhm@
* Automatically create a default lo(4) interface per rdomain.mpi2016-11-141-5/+6
| | | | | | | | | | | | | | | | | | In order to stop abusing lo0 for all rdomains, a new loopback interface will be created every time a rdomain is created. The unit number will be the same as the rdomain, i.e. lo1 will be attached to rdomain 1. If this loopback interface is already in use it wont be possible to create the corresponding rdomain. In order to know which lo(4) interface is attached to a rdomain, its index is stored in the rtable/rdomain map. This is a long overdue since the introduction of rtable/rdomain. It also fixes a recent regression due to resetting the rdomain of an incoming packet reported by semarie@, Andreas Bartelt and Nils Frohberg. ok claudio@
* Kill ip6_forward_rt reducing differences between v4 and v6.mpi2016-08-241-33/+16
| | | | | | A single forwarding cache is not the answer. The answer is 42... err PF! ok bluhm@
* protect a pf specific function with the correct #if. Fixes ramdisk building.phessler2016-07-191-1/+3
| | | | | | | (we got lucky before, because the variable that used to be checked was always available) OK bluhm@