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, Jan 17, 11:03 PM
Unknown Object (File)
Thu, Jan 16, 11:49 PM
Unknown Object (File)
Sun, Jan 12, 8:53 PM
Unknown Object (File)
Dec 13 2024, 10:10 AM
Unknown Object (File)
Dec 12 2024, 12:03 PM
Unknown Object (File)
Dec 10 2024, 6:09 AM
Unknown Object (File)
Dec 8 2024, 3:44 AM
Unknown Object (File)
Nov 16 2024, 7:37 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.