Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLES 12 interface inet6 returns an element 'add' #62

Open
Rocking80 opened this issue Aug 12, 2021 · 3 comments
Open

SLES 12 interface inet6 returns an element 'add' #62

Rocking80 opened this issue Aug 12, 2021 · 3 comments

Comments

@Rocking80
Copy link

OS:

server:~ # more /etc/os-release
NAME="SLES"
VERSION="12-SP5"
VERSION_ID="12.5"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP5"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12:sp5"

ifconfig

server:~ # ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

p3p1      Link encap:Ethernet  HWaddr 90:E2:BA:48:77:28
          inet addr:10.10.0.2  Bcast:10.10.0.255  Mask:255.255.255.0
          inet6 addr: fe80::92e2:baff:fe48:7728/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:353636 errors:0 dropped:272 overruns:0 frame:0
          TX packets:23246 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:40679739 (38.7 Mb)  TX bytes:3620715 (3.4 Mb)

python. you can see in the inet6 there is an element named add. Where does it come from?

server:~ # python
Python 3.6.8 (default, Apr 30 2019, 13:27:23) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import ifcfg
>>> import json

>>> for name, interface in ifcfg.interfaces().items():
...   print(interface)
...
{'inet': '127.0.0.1', 'inet4': ['127.0.0.1'], 'ether': None, 'inet6': ['add', '::1'], 'netmask': '255.0.0.0', 'device': 'lo', 'mtu': '65536', 'rxbytes': '0', 'txbytes': '0'}
{'inet': '10.10.0.2', 'inet4': ['10.10.0.2'], 'ether': '90:F2:BA:48:77:28', 'inet6': ['add', 'fe80::92e2:baff:fe48:7728'], 'netmask': '255.255.255.0', 'device': 'p3p1', 'broadcast': '10.10.0.255', 'mtu': '1500', 'rxbytes': '40370493', 'txbytes': '3396222'}

@benjaoming
Copy link
Collaborator

benjaoming commented Aug 14, 2021

Thanks for filing this issue! Must be that the regex picks up "add", thinking that it's some kind of hex value of an ipv6 address... because the regex is bad.

If you can contribute a fix for this, it will be most welcomed! There are also test cases that could be expanded to include this.

@Rocking80
Copy link
Author

Yes, it's the regex issue. And I found several regex issue on different platforms. I will fix them and test on my side then create PR to fix here.

@benjaoming
Copy link
Collaborator

@Rocking80 sounds great! You are welcome to contribute with new test input data as well, that can solidify the changes for the future 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants