yeah, refactoring this is going to be a larger effort.
I wrote this module because the python module was added in python3.3 and
I was still working with python2. However this was inspired by the
python3 module.
The custom module does support additional stuff - "flags" and
"is_tentative" are properties of addresses that have been **configured**
to an interface in the kernel via netlink. The python module only has
properties regarding the actual number.
So the refactor will have to somehow take this into account.
Meanwhile I'll push this.
-Ondrej
On Wed, Apr 28, 2021 at 04:58:45PM -0400, pgagne(a)redhat.com wrote:
From: Perry Gagne <pgagne(a)redhat.com>
I happened upon this todo when looking at this code for MPTCP.
IMHO we should probably replace this with the builtin ipaddress module, or perhaps a
customized subclass of it.
The ipaddress module contains many tools that can generate address, for example iterating
though a subnet, and others.
https://docs.python.org/3/library/ipaddress.html#module-ipaddress
Refactoring this might be a lot of work, so I don't want to do it now, but I figured
I would atleast update this todo as reminder to anyone who might be looking at the
IpAddress code and want to do it.
Signed-off-by: Perry Gagne <pgagne(a)redhat.com>
---
lnst/Common/IpAddress.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lnst/Common/IpAddress.py b/lnst/Common/IpAddress.py
index 26400077..e572f32b 100644
--- a/lnst/Common/IpAddress.py
+++ b/lnst/Common/IpAddress.py
@@ -15,8 +15,9 @@ import socket
from socket import inet_pton, inet_ntop, AF_INET, AF_INET6
from lnst.Common.LnstError import LnstError
-#TODO create various generators for IPNetworks and IPaddresses in the same
-#network
+#TODO Replace this with Python's builtin ipaddress module.
+# To make use of its IP address generators.
+#
https://docs.python.org/3/library/ipaddress.html#module-ipaddress
class BaseIpAddress(object):
def __init__(self, addr, flags=None):
--
2.30.2
_______________________________________________
LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure