mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-17 11:42:56 +00:00
fix type conversion errors introduced with last commit
This commit is contained in:
parent
0c2fdfcf42
commit
11c294e973
@ -819,7 +819,7 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
|
||||
dest = &mcastaddr;
|
||||
/* unicast destination IP address? */
|
||||
} else {
|
||||
u16_t i;
|
||||
netif_addr_idx_t i;
|
||||
/* outside local network? if so, this can neither be a global broadcast nor
|
||||
a subnet broadcast. */
|
||||
if (!ip4_addr_netcmp(ipaddr, netif_ip4_addr(netif), netif_ip4_netmask(netif)) &&
|
||||
@ -936,7 +936,7 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
|
||||
err_t result = ERR_MEM;
|
||||
int is_new_entry = 0;
|
||||
s16_t i_err;
|
||||
u16_t i;
|
||||
netif_addr_idx_t i;
|
||||
|
||||
/* non-unicast address? */
|
||||
if (ip4_addr_isbroadcast(ipaddr, netif) ||
|
||||
@ -958,7 +958,8 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
|
||||
}
|
||||
return (err_t)i_err;
|
||||
}
|
||||
i = (u16_t)i_err;
|
||||
LWIP_ASSERT("type overflow", (size_t)i_err < NETIF_ADDR_IDX_MAX);
|
||||
i = (netif_addr_idx_t)i_err;
|
||||
|
||||
/* mark a fresh entry as pending (we just sent a request) */
|
||||
if (arp_table[i].state == ETHARP_STATE_EMPTY) {
|
||||
|
@ -286,6 +286,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
u8_t msg_type;
|
||||
s8_t i;
|
||||
s16_t dest_idx;
|
||||
|
||||
ND6_STATS_INC(nd6.recv);
|
||||
|
||||
@ -836,8 +837,8 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
}
|
||||
|
||||
/* Find dest address in cache */
|
||||
i = nd6_find_destination_cache_entry(&destination_address);
|
||||
if (i < 0) {
|
||||
dest_idx = nd6_find_destination_cache_entry(&destination_address);
|
||||
if (dest_idx < 0) {
|
||||
/* Destination not in cache, drop packet. */
|
||||
pbuf_free(p);
|
||||
return;
|
||||
@ -848,7 +849,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
ip6_addr_assign_zone(&target_address, IP6_UNICAST, inp);
|
||||
|
||||
/* Set the new target address. */
|
||||
ip6_addr_copy(destination_cache[i].next_hop_addr, target_address);
|
||||
ip6_addr_copy(destination_cache[dest_idx].next_hop_addr, target_address);
|
||||
|
||||
/* If Link-layer address of other router is given, try to add to neighbor cache. */
|
||||
if (lladdr_opt != NULL) {
|
||||
@ -904,8 +905,8 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
ip6_addr_assign_zone(&destination_address, IP6_UNKNOWN, inp);
|
||||
|
||||
/* Look for entry in destination cache. */
|
||||
i = nd6_find_destination_cache_entry(&destination_address);
|
||||
if (i < 0) {
|
||||
dest_idx = nd6_find_destination_cache_entry(&destination_address);
|
||||
if (dest_idx < 0) {
|
||||
/* Destination not in cache, drop packet. */
|
||||
pbuf_free(p);
|
||||
return;
|
||||
@ -913,7 +914,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
/* Change the Path MTU. */
|
||||
pmtu = lwip_htonl(icmp6hdr->data);
|
||||
destination_cache[i].pmtu = (u16_t)LWIP_MIN(pmtu, 0xFFFF);
|
||||
destination_cache[dest_idx].pmtu = (u16_t)LWIP_MIN(pmtu, 0xFFFF);
|
||||
|
||||
break; /* ICMP6_TYPE_PTB */
|
||||
}
|
||||
@ -1539,10 +1540,10 @@ nd6_free_neighbor_cache_entry(s8_t i)
|
||||
* @return The destination cache entry index that matched, -1 if no
|
||||
* entry is found
|
||||
*/
|
||||
static s8_t
|
||||
static s16_t
|
||||
nd6_find_destination_cache_entry(const ip6_addr_t *ip6addr)
|
||||
{
|
||||
s8_t i;
|
||||
s16_t i;
|
||||
|
||||
IP6_ADDR_ZONECHECK(ip6addr);
|
||||
|
||||
@ -1564,7 +1565,7 @@ nd6_find_destination_cache_entry(const ip6_addr_t *ip6addr)
|
||||
static s16_t
|
||||
nd6_new_destination_cache_entry(void)
|
||||
{
|
||||
s8_t i, j;
|
||||
s16_t i, j;
|
||||
u32_t age;
|
||||
|
||||
/* Find an empty entry. */
|
||||
@ -1910,6 +1911,7 @@ nd6_get_next_hop_entry(const ip6_addr_t *ip6addr, struct netif *netif)
|
||||
const ip6_addr_t *next_hop_addr;
|
||||
#endif /* LWIP_HOOK_ND6_GET_GW */
|
||||
s8_t i;
|
||||
s16_t dst_idx;
|
||||
|
||||
IP6_ADDR_ZONECHECK_NETIF(ip6addr, netif);
|
||||
|
||||
@ -1930,16 +1932,18 @@ nd6_get_next_hop_entry(const ip6_addr_t *ip6addr, struct netif *netif)
|
||||
ND6_STATS_INC(nd6.cachehit);
|
||||
} else {
|
||||
/* Search destination cache. */
|
||||
i = nd6_find_destination_cache_entry(ip6addr);
|
||||
if (i >= 0) {
|
||||
dst_idx = nd6_find_destination_cache_entry(ip6addr);
|
||||
if (dst_idx >= 0) {
|
||||
/* found destination entry. make it our new cached index. */
|
||||
nd6_cached_destination_index = i;
|
||||
LWIP_ASSERT("type overflow", (size_t)dst_idx < NETIF_ADDR_IDX_MAX);
|
||||
nd6_cached_destination_index = (netif_addr_idx_t)dst_idx;
|
||||
} else {
|
||||
/* Not found. Create a new destination entry. */
|
||||
i = nd6_new_destination_cache_entry();
|
||||
if (i >= 0) {
|
||||
dst_idx = nd6_new_destination_cache_entry();
|
||||
if (dst_idx >= 0) {
|
||||
/* got new destination entry. make it our new cached index. */
|
||||
nd6_cached_destination_index = i;
|
||||
LWIP_ASSERT("type overflow", (size_t)dst_idx < NETIF_ADDR_IDX_MAX);
|
||||
nd6_cached_destination_index = (netif_addr_idx_t)dst_idx;
|
||||
} else {
|
||||
/* Could not create a destination cache entry. */
|
||||
return ERR_MEM;
|
||||
@ -2267,7 +2271,7 @@ nd6_get_next_hop_addr_or_queue(struct netif *netif, struct pbuf *q, const ip6_ad
|
||||
u16_t
|
||||
nd6_get_destination_mtu(const ip6_addr_t *ip6addr, struct netif *netif)
|
||||
{
|
||||
s8_t i;
|
||||
s16_t i;
|
||||
|
||||
i = nd6_find_destination_cache_entry(ip6addr);
|
||||
if (i >= 0) {
|
||||
@ -2298,24 +2302,25 @@ void
|
||||
nd6_reachability_hint(const ip6_addr_t *ip6addr)
|
||||
{
|
||||
s8_t i;
|
||||
s16_t dst_idx;
|
||||
|
||||
/* Find destination in cache. */
|
||||
if (ip6_addr_cmp(ip6addr, &(destination_cache[nd6_cached_destination_index].destination_addr))) {
|
||||
i = nd6_cached_destination_index;
|
||||
dst_idx = nd6_cached_destination_index;
|
||||
ND6_STATS_INC(nd6.cachehit);
|
||||
} else {
|
||||
i = nd6_find_destination_cache_entry(ip6addr);
|
||||
dst_idx = nd6_find_destination_cache_entry(ip6addr);
|
||||
}
|
||||
if (i < 0) {
|
||||
if (dst_idx < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find next hop neighbor in cache. */
|
||||
if (ip6_addr_cmp(&(destination_cache[i].next_hop_addr), &(neighbor_cache[nd6_cached_neighbor_index].next_hop_address))) {
|
||||
if (ip6_addr_cmp(&(destination_cache[dst_idx].next_hop_addr), &(neighbor_cache[nd6_cached_neighbor_index].next_hop_address))) {
|
||||
i = nd6_cached_neighbor_index;
|
||||
ND6_STATS_INC(nd6.cachehit);
|
||||
} else {
|
||||
i = nd6_find_neighbor_cache_entry(&(destination_cache[i].next_hop_addr));
|
||||
i = nd6_find_neighbor_cache_entry(&(destination_cache[dst_idx].next_hop_addr));
|
||||
}
|
||||
if (i < 0) {
|
||||
return;
|
||||
|
@ -239,8 +239,10 @@ u8_t netif_alloc_client_data_id(void);
|
||||
|
||||
#if (LWIP_IPV4 && LWIP_ARP && (ARP_TABLE_SIZE > 0x7f)) || (LWIP_IPV6 && (LWIP_ND6_NUM_DESTINATIONS > 0x7f))
|
||||
typedef u16_t netif_addr_idx_t;
|
||||
#define NETIF_ADDR_IDX_MAX 0x7FFF
|
||||
#else
|
||||
typedef u8_t netif_addr_idx_t;
|
||||
#define NETIF_ADDR_IDX_MAX 0x7F
|
||||
#endif
|
||||
|
||||
#if LWIP_NETIF_HWADDRHINT
|
||||
|
Loading…
x
Reference in New Issue
Block a user