On Wed, May 15, 2019 at 01:44:01PM +0200, csfakian(a)redhat.com wrote:
From: Christos Sfakianakis <csfakian(a)redhat.com>
Remove code which is never executed from _update_netlink()
method. Add logging code for cases when a multicast IP is
used in error in place of a unicast one and vice-versa.
Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
---
lnst/Devices/Device.py | 12 ------------
lnst/Devices/VxlanDevice.py | 7 +++++++
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/lnst/Devices/Device.py b/lnst/Devices/Device.py
index 9587a88..3037f45 100644
--- a/lnst/Devices/Device.py
+++ b/lnst/Devices/Device.py
@@ -191,26 +191,14 @@ class Device(object):
raise DeviceError(msg)
if nl_msg['header']['type'] == RTM_NEWLINK:
- if self.ifindex != nl_msg['index']:
- raise DeviceError("RTM_NEWLINK message passed to incorrect "\
- "Device object.")
-
self._nl_msg = nl_msg
elif nl_msg['header']['type'] == RTM_NEWADDR:
- if self.ifindex != nl_msg['index']:
- raise DeviceError("RTM_NEWADDR message passed to incorrect "\
- "Device object.")
-
addr = ipaddress(nl_msg.get_attr('IFA_ADDRESS'))
addr.prefixlen = nl_msg["prefixlen"]
if addr not in self._ip_addrs:
self._ip_addrs.append(addr)
elif nl_msg['header']['type'] == RTM_DELADDR:
- if self.ifindex != nl_msg['index']:
- raise DeviceError("RTM_DELADDR message passed to incorrect "\
- "Device object.")
-
addr = ipaddress(nl_msg.get_attr('IFA_ADDRESS'))
addr.prefixlen = nl_msg["prefixlen"]
diff --git a/lnst/Devices/VxlanDevice.py b/lnst/Devices/VxlanDevice.py
index bab5d4c..9e95743 100644
--- a/lnst/Devices/VxlanDevice.py
+++ b/lnst/Devices/VxlanDevice.py
@@ -11,6 +11,7 @@ olichtne(a)redhat.com (Ondrej Lichtner)
"""
import pyroute2
+import logging
from lnst.Common.Logs import log_exc_traceback
from lnst.Common.DeviceError import DeviceError, DeviceConfigError
from lnst.Common.IpAddress import ipaddress
@@ -30,6 +31,12 @@ class VxlanDevice(SoftDevice):
if "group" not in kwargs and "remote" not in kwargs:
raise DeviceError("One of group or remote must be specified for
vxlan")
+ if kwargs.get("remote", False) and
ipaddress(kwargs["remote"]).is_multicast():
+ logging.debug("ATTENTION: non-unicast remote IP set: %s" %
str(kwargs["remote"]))
+
+ if kwargs.get("group", False) and not
ipaddress(kwargs["group"]).is_multicast():
+ logging.debug("ATTENTION: non-multicast group IP set: %s" %
str(kwargs["group"]))
+
super(VxlanDevice, self).__init__(ifmanager, *args, **kwargs)
@property
--
2.17.1
_______________________________________________
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://getfedora.org/code-of-conduct.html
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...
This seems like it should be two commits:
* remove unused code
* add warning log messages to VxlanDevice class
-Ondrej