Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion nat/src/stateful/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ pub enum AllocatorError {
NoFreeIp,
#[error("failed to allocate port block")]
NoPortBlock,
#[error("no free port block available (base: {0})")]
#[error("no free port available in port block (block base index: {0})")]
Comment thread
mvachhar marked this conversation as resolved.
NoFreePort(u16),
#[error("failed to allocate port: {0}")]
PortAllocationFailed(NatPortError),
#[error("failed to reserve port: {0}")]
PortReservationFailed(u16),
Comment thread
qmonnet marked this conversation as resolved.
#[error("unsupported protocol: {0:?}")]
UnsupportedProtocol(NextHeader),
#[error("missing VPC discriminant")]
Expand Down
2 changes: 1 addition & 1 deletion nat/src/stateful/apalloc/port_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ impl<I: NatIpWithBitmap> AllocatedPortBlock<I> {
)
})?,
)
.map_err(|()| AllocatorError::NoFreePort(port.as_u16()))?;
.map_err(|()| AllocatorError::PortReservationFailed(port.as_u16()))?;

Ok(AllocatedPort::new(port, self.clone()))
}
Expand Down
1 change: 1 addition & 0 deletions nat/src/stateful/nf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ fn translate_error(error: &StatefulNatError) -> DoneReason {
| StatefulNatError::IcmpError
| StatefulNatError::AllocationFailure(
AllocatorError::PortAllocationFailed(_)
| AllocatorError::PortReservationFailed(_)
| AllocatorError::MissingDiscriminant
| AllocatorError::UnsupportedDiscriminant,
) => DoneReason::NatFailure,
Expand Down
Loading