Page MenuHomeFreeBSD

libalias: Handle GetNewPort() errors properly
Needs ReviewPublic

Authored by markj on Wed, Nov 27, 2:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 15, 7:46 PM
Unknown Object (File)
Wed, Dec 4, 12:14 PM
Unknown Object (File)
Tue, Dec 3, 6:15 PM
Unknown Object (File)
Mon, Dec 2, 6:17 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