Git Product home page Git Product logo

Comments (7)

msinn avatar msinn commented on September 22, 2024

The Error comes from ifaddresses(interface)[AF_INET] and AF_INET is a constant with the value of 2.

This looks like the system has no ipv4 address.

Does it happen directly after a system start and the ip stack is not completely initialized?
Can it be, that no dhcp address is assigned to the system yet?

If we just catch the error, should the function just return an empty list?

from smarthome.

bmxp avatar bmxp commented on September 22, 2024

Hm. No. The basic system ist running for some weeks now and I do have an IP4 adress. Yesterday the error occurred twice while using the admin interface (looking at logics, logs and items)

from smarthome.

msinn avatar msinn commented on September 22, 2024

I caught the exception and log a warning. Could you elaborate on your environment (os, python version, ...)?

from smarthome.

bmxp avatar bmxp commented on September 22, 2024

This is the log entry:

2024-04-24 19:14:23 WARNING lib.utils get_all_local_ipv4_addresses: Exception 2 - {17: [{'addr': '06:af:73:fe:f7:11', 'broadcast': 'ff:ff:ff:ff:ff:ff'}]}

Running Python 3.9.2 on Linux (5.10.0-27-amd64 #1 SMP Debian 5.10.205-2 (2023-12-31) x86_64 GNU/Linux)

from smarthome.

msinn avatar msinn commented on September 22, 2024

Ok, there seems to be an interface that has no ipv4 address (AF_INET, which is 2) and no ipv6 address (AF_INET6, which is 10)

I added further info to the logging. Could you test again and post the (multiline) log entry?

from smarthome.

bmxp avatar bmxp commented on September 22, 2024

This results in:

2024-04-26  06:54:56 WARNING  lib.utils         get_all_local_ipv4_addresses: Exception 2 
- interfaces=['lo', 'eno1', 'wlo2']
-act. interface=wlo2
-act. interface data={'lo': {17: [{'addr': '00:00:00:00:00:00', 'peer': '00:00:00:00:00:00'}], 2: [{'addr': '127.0.0.1', 'netmask': '255.0.0.0', 'peer': '127.0.0.1'}], 10: [{'addr': '::1', 'netmask': 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128'}]}, 'eno1': {17: [{'addr': '1c:69:7a:a4:9c:0d', 'broadcast': 'ff:ff:ff:ff:ff:ff'}], 2: [{'addr': '192.168.20.13', 'netmask': '255.255.255.0', 'broadcast': '192.168.20.255'}], 10: [{'addr': 'fe80::1e69:7aff:fea4:9c0d%eno1', 'netmask': 'ffff:ffff:ffff:ffff::/64'}]}, 'wlo2': {17: [{'addr': 'da:81:02:8b:0d:37', 'broadcast': 'ff:ff:ff:ff:ff:ff'}]}}
- {17: [{'addr': 'da:81:02:8b:0d:37', 'broadcast': 'ff:ff:ff:ff:ff:ff'}]}

from smarthome.

msinn avatar msinn commented on September 22, 2024

I have pushed a fix (and removed the logging)

from smarthome.

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.