From bdcac1c3a046fcdf47994f38931e9260cbf8b52a Mon Sep 17 00:00:00 2001 From: Arnaud Ebalard <arno@natisbad.org> Date: Mon, 2 Nov 2009 20:49:29 +0100 Subject: [PATCH] No need to sort and then reverse. Do both simultaneously --- scapy/route6.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scapy/route6.py b/scapy/route6.py index fca4fb92..95333990 100644 --- a/scapy/route6.py +++ b/scapy/route6.py @@ -217,8 +217,8 @@ class Route6: warning("No route found for IPv6 destination %s (no default route?)" % dst) return (LOOPBACK_NAME, "::", "::") # XXX Linux specific - pathes.sort() - pathes.reverse() + # Sort with longest prefix first + pathes.sort(reverse=True) best_plen = pathes[0][0] pathes = filter(lambda x: x[0] == best_plen, pathes) -- GitLab