Skip to content

Can't bind udp socket to IPv6 link-local address #32424

Closed
@misuzu

Description

@misuzu

rustc 1.9.0-nightly (02310fd 2016-03-19)

use std::net::{SocketAddr, SocketAddrV6, UdpSocket};

fn main() {
    let socket = UdpSocket::bind(&SocketAddr::V6(SocketAddrV6::new("fe80::1".parse().unwrap(), 0xfc00, 0, 2))).unwrap();
}
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 19, message: "No such device" } }', ../src/libcore/result.rs:746
stack backtrace:
   1:     0x56131611ad40 - sys::backtrace::tracing::imp::write::h30e3c9196ad08fb7YTu
   2:     0x56131611cecb - panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::closure.44369
   3:     0x56131611cb63 - panicking::default_hook::h980e1a31075bed00wHz
   4:     0x5613161163ef - sys_common::unwind::begin_unwind_inner::h206f0162d5284ac0cJt
   5:     0x561316116a88 - sys_common::unwind::begin_unwind_fmt::h2c53ee344adf066biIt
   6:     0x56131611a2f1 - rust_begin_unwind
   7:     0x561316151d6f - panicking::panic_fmt::h54d7b44acd72bb46zML
   8:     0x5613161147b7 - result::unwrap_failed::h4837588801159113532
                        at ../src/libcore/macros.rs:29
   9:     0x56131611450d - result::Result<T, E>::unwrap::h3114626733729204751
                        at ../src/libcore/result.rs:687
  10:     0x561316114425 - main::h42c5c82a5e10cde9iaa
                        at src/main.rs:4
  11:     0x56131611c7e4 - sys_common::unwind::try::try_fn::h7690829787579432567
  12:     0x56131611a27b - __rust_try
  13:     0x56131611c27b - rt::lang_start::h85991f18bf520b4aJzz
  14:     0x561316115a49 - main
  15:     0x7f337e9e560f - __libc_start_main
  16:     0x5613161142a8 - _start
  17:                0x0 - <unknown>

Same on python:

Python 2.7.11+ (default, Feb 22 2016, 16:38:42)
[GCC 5.3.1 20160220] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>>
>>> s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
>>> s.bind(('fe80::1', 0xfc00, 0, 2))
>>>

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