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

bump version for ipnetwork in pnet_datalink #567

Merged
merged 1 commit into from Jun 1, 2022

Conversation

matteyeux
Copy link
Contributor

Hey,

small PR to bump the version of ipnetwork in pnet_datalink. Since 0.30.0 I have a build error my code :

λ ~/dev/nettest(main*) » cargo run
   Compiling nettest v0.1.0 (/home/mathieu/dev/nettest)
error[E0308]: mismatched types
 --> src/main.rs:8:17
  |
7 |             match ip {
  |                   -- this expression has type `ipnetwork::IpNetwork`
8 |                 IpNetwork::V4(ipv4) => {
  |                 ^^^^^^^^^^^^^^^^^^^ expected enum `ipnetwork::IpNetwork`, found enum `IpNetwork`
  |
  = note: perhaps two different versions of crate `ipnetwork` are being used?

error[E0308]: mismatched types
  --> src/main.rs:11:17
   |
7  |             match ip {
   |                   -- this expression has type `ipnetwork::IpNetwork`
...
11 |                 IpNetwork::V6(ipv6) => {
   |                 ^^^^^^^^^^^^^^^^^^^ expected enum `ipnetwork::IpNetwork`, found enum `IpNetwork`
   |
   = note: perhaps two different versions of crate `ipnetwork` are being used?

For more information about this error, try `rustc --explain E0308`.
error: could not compile `nettest` due to 2 previous errors

Using the snippet below :

use pnet::datalink;
use pnet::ipnetwork::IpNetwork;

fn main() {
    for iface in datalink::interfaces() {
        for ip in iface.ips {
            match ip {
                IpNetwork::V4(ipv4) => {
                    println!("{:?}", ipv4.ip().to_string());
                }
                IpNetwork::V6(ipv6) => {
                    println!("{:?}", ipv6.ip().to_string());
                }
            }
        }
    }   
}

It seems like bumping ipnetwork version fixed it. I noticed it was done in the main Cargo.toml but not the one in pnet_datalink.

@sjoqvist
Copy link

I had just completed an issue describing this, and found your pull request moments before I posted it. I would also like to see this fixed.

For future reference: This seems to have been introduced in pull request #552 and be analogue to the issue #494 (which was caused by a similar automatic pull request – #483).

@matteyeux
Copy link
Contributor Author

Despite the fact that this PR will fix this issue, I think the best way to not have this type of errors is to setup dependabot for others subprojects of libpnet

@stappersg
Copy link
Contributor

stappersg commented May 25, 2022 via email

@sjoqvist
Copy link

What do you need to achieve that?

I have no previous experience of dependabot and I haven't tested this solution, but isn't it as easy as adding one (or more) configuration list item(s) to .github/dependabot.yml?

@matteyeux
Copy link
Contributor Author

@stappersg If dependabot was setup to bump the version of subprojects dependencies, this PR would not be needed because dependabot could have also updated ipnetwork in pnet_datalink.

I could have been done in for both projects in #552

@mrmonday
Copy link
Contributor

mrmonday commented Jun 1, 2022

Thanks!

@mrmonday mrmonday merged commit c24329e into libpnet:master Jun 1, 2022
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

Successfully merging this pull request may close these issues.

None yet

4 participants