From 300e96a7c50dc97cb12ad4e8fabfccbf7927d645 Mon Sep 17 00:00:00 2001 From: Pierre LALET <pierre.lalet@cea.fr> Date: Wed, 21 Dec 2016 12:56:18 +0100 Subject: [PATCH] Fix & test Route6.ifchange() --- scapy/config.py | 2 ++ scapy/route6.py | 6 +++--- test/regression.uts | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scapy/config.py b/scapy/config.py index 53f44a15..568dada8 100755 --- a/scapy/config.py +++ b/scapy/config.py @@ -172,6 +172,8 @@ class CacheInstance(dict): self.timeout = timeout self.name = name self._timetable = {} + def flush(self): + self.__init__(name=self.name, timeout=self.timeout) def __getitem__(self, item): val = dict.__getitem__(self,item) if self.timeout is not None: diff --git a/scapy/route6.py b/scapy/route6.py index 82c6f8f3..e00edfc4 100644 --- a/scapy/route6.py +++ b/scapy/route6.py @@ -128,11 +128,11 @@ class Route6: if iface != iff: continue if gw == '::': - self.routes[i] = (the_net,the_plen,gw,iface,the_addr) + self.routes[i] = (the_net,the_plen,gw,iface,[the_addr]) else: - self.routes[i] = (net,the_plen,gw,iface,the_addr) + self.routes[i] = (net,plen,gw,iface,[the_addr]) self.invalidate_cache() - ip6_neigh_cache.flush() + conf.netcache.in6_neighbor.flush() def ifdel(self, iff): """ removes all route entries that uses 'iff' interface. """ diff --git a/test/regression.uts b/test/regression.uts index ae2954d3..de2e9ee1 100644 --- a/test/regression.uts +++ b/test/regression.uts @@ -67,6 +67,11 @@ if len(routes6): else: True += Test ifchange() +conf.route6.ifchange(LOOPBACK_NAME, "::1/128") +True + + ############ ############ + Basic tests -- GitLab