You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like there are two problems with the ch8-mget example, first the default version of smoltcp 0.5 no longer compiles, I updated to 0.6 and that worked. The second is the example seems to have issues with ethernet not being unicast
❯ cargo run http://www.rustinaction.com/ tap-rust -s 8.8.8.8
warning: unused manifest key: profile.release.codegen_units
warning: trait objects without an explicit `dyn` are deprecated
--> src/dns.rs:40:101
|
40 | pub fn resolve(dns_server_address: &str, domain_name: &str) -> Result<Option<std::net::IpAddr>, Box<Error>> {
|
^^^^^ help: use `dyn`: `dyn Error`
|
= note: `#[warn(bare_trait_objects)]` on by default
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
Running `/home/user/build-artifacts/debug/mget 'http://www.rustinaction.com/' tap-rust -s 8.8.8.8`
thread 'main' panicked at 'Ethernet address f7-f0-a7-28-e7-57 is not unicast', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/smoltcp-0.6.0/src/iface/ethernet.rs:705:13
The error seems to be caused by unknown packets in the socket, but I have no idea what is the cause since I don't know much how to debug it. I tried running the code with cargo run -- http://www.rustinaction.com/ tap-rust.
This method will routinely return errors in response to normal network activity as well as certain boundary conditions such as buffer exhaustion. These errors are provided as an aid for troubleshooting, and are meant to be logged and ignored.
As a special case, Err(Error::Unrecognized) is returned in response to packets containing any unsupported protocol, option, or form, which is a very common occurrence and on a production system it should not even be logged.
Activity
timClicks commentedon Jul 12, 2020
I'll need to spend some time addressing these issues. This may involve re-working the examples somewhat.
jiayihu commentedon Aug 12, 2020
The least significant bit of the first octate should be zero to 0, not 1, for be considered as unicast. I managed to do so in this way:
Unfortunately, running the example still results in error:
The error is from these lines:
The error seems to be caused by unknown packets in the socket, but I have no idea what is the cause since I don't know much how to debug it. I tried running the code with
cargo run -- http://www.rustinaction.com/ tap-rust.In case, full source code of my attempt is available here: https://github.com/jiayihu/lab/blob/master/rust/mget-tcp/src/http.rs but it should be almost identical to the book
mgiles commentedon Nov 14, 2020
I don't think those errors from
pollare a problem. From thepolldocumentation:jiayihu commentedon Nov 14, 2020
@mgiles You're right, my mistake
ch8/ch8-mac: Clear Unicast/Multicast bit