-
Notifications
You must be signed in to change notification settings - Fork 429
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
Add the up/down Device and Interface methods #502
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was lazy and combined some compile errors (utils.rs) and some non-matching indents in the feature commit.
examples/loopback.rs
Outdated
@@ -43,7 +43,7 @@ mod mock { | |||
mod mock { | |||
use std::sync::Arc; | |||
use std::sync::atomic::{Ordering, AtomicUsize}; | |||
use smoltcp::time::{Duration, Instant}; | |||
use smoltcp::time::{Duration, Instant}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an indent fix.
@@ -20,7 +20,7 @@ mod utils { | |||
mod mock { | |||
use std::sync::Arc; | |||
use std::sync::atomic::{Ordering, AtomicUsize}; | |||
use smoltcp::time::{Duration, Instant}; | |||
use smoltcp::time::{Duration, Instant}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
Thanks for the PR! What's the intended use case? It seems the new functionality is not yet used for anything, method calls are threaded through and exposed to the user. You can call custom methods on your particular IMO we should add methods to |
Not explicitly, but there will be requests that we might want to send when we start/stop.
Yeah, currently this isn't really much different than |
Add up/down methods to Device and Interface for placing the underlying device in a up or down state. This interface will also be handy when adding support for MLDv2. Signed-off-by: Dan Robertson <[email protected]>
Thinking about it, there are 2 related but different things we want:
A device may come up/down "on its own". For example, an Ethernet being plugged/unplugged, WiFi connecting/disconnecting.... Or it may come up/down due to us manually setting it up/down. I imagine an Ethernet driver may report as "up" when we've set it as up AND there's a cable plugged in. so perhaps all smoltcp needs is the second? Just an The first can be done with device-specific methods, calling them through |
We discussed yesterday in the chat about the DHCP always needing 5s. Something like this would give smoltcp opportunity to act accordingly to the link state, as @Dirbaio pointed out. Not sure if it's smoltcp's job to track this though, I'm not that familiar with its design. |
Add up/down methods to Device and Interface for placing the underlying
device in a up or down state. This interface will also be handy when
adding support for MLDv2.