Skip to content

IPv6 link-local address parsing & round-tripping #65976

@raggi

Description

@raggi

Consider the following link local IPv6 sockaddr string:

[fe80::f03c:91ff:fedf:75ee%eth0]:8080

This address does not parse or round-trip: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b36d93fe7d2a8699397c6dfafa2a3edf

The output formatting also elides the scopeid, which means that printed addresses are not valid addresses - particularly on multi-homed devices, where the un-scoped address will not function.

I believe that the correct change here is to both parse scopeid's and to include non-zero scopeids in Display. I'm happy to implement this if that is agreeable? It would need to take a dependency on if_nametoindex and if_indextoname (POSIX, net/if.h) in order to function on most Unix style platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions