Skip to content

Commit c3dc4d7

Browse files
committed
feat(nat): remove unnecessary check on discriminant
Signed-off-by: Fredi Raspall <[email protected]>
1 parent f3dd352 commit c3dc4d7

File tree

1 file changed

+3
-8
lines changed
  • nat/src/stateful/apalloc

1 file changed

+3
-8
lines changed

nat/src/stateful/apalloc/mod.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl NatDefaultAllocator {
320320
) -> Result<AllocationResult<AllocatedIpPort<I>>, AllocatorError> {
321321
let next_header = Self::get_next_header(flow_key);
322322
Self::check_proto(next_header)?;
323-
let (src_vpc_id, dst_vpc_id) = Self::check_and_get_discriminants(flow_key)?;
323+
let (src_vpc_id, dst_vpc_id) = Self::get_vpc_discriminants(flow_key)?;
324324

325325
// Get address pools for source
326326
let pool_src_opt = pools_src.get_entry(
@@ -417,7 +417,7 @@ impl NatDefaultAllocator {
417417
}
418418
}
419419

420-
fn check_and_get_discriminants(
420+
fn get_vpc_discriminants(
421421
flow_key: &FlowKey,
422422
) -> Result<(VpcDiscriminant, VpcDiscriminant), AllocatorError> {
423423
let src_vpc_id = flow_key
@@ -429,12 +429,7 @@ impl NatDefaultAllocator {
429429
.dst_vpcd()
430430
.ok_or(AllocatorError::MissingDiscriminant)?;
431431

432-
// We only support VNIs at the moment
433-
#[allow(unreachable_patterns)]
434-
match (src_vpc_id, dst_vpc_id) {
435-
(VpcDiscriminant::VNI(_), VpcDiscriminant::VNI(_)) => Ok((src_vpc_id, dst_vpc_id)),
436-
_ => Err(AllocatorError::UnsupportedDiscriminant),
437-
}
432+
Ok((src_vpc_id, dst_vpc_id))
438433
}
439434

440435
fn get_mapping<I: NatIpWithBitmap>(

0 commit comments

Comments
 (0)