Skip to content

zone_id is required for link-local ipv6 addresses #15688

Closed
@arjantop

Description

@arjantop

There is currently no way to specify a zone id (enp7s0 in this case)

Example:

use std::io::net::udp::UdpSocket;
use std::io::net::ip::{Ipv6Addr, SocketAddr};

fn main() {
    // fe80::52e5:49ff:feba:bae8%enp7s0
    let addr = SocketAddr { ip: Ipv6Addr(0xfe80, 0, 0, 0, 0x52e5, 0x49ff, 0xfeba, 0xbae8), port: 34254 };
    let mut socket = match UdpSocket::bind(addr) {
        Ok(s) => s,
        Err(e) => fail!("couldn't bind socket: {}", e),
    };
}

Error:

task '<main>' failed at 'couldn't bind socket: invalid argument (Invalid argument)', ipv6.rs:9

http://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices

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