Giter VIP home page Giter VIP logo

Comments (4)

EstebanBorai avatar EstebanBorai commented on June 11, 2024

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:

match (*ifa_addr).sa_family as i32 {

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.

zyddnys avatar zyddnys commented on June 11, 2024

Sounds great, thank you for the help

from local-ip-address.

EstebanBorai avatar EstebanBorai commented on June 11, 2024

Thanks to you! I will be working on this and get back to you when its ready!

from local-ip-address.

EstebanBorai avatar EstebanBorai commented on June 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.