summaryrefslogtreecommitdiff
path: root/sys/net
AgeCommit message (Collapse)Author
2018-06-20Use the socket lock rather than the KERNEL_LOCK() in pfkey_sendup().Martin Pieuchot
inputs & ok visa@
2018-06-18Do not allow to change the rdomain of the default loopback interface.Martin Pieuchot
Routing domain must always have an existing lo(4). Problem reported and fix tested by multiplexd at gmx.com.
2018-06-18Refactor the six ways to find TCP options into one new function. As a result:Richard Procter
- MSS and WSCALE option candidates must now meet their min type length. - 'max-mss' is now more tolerant of malformed option lists. These changes were immaterial to the live traffic I've examined. OK sashan@ mpi@
2018-06-15Fix the lock order problem found by witness. Release the lock forYASUOKA Masahiko
pppx_ifs earlier not to overlap the protected section for ifnet. Also introduce pxi_ready flag to protect pxi not to be used before initialization. ok bluhm
2018-06-11Rename routing & pfkey tables for coherency with other PCB tables.Martin Pieuchot
ok claudio@
2018-06-11Push the KERNEL_LOCK() inside route_input().Martin Pieuchot
ok visa@, tb@
2018-06-06Prefix fields of pfkey & routing PCBs, part 2, no functionnal change.Martin Pieuchot
ok tb@
2018-06-06Prefix fields of pfkey & routing PCBs, no functionnal change.Martin Pieuchot
ok visa@, tb@
2018-06-06Pass the socket to sounlock(), this prepare the terrain for per-socketMartin Pieuchot
locking. ok visa@, bluhm@
2018-06-06Asseert that a pfkey or routing socket is referenced by a `fp' insteadMartin Pieuchot
of calling sofree(), when its PCB is detached. This is different from TCP which does not always detach `inpcb's from sockets. In the pfkey & routing case caling sofree() there is a noop whereas for TCP it's needed to free closed connections. Having fewer sofree() makes it easier to understand the code and move the locks down. ok visa@
2018-06-04The function pf_create_state() calls pf_set_protostate() beforeAlexander Bluhm
pf_state_insert(), so the state key has not been set. When inlining, the compiler recognized the NULL pointer dereference in s->key[PF_SK_STACK]->proto and optimized it away. But if pf.c was compiled with -fno-inline, the system crashed during boot. Add a NULL check in pf_set_protostate() to handle the situation when the function is called. OK sashan@ henning@
2018-06-01While sending the pf syncookie, we are holding the pf lock. SoAlexander Bluhm
goto unlock when leaving this block. OK sashan@ henning@
2018-05-30restrict the prio values from SIOCSIFLLPRIO to what the kernel handlesDavid Gwynne
previously the ioctl code checked that prio was an int less than UCHAR_MAX, but the rest of the kernel (and priq code in particular) expects it to be between 0 and 7 inclusive. ok krw@ tb@
2018-05-30Add SIOCGIFGLIST to fetch a list of interface groups on the system.Stuart Henderson
From Jan Klemkow, ok mpi@ tb@, ok/bugfix bluhm@
2018-05-28implement support for MikroTik's Ethernet over IP protocol as eoip(4)David Gwynne
it is sort of like egre(4), but different enough to warrant separate handling. more specifically, eoip sits under gre 1, not 0, and has it's own protocol id (0x6400). the gre key field is mandantory (the rest cannot be set) which is split into a 16 bit length field and a 16 bit tunnel id. lastly, it has a keepalive mechanism where peers send 0 length packets as hellos to each other periodically, which has no equivalent in egre(4) and is different to the gre(4) keepalives. ok sthen@
2018-05-19As long we have no per socket locking, we must grab either net lockAlexander Bluhm
or kernel lock when accessing a socket. For pf key sockets it is kernel lock, so add its protection in pfkey_sendup(). Fixes a kernel lock assertion panic reported by Peter J. Philipp. OK mpi@ visa@
2018-05-17Move the handling of SIOCIFGCLONERS out of the NET_RLOCK(). The globalTheo Buehler
&if_clone list and the if_cloners_count are currently protected by the KERNEL_LOCK(). Introduce the ifclonerslk rwlock to serialize access to these two globals as a small step towards removing the KERNEL_LOCK() from the ioctl path. While there, separate the two codepaths in if_clone_list() more clearly and replace a ternary operator with MIN(). guidance & ok mpi, ok visa
2018-05-16Fix kernel builds without IPSEC.Reyk Floeter
OK mikeb@
2018-05-15Take NET_LOCK for pppioctl when called via the tty ioctl handlerMike Belopuhov
ok mpi
2018-05-15Grab the KERNEL_LOCK() in pppasyncstart/pppasyncrelinq/pppasyncctlp.Martin Pieuchot
The tty layer still relies on it to serialize access to its data. Fixes crashes reported & tested by form@ via mikeb@. ok mikeb@
2018-05-14Use a SRP list to protect pfkeyv2 sockets, thus removing the need toMartin Pieuchot
grab the KERNEL_LOCK() when delivering messages. This is the same solution already used by routing sockets. ok claudio@, visa@
2018-05-12Make LACP_STATE_BITS accessible to userlandccardenas
Update ifconfig to display LACP State (Actor and Partner) on each trunk port Ok benno@, phessler@, and tb@
2018-05-10pf route-to should not send packets from 127.0.0.1 or ::1 addressAlexander Bluhm
to the network. This is necessary for locally generated icmp packets that would be dropped otherwise. Refine this check to modify only the source address of packets that go to the external network. This allows route-to tricks on loopback interface. OK sashan@
2018-05-08Introduce rtm_sendup() a function to deliver routing messages to aMartin Pieuchot
socket receive buffer. It is modelled after pfkey_sendup() as both will need the same MP treatment. ok tb@, bluhm@, visa@
2018-04-28replace add_*_randomness with enqueue_randomness()Jasper Lievisse Adriaanse
this gets rid of the source annotation which doesn't really add anything other than adding complexitiy. randomess is generally good enough that the few extra bits that the source type would add are not worth it. ok mikeb@ deraadt@
2018-04-28bump my copyrightPeter Hessler
2018-04-28don't check if we still have the BFD flag set when sending a packet, as wePeter Hessler
might be shutting the session down
2018-04-28properly delete the bfd configuration when it is disabledPeter Hessler
2018-04-28use unsigned variables for things that we use as unsignedPeter Hessler
noticed by clang
2018-04-28add the socket lock around our use of socketsPeter Hessler
2018-04-25Make this header standalone #if __BSD_VISIBLE, by including needed headersJeremie Courreges-Anglas
Puts us in line with Free/NetBSD and Linux and will get us rid of pointless patches in the ports tree. ok guenther@ deraadt@
2018-04-24Use pf_rm_rule() instead of pool_put() to decrement references byAlexander Bluhm
the rule created in pf_rule_copyin(). Plugs a potential kif memory leak in pf(4) ioctl. OK sashan@
2018-04-24Fix copy and paste typo in pfi_kif_unref route error message.Alexander Bluhm
2018-04-24Push NET_LOCK down in the default ifioctl case.Paul Irofti
For the PRU_CONTROL bit the NET_LOCK surrounds in[6]_control() and on the ENOTSUPP case we guard the driver if_ioctl functions. OK mpi@
2018-04-24Remove unused rtentry parameter.Florian Obser
Input bluhm OK benno, kn, claudio
2018-04-19when adding span ports, restrict them to ether and mplstunnel interfaces.David Gwynne
this is the same check that's done when adding normal members to the bridge. it prevents things like gif(4) being added to the bridge, which in turn prevents panics when shoving ethernet packets down a layer 3 interface. reported and tested by jasper@
2018-04-18If m_pullup() changes the mbuf in gif_input(), also adjust the mbufAlexander Bluhm
pointer in the IP protocol loop. Reset the loop's mbuf when the mbuf is freed. The latter is not necessary, but clearing a pointer to freed data is safer. OK dlg@
2018-04-13Remove compatibility with pfctl from 6.1 and plug a few leaksMike Belopuhov
No objections from henning, OK visa
2018-04-08use the specified protocol on v6 outputDavid Gwynne
found by and diff from peter j philip ok jca@
2018-04-08on output, actually attach the mbuf tag to packet.David Gwynne
this is to suppress loops over the interface, and avoids a leak of the tag on every packet. found and fix testd by christian barthel also tested by job snijders ok bluhm@
2018-04-06All users of the PFLOG_PACKET() macro are inside "#if NPFLOG > 0".Alexander Bluhm
So this macro does not make much sense, just call pflog_packet(). OK sashan@ henning@
2018-04-05Zap the obsolete PF_TRANS_ALTQ.Lawrence Teo
Note: Remember to "make includes" and recompile the following programs together with the kernel: sbin/pfctl usr.sbin/authpf usr.sbin/ftp-proxy usr.sbin/relayd usr.sbin/tftp-proxy Thanks to sthen@ for checking the ports tree. ok bluhm@ sashan@ visa@
2018-04-05Explicitly check PF_TRANS_RULESET in DIOCXBEGIN, DIOCXCOMMIT, and DIOCXROLLBACK.Lawrence Teo
ok bluhm@ sashan@ visa@
2018-04-03use link0 to use llprio in transmitted packets, regardless of mbuf prio.David Gwynne
some ISPs now provide services over vlans, but require vlan packets going to the internet have their priority set to 1 (ie, 0 on the wire) or they will be dropped. configuring this on openbsd requires config in several places, eg, pf rules to set the prio on ip packets, llprio on the pppoe interface for it's management frames, and the llprio on the vlan interface if you're using dhclient on it. this has the side effect that you can no longer use priority queuing, and can be error prone to get right. using link0 to flatteng the priority for isp transit is simple to configure, and allows priority queuing. a man page update is coming. ok henning@
2018-03-29NET_LOCK is also required in pppxwrite and pppxclose.Jonathan Matthew
ok dlg@ mpi@
2018-03-28- memory leak occurs when adding same table twice.Alexandr Nedvedicky
(tj found fix in FreeBSD repo for us) OK @bluhm, @henning
2018-03-20Call bpfdetach() without holding the NET_LOCK().Martin Pieuchot
Prevents a rwlock recursion found by stsp@. ok stsp@, deraadt@, visa@
2018-03-15Remove the check for flags M_AUTH and M_CONF (AH and ESP).remi
The check prevents incomming multicast packages from arriving at the gif interface (eg. OSPF) when the traffic is protected by IPsec in transport mode. ok dlg@
2018-03-13on input, check the unicast address before the multicast handling.David Gwynne
if the mac address is not for the interface, it must be multicast or broadcast. this is instead of if the packet is not multicast/broadcast, it must be for the interface. this allows ethernet interfaces to have multicast mac addresses without having to special case it themselves. eg, carp load balancing should become easier with this. ok mpi@
2018-03-12Delete unused variable.Kenji Aoyama
ok jsg@