Page MenuHomeFreeBSD

libalias: Handle GetNewPort() errors properly
ClosedPublic

Authored by markj on Nov 27 2024, 2:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 18, 10:06 PM
Unknown Object (File)
Fri, Apr 18, 11:04 AM
Unknown Object (File)
Thu, Apr 17, 2:47 AM
Unknown Object (File)
Mon, Apr 14, 12:39 PM
Unknown Object (File)
Sat, Apr 5, 6:55 AM
Unknown Object (File)
Fri, Mar 28, 2:23 AM
Unknown Object (File)
Thu, Mar 27, 11:24 PM
Unknown Object (File)
Thu, Mar 27, 9:25 PM

Details

Summary

AddLink() fails when memory allocation fails or no free port is
available; both are error conditions. However, functions such as
FindUdpTcpIn() were converting such failures to PKT_ALIAS_IGNORED, which
effectively means, "pass the packet without translation," which isn't
what we want.

Fix the problem by making sure that AddLink() errors are converted to
PKT_ALIAS_ERROR where appropriate. The diff is a bit large but is
mostly mechanical: functions like TcpAliasOut() are converted to return
a result code, and an additional out-parameter is added to return the
alias_link pointer.

Reported by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
Tested by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Nov 27 2024, 2:33 PM

If there are no objections, I will commit this soon.

With diagonal reading definitely seems like improvement, but I don't remember anything of libalias, didn't do a search for landmines. No objections!

This revision was not accepted when it landed; it landed in state Needs Review.Fri, Apr 18, 3:12 PM
This revision was automatically updated to reflect the committed changes.