author | Tommaso Pecorella <tommaso.pecorella@unifi.it> |
Wed, 07 Aug 2013 23:18:48 +0200 | |
changeset 10131 | 0dc090fc749d |
parent 9880 | 14589334beb9 |
child 10158 | 971f362648c3 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7252
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4731
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 |
|
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
21 |
#include <iomanip> |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
22 |
#include "ns3/log.h" |
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
23 |
#include "ns3/node.h" |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
24 |
#include "ns3/packet.h" |
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
25 |
#include "ns3/simulator.h" |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
26 |
#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
|
27 |
#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
|
28 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
29 |
#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
|
30 |
#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
|
31 |
|
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
32 |
namespace ns3 { |
4731
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 |
NS_LOG_COMPONENT_DEFINE ("Ipv6StaticRouting"); |
6393
f7e1f9dfa08d
ensure objects are regsitered
Josh Pelkey <jpelkey@gatech.edu>
parents:
5891
diff
changeset
|
35 |
NS_OBJECT_ENSURE_REGISTERED (Ipv6StaticRouting); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
36 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
37 |
TypeId Ipv6StaticRouting::GetTypeId () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
38 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
39 |
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
|
40 |
.SetParent<Ipv6RoutingProtocol> () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
41 |
.AddConstructor<Ipv6StaticRouting> () |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
42 |
; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
43 |
return tid; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
44 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
45 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
46 |
Ipv6StaticRouting::Ipv6StaticRouting () |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
47 |
: 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
|
48 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
49 |
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
|
50 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
51 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
52 |
Ipv6StaticRouting::~Ipv6StaticRouting () |
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 |
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
|
55 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
56 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
57 |
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
|
58 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
59 |
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
|
60 |
NS_ASSERT (m_ipv6 == 0 && ipv6 != 0); |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
61 |
uint32_t i = 0; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
62 |
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
|
63 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
64 |
for (i = 0; i < m_ipv6->GetNInterfaces (); i++) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
65 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
66 |
if (m_ipv6->IsUp (i)) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
67 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
68 |
NotifyInterfaceUp (i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
69 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
70 |
else |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
71 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
72 |
NotifyInterfaceDown (i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
73 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
74 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
75 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
76 |
|
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
77 |
// Formatted like output of "route -n" command |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
78 |
void |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
79 |
Ipv6StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
80 |
{ |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
81 |
NS_LOG_FUNCTION (this); |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
82 |
std::ostream* os = stream->GetStream (); |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
83 |
if (GetNRoutes () > 0) |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
84 |
{ |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
85 |
*os << "Node: " << m_ipv6->GetObject<Node> ()->GetId () |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
86 |
<< " Time: " << Simulator::Now ().GetSeconds () << "s " |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
87 |
<< "Ipv6StaticRouting table" << std::endl; |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
88 |
|
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
89 |
for (uint32_t j = 0; j < GetNRoutes (); j++) |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
90 |
{ |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
91 |
Ipv6RoutingTableEntry route = GetRoute (j); |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
92 |
*os << route << std::endl; |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
93 |
} |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
94 |
} |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
95 |
} |
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
96 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
97 |
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
|
98 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
99 |
NS_LOG_FUNCTION (this << dst << nextHop << interface << prefixToUse << metric); |
10131
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9880
diff
changeset
|
100 |
if (nextHop.IsLinkLocal()) |
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9880
diff
changeset
|
101 |
{ |
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9880
diff
changeset
|
102 |
NS_LOG_WARN ("Ipv6StaticRouting::AddHostRouteTo - Next hop should be link-local"); |
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9880
diff
changeset
|
103 |
} |
9848
800877664177
Bug 1688 - Routers should advertise themselves from the link-local address
Guowang Shi <shiguowang2007@gmail.com>
parents:
9836
diff
changeset
|
104 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
105 |
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
|
106 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
107 |
|
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
108 |
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
|
109 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
110 |
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
|
111 |
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
|
112 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
113 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
114 |
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
|
115 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
116 |
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
|
117 |
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
|
118 |
*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
|
119 |
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
|
120 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
121 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
122 |
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
|
123 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
124 |
NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << prefixToUse << metric); |
10131
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9880
diff
changeset
|
125 |
if (nextHop.IsLinkLocal()) |
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9880
diff
changeset
|
126 |
{ |
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9880
diff
changeset
|
127 |
NS_LOG_WARN ("Ipv6StaticRouting::AddNetworkRouteTo - Next hop should be link-local"); |
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9880
diff
changeset
|
128 |
} |
9848
800877664177
Bug 1688 - Routers should advertise themselves from the link-local address
Guowang Shi <shiguowang2007@gmail.com>
parents:
9836
diff
changeset
|
129 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
130 |
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
|
131 |
*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
|
132 |
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
|
133 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
134 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
135 |
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
|
136 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
137 |
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
|
138 |
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
|
139 |
*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
|
140 |
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
|
141 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
142 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
143 |
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
|
144 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
145 |
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
|
146 |
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
|
147 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
148 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
149 |
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
|
150 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
151 |
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
|
152 |
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
|
153 |
*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
|
154 |
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
|
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 |
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
|
158 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
159 |
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
|
160 |
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
|
161 |
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
|
162 |
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
|
163 |
*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
|
164 |
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
|
165 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
166 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
167 |
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
|
168 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
169 |
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
|
170 |
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
|
171 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
172 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
173 |
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
|
174 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
175 |
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
|
176 |
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
|
177 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
178 |
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
|
179 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
180 |
uint32_t tmp = 0; |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
181 |
for (MulticastRoutesCI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i++) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
182 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
183 |
if (tmp == index) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
184 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
185 |
return *i; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
186 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
187 |
tmp++; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
188 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
189 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
190 |
return 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
191 |
} |
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 |
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
|
194 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
195 |
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
|
196 |
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
|
197 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
198 |
Ipv6MulticastRoutingTableEntry *route = *i; |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
199 |
if (origin == route->GetOrigin () |
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
200 |
&& group == route->GetGroup () |
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
201 |
&& inputInterface == route->GetInputInterface ()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
202 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
203 |
delete *i; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
204 |
m_multicastRoutes.erase (i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
205 |
return true; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
206 |
} |
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 false; |
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 |
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
|
212 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
213 |
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
|
214 |
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
|
215 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
216 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i++) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
217 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
218 |
if (tmp == index) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
219 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
220 |
delete *i; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
221 |
m_multicastRoutes.erase (i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
222 |
return; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
223 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
224 |
tmp++; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
225 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
226 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
227 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
228 |
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
|
229 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
230 |
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
|
231 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
232 |
/* in the network table */ |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
233 |
for (NetworkRoutesI j = m_networkRoutes.begin (); j != m_networkRoutes.end (); j++) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
234 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
235 |
Ipv6RoutingTableEntry* rtentry = j->first; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
236 |
Ipv6Prefix prefix = rtentry->GetDestNetworkPrefix (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
237 |
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
|
238 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
239 |
if (prefix.IsMatch (network, entry) && rtentry->GetInterface () == interfaceIndex) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
240 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
241 |
return true; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
242 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
243 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
244 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
245 |
/* 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
|
246 |
return false; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
247 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
248 |
|
5863
a4b21e0ee84c
Bug 759: Ipv6 uses wrong outgoing interface.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5856
diff
changeset
|
249 |
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
|
250 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
251 |
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
|
252 |
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
|
253 |
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
|
254 |
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
|
255 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
256 |
/* when sending on link-local multicast, there have to be interface specified */ |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
257 |
if (dst == Ipv6Address::GetAllNodesMulticast () || dst.IsSolicitedMulticast () |
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
258 |
|| dst == Ipv6Address::GetAllRoutersMulticast () || dst == Ipv6Address::GetAllHostsMulticast ()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
259 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
260 |
NS_ASSERT_MSG (interface, "Try to send on link-local multicast address, and no interface index is given!"); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
261 |
rtentry = Create<Ipv6Route> (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
262 |
rtentry->SetSource (SourceAddressSelection (m_ipv6->GetInterfaceForDevice (interface), dst)); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
263 |
rtentry->SetDestination (dst); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
264 |
rtentry->SetGateway (Ipv6Address::GetZero ()); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
265 |
rtentry->SetOutputDevice (interface); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
266 |
return rtentry; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
267 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
268 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
269 |
for (NetworkRoutesI it = m_networkRoutes.begin (); it != m_networkRoutes.end (); it++) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
270 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
271 |
Ipv6RoutingTableEntry* j = it->first; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
272 |
uint32_t metric = it->second; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
273 |
Ipv6Prefix mask = j->GetDestNetworkPrefix (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
274 |
uint16_t maskLen = mask.GetPrefixLength (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
275 |
Ipv6Address entry = j->GetDestNetwork (); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
276 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
277 |
NS_LOG_LOGIC ("Searching for route to " << dst << ", mask length " << maskLen << ", metric " << metric); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
278 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
279 |
if (mask.IsMatch (dst, entry)) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
280 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
281 |
NS_LOG_LOGIC ("Found global network route " << j << ", mask length " << maskLen << ", metric " << metric); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
282 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
283 |
/* if interface is given, check the route will output on this interface */ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
284 |
if (!interface || interface == m_ipv6->GetNetDevice (j->GetInterface ())) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
285 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
286 |
if (maskLen < longestMask) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
287 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
288 |
NS_LOG_LOGIC ("Previous match longer, skipping"); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
289 |
continue; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
290 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
291 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
292 |
if (maskLen > longestMask) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
293 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
294 |
shortestMetric = 0xffffffff; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
295 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
296 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
297 |
longestMask = maskLen; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
298 |
if (metric > shortestMetric) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
299 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
300 |
NS_LOG_LOGIC ("Equal mask length, but previous metric shorter, skipping"); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
301 |
continue; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
302 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
303 |
|
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
304 |
shortestMetric = metric; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
305 |
Ipv6RoutingTableEntry* route = j; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
306 |
uint32_t interfaceIdx = route->GetInterface (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
307 |
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
|
308 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
309 |
if (route->GetGateway ().IsAny ()) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
310 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
311 |
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ())); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
312 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
313 |
else if (route->GetDest ().IsAny ()) /* default route */ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
314 |
{ |
9836
d675eb43a62f
Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7791
diff
changeset
|
315 |
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetPrefixToUse ().IsAny () ? dst : route->GetPrefixToUse ())); |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
316 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
317 |
else |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
318 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
319 |
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetGateway ())); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
320 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
321 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
322 |
rtentry->SetDestination (route->GetDest ()); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
323 |
rtentry->SetGateway (route->GetGateway ()); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
324 |
rtentry->SetOutputDevice (m_ipv6->GetNetDevice (interfaceIdx)); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
325 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
326 |
} |
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 |
|
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
329 |
if (rtentry) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
330 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
331 |
NS_LOG_LOGIC ("Matching route via " << rtentry->GetDestination () << " (throught " << rtentry->GetGateway () << ") at the end"); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
332 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
333 |
return rtentry; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
334 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
335 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
336 |
void Ipv6StaticRouting::DoDispose () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
337 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
338 |
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
|
339 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
340 |
for (NetworkRoutesI j = m_networkRoutes.begin (); j != m_networkRoutes.end (); j = m_networkRoutes.erase (j)) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
341 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
342 |
delete j->first; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
343 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
344 |
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
|
345 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
346 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i = m_multicastRoutes.erase (i)) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
347 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
348 |
delete (*i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
349 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
350 |
m_multicastRoutes.clear (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
351 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
352 |
m_ipv6 = 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
353 |
Ipv6RoutingProtocol::DoDispose (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
354 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
355 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
356 |
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
|
357 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
358 |
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
|
359 |
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
|
360 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
361 |
for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i++) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
362 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
363 |
Ipv6MulticastRoutingTableEntry* route = *i; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
364 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
365 |
/* |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
366 |
We've been passed an origin address, a multicast group address and an |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
367 |
interface index. We have to decide if the current route in the list is |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
368 |
a match. |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
369 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
370 |
The first case is the restrictive case where the origin, group and index |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
371 |
matches. This picks up exact routes during forwarded and exact routes from |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
372 |
the local node (in which case the ifIndex is a wildcard). |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
373 |
*/ |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
374 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
375 |
if (origin == route->GetOrigin () && group == route->GetGroup ()) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
376 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
377 |
/* skipping SSM case */ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
378 |
NS_LOG_LOGIC ("Find source specific multicast route" << *i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
379 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
380 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
381 |
if (group == route->GetGroup ()) |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
382 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
383 |
if (interface == Ipv6::IF_ANY || interface == route->GetInputInterface ()) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
384 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
385 |
NS_LOG_LOGIC ("Found multicast route" << *i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
386 |
mrtentry = Create<Ipv6MulticastRoute> (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
387 |
mrtentry->SetGroup (route->GetGroup ()); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
388 |
mrtentry->SetOrigin (route->GetOrigin ()); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
389 |
mrtentry->SetParent (route->GetInputInterface ()); |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
390 |
for (uint32_t j = 0; j < route->GetNOutputInterfaces (); j++) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
391 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
392 |
if (route->GetOutputInterface (j)) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
393 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
394 |
NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j)); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
395 |
mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv6MulticastRoute::MAX_TTL - 1); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
396 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
397 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
398 |
return mrtentry; |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
399 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
400 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
401 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
402 |
return mrtentry; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
403 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
404 |
|
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
405 |
uint32_t Ipv6StaticRouting::GetNRoutes () const |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
406 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
407 |
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
|
408 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
409 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
410 |
Ipv6RoutingTableEntry Ipv6StaticRouting::GetDefaultRoute () |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
411 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
412 |
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
|
413 |
Ipv6Address dst ("::"); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
414 |
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
|
415 |
Ipv6RoutingTableEntry* result = 0; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
416 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
417 |
for (NetworkRoutesI it = m_networkRoutes.begin (); it != m_networkRoutes.end (); it++) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
418 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
419 |
Ipv6RoutingTableEntry* j = it->first; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
420 |
uint32_t metric = it->second; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
421 |
Ipv6Prefix mask = j->GetDestNetworkPrefix (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
422 |
uint16_t maskLen = mask.GetPrefixLength (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
423 |
Ipv6Address entry = j->GetDestNetwork (); |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
424 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
425 |
if (maskLen) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
426 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
427 |
continue; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
428 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
429 |
|
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
430 |
if (metric > shortestMetric) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
431 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
432 |
continue; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
433 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
434 |
shortestMetric = metric; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
435 |
result = j; |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
436 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
437 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
438 |
if (result) |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
439 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
440 |
return result; |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
441 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
442 |
else |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
443 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
444 |
return Ipv6RoutingTableEntry (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
445 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
446 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
447 |
|
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
448 |
Ipv6RoutingTableEntry Ipv6StaticRouting::GetRoute (uint32_t index) const |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
449 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
450 |
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
|
451 |
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
|
452 |
|
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
453 |
for (NetworkRoutesCI 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
|
454 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
455 |
if (tmp == index) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
456 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
457 |
return it->first; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
458 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
459 |
tmp++; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
460 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
461 |
NS_ASSERT (false); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
462 |
// quiet compiler. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
463 |
return 0; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
464 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
465 |
|
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
466 |
uint32_t Ipv6StaticRouting::GetMetric (uint32_t index) const |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
467 |
{ |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
468 |
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
|
469 |
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
|
470 |
|
7791
21c3495394b4
Enhancement 1393 - IPv6 Routing Helper RT Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7790
diff
changeset
|
471 |
for (NetworkRoutesCI it = m_networkRoutes.begin (); it != m_networkRoutes.end (); it++) |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
472 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
473 |
if (tmp == index) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
474 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
475 |
return it->second; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
476 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
477 |
tmp++; |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
478 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
479 |
NS_ASSERT (false); |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
480 |
// quiet compiler. |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
481 |
return 0; |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
482 |
} |
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
483 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
484 |
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
|
485 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
486 |
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
|
487 |
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
|
488 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
489 |
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
|
490 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
491 |
if (tmp == index) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
492 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
493 |
delete it->first; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
494 |
m_networkRoutes.erase (it); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
495 |
return; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
496 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
497 |
tmp++; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
498 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
499 |
NS_ASSERT (false); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
500 |
} |
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 |
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
|
503 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
504 |
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
|
505 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
506 |
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
|
507 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
508 |
Ipv6RoutingTableEntry* rtentry = it->first; |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
509 |
if (network == rtentry->GetDest () && rtentry->GetInterface () == ifIndex |
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
510 |
&& rtentry->GetPrefixToUse () == prefixToUse) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
511 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
512 |
delete it->first; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
513 |
m_networkRoutes.erase (it); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
514 |
return; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
515 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
516 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
517 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
518 |
|
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5796
diff
changeset
|
519 |
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
|
520 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
521 |
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
|
522 |
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
|
523 |
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
|
524 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
525 |
if (destination.IsMulticast ()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
526 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
527 |
// Note: Multicast routes for outbound packets are stored in the |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
528 |
// normal unicast table. An implication of this is that it is not |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
529 |
// possible to source multicast datagrams on multiple interfaces. |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
530 |
// This is a well-known property of sockets implementation on |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
531 |
// many Unix variants. |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
532 |
// So, we just log it and fall through to LookupStatic () |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
533 |
NS_LOG_LOGIC ("RouteOutput ()::Multicast destination"); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
534 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
535 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
536 |
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
|
537 |
if (rtentry) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
538 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
539 |
sockerr = Socket::ERROR_NOTERROR; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
540 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
541 |
else |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
542 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
543 |
sockerr = Socket::ERROR_NOROUTETOHOST; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
544 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
545 |
return rtentry; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
546 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
547 |
|
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
548 |
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
|
549 |
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
|
550 |
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
|
551 |
{ |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
552 |
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
|
553 |
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
|
554 |
// 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
|
555 |
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
|
556 |
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
|
557 |
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
|
558 |
|
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
559 |
if (dst.IsMulticast ()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
560 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
561 |
NS_LOG_LOGIC ("Multicast destination"); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
562 |
Ptr<Ipv6MulticastRoute> mrtentry = LookupStatic (header.GetSourceAddress (), |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
563 |
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
|
564 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
565 |
if (mrtentry) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
566 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
567 |
NS_LOG_LOGIC ("Multicast route found"); |
9849
b3ec74c99612
Bug 1697 - ICMPv6 Redirect trigger contains multiple bugs
Guowang Shi <shiguowang2007@gmail.com>
parents:
9848
diff
changeset
|
568 |
mcb (idev, mrtentry, p, header); // multicast forwarding callback |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
569 |
return true; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
570 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
571 |
else |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
572 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
573 |
NS_LOG_LOGIC ("Multicast route not found"); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
574 |
return false; // Let other routing protocols try to handle this |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
575 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
576 |
} |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
577 |
|
9870
6543f3876ff5
[Doxygen] use \todo
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
7791
diff
changeset
|
578 |
/// \todo Configurable option to enable RFC 1222 Strong End System Model |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
579 |
// Right now, we will be permissive and allow a source to send us |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
580 |
// a packet to one of our other interface addresses; that is, the |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
581 |
// destination unicast address does not match one of the iif addresses, |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
582 |
// but we check our other interfaces. This could be an option |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
583 |
// (to remove the outer loop immediately below and just check iif). |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
584 |
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
|
585 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
586 |
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
|
587 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
588 |
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
|
589 |
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
|
590 |
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
|
591 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
592 |
if (j == iif) |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
593 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
594 |
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
|
595 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
596 |
else |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
597 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
598 |
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
|
599 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
600 |
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
|
601 |
return true; |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
602 |
} |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
603 |
NS_LOG_LOGIC ("Address " << addr << " not a match"); |
5352
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
604 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
605 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
606 |
// 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
|
607 |
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
|
608 |
{ |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
609 |
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
|
610 |
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
|
611 |
return false; |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
612 |
} |
54b51a1105d6
allow static and global routing to deliver local packets (bug 651)
Tom Henderson <tomh@tomh.org>
parents:
4766
diff
changeset
|
613 |
// 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
|
614 |
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
|
615 |
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
|
616 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
617 |
if (rtentry != 0) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
618 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
619 |
NS_LOG_LOGIC ("Found unicast destination- calling unicast callback"); |
9849
b3ec74c99612
Bug 1697 - ICMPv6 Redirect trigger contains multiple bugs
Guowang Shi <shiguowang2007@gmail.com>
parents:
9848
diff
changeset
|
620 |
ucb (idev, rtentry, p, header); // unicast forwarding callback |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
621 |
return true; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
622 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
623 |
else |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
624 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
625 |
NS_LOG_LOGIC ("Did not find unicast destination- returning false"); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
626 |
return false; // Let other routing protocols try to handle this |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
627 |
} |
4731
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 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
630 |
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
|
631 |
{ |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
632 |
for (uint32_t j = 0; j < m_ipv6->GetNAddresses (i); j++) |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
633 |
{ |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
634 |
if (m_ipv6->GetAddress (i, j).GetAddress () != Ipv6Address () |
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
635 |
&& m_ipv6->GetAddress (i, j).GetPrefix () != Ipv6Prefix ()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
636 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
637 |
if (m_ipv6->GetAddress (i, j).GetPrefix () == Ipv6Prefix (128)) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
638 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
639 |
/* host route */ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
640 |
AddHostRouteTo (m_ipv6->GetAddress (i, j).GetAddress (), i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
641 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
642 |
else |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
643 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
644 |
AddNetworkRouteTo (m_ipv6->GetAddress (i, j).GetAddress ().CombinePrefix (m_ipv6->GetAddress (i, j).GetPrefix ()), |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
645 |
m_ipv6->GetAddress (i, j).GetPrefix (), i); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
646 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
647 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
648 |
} |
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 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
651 |
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
|
652 |
{ |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
653 |
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
|
654 |
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
|
655 |
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
|
656 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
657 |
/* 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
|
658 |
while (j < max) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
659 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
660 |
Ipv6RoutingTableEntry route = GetRoute (j); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
661 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
662 |
if (route.GetInterface () == i) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
663 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
664 |
RemoveRoute (j); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
665 |
} |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
666 |
else |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
667 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
668 |
j++; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
669 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
670 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
671 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
672 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
673 |
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
|
674 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
675 |
if (!m_ipv6->IsUp (interface)) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
676 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
677 |
return; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
678 |
} |
4731
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 |
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
|
681 |
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
|
682 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
683 |
if (address.GetAddress () != Ipv6Address () && address.GetPrefix () != Ipv6Prefix ()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
684 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
685 |
AddNetworkRouteTo (networkAddress, networkMask, interface); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
686 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
687 |
} |
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 |
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
|
690 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
691 |
if (!m_ipv6->IsUp (interface)) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
692 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
693 |
return; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
694 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
695 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
696 |
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
|
697 |
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
|
698 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
699 |
// 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
|
700 |
// which reference this network |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
701 |
for (uint32_t j = 0; j < GetNRoutes (); j++) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
702 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
703 |
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
|
704 |
|
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
705 |
if (route.GetInterface () == interface |
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
706 |
&& route.IsNetwork () |
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
707 |
&& route.GetDestNetwork () == networkAddress |
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
708 |
&& route.GetDestNetworkPrefix () == networkMask) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
709 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
710 |
RemoveRoute (j); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
711 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
712 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
713 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
714 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
715 |
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
|
716 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
717 |
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
|
718 |
if (dst != Ipv6Address::GetZero ()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
719 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
720 |
AddNetworkRouteTo (dst, mask, nextHop, interface); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
721 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
722 |
else /* default route */ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
723 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
724 |
/* this case is mainly used by configuring default route following RA processing, |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
725 |
* in case of multipe prefix in RA, the first will configured default route |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
726 |
*/ |
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
|
727 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
728 |
/* for the moment, all default route has the same metric |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
729 |
* so according to the longest prefix algorithm, |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
730 |
* the default route choosen will be the last added |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
731 |
*/ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
732 |
SetDefaultRoute (nextHop, interface, prefixToUse); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
733 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
734 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
735 |
|
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
736 |
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
|
737 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
738 |
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
|
739 |
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
|
740 |
{ |
9879
407d9c42419b
[Coverity] "erase" invalidates iterator
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9836
diff
changeset
|
741 |
for (NetworkRoutesI j = m_networkRoutes.begin (); j != m_networkRoutes.end ();) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
742 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
743 |
Ipv6RoutingTableEntry* rtentry = j->first; |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
744 |
Ipv6Prefix prefix = rtentry->GetDestNetworkPrefix (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
745 |
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
|
746 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
747 |
if (dst == entry && prefix == mask && rtentry->GetInterface () == interface) |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
748 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
749 |
delete j->first; |
9879
407d9c42419b
[Coverity] "erase" invalidates iterator
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9836
diff
changeset
|
750 |
j = m_networkRoutes.erase (j); |
407d9c42419b
[Coverity] "erase" invalidates iterator
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9836
diff
changeset
|
751 |
} |
407d9c42419b
[Coverity] "erase" invalidates iterator
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9836
diff
changeset
|
752 |
else |
407d9c42419b
[Coverity] "erase" invalidates iterator
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9836
diff
changeset
|
753 |
{ |
407d9c42419b
[Coverity] "erase" invalidates iterator
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9836
diff
changeset
|
754 |
++j; |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
755 |
} |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
756 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
757 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
758 |
else |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
759 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
760 |
/* default route case */ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
761 |
RemoveRoute (dst, mask, interface, prefixToUse); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
762 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
763 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
764 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
765 |
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
|
766 |
{ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
767 |
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
|
768 |
Ipv6Address ret; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
769 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
770 |
/* 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
|
771 |
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
|
772 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
773 |
if (dest == Ipv6Address::GetAllNodesMulticast () || dest == Ipv6Address::GetAllRoutersMulticast () || dest == Ipv6Address::GetAllHostsMulticast ()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
774 |
{ |
7790
47d6d575412c
Bug 1362 - ICMPv6 does not forward ICMPs to upper layers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7385
diff
changeset
|
775 |
return ret; |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
776 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
777 |
|
9836
d675eb43a62f
Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7791
diff
changeset
|
778 |
/* usually IPv6 interfaces have one link-local address and one global address */ |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
779 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
780 |
for (uint32_t i = 1; i < m_ipv6->GetNAddresses (interface); i++) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
781 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
782 |
Ipv6InterfaceAddress test = m_ipv6->GetAddress (interface, i); |
9836
d675eb43a62f
Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7791
diff
changeset
|
783 |
Ipv6InterfaceAddress dst(dest); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
784 |
|
9836
d675eb43a62f
Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7791
diff
changeset
|
785 |
if (test.GetScope() == dst.GetScope()) |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
786 |
{ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
787 |
return test.GetAddress (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5863
diff
changeset
|
788 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
789 |
} |
4761
8c0b3a413f4b
Add metric and longest prefix match support for IPv6.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4731
diff
changeset
|
790 |
|
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
791 |
return ret; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
792 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
793 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
794 |
} /* namespace ns3 */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
795 |