Skip to content

UDP session filters can't access the addresses on the first packet #41186

@lilmayofuksu

Description

@lilmayofuksu

Or "UdpRecvData::addresses_ becomes empty after createSession in StickySessionUdpProxyFilter::onDataInternal"

Description:

Network::FilterStatus StickySessionUdpProxyFilter::onDataInternal(Network::UdpRecvData& data) {
bool defer_socket = config_->hasSessionFilters() || config_->tunnelingConfig();
const auto active_session_it = sessions_.find(data.addresses_);
ActiveSession* active_session;
if (active_session_it == sessions_.end()) {
active_session = createSession(std::move(data.addresses_), nullptr, defer_socket);
if (active_session == nullptr) {

In this function, data.addresses_ is moved after a new session gets created. This causes data.addresses_ to be empty and because of it, UDP session filters won't be able to access them.

This only affects the first packet received from the peer.

Repro steps:

Create or re-use an existing UDP session filter that implements onData and log the pointers of data.addresses_.peer_ and data.addresses_.local_

Logs:

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions