Skip to content

datapath: Improve BPF SNAT address selection #17158

@brb

Description

@brb

Currently, the BPF-based SNAT uses IPV4_MASQUERADE addr for SNAT'ing. This works fine as long as there is a single global scope IP addr. However, if we add multiple IP addrs then only one will be selected.

To improve the selection we could do the bpf_fib_lookup() to determine src IP addr instead. This would also eliminate the IPV4_MASQUERADE. However, the kernel helper might need to be relaxed, as currently it errors out if no L2 neigh entry is found for a nexthop of the given dst IP addr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.area/kernelRequires upstream work in the Linux kernel.feature/snatRelates to SNAT or Masquerading of traffickind/featureThis introduces new functionality.pinnedThese issues are not marked stale by our issue bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions