ftao / python-ifcfg

Python cross-platform network interface discovery (ifconfig/ipconfig/ip)
BSD 3-Clause "New" or "Revised" License
55 stars 37 forks source link

Netmask showing wrong data #66

Open sukeshleel opened 2 years ago

sukeshleel commented 2 years ago

Hi @benjaoming,

I'm trying to get interfaces details using the code in this repo in the Linux machine, where in that linux machine "ifconfig" command is deprecated, only "ip" command is available so it using fall back approach.

I'm seeing that netmask value is /16 or /24 or /8 etc., instead of actual netmask value. kindly refer attached screenshot.

Same packages I'm using where "ifconfig" is available there I can see that netmask value is proper. Kindly let me know if this issue can be fixed.

If screenshot is not clear please refer the below text,

  1. Issue data 'wifi1': {'inet': '169.254.193.75', 'inet4': ['169.254.193.75'], 'ether': None, 'inet6': ['fe80::7d38:44e:84e:c14b'], 'netmask': '/16', 'device': 'wifi1', 'flags': ' <>', 'mtu': '1500', 'broadcast': '169.254.255.255'}}

    ifcfg.version '0.22'

  2. Working data {u'lo': {u'ether': None, u'netmask': u'255.0.0.0', u'flags': u'73<UP,LOOPBACK,RUNNING> ', u'device': u'lo', u'mtu': u'65536', u'inet6': [u'::1'], u'inet': u'127.0.0.1', u'inet4': [u'127.0.0.1']}, u'eth0': {u'ether': u'00:0c:29:3e:2e:75', u'broadcast': u'172.16.255.255', u'netmask': u'255.255.0.0', u'flags': u'4163<UP,BROADCAST,RUNNING,MULTICAST> ', u'device': u'eth0', u'mtu': u'1500', u'inet6': [u'fe80::20c:29ff:fe3e:2e75'], u'inet': u'172.16.9.150', u'inet4': [u'172.16.9.150']}}

    ifcfg.version u'0.22'

Issue_ip Issue_ip1

Regards, Leel.