Page MenuHomeFreeBSD

libalias: Handle GetNewPort() errors properly
Needs ReviewPublic

Authored by markj on Nov 27 2024, 2:33 PM.
Tags
None
Referenced Files
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
Unknown Object (File)
Feb 21 2025, 2:44 PM
Unknown Object (File)
Jan 24 2025, 3:57 AM
Unknown Object (File)
Dec 25 2024, 6:06 PM
Unknown Object (File)
Dec 25 2024, 6:35 AM

Details

Reviewers
None
Group Reviewers
network
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 60811
Build 57695: arc lint + arc unit

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!