From 608862b8d219fd726110e13607ee1dff71828eea Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 12 Feb 2007 22:44:18 +0100 Subject: [PATCH] make route iteration actually work --- src/node/ipv4.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/node/ipv4.cc b/src/node/ipv4.cc index 8fba973e6..9fb146d32 100644 --- a/src/node/ipv4.cc +++ b/src/node/ipv4.cc @@ -174,7 +174,10 @@ Ipv4::GetRoute (uint32_t index) { return m_defaultRoute; } - index--; + if (index > 0 && m_defaultRoute != 0) + { + index--; + } if (index < m_hostRoutes.size ()) { uint32_t tmp = 0; @@ -213,7 +216,10 @@ Ipv4::RemoveRoute (uint32_t index) delete m_defaultRoute; m_defaultRoute = 0; } - index--; + if (index > 0 && m_defaultRoute != 0) + { + index--; + } if (index < m_hostRoutes.size ()) { uint32_t tmp = 0;