|
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 |
const std::set<uint32_t> ifaceExclusions = GetInterfaceExclusions(); |
275 |
|
276 |
if(ifaceExclusions.find(i) != ifaceExclusions.end ()) |
277 |
continue; |
278 |
|
272 |
// Create a socket to listen only on this interface |
279 |
// Create a socket to listen only on this interface |
273 |
Ptr<Socket> socket = Socket::CreateSocket (GetObject<Node> (), |
280 |
Ptr<Socket> socket = Socket::CreateSocket (GetObject<Node> (), |
274 |
UdpSocketFactory::GetTypeId()); |
281 |
UdpSocketFactory::GetTypeId()); |
|
279 |
} |
286 |
} |
280 |
socket->Connect (InetSocketAddress (Ipv4Address (0xffffffff), OLSR_PORT_NUMBER)); |
287 |
socket->Connect (InetSocketAddress (Ipv4Address (0xffffffff), OLSR_PORT_NUMBER)); |
281 |
m_socketAddresses[socket] = m_ipv4->GetAddress (i, 0); |
288 |
m_socketAddresses[socket] = m_ipv4->GetAddress (i, 0); |
|
|
289 |
|
290 |
canRunOlsr = true; |
282 |
} |
291 |
} |
283 |
|
292 |
|
284 |
HelloTimerExpire (); |
293 |
if(canRunOlsr) |
285 |
TcTimerExpire (); |
294 |
{ |
286 |
MidTimerExpire (); |
295 |
HelloTimerExpire (); |
|
|
296 |
TcTimerExpire (); |
297 |
MidTimerExpire (); |
287 |
|
298 |
|
288 |
NS_LOG_DEBUG ("OLSR on node " << m_mainAddress << " started"); |
299 |
NS_LOG_DEBUG ("OLSR on node " << m_mainAddress << " started"); |
|
|
300 |
} |
289 |
} |
301 |
} |
290 |
|
302 |
|
291 |
void RoutingProtocol::SetMainInterface (uint32_t interface) |
303 |
void RoutingProtocol::SetMainInterface (uint32_t interface) |
|
293 |
m_mainAddress = m_ipv4->GetAddress (interface, 0).GetLocal (); |
305 |
m_mainAddress = m_ipv4->GetAddress (interface, 0).GetLocal (); |
294 |
} |
306 |
} |
295 |
|
307 |
|
|
|
308 |
void RoutingProtocol::SetInterfaceExclusions (std::set<uint32_t> exceptions) |
309 |
{ |
310 |
m_interfaceExclusions = exceptions; |
311 |
} |
296 |
|
312 |
|
297 |
// |
313 |
// |
298 |
// \brief Processes an incoming %OLSR packet following RFC 3626 specification. |
314 |
// \brief Processes an incoming %OLSR packet following RFC 3626 specification. |