summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_carp.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* carp(4) percpu countersjca2017-02-201-28/+37
| | | | ok florian@
* Change the IPv4 pr_input function to the way IPv6 is implemented,bluhm2017-01-291-33/+35
| | | | | | | 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@
* Since raw_input() and route_input() are gone from pr_input, we canbluhm2017-01-251-8/+2
| | | | | | make the variable parameters of the protocol input functions fixed. Also add the proto to make it similar to IPv6. OK mpi@ guenther@ millert@
* Flag pseudo-interfaces as such in order to call add_net_randomness()mpi2017-01-231-1/+2
| | | | | | | | | only once per packet. Fix a regression introduced when if_input() started to be called by every pseudo-driver. ok claudio@, dlg@
* Prevent grabing the NET_LOCK() twice in the ioctl(2) and input path.mpi2016-12-201-19/+35
| | | | | | While here remove two redundant splsoftnet()/splx() dances. inputs and ok bluhm@
* Introduce the NET_LOCK() a rwlock used to serialize accesses to the partsmpi2016-12-191-3/+3
| | | | | | | | | | | 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@
* Rename SRPL_ENTER() to SRPL_FIRST() and SRPL_NEXT() to SRPL_FOLLOW().mpi2016-11-201-4/+4
| | | | | | | | This allows us to introduce SRPL_NEXT() that can be used to start iterating on an arbitrary member of an srp list, hence without calling SRPL_ENTER(). ok dlg@, jmatthew@
* Accept CARP advertisement packets whose destination is not for multicast.yasuoka2016-10-251-2/+2
| | | | | | | | When both "carppeer" and "real mac-address" are used at once and the BACKUP is to take over the new MASTER, the present MASTER receives such packets. Found by and diff from nagasaka at iij. ok henning bluhm
* Convert timeouts that need a process context to timeout_set_proc(9).mpi2016-10-041-4/+4
| | | | | | | The current reason is that rtalloc_mpath(9) inside ip_output() might end up inserting a RTF_CLONED route and that require a write lock. ok kettenis@, bluhm@
* fix revision 1.290 of sys/netinet/ip_carp.c.benno2016-07-251-1/+2
| | | | | diff from jsg@ ok deraadt@, benno@
* Fix the check supposed to prevent 'ip' and 'ip-stealth' balancing modesmpi2016-07-191-5/+4
| | | | | | | | | | | | from leaking the multicast address. beck@ found the hard way that this made his second CARP master use a wrong MAC address. This is part of a bigger diff from Florian Riehm who is currently working on a proper solution to fix balancing modes. ok beck@, bluhm@
* Get rid of the ``enaddr'' argument of carp_iamatch().mpi2016-06-061-9/+3
| | | | | | | It was only checked in balancing mode, which is currently broken, and is no longer needed. Discusssed with bluhm@ and Florian Riehm.
* Insert a hack to deal with interfaces removing the VLAN header beforempi2016-05-301-1/+14
| | | | | | | | | | | | | | the packet has been feed to the pseudo-interfaces input handlers. To fix that without introducing a layer violation we should be able to disable HW-vlan on parent when in use with different pseudo-interfaces. In the case of bridge(4) for example it makes no sense to let the interface remove the VLAN header if the kernel has to add it back for every packet. Fix issues reported by sebastia@ and markus@ From dlg@, ok claudio@
* rework the srp api so it takes an srp_ref struct that the caller provides.dlg2016-05-181-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | the srp_ref struct is used to track the location of the callers hazard pointer so later calls to srp_follow and srp_enter already know what to clear. this in turn means most of the caveats around using srps go away. specifically, you can now: - switch cpus while holding an srp ref - ie, you can sleep while holding an srp ref - you can take and release srp refs in any order the original intent was to simplify use of the api when dealing with complicated data structures. the caller now no longer has to track the location of the srp a value was fetched from, the srp_ref effectively does that for you. srp lists have been refactored to use srp_refs instead of srpl_iter structs. this is in preparation of using srps inside the ART code. ART is a complicated data structure, and lookups require overlapping holds of srp references. ok mpi@ jmatthew@
* We're always ready! So send IFQ_SET_READY() to the bitbucket.mpi2016-04-131-2/+1
|
* provide m_dup_pkt() for doing fast deep mbuf copies with a specified alignmentdlg2016-02-231-2/+2
| | | | | | | | | | | | | | | | | | | if a physical interface receives a multicast/broadcast packet and has carp interfaces on it, that packet needs to be copied for reception by each of those carp interfaces. previously it was using m_copym2, but that doesn't respect the alignment of the source packet. this meant the ip header in the copies were aligned incorrectly for the network stack, which breaks strict alignment archs. m_dup_pkt lets carp specify that the payload needs an ETHER_ALIGN adjustment, so the ip header inside will be aligned correctly. reported and tested by anthony eden who hit this on armv7 i reproduced the problem on sparc64 and verified the fix on amd64 and sparc64 ok mpi@ mikeb@ deraadt@
* Introduce in{,6}_hasmulti(), two functions to check in the hot path ifmpi2016-01-211-6/+2
| | | | | | an interface joined a specific multicast group. ok phessler@, visa@, dlg@
* Prevent a NULL-reference if SIOCGVH is issued without carpdev argument.mpi2016-01-121-11/+10
| | | | | | Problem reported by and diff tested by Fabian Raetz, thanks! ok benno@, bluhm@
* Make carp_output() mpsafe.mpi2015-12-191-5/+12
| | | | | | | This is needed in order to fully unlock ARP processing with carp(4) interfaces as found the hardway by sthen@. ok sthen@, dlg@
* Use SRPL_HEAD() and SRPL_ENTRY() to be consistent with and allow tompi2015-12-031-4/+4
| | | | | | fallback to a SLIST. ok dlg@, jasper@
* Make use of srp_enter()/srp_leave() in carp_iamatch() in preparationmpi2015-11-181-8/+10
| | | | | | for unlocking the ARP input path. ok dlg@
* IFQ_DROP means a drop because enqueue on the send q failed, not cos txdlg2015-11-121-2/+1
| | | | later failed.
* Remove leftovers from previous carp(4)-to-relayd(8) conversion diff.mpi2015-11-021-6/+1
| | | | Pointed by and ok reyk@
* Retire ARP load-balacing, thanks for all the fish!mpi2015-11-021-137/+22
| | | | | | | | | One of the keys of our MP work relies on making OpenBSD's kernel simpler! In this case turning ARP processing MP-safe is quite complicated due to the way carp(4) is hooked in arpinput() and nowadays you'd better run kitchensinkd(9) anyway :) ok bluhm@, claudio@, reyk@
* Introduce if_rtrequest() the successor of ifa_rtrequest().mpi2015-10-251-2/+1
| | | | | | | | | L2 resolution depends on the protocol (encoded in the route entry) and an ``ifp''. Not having to care about an ``ifa'' makes our life easier in our MP effort. Fewer dependencies between data structures implies fewer headaches. Discussed with bluhm@, ok claudio@
* Do not pass an ``ia'' just to dereference ``ia_ifp''.mpi2015-10-221-3/+3
| | | | ok claudio@, bluhm@, jsg@
* Init a variable in the recently added carp_vhe_match() function clangjsg2015-10-141-2/+2
| | | | | | and mpi believe could be used uninitialised. ok mpi@
* Revert if_oqdrops accounting changes done in kernel, per request from mpi@.uebayasi2015-10-051-1/+2
| | | | | | | | | | | | | (Especially adding IF_DROP() after IFQ_ENQUEUE() was completely wrong because IFQ_ENQUEUE() already does it. Oops.) After this revert, the situation becomes: - if_snd.ifq_drops is incremented in either IFQ_ENQUEUE() or IF_DROP(), but it is not shown to userland, and - if_data.ifi_oqdrops is shown to userland, but it is not incremented by anyone.
* Don't count IF_DROP()'ed packets as if_oerrors too.uebayasi2015-10-051-2/+1
| | | | | | mpi@ plans to clean-up IF_DROP()'s, but fix consistent use of it for now. OK dlg@
* Factors ou the route hashing code to implement Equal-Cost Multi-Pathmpi2015-09-281-14/+13
| | | | | | | | for ART. While here sync the two remaining mix() macros. ok chris@, dlg@
* make carp_input mpsafe.dlg2015-09-271-78/+234
| | | | | | | | | | | | | | | | | | | | | there are three data structures involved here: the list of carp interfaces on a parent interface (struct carp_if) is now accessed via the if_ih cookie. its lifetime is managed by the if_ih_insert and if_ih_remove calls. the second is the interfaces (struct carp_softc) in the list above. these has been moved from being access via a TAILQ to an SRPL. modifications to the list are serialised by the kernel lock. the third is the list of vhost entries (struct carp_vhost_entry). these used to be in a LIST on each carp_softc, but have been moved to being accessed vian an SRPL. modifications to the list are serialised by the kernel lock. written at l2k15 tested by mpi@ and hrvoje popovski ok mpi@
* consistently name the ifnet * that refers to the parent interfacedlg2015-09-121-50/+50
| | | | | | | | | ifp0, and the ifnet * that refers to the carp interface ifp. this makes it easier for me to read. it's probably not the right name for ifp0, but at least it's consistent. ok sthen@ bluhm@ mpi@ claudio@
* vhif_ifp in struct carp_ifs is set but never used. it can be trimmed.dlg2015-09-121-4/+1
| | | | ok claudio@ mpi@
* vhif_nvrs in carp_if is used to count the number of entries indlg2015-09-121-4/+2
| | | | | | | | | vhif_ifs so you can tell when that list is empty. you can use TAILQ_EMPTY to see if a list is empty though, so kill the count and use EMPTY instead. ok mpi@
* Kill yet another argument to functions in IPv6. This time ip6_output'sclaudio2015-09-111-2/+2
| | | | | | | ifpp - XXX: just for statistics ifpp is always NULL in all callers so that statistic confirms ifpp is dying OK mpi@
* pass a cookie argument to interface input handlers that can be usedmikeb2015-09-101-5/+5
| | | | | | | to pass additional context or transient data with the similar life time. ok mpi, suggestions, hand holding and ok from dlg
* if_put after if_get.dlg2015-09-101-29/+51
| | | | ok claudio@
* move the if input handler list to an SRP list.dlg2015-09-101-22/+5
| | | | | | | | | | | | instead of having every driver that manipulates the ifih list understand SRPLs, this moves that processing into if_ih_insert and if_ih_remove functions. we rely on the kernel lock to serialise the modifications to the list. tested by mpi@ ok mpi@ claudio@ mikeb@
* By design if_input_process() needs to hold a reference on the receivingmpi2015-07-021-11/+4
| | | | | | | | | ifp in order to access its ifih handlers. So get rid of if_get() in the various ifih handlers we know the ifp is live at this point. ok dlg@
* Rename if_output() into if_enqueue() to avoid confusion with commentsmpi2015-06-301-2/+2
| | | | | | talking about (*ifp->if_output)(). ok claudio@, dlg@
* count if_ibytes in if_input like we do for if_ipackets.dlg2015-06-291-3/+1
| | | | tweaks and ok mpi@
* Increment if_ipackets in if_input().mpi2015-06-241-3/+1
| | | | | | | Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
* Store a unique ID, an interface index, rather than a pointer to thempi2015-06-161-8/+34
| | | | | | | | | | | | | | | receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
* Move carp-related logic from ether_output() into carp_start().mpi2015-06-081-24/+46
| | | | ok sthen@, phessler@
* Take carp(4) out of ether_input().mpi2015-06-021-62/+78
| | | | | | Tested by <mxb AT alumni DOT chalmers DOT se>, thanks! ok bluhm@, dlg@
* Correctly state the link state to INVALID when creating a carp interface.mpi2015-05-211-8/+11
| | | | | | | | | | | | Since vhe are allocated with M_ZERO and INIT is also defined to be 0, carp_set_state() would result in a no-op because of the state check. So explicitly initialize the state of a vhe to INIT and move the state check in carp_set_state_all() to prevent similar issues in the future. Problem and initial diff from Johan Ymerson, thanks! ok henning@
* Give carp(4) interfaces their own low priority. The change should notclaudio2015-05-151-1/+2
| | | | | | change behaviour for now but will allow to share the same address with the parent interface without major hacks. OK mpi@
* Remove a NULL check in carp_set_ifp() as we always pass a valid ifpmpi2015-05-151-58/+54
| | | | | | pointer to this function. ok claudio@
* Make sure to overwrite sdl_type after calling ether_ifattach().mpi2015-04-281-1/+2
| | | | Fix a problem found by Johan Huldtgren, ok phessler@
* Add the necessary glue to keep carp(4) working while other pseudo-driversmpi2015-04-221-14/+23
| | | | | | are converted to if_input(), this time without breaking parent-less setup. ok sthen@, dlg@