From 9a9dfcd1ada7664349ce07e1105e85ac59e5b88b Mon Sep 17 00:00:00 2001 From: "Peter D. Barnes, Jr." Date: Tue, 2 Jul 2013 21:56:54 +0200 Subject: [PATCH] Bug 1727 - Ping6 should use a proper source address --- RELEASE_NOTES | 1 + src/applications/model/ping6.cc | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index a4192fbee..4b99ab1f9 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -41,6 +41,7 @@ Bugs fixed - Bug 1718 - Ipv4StaticRouting log component is misspelled - Bug 1719 - IPv6 default state is set to not forward packets - Bug 1720 - IPv6 Fragmentation cause crashes +- Bug 1727 - Ping6 should use a proper source address Known issues ------------ diff --git a/src/applications/model/ping6.cc b/src/applications/model/ping6.cc index e323dd78e..c9a120407 100644 --- a/src/applications/model/ping6.cc +++ b/src/applications/model/ping6.cc @@ -171,8 +171,17 @@ void Ping6::Send () /* hack to have ifIndex in Ipv6RawSocketImpl * maybe add a SetIfIndex in Ipv6RawSocketImpl directly */ - src = GetNode ()->GetObject ()->GetAddress (m_ifIndex, 0).GetAddress (); - } + Ipv6InterfaceAddress dstIa (m_peerAddress); + for (uint32_t i = 0; i < GetNode ()->GetObject ()->GetNAddresses (m_ifIndex); i++) + { + src = GetNode ()->GetObject ()->GetAddress (m_ifIndex, i).GetAddress (); + Ipv6InterfaceAddress srcIa (src); + if ( srcIa.GetScope() == dstIa.GetScope() ) + { + break; + } + } + } else { src = m_localAddress;