summaryrefslogtreecommitdiff
path: root/sys/net/if_pflow.c
AgeCommit message (Collapse)Author
2018-07-30Use FNONBLOCK instead of SS_NBIO to check/indicate that the I/O modeMartin Pieuchot
for sockets is non-blocking. This allows us to G/C SS_NBIO. Having to keep the two flags in sync in a mp-safe way is complicated. This change introduce a behavior change in sosplice(), it can now always block. However this should not matter much due to the socket lock being taken beforhand. ok bluhm@, benno@, visa@
2018-07-16use 'switch' rathan than an if-else construct to match on the netflow ↵Jasper Lievisse Adriaanse
version to in pflow_get_mbuf(), to match the rest of the file ok benno@ florian@
2018-06-06Pass the socket to sounlock(), this prepare the terrain for per-socketMartin Pieuchot
locking. ok visa@, bluhm@
2018-02-19Remove almost unused `flags' argument of suser().Martin Pieuchot
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@
2018-01-09Creating a cloned interface could return ENOMEM due to temporaryAlexander Bluhm
memory shortage. As it is invoked from a system call, it should not fail and wait instead. OK visa@ mpi@
2017-10-31- add one more softnet taskqAlexandr Nedvedicky
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@
2017-09-08If you use sys/param.h, you don't need sys/types.hTheo de Raadt
2017-08-12Use the NET_LOCK() macro instead of handrolling it.Martin Pieuchot
Tested by Hrvoje Popovski.
2017-08-11Remove NET_LOCK()'s argument.Martin Pieuchot
Tested by Hrvoje Popovski, ok bluhm@
2017-08-10Move the solock()/sounlock() dance outside of sobind().Martin Pieuchot
ok phessler@, visa@, bluhm@
2017-05-31Use mbuf_queue to properly serialize access to pflow output queue.Visa Hankala
Input from mpi@, jmatthew@; OK mpi@, henning@, benno@
2017-05-30remove no longer needed splnet/splx.Sebastian Benoit
ok florian@
2017-05-27fix previous as noted by mpi, thx florianSebastian Benoit
2017-05-27move sending of pflow packet into a task, seperated from the dataSebastian Benoit
collection by a mbuf queue. with help from mpi@ ok florian@
2017-05-15Enable the NET_LOCK(), take 3.Martin Pieuchot
Recursions are still marked as XXXSMP. ok deraadt@, bluhm@
2017-03-17Revert the NET_LOCK() and bring back pf's contention lock for release.Martin Pieuchot
For the moment the NET_LOCK() is always taken by threads running under KERNEL_LOCK(). That means it doesn't buy us anything except a possible deadlock that we did not spot. So make sure this doesn't happen, we'll have plenty of time in the next release cycle to stress test it. ok visa@
2017-02-16Revert "Release the NET_LOCK() before entering per-driver ioctl() routine".Martin Pieuchot
This is most likely to be the cause of the deadlock seen by port builders since it's the only changed that happened after a2k17. Instead bring back pirofti@ original hack to release the NET_LOCK() inside iwm(4) and iwn(4). This fixes some splassert reported by bluhm@ Deadlock reported by naddy@ and rpe@ and ajacoutot@ confirmed the deadlock has been introduced post a2k17. Tested by and ok tb@
2017-02-07No longer need to unlock the netlock since the upper layer is doing it.Martin Pieuchot
Found by Hrvoje Popovski.
2017-01-25Enable the NET_LOCK(), take 2.Martin Pieuchot
Recursions are currently known and marked a XXXSMP. Please report any assert to bugs@
2017-01-24A space here, a space there. Soon we're talking real whitespaceKenneth R Westerback
rectification.
2017-01-23Flag pseudo-interfaces as such in order to call add_net_randomness()Martin Pieuchot
only once per packet. Fix a regression introduced when if_input() started to be called by every pseudo-driver. ok claudio@, dlg@
2017-01-20No need to handle SIOCAIFADDR in drivers, it's never passed down toMartin Pieuchot
them. ok claudio@
2017-01-18Allow changing of sender ip/port without switching address family.Florian Obser
With this regress tests pass again. OK benno
2017-01-18Allow changing of receiver ip/port without switching address family.Florian Obser
OK benno
2017-01-03Move the logic for SIOCSETPFLOW in a helper function to help withMartin Pieuchot
upcoming locking. ok visa@, bluhm@
2016-12-29Change NET_LOCK()/NET_UNLOCK() to be simple wrappers aroundMartin Pieuchot
splsoftnet()/splx() until the known issues are fixed. In other words, stop using a rwlock since it creates a deadlock when chrome is used. Issue reported by Dimitris Papastamos and kettenis@ ok visa@
2016-12-21Remove the netlock workaround since if_detach is doing it for us now.Mike Belopuhov
ok mpi, bluhm
2016-12-20Release the NET_LOCK() before calling any socket function since it isMartin Pieuchot
not recursive. This is temporary until all recursions are found and can be addressed in a correct way. With inputs from bluhm@
2016-10-04Convert timeouts that need a process context to timeout_set_proc(9).Martin Pieuchot
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@
2016-04-29Make if_output() return EAFNOSUPPORT instead of just dropping packetsKenneth R Westerback
and pretending the output succeeded. Packets are still dropped! Idea from jsg@ following same change to bridge(4). ok mpi@
2015-10-03IPv6 transport for pflow data.Florian Obser
Input deraadt@ Bug fix & OK benno@
2015-09-12Call socreate(9) only when we have a destination ip and port.Florian Obser
Call sobind(9) only when we have a source ip. With this we can treat sc->so != NULL as a flag if the interface is in state IFF_RUNNING. Input & OK bluhm@, OK benno@
2015-09-09size for free()Florian Obser
OK semarie@, deraadt@
2015-09-04pflow_flush() still needs sc->send_nam; free it later.Florian Obser
2015-09-04Fix an mbuf use-after-fruit in pflow_clone_create().Martin Pieuchot
Issue reported by semarie@ on bugs@ who also isolated the use-after-fruit to pflow(4) using dlg@'s tracing mbuf diff. Inputs from and ok florian@, semarie@, benno@
2015-07-21We don't do 'ARGSUSED' anymoreFlorian Obser
2015-07-21use curproc instead of proc0Florian Obser
pointed out by and OK bluhm@
2015-07-20Use the kernel socket interface (sosend(9) etc) instead of shovingFlorian Obser
packets directly into the network stack with ip_output(). The locking is intentionally left as is and will be improved in another commit. Input / OK bluhm@, OK benno@
2015-07-16add missing malloc checkFlorian Obser
OK benno@
2015-06-16Store a unique ID, an interface index, rather than a pointer to theMartin Pieuchot
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@
2015-06-07Introduce unhandled_af() for cases where code conditionally doesJonathan Gray
something based on an address family and later assumes one of the paths was taken. This was initially just calls to panic until guenther suggested a function to reduce the amount of strings needed. This reduces the amount of noise with static analysers and acts as a sanity check. ok guenther@ bluhm@
2014-12-19unifdef INET in net code as a precursor to removing the pretend option.Ted Unangst
long live the one true internet. ok henning mikeb
2014-11-20Yet more #include de-duplication.Kenneth R Westerback
ok deraadt@ tedu@
2014-11-18move arc4random prototype to systm.h. more appropriate for most codeTed Unangst
to include that than rdnvar.h. ok deraadt dlg
2014-08-13Bring IPFIX sequence numbers in line with the RFC; originalBret Lambert
diff from benno@. ok benno@, florian@
2014-07-22Fewer <netinet/in_systm.h> !Martin Pieuchot
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-04-21ip_output() using varargs always struck me as bizarre, esp since it's onlyHenning Brauer
ever used to pass on uint32 (for ipsec). stop that madness and just pass the uint32, 0 in all cases but the two that pass the ipsec flowinfo. ok deraadt reyk guenther
2014-04-14"struct pkthdr" holds a routing table ID, not a routing domain one.Martin Pieuchot
Avoid the confusion by using an appropriate name for the variable. Note that since routing domain IDs are a subset of the set of routing table IDs, the following idiom is correct: rtableid = rdomain But to get the routing domain ID corresponding to a given routing table ID, you must call rtable_l2(9). claudio@ likes it, ok mikeb@
2014-03-29Kill pflowproto 9, it's unfixable post 2038, a better, standardizedFlorian Obser
option is pflowproto 10. Also it duplicates a lot of code from pflowproto 10 and will get in the way in the future. OK benno@