Skip to content

[wasi:sockets/ip-name-lookup#resolve_addresses] way to track name to IpAddress resolution #7694

@rylev

Description

@rylev

My use case is essentially to allow any socket operation as long as the IP addressed used for that operation was resolved in the last call to wasi:sockets/ip-name-lookup#resolve_addresses.

Given the changes in #7662 this would stand to reason that somehow I need the ability to have a list of resolved names to IP addresses in the closure passed to socket_addr_check.

This could be accomplished in several ways:

  1. Wasmtime passes such a list directly as an argument to the SocketAddrCheck closure.
  2. Wasmtime gives a way for the embedder to query what the list is at any time.
  3. Wasmtime allows the embedder to hook into DNS resolution and be called back with any (name, resolved IP address) pairs
  4. Other ways?

I think I might lean towards option 3. Perhaps this callback could be in the form Fn(&str, IpAddress) -> Result<(), ErrorCode> which would be called anytime resolve_next_address is about to return a Ok(Some(addr)) to the guest. This would allow the embedder to do the following things:

  • Observe DNS resolution as it happens (needed to unlock my use case)
  • Change resolution so that a name resolves to a different set of IP addresses
  • Return an ErrorCode error from resolve_next_address

If we can agree on an approach, I'm happy to do the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions