Skip to content

netlib: resolve isolated gateway MAC inside the task netns - #5132

Merged
xxx0624 merged 1 commit into
aws:devfrom
xxx0624:dualstack-gateway-neigh-in-netns
Sep 10, 2026
Merged

xxx0624 merged 1 commit into
aws:devfrom
xxx0624:dualstack-gateway-neigh-in-netns

Conversation

@xxx0624

@xxx0624 xxx0624 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

The isolated platform installs a permanent ARP neighbor for the VPC gateway so the micro-VM guest (which has no L2 broadcast) can reach it. resolveHostNeighbor obtained the gateway MAC from the host root netns ARP cache. On ECS managed instances the host instance's subnet may or may not match the task's subnet; when they differ, the host has no interface on the task's subnet and its ARP cache never contains the task's gateway, so setup failed with:

  ResourceInitializationError: gateway MAC not in host neighbor cache:
  no neighbor entry for <gw> in host ARP table

This affected any task whose subnet differed from the host's (both IPv4-on-dualstack and dualstack-on-IPv4 instance combinations), i.e. the case that dualstack rollout exposed. It is not IPv6-specific; only IPv6-only ENIs skip the IPv4 path.

Resolve the gateway MAC from inside the task netns instead, where the task ENI carries the task's own VPC IP and has L2 reachability to the gateway regardless of the host's subnet. addGatewayNeighbor now does the resolution within ExecInNSPath: look up the interface, poll its neighbor table (nudging the kernel to ARP the gateway between polls) until a resolved entry appears or a timeout elapses, then install the permanent neighbor + /32 link-scope route as before.

Implementation details

Resolve the gateway MAC from inside the task netns instead, where the task ENI carries the task's own VPC IP and has L2 reachability to the gateway regardless of the host's subnet. addGatewayNeighbor now does the resolution within ExecInNSPath: look up the interface, poll its neighbor table (nudging the kernel to ARP the gateway between polls) until a resolved entry appears or a timeout elapses, then install the permanent neighbor + /32 link-scope route as before.

Testing

New tests cover the changes: Yes

Run the e2e tests locally on isolated platform on ECS MI where the IPv4 tasks can run on dualstack instances and dualstack tasks can run on IPv4 instances.

Description for the changelog

  • Enhancement - Resolve the gateway MAC from inside the task netns for isolated platform

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The isolated platform installs a permanent ARP neighbor for the VPC
gateway so the micro-VM guest (which has no L2 broadcast) can reach it.
resolveHostNeighbor obtained the gateway MAC from the host root netns
ARP cache. On ECS managed instances the host instance's subnet may or
may not match the task's subnet; when they differ, the host has no
interface on the task's subnet and its ARP cache never contains the
task's gateway, so setup failed with:

  ResourceInitializationError: gateway MAC not in host neighbor cache:
  no neighbor entry for <gw> in host ARP table

This affected any task whose subnet differed from the host's (both
IPv4-on-dualstack and dualstack-on-IPv4 instance combinations), i.e. the
case that dualstack rollout exposed. It is not IPv6-specific; only
IPv6-only ENIs skip the IPv4 path.

Resolve the gateway MAC from inside the task netns instead, where the
task ENI carries the task's own VPC IP and has L2 reachability to the
gateway regardless of the host's subnet. addGatewayNeighbor now does the
resolution within ExecInNSPath: look up the interface, poll its neighbor
table (nudging the kernel to ARP the gateway between polls) until a
resolved entry appears or a timeout elapses, then install the permanent
neighbor + /32 link-scope route as before.

Tests updated for the in-netns flow and a gateway-not-resolvable case.
@xxx0624
xxx0624 requested a review from a team as a code owner September 9, 2026 23:54
return errors.Wrapf(linkErr, "failed to find device %s in task netns", eni.DeviceName)
}

gwMAC, err := il.resolveGatewayNeighbor(link, gwIP)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gwMAC is no longer logged, are we missing out on helpful data?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error from the func should be good for us to troubleshooting but no harm to log it.

@xxx0624
xxx0624 merged commit 46c216c into aws:dev Sep 10, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants