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

IPv6 support #24

Open
mordner opened this issue Oct 9, 2018 · 1 comment
Open

IPv6 support #24

mordner opened this issue Oct 9, 2018 · 1 comment

Comments

@mordner
Copy link

mordner commented Oct 9, 2018

It seems IPv6 targets are not supported.
On my machine I get AAAA records which are preferred for time.google.com.

$ cargo test
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading chrono v0.4.6
 Downloading num-traits v0.2.6
 Downloading num-integer v0.1.39
   Compiling num-traits v0.2.6
   Compiling num-integer v0.1.39
   Compiling cfg-if v0.1.5
   Compiling custom_derive v0.1.7
   Compiling libc v0.2.43
   Compiling byteorder v1.2.6
   Compiling conv v0.3.3
   Compiling log v0.4.5
   Compiling log v0.3.9
   Compiling time v0.1.40
   Compiling ntp v0.5.0 (file:///home/mordner/projects/ntp)
   Compiling chrono v0.4.6
    Finished dev [unoptimized + debuginfo] target(s) in 8.01s
     Running target/debug/deps/ntp-f3e12cb312a2b718

running 2 tests
test test_request_ntp_org ... ok
test test_request_google ... FAILED

failures:

---- test_request_google stdout ----
thread 'test_request_google' panicked at 'Failed to get a ntp packet from time.google.com: Os { code: 97, kind: Other, message: "Address family not supported by protocol" }', libcore/result.rs:945:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:221
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:475
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   6: rust_begin_unwind
             at libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   8: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:26
   9: <core::result::Result<T, E>>::expect
             at /checkout/src/libcore/result.rs:809
  10: ntp::test_request_google
             at src/lib.rs:113
  11: ntp::__test::TESTS::{{closure}}
             at src/lib.rs:111
  12: core::ops::function::FnOnce::call_once
             at /checkout/src/libcore/ops/function.rs:223
  13: <F as alloc::boxed::FnBox<A>>::call_box
             at libtest/lib.rs:1451
             at /checkout/src/libcore/ops/function.rs:223
             at /checkout/src/liballoc/boxed.rs:642
  14: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105


failures:
    test_request_google

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--lib'

$ host time.google.com
time.google.com has address 216.239.35.8
time.google.com has IPv6 address 2001:4860:4806:8::

$ host 0.pool.ntp.org
0.pool.ntp.org has address 93.90.200.201
0.pool.ntp.org has address 193.175.73.151
0.pool.ntp.org has address 78.47.234.59
0.pool.ntp.org has address 81.7.16.52

I guess binding to an IPv4 socket has something to do with it:
https://github.com/JeffBelgum/ntp/blob/master/src/lib.rs#L85

@mitchmindtree
Copy link
Contributor

Thanks for the issue @mordner!

That function is kind of just a "simple" helper API on top of the protocol implementation itself - we should probably break up the internals of it into some smaller reusable functions to make it easier to specify what socket you want to bind to, etc.

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