147,6 → 147,10 |
*/ |
#define IP_FRAGMENT_OFFSET( length ) (( length ) / 8 ) |
|
/** The IP localhost address. |
*/ |
#define IPV4_LOCALHOST_ADDRESS htonl(( 127 << 24 ) + 1 ) |
|
/** IP global data. |
*/ |
ip_globals_t ip_globals; |
573,7 → 577,7 |
phone = ip_prepare_icmp_and_get_phone( error, packet, NULL ); |
if( phone >= 0 ){ |
// unreachable ICMP if no routing |
icmp_destination_unreachable_msg( phone, ICMP_HOST_UNREACH, 0, packet ); |
icmp_destination_unreachable_msg( phone, ICMP_NET_UNREACH, 0, packet ); |
} |
return ENOENT; |
} |
586,6 → 590,21 |
return ip_release_and_return( packet, EINVAL ); |
} |
} |
if( route->address.s_addr == dest->s_addr ){ |
// find the loopback device to deliver |
dest->s_addr = IPV4_LOCALHOST_ADDRESS; |
route = ip_find_route( * dest ); |
netif = route ? route->netif : NULL; |
if( !( netif && route )){ |
fibril_rwlock_read_unlock( & ip_globals.netifs_lock ); |
phone = ip_prepare_icmp_and_get_phone( error, packet, NULL ); |
if( phone >= 0 ){ |
// unreachable ICMP if no routing |
icmp_destination_unreachable_msg( phone, ICMP_HOST_UNREACH, 0, packet ); |
} |
return ENOENT; |
} |
} |
src = ip_netif_address( netif ); |
if( ! src ){ |
fibril_rwlock_read_unlock( & ip_globals.netifs_lock ); |