|
1166 |
ipv6Fragment->GetFragments (packet, ipHeader, targetMtu, fragments); |
1166 |
ipv6Fragment->GetFragments (packet, ipHeader, targetMtu, fragments); |
1167 |
} |
1167 |
} |
1168 |
|
1168 |
|
1169 |
if (!route->GetGateway ().IsEqual (Ipv6Address::GetAny ())) |
1169 |
Ipv6Address nextHop = (route->GetGateway ().IsEqual (Ipv6Address::GetAny ())) ? ipHeader.GetDestinationAddress () : route->GetGateway(); |
|
|
1170 |
Ipv6InterfaceAddress src = outInterface->GetAddressMatchingDestination (nextHop); |
1171 |
bool tentative_ns = false; |
1172 |
if (src.GetState() == Ipv6InterfaceAddress::TENTATIVE) |
1173 |
{ |
1174 |
if (ipHeader.GetNextHeader() == Ipv6Header::IPV6_ICMPV6) |
1175 |
{ |
1176 |
Icmpv6Header icmpv6Header; |
1177 |
packet->PeekHeader (icmpv6Header); |
1178 |
if (icmpv6Header.GetType () == Icmpv6Header::ICMPV6_ND_NEIGHBOR_SOLICITATION) |
1179 |
{ |
1180 |
Icmpv6NS ns; |
1181 |
packet->PeekHeader (ns); |
1182 |
if (ns.GetIpv6Target() == src.GetAddress()) |
1183 |
{ |
1184 |
tentative_ns = true; |
1185 |
} |
1186 |
} |
1187 |
} |
1188 |
} |
1189 |
if ((src.GetState() == Ipv6InterfaceAddress::TENTATIVE && !tentative_ns) || src.GetState() == Ipv6InterfaceAddress::INVALID) |
1190 |
{ |
1191 |
NS_LOG_LOGIC ("Dropping-- interface address state is invalid or tentative"); |
1192 |
m_dropTrace (ipHeader, packet, DROP_INVALID_ADDRESS, m_node->GetObject<Ipv6> (), interface); |
1193 |
} |
1194 |
else |
1170 |
{ |
1195 |
{ |
1171 |
if (outInterface->IsUp ()) |
1196 |
if (outInterface->IsUp ()) |
1172 |
{ |
1197 |
{ |
1173 |
NS_LOG_LOGIC ("Send to gateway " << route->GetGateway ()); |
1198 |
NS_LOG_LOGIC ("Send to " << nextHop); |
1174 |
|
1199 |
|
1175 |
if (fragments.size () != 0) |
1200 |
if (fragments.size () != 0) |
1176 |
{ |
1201 |
{ |
|
1179 |
for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it = fragments.begin (); it != fragments.end (); it++) |
1204 |
for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it = fragments.begin (); it != fragments.end (); it++) |
1180 |
{ |
1205 |
{ |
1181 |
CallTxTrace (it->second, it->first, m_node->GetObject<Ipv6> (), interface); |
1206 |
CallTxTrace (it->second, it->first, m_node->GetObject<Ipv6> (), interface); |
1182 |
outInterface->Send (it->first, it->second, route->GetGateway ()); |
1207 |
outInterface->Send (it->first, it->second, nextHop); |
1183 |
} |
1208 |
} |
1184 |
} |
1209 |
} |
1185 |
else |
1210 |
else |
1186 |
{ |
1211 |
{ |
1187 |
CallTxTrace (ipHeader, packet, m_node->GetObject<Ipv6> (), interface); |
1212 |
CallTxTrace (ipHeader, packet, m_node->GetObject<Ipv6> (), interface); |
1188 |
outInterface->Send (packet, ipHeader, route->GetGateway ()); |
1213 |
outInterface->Send (packet, ipHeader, nextHop); |
1189 |
} |
1214 |
} |
1190 |
} |
1215 |
} |
1191 |
else |
1216 |
else |
1192 |
{ |
1217 |
{ |
1193 |
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << route->GetGateway ()); |
1218 |
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << nextHop); |
1194 |
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ipv6> (), interface); |
|
|
1195 |
} |
1196 |
} |
1197 |
else |
1198 |
{ |
1199 |
if (outInterface->IsUp ()) |
1200 |
{ |
1201 |
NS_LOG_LOGIC ("Send to destination " << ipHeader.GetDestinationAddress ()); |
1202 |
|
1203 |
if (fragments.size () != 0) |
1204 |
{ |
1205 |
std::ostringstream oss; |
1206 |
|
1207 |
for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it = fragments.begin (); it != fragments.end (); it++) |
1208 |
{ |
1209 |
CallTxTrace (it->second, it->first, m_node->GetObject<Ipv6> (), interface); |
1210 |
outInterface->Send (it->first, it->second, ipHeader.GetDestinationAddress ()); |
1211 |
} |
1212 |
} |
1213 |
else |
1214 |
{ |
1215 |
CallTxTrace (ipHeader, packet, m_node->GetObject<Ipv6> (), interface); |
1216 |
outInterface->Send (packet, ipHeader, ipHeader.GetDestinationAddress ()); |
1217 |
} |
1218 |
} |
1219 |
else |
1220 |
{ |
1221 |
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << ipHeader.GetDestinationAddress ()); |
1222 |
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ipv6> (), interface); |
1219 |
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ipv6> (), interface); |
1223 |
} |
1220 |
} |
1224 |
} |
1221 |
} |