summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/netlink/core.py9
-rw-r--r--python/netlink/util.py3
2 files changed, 9 insertions, 3 deletions
diff --git a/python/netlink/core.py b/python/netlink/core.py
index ee40b0de..fbd1c9e6 100644
--- a/python/netlink/core.py
+++ b/python/netlink/core.py
@@ -449,6 +449,9 @@ class ObjIterator(object):
return capi.nl_cache_get_next(self._nl_object)
def next(self):
+ return self.__next__(self)
+
+ def __next__(self):
if self._end:
raise StopIteration()
@@ -566,12 +569,12 @@ class Cache(object):
capi.nl_cache_refill(socket._sock, self._nl_cache)
return self
- def resync(self, socket=None, cb=None):
+ def resync(self, socket=None, cb=None, args=None):
"""Synchronize cache with content in kernel"""
if socket is None:
socket = lookup_socket(self._protocol)
- capi.nl_cache_resync(socket._sock, self._nl_cache, cb)
+ capi.nl_cache_resync(socket._sock, self._nl_cache, cb, args)
def provide(self):
"""Provide this cache to others
@@ -668,6 +671,8 @@ class AbstractAddress(object):
self._nl_addr = None
if isinstance(addr, str):
+ # returns None on success I guess
+ # TO CORRECT
addr = capi.addr_parse(addr, socket.AF_UNSPEC)
if addr is None:
raise ValueError('Invalid address format')
diff --git a/python/netlink/util.py b/python/netlink/util.py
index 23940336..22ed5cfc 100644
--- a/python/netlink/util.py
+++ b/python/netlink/util.py
@@ -17,8 +17,9 @@ import types
__version__ = '1.0'
+#rename into colored_output
def _color(t, c):
- return b'{esc}[{color}m{text}{esc}[0m'.format(esc=b'\x1b', color=c, text=t)
+ return '{esc}[{color}m{text}{esc}[0m'.format(esc=b'\x1b'.decode(), color=c, text=t)
def black(t):
return _color(t, 30)