Closed mindsuru closed 1 week ago
I don't understand exactly why it is the way it was, but at least it works now. As far as I know, the Java framework works with nmcli and reads the data from /proc/net/dev and there is a small problem with me. My modem is called wwan0 in the path mentioned. With nmcli device status, however, I get the name cdc-wdm0 for the interface. Therefore I got an error in the file deviceMonitor.js that device = null. I have therefore changed the function _loadDevices() slightly. It is anything but nice, but it works for now.
for (const name of devices) {
let deviceObj;
if (name == 'wwan0'){
deviceObj = this._client.get_device_by_iface('cdc-wdm0');
} else {
deviceObj = this._client.get_device_by_iface(name);
}
const addresses = this._getIPAddress(deviceObj, GLib.SYSDEF_AF_INET);
const type = this.getDeviceTypeFromDevice(deviceObj);
this._devices[name] = {
name,
type,
device: deviceObj,
ip: addresses[0] || ""
};
}
@mindsuru Can you check what does below comands print ?
ifconfig
ls /sys/class/net
If these commands are giving us correct value we can think of using it depending on compatibility and consistency, otherwise we will add a safety check to avoid the crash.
`ifconfig enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether 54:e1:ad:b4:7b:d3 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 16 memory 0xdc200000-dc220000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
lxcbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet ----------- netmask 255.255.255.0 broadcast ----------- ether ----------- txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1330 inet ----------- netmask 255.255.255.0 destination ----------- inet6 ----------- prefixlen 64 scopeid 0x20 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 19840 bytes 7264648 (7.2 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 20863 bytes 4083116 (4.0 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp58s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether 9c:da:3e:7c:cb:2b txqueuelen 1000 (Ethernet) RX packets 59920 bytes 69032469 (69.0 MB) RX errors 0 dropped 3421 overruns 0 frame 0 TX packets 20997 bytes 5852551 (5.8 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wwan0: flags=4291<UP,BROADCAST,RUNNING,NOARP,MULTICAST> mtu 1430
inet ----------- netmask 255.255.255.224 broadcast -----------
inet6 ----------- prefixlen 64 scopeid 0x0
ls /sys/class/net enp0s31f6 lo lxcbr0 tun0 wlp58s0 wwan0
Doesn't look like a problem with the output inteface names are correct. I don't think we can add some workaround for this. But will add safety check in next release.