Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iptables wait option #289

Merged
merged 2 commits into from
Jul 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/common/IP/IPManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ private void AddRoutingRules(IEnumerable<EndpointInfo> endpoints, CancellationTo
{
foreach (var portPair in endpoint.Ports)
{
rules.Add($"--table nat --append PREROUTING -p tcp --dst {endpoint.LocalIP} --dport {portPair.RemotePort} --jump DNAT --to-destination {endpoint.LocalIP}:{portPair.LocalPort}");
rules.Add($"--table nat --append OUTPUT -p tcp --dst {endpoint.LocalIP} --dport {portPair.RemotePort} --jump DNAT --to-destination {endpoint.LocalIP}:{portPair.LocalPort}");
// --wait -w [seconds] maximum wait to acquire xtables lock before give up
rules.Add($"--table nat --append PREROUTING -p tcp --dst {endpoint.LocalIP} --dport {portPair.RemotePort} --jump DNAT --to-destination {endpoint.LocalIP}:{portPair.LocalPort} --wait 30");
rules.Add($"--table nat --append OUTPUT -p tcp --dst {endpoint.LocalIP} --dport {portPair.RemotePort} --jump DNAT --to-destination {endpoint.LocalIP}:{portPair.LocalPort} --wait 30");
}
}

Expand Down Expand Up @@ -297,7 +298,7 @@ private void RemoveRoutingRules(CancellationToken cancellationToken, IPAddress[]
command: args,
logCallback: (line) => _log.Info(line),
envVariables: null,
timeout: TimeSpan.FromSeconds(10),
timeout: TimeSpan.FromSeconds(60),
hsubramanianaks marked this conversation as resolved.
Show resolved Hide resolved
cancellationToken: cancellationToken,
out string output);

Expand Down