Comments (4)
Hello @zyddnys! Thanks for reporting this issue!
I'm checking on your error and I was able to reproduce it.
The invalid access occurs here:
Line 149 in 078a53f
The pointer ifa_addr
is null
, thus access to its fields is not valid, and when we attempt to access the sa_family
field we receive SIGSEGV.
If you check for your network interfaces running:
ip link show
You will get this output:
# Network interfaces from your system..
8: tun0: <POINTOPOINT,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 500
link/none
Note that we don't have an address assigned to our tun0
interface, instead we have link/none
in it's place.
sudo ip tuntap add tun0 mode tun
Solution Draft
I think I've to introduce support for network interfaces with no address.
So instead of having:
Vec<(String, IpAddr)>
For the list of network interfaces, we could have:
Vec<(String, Option<IpAddr>)>
Or perhaps, even more descriptive:
enum NetworkInterfaceAddress {
AfInet,
AfInet6,
}
struct NetworkInterface {
name: String,
ip_address: Option<IpAddr>,
family: NetworkInterfaceFamily,
}
What do you think?
from local-ip-address.
Sounds great, thank you for the help
from local-ip-address.
Thanks to you! I will be working on this and get back to you when its ready!
from local-ip-address.
Hi @zyddnys, I hope you are doing well!
I've been discussing improvements to the API in #26, I would appreciate your suggestions there as we were talking about something similar here.
Take a look to this struct definition here:
#26 (comment)
Let me know your comments!
from local-ip-address.
Related Issues (20)
- Fails to compile on Raspberry-Pi Flavor Linux HOT 1
- Compilation error with version local-ip-address-0.5.2 HOT 7
- error: build failed HOT 1
- Unexpected "\0" in the network interface name HOT 3
- failed to resolve: use of undeclared crate or module `env` HOT 2
- New release for windows-sys 0.48 HOT 3
- Windows 10 Chinese version is not supported HOT 13
- Additional interface info? HOT 12
- Cannot compile for Windows MSVC on Linux HOT 5
- Incorrect local IP address got on Windows HOT 4
- Hope to support FreeBSD OS HOT 3
- Use Os Error HOT 5
- Release HOT 6
- Use `std::alloc::alloc` instead of `libc::malloc` HOT 2
- Misleading error message when using non-`en0` interface on macOS HOT 1
- Update `neli` to latest version or change approach
- Determine the primary outbound local IP if multiple present in interfaces HOT 1
- conditional compilation for WebAssembly HOT 1
- MacOS bug on 0.5.0 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from local-ip-address.