summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChia-Lin Cho <fox91119@gmail.com>2016-01-22 21:20:58 +0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-01-31 12:46:48 +0900
commit648ac64fd6c55af401002c2a1d38241d6c831452 (patch)
tree7c0736018e1c5960c0d9497d401585ee9d465f5b
parent63f9502ea0c9b23d8ccee33e67ff1a7f06d1490f (diff)
topology: Make sure the last IP in the list is the newest IP.
In the wireless network, when host attaches AP, it will send many ARP requests which Src IP were used before. This causes the last IP in the list may not be the newest one and we also cannot know which IP in the list is the newest. So this patch can solve it. Signed-off-by: Chia-Lin Cho <fox91119@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/topology/switches.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index 9622a903..e21f00eb 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -206,10 +206,14 @@ class HostState(dict):
if not host:
return
- if ip_v4 != None and ip_v4 not in host.ipv4:
+ if ip_v4 != None:
+ if ip_v4 in host.ipv4:
+ host.ipv4.remove(ip_v4)
host.ipv4.append(ip_v4)
- if ip_v6 != None and ip_v6 not in host.ipv6:
+ if ip_v6 != None:
+ if ip_v6 in host.ipv6:
+ host.ipv6.remove(ip_v6)
host.ipv6.append(ip_v6)
def get_by_dpid(self, dpid):