|
251 |
NS_LOG_DEBUG ("Starting OLSR on node " << m_mainAddress); |
251 |
NS_LOG_DEBUG ("Starting OLSR on node " << m_mainAddress); |
252 |
|
252 |
|
253 |
Ipv4Address loopback ("127.0.0.1"); |
253 |
Ipv4Address loopback ("127.0.0.1"); |
|
|
254 |
|
255 |
bool canRunOlsr = false; |
254 |
for (uint32_t i = 0; i < m_ipv4->GetNInterfaces (); i++) |
256 |
for (uint32_t i = 0; i < m_ipv4->GetNInterfaces (); i++) |
255 |
{ |
257 |
{ |
256 |
Ipv4Address addr = m_ipv4->GetAddress (i, 0).GetLocal (); |
258 |
Ipv4Address addr = m_ipv4->GetAddress (i, 0).GetLocal (); |
|
269 |
NS_ASSERT (GetMainAddress (addr) == m_mainAddress); |
271 |
NS_ASSERT (GetMainAddress (addr) == m_mainAddress); |
270 |
} |
272 |
} |
271 |
|
273 |
|
|
|
274 |
if(m_interfaceExclusions.find (i) != m_interfaceExclusions.end ()) |
275 |
continue; |
276 |
|
272 |
// Create a socket to listen only on this interface |
277 |
// Create a socket to listen only on this interface |
273 |
Ptr<Socket> socket = Socket::CreateSocket (GetObject<Node> (), |
278 |
Ptr<Socket> socket = Socket::CreateSocket (GetObject<Node> (), |
274 |
UdpSocketFactory::GetTypeId()); |
279 |
UdpSocketFactory::GetTypeId()); |
|
279 |
} |
284 |
} |
280 |
socket->Connect (InetSocketAddress (Ipv4Address (0xffffffff), OLSR_PORT_NUMBER)); |
285 |
socket->Connect (InetSocketAddress (Ipv4Address (0xffffffff), OLSR_PORT_NUMBER)); |
281 |
m_socketAddresses[socket] = m_ipv4->GetAddress (i, 0); |
286 |
m_socketAddresses[socket] = m_ipv4->GetAddress (i, 0); |
|
|
287 |
|
288 |
canRunOlsr = true; |
282 |
} |
289 |
} |
283 |
|
290 |
|
284 |
HelloTimerExpire (); |
291 |
if(canRunOlsr) |
285 |
TcTimerExpire (); |
292 |
{ |
286 |
MidTimerExpire (); |
293 |
HelloTimerExpire (); |
|
|
294 |
TcTimerExpire (); |
295 |
MidTimerExpire (); |
287 |
|
296 |
|
288 |
NS_LOG_DEBUG ("OLSR on node " << m_mainAddress << " started"); |
297 |
NS_LOG_DEBUG ("OLSR on node " << m_mainAddress << " started"); |
|
|
298 |
} |
289 |
} |
299 |
} |
290 |
|
300 |
|
291 |
void RoutingProtocol::SetMainInterface (uint32_t interface) |
301 |
void RoutingProtocol::SetMainInterface (uint32_t interface) |
|
293 |
m_mainAddress = m_ipv4->GetAddress (interface, 0).GetLocal (); |
303 |
m_mainAddress = m_ipv4->GetAddress (interface, 0).GetLocal (); |
294 |
} |
304 |
} |
295 |
|
305 |
|
|
|
306 |
void RoutingProtocol::SetInterfaceExclusions (std::set<uint32_t> exceptions) |
307 |
{ |
308 |
m_interfaceExclusions = exceptions; |
309 |
} |
296 |
|
310 |
|
297 |
// |
311 |
// |
298 |
// \brief Processes an incoming %OLSR packet following RFC 3626 specification. |
312 |
// \brief Processes an incoming %OLSR packet following RFC 3626 specification. |