magic-wormhole / magic-wormhole.rs

Rust implementation of Magic Wormhole, with new features and enhancements
European Union Public License 1.2
737 stars 81 forks source link

Panics when IPv6 is disabled #162

Closed felinira closed 2 years ago

felinira commented 2 years ago

Currently the library panics if IPv6 is disabled via sysctl.

thread 'smol-1' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 97, kind: Uncategorized, message: "Address family not supported by protocol" }', /run/build/warp/cargo/vendor/magic-wormhole/src/transit.rs:752:30

piegamesde commented 2 years ago

Oh wow that code path has a lot of missing error handling :see_no_evil:

piegamesde commented 2 years ago

Fixes are on dev. Let me know if that way of error handling is appropriate for you.

felinira commented 2 years ago

Thanks! Error handling looks fine to me, everything that is not a panic makes me happy^^.

It appears to have not been enough though for this particular problem: https://gitlab.gnome.org/felinira/warp/-/issues/8#note_1460858

It seems to panic here now 🙊

thread 'smol-1' panicked at 'assertion failed: socket.is_some() == our_abilities.can_direct()', /run/build/warp/cargo/vendor/magic-wormhole/src/transit.rs:1036:9
piegamesde commented 2 years ago

Oops forgot about that one, sorry ^^. Technically that assertion is redundant anyways, but it could also be weakened to the implication assert!(socket.is_none() || our_abilities.can_direct());.

That being said, I don't feel happy about this progression. It feels like some weird silent failure case but also without a good possibility to expose the error. Maybe I'll try building in a fallback that is not IPv6 specific to make this work again.

Are there any other scenarios where binding a local port may fail but the transfer can still take place?

felinira commented 2 years ago

This seems to have fixed it.