author | Antti M?kel? <zarhan@cc.hut.fi> |
Tue, 15 Dec 2009 20:41:36 -0800 | |
changeset 5856 | 7fd20c798a7d |
parent 5796 | cd4576c14476 |
child 5863 | a4b21e0ee84c |
permissions | -rw-r--r-- |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
2 |
/* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007-2009 Strasbourg University |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
4 |
* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
8 |
* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
13 |
* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
17 |
* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
18 |
* Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr> |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
19 |
*/ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
20 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
21 |
#include "ns3/log.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
22 |
#include "ns3/packet.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
23 |
#include "ns3/ipv6-route.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
24 |
#include "ns3/net-device.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
25 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
26 |
#include "ipv6-static-routing.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
27 |
#include "ipv6-routing-table-entry.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
28 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
29 |
namespace ns3 |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
30 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
31 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
32 |
NS_LOG_COMPONENT_DEFINE ("Ipv6StaticRouting"); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
33 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
34 |
TypeId Ipv6StaticRouting::GetTypeId () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
35 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
36 |
static TypeId tid = TypeId ("ns3::Ipv6StaticRouting") |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
37 |
.SetParent<Ipv6RoutingProtocol> () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
38 |
.AddConstructor<Ipv6StaticRouting> () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
39 |
; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
40 |
return tid; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
41 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
42 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
43 |
Ipv6StaticRouting::Ipv6StaticRouting () |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
44 |
: m_ipv6 (0) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
45 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
46 |
NS_LOG_FUNCTION_NOARGS (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
47 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
48 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
49 |
Ipv6StaticRouting::~Ipv6StaticRouting () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
50 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
51 |
NS_LOG_FUNCTION_NOARGS (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
52 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
53 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
54 |
void Ipv6StaticRouting::SetIpv6 (Ptr<Ipv6> ipv6) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
55 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
56 |
NS_LOG_FUNCTION (this << ipv6); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
57 |
NS_ASSERT (m_ipv6 == 0 && ipv6 != 0); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
58 |
uint32_t i = 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
59 |
m_ipv6 = ipv6; |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
60 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
61 |
for (i = 0 ; i < m_ipv6->GetNInterfaces () ; i++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
62 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
63 |
if (m_ipv6->IsUp (i)) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
64 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
65 |
NotifyInterfaceUp (i); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
66 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
67 |
else |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
68 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
69 |
NotifyInterfaceDown (i); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
70 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
71 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
72 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
73 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
74 |
void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
75 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
76 |
NS_LOG_FUNCTION (this << dst << nextHop << interface << prefixToUse << metric); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
77 |
AddNetworkRouteTo (dst, Ipv6Prefix::GetOnes (), nextHop, interface, prefixToUse, metric); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
78 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
79 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
80 |
void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, uint32_t interface, uint32_t metric) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
81 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
82 |
NS_LOG_FUNCTION (this << dst << interface << metric); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
83 |
AddNetworkRouteTo (dst, Ipv6Prefix::GetOnes (), interface, metric); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
84 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
85 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
86 |
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, uint32_t metric) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
87 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
88 |
NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << metric); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
89 |
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry (); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
90 |
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
91 |
m_networkRoutes.push_back (std::make_pair (route, metric)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
92 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
93 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
94 |
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
95 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
96 |
NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << prefixToUse << metric); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
97 |
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
98 |
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface, prefixToUse); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
99 |
m_networkRoutes.push_back (std::make_pair (route, metric)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
100 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
101 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
102 |
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface, uint32_t metric) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
103 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
104 |
NS_LOG_FUNCTION (this << network << networkPrefix << interface); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
105 |
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
106 |
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, interface); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
107 |
m_networkRoutes.push_back (std::make_pair (route, metric)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
108 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
109 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
110 |
void Ipv6StaticRouting::SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
111 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
112 |
NS_LOG_FUNCTION (this << nextHop << interface << prefixToUse); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
113 |
AddNetworkRouteTo (Ipv6Address ("::"), Ipv6Prefix::GetZero (), nextHop, interface, prefixToUse, metric); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
114 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
115 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
116 |
void Ipv6StaticRouting::AddMulticastRoute (Ipv6Address origin, Ipv6Address group, uint32_t inputInterface, std::vector<uint32_t> outputInterfaces) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
117 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
118 |
NS_LOG_FUNCTION (this << origin << group << inputInterface); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
119 |
Ipv6MulticastRoutingTableEntry* route = new Ipv6MulticastRoutingTableEntry (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
120 |
*route = Ipv6MulticastRoutingTableEntry::CreateMulticastRoute (origin, group, inputInterface, outputInterfaces); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
121 |
m_multicastRoutes.push_back (route); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
122 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
123 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
124 |
void Ipv6StaticRouting::SetDefaultMulticastRoute (uint32_t outputInterface) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
125 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
126 |
NS_LOG_FUNCTION (this << outputInterface); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
127 |
Ipv6RoutingTableEntry *route = new Ipv6RoutingTableEntry (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
128 |
Ipv6Address network = Ipv6Address ("ff00::"); /* RFC 3513 */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
129 |
Ipv6Prefix networkMask = Ipv6Prefix (8); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
130 |
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkMask, outputInterface); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
131 |
m_networkRoutes.push_back (std::make_pair (route, 0)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
132 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
133 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
134 |
uint32_t Ipv6StaticRouting::GetNMulticastRoutes () const |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
135 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
136 |
NS_LOG_FUNCTION_NOARGS (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
137 |
return m_multicastRoutes.size (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
138 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
139 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
140 |
Ipv6MulticastRoutingTableEntry Ipv6StaticRouting::GetMulticastRoute (uint32_t index) const |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
141 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
142 |
NS_LOG_FUNCTION (this << index); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
143 |
NS_ASSERT_MSG (index < m_multicastRoutes.size (), "Ipv6StaticRouting::GetMulticastRoute () : Index out of range"); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
144 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
145 |
if (index < m_multicastRoutes.size ()) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
146 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
147 |
uint32_t tmp = 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
148 |
for (MulticastRoutesCI i = m_multicastRoutes.begin () ; i != m_multicastRoutes.end () ; i++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
149 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
150 |
if (tmp == index) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
151 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
152 |
return *i; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
153 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
154 |
tmp++; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
155 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
156 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
157 |
return 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
158 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
159 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
160 |
bool Ipv6StaticRouting::RemoveMulticastRoute (Ipv6Address origin, Ipv6Address group, uint32_t inputInterface) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
161 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
162 |
NS_LOG_FUNCTION (this << origin << group << inputInterface); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
163 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
164 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
165 |
Ipv6MulticastRoutingTableEntry *route = *i; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
166 |
if (origin == route->GetOrigin () && |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
167 |
group == route->GetGroup () && |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
168 |
inputInterface == route->GetInputInterface ()) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
169 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
170 |
delete *i; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
171 |
m_multicastRoutes.erase (i); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
172 |
return true; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
173 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
174 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
175 |
return false; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
176 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
177 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
178 |
void Ipv6StaticRouting::RemoveMulticastRoute (uint32_t index) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
179 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
180 |
NS_LOG_FUNCTION (this << index); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
181 |
uint32_t tmp = 0; |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
182 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
183 |
for (MulticastRoutesI i = m_multicastRoutes.begin () ; i != m_multicastRoutes.end () ; i++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
184 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
185 |
if (tmp == index) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
186 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
187 |
delete *i; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
188 |
m_multicastRoutes.erase (i); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
189 |
return; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
190 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
191 |
tmp++; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
192 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
193 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
194 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
195 |
bool Ipv6StaticRouting::HasNetworkDest (Ipv6Address network, uint32_t interfaceIndex) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
196 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
197 |
NS_LOG_FUNCTION (this << network << interfaceIndex); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
198 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
199 |
/* in the network table */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
200 |
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
201 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
202 |
Ipv6RoutingTableEntry* rtentry = j->first; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
203 |
Ipv6Prefix prefix = rtentry->GetDestNetworkPrefix (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
204 |
Ipv6Address entry = rtentry->GetDestNetwork (); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
205 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
206 |
if (prefix.IsMatch (network, entry) && rtentry->GetInterface () == interfaceIndex) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
207 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
208 |
return true; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
209 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
210 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
211 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
212 |
/* beuh!!! not route at all */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
213 |
return false; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
214 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
215 |
|
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5796
diff
changeset
|
216 |
Ptr<Ipv6Route> Ipv6StaticRouting::LookupStatic (Ipv6Address dst, Ptr <NetDevice> interface) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
217 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
218 |
NS_LOG_FUNCTION (this << dst << interface); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
219 |
Ptr<Ipv6Route> rtentry = 0; |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
220 |
uint16_t longestMask = 0; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
221 |
uint32_t shortestMetric = 0xffffffff; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
222 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
223 |
/* when sending on link-local multicast, there have to be interface specified */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
224 |
if (dst == Ipv6Address::GetAllNodesMulticast () || dst.IsSolicitedMulticast () || |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
225 |
dst == Ipv6Address::GetAllRoutersMulticast () || dst == Ipv6Address::GetAllHostsMulticast ()) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
226 |
{ |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5796
diff
changeset
|
227 |
NS_ASSERT_MSG (interface, "Try to send on link-local multicast address, and no interface index is given!"); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
228 |
rtentry = Create<Ipv6Route> (); |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5796
diff
changeset
|
229 |
rtentry->SetSource (SourceAddressSelection (m_ipv6->GetInterfaceForDevice (interface), dst)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
230 |
rtentry->SetDestination (dst); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
231 |
rtentry->SetGateway (Ipv6Address::GetZero ()); |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5796
diff
changeset
|
232 |
rtentry->SetOutputDevice (interface); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
233 |
return rtentry; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
234 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
235 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
236 |
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
237 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
238 |
Ipv6RoutingTableEntry* j = it->first; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
239 |
uint32_t metric = it->second; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
240 |
Ipv6Prefix mask = j->GetDestNetworkPrefix (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
241 |
uint16_t maskLen = mask.GetPrefixLength (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
242 |
Ipv6Address entry = j->GetDestNetwork (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
243 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
244 |
NS_LOG_LOGIC ("Searching for route to " << dst << ", mask length " << maskLen << ", metric " << metric); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
245 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
246 |
if (mask.IsMatch (dst, entry)) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
247 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
248 |
NS_LOG_LOGIC ("Found global network route " << j << ", mask length " << maskLen << ", metric " << metric); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
249 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
250 |
/* if interface is given, check the route will output on this interface */ |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5796
diff
changeset
|
251 |
if (!interface || interface == m_ipv6->GetNetDevice (j->GetInterface ())) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
252 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
253 |
if (maskLen < longestMask) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
254 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
255 |
NS_LOG_LOGIC ("Previous match longer, skipping"); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
256 |
continue; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
257 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
258 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
259 |
if (maskLen > longestMask) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
260 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
261 |
shortestMetric = 0xffffffff; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
262 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
263 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
264 |
longestMask = maskLen; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
265 |
if (metric > shortestMetric) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
266 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
267 |
NS_LOG_LOGIC ("Equal mask length, but previous metric shorter, skipping"); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
268 |
continue; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
269 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
270 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
271 |
shortestMetric = metric; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
272 |
Ipv6RoutingTableEntry* route = j; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
273 |
uint32_t interfaceIdx = route->GetInterface (); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
274 |
rtentry = Create<Ipv6Route> (); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
275 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
276 |
if (route->GetGateway ().IsAny ()) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
277 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
278 |
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ())); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
279 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
280 |
else if (route->GetDest ().IsAny ()) /* default route */ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
281 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
282 |
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetPrefixToUse ().IsAny () ? route->GetGateway () : route->GetPrefixToUse ())); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
283 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
284 |
else |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
285 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
286 |
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetGateway ())); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
287 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
288 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
289 |
rtentry->SetDestination (route->GetDest ()); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
290 |
rtentry->SetGateway (route->GetGateway ()); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
291 |
rtentry->SetOutputDevice (m_ipv6->GetNetDevice (interfaceIdx)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
292 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
293 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
294 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
295 |
|
4766
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
296 |
if(rtentry) |
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
297 |
{ |
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
298 |
NS_LOG_LOGIC ("Matching route via " << rtentry->GetDestination () << " (throught " << rtentry->GetGateway () << ") at the end"); |
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
299 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
300 |
return rtentry; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
301 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
302 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
303 |
void Ipv6StaticRouting::DoDispose () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
304 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
305 |
NS_LOG_FUNCTION_NOARGS (); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
306 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
307 |
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j = m_networkRoutes.erase (j)) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
308 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
309 |
delete j->first; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
310 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
311 |
m_networkRoutes.clear (); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
312 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
313 |
for (MulticastRoutesI i = m_multicastRoutes.begin () ; i != m_multicastRoutes.end () ; i = m_multicastRoutes.erase (i)) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
314 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
315 |
delete (*i); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
316 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
317 |
m_multicastRoutes.clear (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
318 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
319 |
m_ipv6 = 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
320 |
Ipv6RoutingProtocol::DoDispose (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
321 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
322 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
323 |
Ptr<Ipv6MulticastRoute> Ipv6StaticRouting::LookupStatic (Ipv6Address origin, Ipv6Address group, uint32_t interface) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
324 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
325 |
NS_LOG_FUNCTION (this << origin << group << interface); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
326 |
Ptr<Ipv6MulticastRoute> mrtentry = 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
327 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
328 |
for (MulticastRoutesI i = m_multicastRoutes.begin () ; i != m_multicastRoutes.end () ; i++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
329 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
330 |
Ipv6MulticastRoutingTableEntry* route = *i; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
331 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
332 |
/* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
333 |
We've been passed an origin address, a multicast group address and an |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
334 |
interface index. We have to decide if the current route in the list is |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
335 |
a match. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
336 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
337 |
The first case is the restrictive case where the origin, group and index |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
338 |
matches. This picks up exact routes during forwarded and exact routes from |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
339 |
the local node (in which case the ifIndex is a wildcard). |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
340 |
*/ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
341 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
342 |
if (origin == route->GetOrigin () && group == route->GetGroup ()) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
343 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
344 |
/* skipping SSM case */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
345 |
NS_LOG_LOGIC ("Find source specific multicast route" << *i); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
346 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
347 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
348 |
if (group == route->GetGroup ()) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
349 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
350 |
if (interface == Ipv6::IF_ANY || interface == route->GetInputInterface ()) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
351 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
352 |
NS_LOG_LOGIC ("Found multicast route" << *i); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
353 |
mrtentry = Create<Ipv6MulticastRoute> (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
354 |
mrtentry->SetGroup (route->GetGroup ()); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
355 |
mrtentry->SetOrigin (route->GetOrigin ()); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
356 |
mrtentry->SetParent (route->GetInputInterface ()); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
357 |
for (uint32_t j = 0 ; j < route->GetNOutputInterfaces () ; j++) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
358 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
359 |
if (route->GetOutputInterface (j)) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
360 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
361 |
NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j)); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
362 |
mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv6MulticastRoute::MAX_TTL - 1); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
363 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
364 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
365 |
return mrtentry; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
366 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
367 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
368 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
369 |
return mrtentry; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
370 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
371 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
372 |
uint32_t Ipv6StaticRouting::GetNRoutes () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
373 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
374 |
return m_networkRoutes.size (); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
375 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
376 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
377 |
Ipv6RoutingTableEntry Ipv6StaticRouting::GetDefaultRoute () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
378 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
379 |
NS_LOG_FUNCTION_NOARGS (); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
380 |
Ipv6Address dst ("::"); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
381 |
uint32_t shortestMetric = 0xffffffff; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
382 |
Ipv6RoutingTableEntry* result = 0; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
383 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
384 |
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
385 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
386 |
Ipv6RoutingTableEntry* j = it->first; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
387 |
uint32_t metric = it->second; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
388 |
Ipv6Prefix mask = j->GetDestNetworkPrefix (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
389 |
uint16_t maskLen = mask.GetPrefixLength (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
390 |
Ipv6Address entry = j->GetDestNetwork (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
391 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
392 |
if (maskLen) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
393 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
394 |
continue; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
395 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
396 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
397 |
if (metric > shortestMetric) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
398 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
399 |
continue; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
400 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
401 |
shortestMetric = metric; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
402 |
result = j; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
403 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
404 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
405 |
if (result) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
406 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
407 |
return result; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
408 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
409 |
else |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
410 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
411 |
return Ipv6RoutingTableEntry (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
412 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
413 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
414 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
415 |
Ipv6RoutingTableEntry Ipv6StaticRouting::GetRoute (uint32_t index) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
416 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
417 |
NS_LOG_FUNCTION (this << index); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
418 |
uint32_t tmp = 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
419 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
420 |
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
421 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
422 |
if (tmp == index) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
423 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
424 |
return it->first; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
425 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
426 |
tmp++; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
427 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
428 |
NS_ASSERT (false); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
429 |
// quiet compiler. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
430 |
return 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
431 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
432 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
433 |
uint32_t Ipv6StaticRouting::GetMetric (uint32_t index) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
434 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
435 |
NS_LOG_FUNCTION_NOARGS (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
436 |
uint32_t tmp = 0; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
437 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
438 |
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
439 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
440 |
if (tmp == index) |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
441 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
442 |
return it->second; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
443 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
444 |
tmp++; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
445 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
446 |
NS_ASSERT (false); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
447 |
// quiet compiler. |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
448 |
return 0; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
449 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
450 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
451 |
void Ipv6StaticRouting::RemoveRoute (uint32_t index) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
452 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
453 |
NS_LOG_FUNCTION (this << index); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
454 |
uint32_t tmp = 0; |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
455 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
456 |
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
457 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
458 |
if (tmp == index) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
459 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
460 |
delete it->first; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
461 |
m_networkRoutes.erase (it); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
462 |
return; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
463 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
464 |
tmp++; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
465 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
466 |
NS_ASSERT (false); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
467 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
468 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
469 |
void Ipv6StaticRouting::RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex, Ipv6Address prefixToUse) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
470 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
471 |
NS_LOG_FUNCTION (this << network << prefix << ifIndex); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
472 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
473 |
for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
474 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
475 |
Ipv6RoutingTableEntry* rtentry = it->first; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
476 |
if (network == rtentry->GetDest () && rtentry->GetInterface () == ifIndex && |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
477 |
rtentry->GetPrefixToUse () == prefixToUse) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
478 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
479 |
delete it->first; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
480 |
m_networkRoutes.erase (it); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
481 |
return; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
482 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
483 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
484 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
485 |
|
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5796
diff
changeset
|
486 |
Ptr<Ipv6Route> Ipv6StaticRouting::RouteOutput (Ptr<Packet> p, const Ipv6Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
487 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
488 |
NS_LOG_FUNCTION (this << header << oif); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
489 |
Ipv6Address destination = header.GetDestinationAddress (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
490 |
Ptr<Ipv6Route> rtentry = 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
491 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
492 |
if (destination.IsMulticast ()) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
493 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
494 |
// Note: Multicast routes for outbound packets are stored in the |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
495 |
// normal unicast table. An implication of this is that it is not |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
496 |
// possible to source multicast datagrams on multiple interfaces. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
497 |
// This is a well-known property of sockets implementation on |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
498 |
// many Unix variants. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
499 |
// So, we just log it and fall through to LookupStatic () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
500 |
NS_LOG_LOGIC ("RouteOutput ()::Multicast destination"); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
501 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
502 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
503 |
rtentry = LookupStatic (destination, oif); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
504 |
if (rtentry) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
505 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
506 |
sockerr = Socket::ERROR_NOTERROR; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
507 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
508 |
else |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
509 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
510 |
sockerr = Socket::ERROR_NOROUTETOHOST; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
511 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
512 |
return rtentry; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
513 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
514 |
|
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
515 |
bool Ipv6StaticRouting::RouteInput (Ptr<const Packet> p, const Ipv6Header &header, Ptr<const NetDevice> idev, |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
516 |
UnicastForwardCallback ucb, MulticastForwardCallback mcb, |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
517 |
LocalDeliverCallback lcb, ErrorCallback ecb) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
518 |
{ |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
519 |
NS_LOG_FUNCTION (this << p << header << header.GetSourceAddress () << header.GetDestinationAddress () << idev); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
520 |
NS_ASSERT (m_ipv6 != 0); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
521 |
// Check if input device supports IP |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
522 |
NS_ASSERT (m_ipv6->GetInterfaceForDevice (idev) >= 0); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
523 |
uint32_t iif = m_ipv6->GetInterfaceForDevice (idev); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
524 |
Ipv6Address dst = header.GetDestinationAddress (); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
525 |
|
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
526 |
if (dst.IsMulticast ()) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
527 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
528 |
NS_LOG_LOGIC ("Multicast destination"); |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
529 |
Ptr<Ipv6MulticastRoute> mrtentry = LookupStatic (header.GetSourceAddress (), |
5796 | 530 |
header.GetDestinationAddress (), m_ipv6->GetInterfaceForDevice (idev)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
531 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
532 |
if (mrtentry) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
533 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
534 |
NS_LOG_LOGIC ("Multicast route found"); |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
535 |
mcb (mrtentry, p, header); // multicast forwarding callback |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
536 |
return true; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
537 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
538 |
else |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
539 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
540 |
NS_LOG_LOGIC ("Multicast route not found"); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
541 |
return false; // Let other routing protocols try to handle this |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
542 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
543 |
} |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
544 |
|
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
545 |
// TODO: Configurable option to enable RFC 1222 Strong End System Model |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
546 |
// Right now, we will be permissive and allow a source to send us |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
547 |
// a packet to one of our other interface addresses; that is, the |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
548 |
// destination unicast address does not match one of the iif addresses, |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
549 |
// but we check our other interfaces. This could be an option |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
550 |
// (to remove the outer loop immediately below and just check iif). |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
551 |
for (uint32_t j = 0; j < m_ipv6->GetNInterfaces (); j++) |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
552 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
553 |
for (uint32_t i = 0; i < m_ipv6->GetNAddresses (j); i++) |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
554 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
555 |
Ipv6InterfaceAddress iaddr = m_ipv6->GetAddress (j, i); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
556 |
Ipv6Address addr = iaddr.GetAddress (); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
557 |
if (addr.IsEqual (header.GetDestinationAddress ())) |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
558 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
559 |
if (j == iif) |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
560 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
561 |
NS_LOG_LOGIC ("For me (destination " << addr << " match)"); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
562 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
563 |
else |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
564 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
565 |
NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestinationAddress ()); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
566 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
567 |
lcb (p, header, iif); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
568 |
return true; |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
569 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
570 |
NS_LOG_LOGIC ("Address "<< addr << " not a match"); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
571 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
572 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
573 |
// Check if input device supports IP forwarding |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
574 |
if (m_ipv6->IsForwarding (iif) == false) |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
575 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
576 |
NS_LOG_LOGIC ("Forwarding disabled for this interface"); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
577 |
ecb (p, header, Socket::ERROR_NOROUTETOHOST); |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
578 |
return false; |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
579 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
580 |
// Next, try to find a route |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
581 |
NS_LOG_LOGIC ("Unicast destination"); |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
582 |
Ptr<Ipv6Route> rtentry = LookupStatic (header.GetDestinationAddress ()); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
583 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
584 |
if (rtentry != 0) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
585 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
586 |
NS_LOG_LOGIC ("Found unicast destination- calling unicast callback"); |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
587 |
ucb (rtentry, p, header); // unicast forwarding callback |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
588 |
return true; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
589 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
590 |
else |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
591 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
592 |
NS_LOG_LOGIC ("Did not find unicast destination- returning false"); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
593 |
return false; // Let other routing protocols try to handle this |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
594 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
595 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
596 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
597 |
void Ipv6StaticRouting::NotifyInterfaceUp (uint32_t i) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
598 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
599 |
for (uint32_t j = 0 ; j < m_ipv6->GetNAddresses (i) ; j++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
600 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
601 |
if (m_ipv6->GetAddress (i, j).GetAddress () != Ipv6Address () && |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
602 |
m_ipv6->GetAddress (i, j).GetPrefix () != Ipv6Prefix ()) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
603 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
604 |
if (m_ipv6->GetAddress (i, j).GetPrefix () == Ipv6Prefix (128)) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
605 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
606 |
/* host route */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
607 |
AddHostRouteTo (m_ipv6->GetAddress (i, j).GetAddress (), i); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
608 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
609 |
else |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
610 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
611 |
AddNetworkRouteTo (m_ipv6->GetAddress (i, j).GetAddress ().CombinePrefix (m_ipv6->GetAddress (i, j).GetPrefix ()), |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
612 |
m_ipv6->GetAddress (i, j).GetPrefix (), i); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
613 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
614 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
615 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
616 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
617 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
618 |
void Ipv6StaticRouting::NotifyInterfaceDown (uint32_t i) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
619 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
620 |
NS_LOG_FUNCTION (this << i); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
621 |
uint32_t j = 0; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
622 |
uint32_t max = GetNRoutes (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
623 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
624 |
/* remove all static routes that are going through this interface */ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
625 |
while (j < max) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
626 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
627 |
Ipv6RoutingTableEntry route = GetRoute (j); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
628 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
629 |
if (route.GetInterface () == i) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
630 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
631 |
RemoveRoute (j); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
632 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
633 |
else |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
634 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
635 |
j++; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
636 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
637 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
638 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
639 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
640 |
void Ipv6StaticRouting::NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
641 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
642 |
if (!m_ipv6->IsUp (interface)) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
643 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
644 |
return; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
645 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
646 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
647 |
Ipv6Address networkAddress = address.GetAddress ().CombinePrefix (address.GetPrefix ()); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
648 |
Ipv6Prefix networkMask = address.GetPrefix (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
649 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
650 |
if (address.GetAddress () != Ipv6Address () && address.GetPrefix () != Ipv6Prefix ()) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
651 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
652 |
AddNetworkRouteTo (networkAddress, networkMask, interface); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
653 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
654 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
655 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
656 |
void Ipv6StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
657 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
658 |
if (!m_ipv6->IsUp (interface)) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
659 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
660 |
return; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
661 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
662 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
663 |
Ipv6Address networkAddress = address.GetAddress ().CombinePrefix (address.GetPrefix ()); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
664 |
Ipv6Prefix networkMask = address.GetPrefix (); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
665 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
666 |
// Remove all static routes that are going through this interface |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
667 |
// which reference this network |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
668 |
for (uint32_t j = 0 ; j < GetNRoutes () ; j++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
669 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
670 |
Ipv6RoutingTableEntry route = GetRoute (j); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
671 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
672 |
if (route.GetInterface () == interface && |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
673 |
route.IsNetwork () && |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
674 |
route.GetDestNetwork () == networkAddress && |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
675 |
route.GetDestNetworkPrefix () == networkMask) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
676 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
677 |
RemoveRoute (j); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
678 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
679 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
680 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
681 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
682 |
void Ipv6StaticRouting::NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
683 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
684 |
NS_LOG_INFO (this << dst << mask << nextHop << interface << prefixToUse); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
685 |
if (dst != Ipv6Address::GetZero ()) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
686 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
687 |
AddNetworkRouteTo (dst, mask, nextHop, interface); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
688 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
689 |
else /* default route */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
690 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
691 |
/* this case is mainly used by configuring default route following RA processing, |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
692 |
* in case of multipe prefix in RA, the first will configured default route |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
693 |
*/ |
4766
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
694 |
|
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
695 |
/* for the moment, all default route has the same metric |
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
696 |
* so according to the longest prefix algorithm, |
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
697 |
* the default route choosen will be the last added |
0a74df84902f
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4761
diff
changeset
|
698 |
*/ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
699 |
SetDefaultRoute (nextHop, interface, prefixToUse); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
700 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
701 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
702 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
703 |
void Ipv6StaticRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
704 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
705 |
NS_LOG_FUNCTION (this << dst << mask << nextHop << interface); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
706 |
if (dst != Ipv6Address::GetZero ()) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
707 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
708 |
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
709 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
710 |
Ipv6RoutingTableEntry* rtentry = j->first; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
711 |
Ipv6Prefix prefix = rtentry->GetDestNetworkPrefix (); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
712 |
Ipv6Address entry = rtentry->GetDestNetwork (); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
713 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
714 |
if (dst == entry && prefix == mask && rtentry->GetInterface () == interface) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
715 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
716 |
delete j->first; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
717 |
m_networkRoutes.erase (j); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
718 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
719 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
720 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
721 |
else |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
722 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
723 |
/* default route case */ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
724 |
RemoveRoute (dst, mask, interface, prefixToUse); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
725 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
726 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
727 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
728 |
Ipv6Address Ipv6StaticRouting::SourceAddressSelection (uint32_t interface, Ipv6Address dest) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
729 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
730 |
NS_LOG_FUNCTION (this << interface << dest); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
731 |
Ipv6Address ret; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
732 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
733 |
/* first address of an IPv6 interface is link-local ones */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
734 |
ret = m_ipv6->GetAddress (interface, 0).GetAddress (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
735 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
736 |
if (dest == Ipv6Address::GetAllNodesMulticast () || dest == Ipv6Address::GetAllRoutersMulticast () || dest == Ipv6Address::GetAllHostsMulticast ()) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
737 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
738 |
return ret; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
739 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
740 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
741 |
/* useally IPv6 interfaces have one link-local address and one global address */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
742 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
743 |
for (uint32_t i = 1 ; i < m_ipv6->GetNAddresses (interface) ; i++) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
744 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
745 |
Ipv6InterfaceAddress test = m_ipv6->GetAddress (interface, i); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
746 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
747 |
if (test.GetAddress ().CombinePrefix (test.GetPrefix ()) == dest.CombinePrefix (test.GetPrefix ())) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
748 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
749 |
return test.GetAddress (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
750 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
751 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
752 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
753 |
return ret; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
754 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
755 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
756 |
} /* namespace ns3 */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
757 |