void RoutingProtocol6::NotifyInterfaceUp (uint32_t i) { NS_LOG_INFO("RoutingProtocol6 notify interface up is being called"); NS_LOG_FUNCTION (this << m_ipv6->GetAddress (i, 0).GetAddress ()); Ptr l3 = m_ipv6->GetObject (); uint32_t Naddresses= l3->GetNAddresses(i); Ptr dev = l3->GetNetDevice(i); NS_LOG_INFO("Number of addresses associated with interface="<GetAddress(i,1)); Ipv6InterfaceAddress iface = l3->GetAddress (i, 1); RoutingTableEntry6 rt (/*device=*/ dev, /*dst=*/ iface.GetAddress(), /*know seqno=*/ true, /*seqno=*/ 0, /*iface=*/ iface, /*hops=*/ 1, /*next hop=*/iface.GetAddress().GetZero(), /*lifetime=*/ Simulator::GetMaximumSimulationTime ()); m_routingTable.AddRoute (rt); bool sendSocketFound = false; for (SocketListI iter = m_sendSocketList.begin(); iter != m_sendSocketList.end (); iter++ ) { if (iter->second == i) { NS_LOG_INFO("Send socket already exists"); sendSocketFound = true; break; } } Ipv6InterfaceAddress address = l3->GetAddress (i, 0); NS_LOG_INFO("Notifyinterfaceup i="< theNode = GetObject (); Ptr socket = Socket::CreateSocket (theNode, tid); NS_ASSERT_MSG(socket,"unicast socket not created"); Inet6SocketAddress local = Inet6SocketAddress (address.GetAddress (), AODV_PORT); int ret= socket->Bind (local); NS_ASSERT_MSG(ret>=0," Socket not bound to unicast address"); socket->BindToNetDevice (m_ipv6->GetNetDevice (i)); NS_LOG_INFO("Send socket bound net device="<GetBoundNetDevice()); socket->SetRecvCallback (MakeCallback (&RoutingProtocol6::RecvAodv, this)); //previously i had not set the callback socket->SetIpv6RecvHopLimit(true); socket->SetAttribute ("IpTtl", UintegerValue (1)); NS_LOG_INFO("socket instance type id="<GetInstanceTypeId()); m_socketAddresses.insert (std::make_pair (socket, address)); Ipv6Address test; if (m_socketAddresses.find (socket) != m_socketAddresses.end ()) { test = m_socketAddresses[socket].GetAddress (); NS_LOG_INFO("In socket addresses, added address="< theNode = GetObject (); m_recvSocket = Socket::CreateSocket (theNode, tid); NS_ASSERT_MSG(m_recvSocket,"receive socket not created"); Inet6SocketAddress local = Inet6SocketAddress (Ipv6Address::GetAny (), AODV_PORT); m_recvSocket->Bind (local); m_recvSocket->BindToNetDevice (m_ipv6->GetNetDevice (i)); m_recvSocket->SetIpv6RecvHopLimit(true); NS_LOG_INFO("Listen socket bound net device="<GetBoundNetDevice()); m_recvSocket->SetRecvCallback (MakeCallback (&RoutingProtocol6::RecvAodv, this)); m_recvSocket->SetRecvPktInfo (true); m_recvSocket->SetAttribute ("IpTtl", UintegerValue (1)); m_socketAddresses.insert (std::make_pair (m_recvSocket, address)); } if (l3->GetInterface (i)->GetNdiscCache ()) { NS_LOG_INFO("Entry in ndiscCache"); m_nb.AddNdiscCache (l3->GetInterface (i)->GetNdiscCache ()); } else { NS_LOG_INFO("No entry in ndiscCache"); } // Allow neighbor manager use this interface for layer 2 feedback if possible Ptr wifi = dev->GetObject (); if (wifi == 0) return; Ptr mac = wifi->GetMac (); if (mac == 0) return; mac->TraceConnectWithoutContext ("TxErrHeader", m_nb.GetTxErrorCallback ()); }