Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
misuzu opened this issue Mar 22, 2016 · 2 comments
Closed

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

misuzu opened this issue Mar 22, 2016 · 2 comments

Comments

@misuzu
Copy link

misuzu commented Mar 22, 2016

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))
>>>
alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 22, 2016
Apparently these aren't supposed to be stored in network byte order, so doing so
ends up causing failures when it would otherwise succeed when stored in the host
byte order.

Closes rust-lang#32424
@alexcrichton
Copy link
Member

Oh dear, looks like these are stored in the network byte order and they're apparently supposed to not be stored as such.

#32429

eddyb added a commit to eddyb/rust that referenced this issue Mar 23, 2016
std: Store flowinfo/scope_id in host byte order

Apparently these aren't supposed to be stored in network byte order, so doing so
ends up causing failures when it would otherwise succeed when stored in the host
byte order.

Closes rust-lang#32424
@misuzu
Copy link
Author

misuzu commented Mar 24, 2016

Works on latest nightly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants