Page MenuHomeFreeBSD

if_ovpn: ensure we're in vnet context when calling sorele()
ClosedPublic

Authored by kp on Nov 10 2022, 1:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 18, 12:43 AM
Unknown Object (File)
Sep 30 2024, 1:42 PM
Unknown Object (File)
Sep 30 2024, 1:33 PM
Unknown Object (File)
Sep 30 2024, 1:32 PM
Unknown Object (File)
Sep 27 2024, 5:43 PM
Unknown Object (File)
Sep 27 2024, 4:37 PM
Unknown Object (File)
Sep 27 2024, 10:08 AM
Unknown Object (File)
Sep 26 2024, 10:06 PM

Details

Summary

We reference count to ensure we don't release the socket while we still
have data in flight. That means that we can end up releasing the socket
from ovpn_encrypt_tx_cb().

We must have a vnet context set when calling sorele() (which asserts
this from within sofree()), so move the CURVNET_SET()/CURVNET_RESTORE()
to ensure this is the case.

While here also add a couple of assertions to make this more obvious,
and to ease future debugging.

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 48253
Build 45139: arc lint + arc unit

Event Timeline

kp requested review of this revision.Nov 10 2022, 1:31 PM

Just a fractional micropercent optimization suggestion. First set the VNET context, then enter the epoch. Same at the end: first exit the epoch, then restore VNET pointer. The VNET context set on a thread for extra time doesn't have any negative impact. The epoch prolonged for extra time does.

micro-optimisation, as recommended by Gleb.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 14 2022, 8:37 AM
This revision was automatically updated to reflect the committed changes.