mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-27 16:43:00 +00:00
minor: coding style
This commit is contained in:
parent
22df34fc70
commit
2b971400fa
@ -883,7 +883,8 @@ netconn_gethostbyname(const char *name, ip_addr_t *addr)
|
|||||||
#endif /* LWIP_DNS*/
|
#endif /* LWIP_DNS*/
|
||||||
|
|
||||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||||
void netconn_thread_init(void)
|
void
|
||||||
|
netconn_thread_init(void)
|
||||||
{
|
{
|
||||||
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
|
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
|
||||||
if ((sem == NULL) || !sys_sem_valid(sem)) {
|
if ((sem == NULL) || !sys_sem_valid(sem)) {
|
||||||
@ -893,7 +894,8 @@ void netconn_thread_init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void netconn_thread_cleanup(void)
|
void
|
||||||
|
netconn_thread_cleanup(void)
|
||||||
{
|
{
|
||||||
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
|
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
|
||||||
if ((sem != NULL) && sys_sem_valid(sem)) {
|
if ((sem != NULL) && sys_sem_valid(sem)) {
|
||||||
|
@ -575,7 +575,8 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
|||||||
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
|
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
|
||||||
)
|
)
|
||||||
#endif /* LWIP_IGMP || IP_ACCEPT_LINK_LAYER_ADDRESSING */
|
#endif /* LWIP_IGMP || IP_ACCEPT_LINK_LAYER_ADDRESSING */
|
||||||
{ if ((ip_addr_isbroadcast(ip_current_src_addr(), inp)) ||
|
{
|
||||||
|
if ((ip_addr_isbroadcast(ip_current_src_addr(), inp)) ||
|
||||||
(ip_addr_ismulticast(ip_current_src_addr()))) {
|
(ip_addr_ismulticast(ip_current_src_addr()))) {
|
||||||
/* packet source is not valid */
|
/* packet source is not valid */
|
||||||
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, ("ip_input: packet source is not valid.\n"));
|
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, ("ip_input: packet source is not valid.\n"));
|
||||||
|
@ -497,8 +497,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
|||||||
else {
|
else {
|
||||||
netif = NULL;
|
netif = NULL;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* start trying with inp. if that's not acceptable, start walking the
|
/* start trying with inp. if that's not acceptable, start walking the
|
||||||
list of configured netifs.
|
list of configured netifs.
|
||||||
'first' is used as a boolean to mark whether we started walking the list */
|
'first' is used as a boolean to mark whether we started walking the list */
|
||||||
|
@ -210,7 +210,9 @@ ip6addr_ntoa_r(const ip6_addr_t *addr, char *buf, int buflen)
|
|||||||
if (current_block_index == 7) {
|
if (current_block_index == 7) {
|
||||||
/* special case, we must render a ':' for the last block. */
|
/* special case, we must render a ':' for the last block. */
|
||||||
buf[i++] = ':';
|
buf[i++] = ':';
|
||||||
if (i >= buflen) return NULL;
|
if (i >= buflen) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (empty_block_flag == 0) {
|
if (empty_block_flag == 0) {
|
||||||
@ -224,41 +226,45 @@ ip6addr_ntoa_r(const ip6_addr_t *addr, char *buf, int buflen)
|
|||||||
if (next_block_value == 0) {
|
if (next_block_value == 0) {
|
||||||
empty_block_flag = 1;
|
empty_block_flag = 1;
|
||||||
buf[i++] = ':';
|
buf[i++] = ':';
|
||||||
if (i >= buflen) return NULL;
|
if (i >= buflen) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
continue; /* move on to next block. */
|
continue; /* move on to next block. */
|
||||||
}
|
}
|
||||||
}
|
} else if (empty_block_flag == 1) {
|
||||||
else if (empty_block_flag == 1) {
|
|
||||||
/* move on to next block. */
|
/* move on to next block. */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
} else if (empty_block_flag == 1) {
|
||||||
else if (empty_block_flag == 1) {
|
|
||||||
/* Set this flag value so we don't produce multiple empty blocks. */
|
/* Set this flag value so we don't produce multiple empty blocks. */
|
||||||
empty_block_flag = 2;
|
empty_block_flag = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_block_index > 0) {
|
if (current_block_index > 0) {
|
||||||
buf[i++] = ':';
|
buf[i++] = ':';
|
||||||
if (i >= buflen) return NULL;
|
if (i >= buflen) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((current_block_value & 0xf000) == 0) {
|
if ((current_block_value & 0xf000) == 0) {
|
||||||
zero_flag = 1;
|
zero_flag = 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
buf[i++] = xchar(((current_block_value & 0xf000) >> 12));
|
buf[i++] = xchar(((current_block_value & 0xf000) >> 12));
|
||||||
zero_flag = 0;
|
zero_flag = 0;
|
||||||
if (i >= buflen) return NULL;
|
if (i >= buflen) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((current_block_value & 0xf00) == 0) && (zero_flag)) {
|
if (((current_block_value & 0xf00) == 0) && (zero_flag)) {
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
buf[i++] = xchar(((current_block_value & 0xf00) >> 8));
|
buf[i++] = xchar(((current_block_value & 0xf00) >> 8));
|
||||||
zero_flag = 0;
|
zero_flag = 0;
|
||||||
if (i >= buflen) return NULL;
|
if (i >= buflen) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((current_block_value & 0xf0) == 0) && (zero_flag)) {
|
if (((current_block_value & 0xf0) == 0) && (zero_flag)) {
|
||||||
@ -267,11 +273,15 @@ ip6addr_ntoa_r(const ip6_addr_t *addr, char *buf, int buflen)
|
|||||||
else {
|
else {
|
||||||
buf[i++] = xchar(((current_block_value & 0xf0) >> 4));
|
buf[i++] = xchar(((current_block_value & 0xf0) >> 4));
|
||||||
zero_flag = 0;
|
zero_flag = 0;
|
||||||
if (i >= buflen) return NULL;
|
if (i >= buflen) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[i++] = xchar((current_block_value & 0xf));
|
buf[i++] = xchar((current_block_value & 0xf));
|
||||||
if (i >= buflen) return NULL;
|
if (i >= buflen) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
|
@ -183,9 +183,6 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
mld6_leavegroup(netif_ip6_addr(inp, i), &multicast_address);
|
mld6_leavegroup(netif_ip6_addr(inp, i), &multicast_address);
|
||||||
#endif /* LWIP_IPV6_MLD */
|
#endif /* LWIP_IPV6_MLD */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if LWIP_IPV6_AUTOCONFIG
|
#if LWIP_IPV6_AUTOCONFIG
|
||||||
/* Check to see if this address was autoconfigured. */
|
/* Check to see if this address was autoconfigured. */
|
||||||
if (!ip6_addr_islinklocal(ip6_current_dest_addr())) {
|
if (!ip6_addr_islinklocal(ip6_current_dest_addr())) {
|
||||||
@ -211,8 +208,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
MEMCPY(neighbor_cache[i].lladdr, lladdr_opt->addr, inp->hwaddr_len);
|
MEMCPY(neighbor_cache[i].lladdr, lladdr_opt->addr, inp->hwaddr_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* This is a solicited NA.
|
/* This is a solicited NA.
|
||||||
* neighbor address resolution response?
|
* neighbor address resolution response?
|
||||||
* neighbor unreachability detection response? */
|
* neighbor unreachability detection response? */
|
||||||
@ -287,8 +283,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
if (p->len < (sizeof(struct ns_header) + (lladdr_opt->length << 3))) {
|
if (p->len < (sizeof(struct ns_header) + (lladdr_opt->length << 3))) {
|
||||||
lladdr_opt = NULL;
|
lladdr_opt = NULL;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lladdr_opt = NULL;
|
lladdr_opt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,8 +319,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Sender is trying to resolve our address. */
|
/* Sender is trying to resolve our address. */
|
||||||
/* Verify that they included their own link-layer address. */
|
/* Verify that they included their own link-layer address. */
|
||||||
if (lladdr_opt == NULL) {
|
if (lladdr_opt == NULL) {
|
||||||
@ -347,9 +341,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
neighbor_cache[i].state = ND6_DELAY;
|
neighbor_cache[i].state = ND6_DELAY;
|
||||||
neighbor_cache[i].counter.delay_time = LWIP_ND6_DELAY_FIRST_PROBE_TIME;
|
neighbor_cache[i].counter.delay_time = LWIP_ND6_DELAY_FIRST_PROBE_TIME;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Add their IPv6 address and link-layer address to neighbor cache.
|
/* Add their IPv6 address and link-layer address to neighbor cache.
|
||||||
* We will need it at least to send a unicast NA message, but most
|
* We will need it at least to send a unicast NA message, but most
|
||||||
* likely we will also be communicating with this node soon. */
|
* likely we will also be communicating with this node soon. */
|
||||||
@ -509,13 +501,11 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ND6_OPTION_TYPE_ROUTE_INFO:
|
case ND6_OPTION_TYPE_ROUTE_INFO:
|
||||||
{
|
|
||||||
/* TODO implement preferred routes.
|
/* TODO implement preferred routes.
|
||||||
struct route_option * route_opt;
|
struct route_option * route_opt;
|
||||||
route_opt = (struct route_option *)buffer;*/
|
route_opt = (struct route_option *)buffer;*/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
/* Unrecognized option, abort. */
|
/* Unrecognized option, abort. */
|
||||||
ND6_STATS_INC(nd6.proterr);
|
ND6_STATS_INC(nd6.proterr);
|
||||||
@ -547,8 +537,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
if (p->len < (sizeof(struct redirect_header) + (lladdr_opt->length << 3))) {
|
if (p->len < (sizeof(struct redirect_header) + (lladdr_opt->length << 3))) {
|
||||||
lladdr_opt = NULL;
|
lladdr_opt = NULL;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lladdr_opt = NULL;
|
lladdr_opt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,8 +656,7 @@ nd6_tmr(void)
|
|||||||
if (neighbor_cache[i].counter.probes_sent >= LWIP_ND6_MAX_MULTICAST_SOLICIT) {
|
if (neighbor_cache[i].counter.probes_sent >= LWIP_ND6_MAX_MULTICAST_SOLICIT) {
|
||||||
/* Retries exceeded. */
|
/* Retries exceeded. */
|
||||||
nd6_free_neighbor_cache_entry(i);
|
nd6_free_neighbor_cache_entry(i);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Send a NS for this entry. */
|
/* Send a NS for this entry. */
|
||||||
neighbor_cache[i].counter.probes_sent++;
|
neighbor_cache[i].counter.probes_sent++;
|
||||||
nd6_send_ns(neighbor_cache[i].netif, &(neighbor_cache[i].next_hop_address), ND6_SEND_FLAG_MULTICAST_DEST);
|
nd6_send_ns(neighbor_cache[i].netif, &(neighbor_cache[i].next_hop_address), ND6_SEND_FLAG_MULTICAST_DEST);
|
||||||
@ -683,8 +671,7 @@ nd6_tmr(void)
|
|||||||
/* Change to stale state. */
|
/* Change to stale state. */
|
||||||
neighbor_cache[i].state = ND6_STALE;
|
neighbor_cache[i].state = ND6_STALE;
|
||||||
neighbor_cache[i].counter.stale_time = 0;
|
neighbor_cache[i].counter.stale_time = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
neighbor_cache[i].counter.reachable_time -= ND6_TMR_INTERVAL;
|
neighbor_cache[i].counter.reachable_time -= ND6_TMR_INTERVAL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -696,8 +683,7 @@ nd6_tmr(void)
|
|||||||
/* Change to PROBE state. */
|
/* Change to PROBE state. */
|
||||||
neighbor_cache[i].state = ND6_PROBE;
|
neighbor_cache[i].state = ND6_PROBE;
|
||||||
neighbor_cache[i].counter.probes_sent = 0;
|
neighbor_cache[i].counter.probes_sent = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
neighbor_cache[i].counter.delay_time -= ND6_TMR_INTERVAL;
|
neighbor_cache[i].counter.delay_time -= ND6_TMR_INTERVAL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -705,8 +691,7 @@ nd6_tmr(void)
|
|||||||
if (neighbor_cache[i].counter.probes_sent >= LWIP_ND6_MAX_MULTICAST_SOLICIT) {
|
if (neighbor_cache[i].counter.probes_sent >= LWIP_ND6_MAX_MULTICAST_SOLICIT) {
|
||||||
/* Retries exceeded. */
|
/* Retries exceeded. */
|
||||||
nd6_free_neighbor_cache_entry(i);
|
nd6_free_neighbor_cache_entry(i);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Send a NS for this entry. */
|
/* Send a NS for this entry. */
|
||||||
neighbor_cache[i].counter.probes_sent++;
|
neighbor_cache[i].counter.probes_sent++;
|
||||||
nd6_send_ns(neighbor_cache[i].netif, &(neighbor_cache[i].next_hop_address), 0);
|
nd6_send_ns(neighbor_cache[i].netif, &(neighbor_cache[i].next_hop_address), 0);
|
||||||
@ -769,8 +754,7 @@ nd6_tmr(void)
|
|||||||
|
|
||||||
prefix_list[i].netif = NULL;
|
prefix_list[i].netif = NULL;
|
||||||
prefix_list[i].flags = 0;
|
prefix_list[i].flags = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
prefix_list[i].invalidation_timer -= ND6_TMR_INTERVAL / 1000;
|
prefix_list[i].invalidation_timer -= ND6_TMR_INTERVAL / 1000;
|
||||||
|
|
||||||
#if LWIP_IPV6_AUTOCONFIG
|
#if LWIP_IPV6_AUTOCONFIG
|
||||||
@ -813,8 +797,7 @@ nd6_tmr(void)
|
|||||||
/* No NA received in response. Mark address as valid. */
|
/* No NA received in response. Mark address as valid. */
|
||||||
netif->ip6_addr_state[i] = IP6_ADDR_PREFERRED;
|
netif->ip6_addr_state[i] = IP6_ADDR_PREFERRED;
|
||||||
/* TODO implement preferred and valid lifetimes. */
|
/* TODO implement preferred and valid lifetimes. */
|
||||||
}
|
} else if (netif->flags & NETIF_FLAG_UP) {
|
||||||
else if (netif->flags & NETIF_FLAG_UP) {
|
|
||||||
#if LWIP_IPV6_MLD
|
#if LWIP_IPV6_MLD
|
||||||
if ((netif->ip6_addr_state[i] & 0x07) == 0) {
|
if ((netif->ip6_addr_state[i] & 0x07) == 0) {
|
||||||
/* Join solicited node multicast group. */
|
/* Join solicited node multicast group. */
|
||||||
@ -970,12 +953,10 @@ nd6_send_na(struct netif * netif, const ip6_addr_t * target_addr, u8_t flags)
|
|||||||
if (flags & ND6_SEND_FLAG_MULTICAST_DEST) {
|
if (flags & ND6_SEND_FLAG_MULTICAST_DEST) {
|
||||||
ip6_addr_set_solicitednode(&multicast_address, target_addr->addr[3]);
|
ip6_addr_set_solicitednode(&multicast_address, target_addr->addr[3]);
|
||||||
dest_addr = &multicast_address;
|
dest_addr = &multicast_address;
|
||||||
}
|
} else if (flags & ND6_SEND_FLAG_ALLNODES_DEST) {
|
||||||
else if (flags & ND6_SEND_FLAG_ALLNODES_DEST) {
|
|
||||||
ip6_addr_set_allnodes_linklocal(&multicast_address);
|
ip6_addr_set_allnodes_linklocal(&multicast_address);
|
||||||
dest_addr = &multicast_address;
|
dest_addr = &multicast_address;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dest_addr = ip6_current_src_addr();
|
dest_addr = ip6_current_src_addr();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,8 +993,7 @@ nd6_send_rs(struct netif * netif)
|
|||||||
/* Link-local source address, or unspecified address? */
|
/* Link-local source address, or unspecified address? */
|
||||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, 0))) {
|
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, 0))) {
|
||||||
src_addr = netif_ip6_addr(netif, 0);
|
src_addr = netif_ip6_addr(netif, 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
src_addr = IP6_ADDR_ANY6;
|
src_addr = IP6_ADDR_ANY6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1527,8 +1507,7 @@ nd6_get_next_hop_entry(const ip6_addr_t * ip6addr, struct netif * netif)
|
|||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
/* found destination entry. make it our new cached index. */
|
/* found destination entry. make it our new cached index. */
|
||||||
nd6_cached_destination_index = i;
|
nd6_cached_destination_index = i;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Not found. Create a new destination entry. */
|
/* Not found. Create a new destination entry. */
|
||||||
i = nd6_new_destination_cache_entry();
|
i = nd6_new_destination_cache_entry();
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
@ -1548,8 +1527,7 @@ nd6_get_next_hop_entry(const ip6_addr_t * ip6addr, struct netif * netif)
|
|||||||
/* Destination in local link. */
|
/* Destination in local link. */
|
||||||
destination_cache[nd6_cached_destination_index].pmtu = netif->mtu;
|
destination_cache[nd6_cached_destination_index].pmtu = netif->mtu;
|
||||||
ip6_addr_copy(destination_cache[nd6_cached_destination_index].next_hop_addr, destination_cache[nd6_cached_destination_index].destination_addr);
|
ip6_addr_copy(destination_cache[nd6_cached_destination_index].next_hop_addr, destination_cache[nd6_cached_destination_index].destination_addr);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* We need to select a router. */
|
/* We need to select a router. */
|
||||||
i = nd6_select_router(ip6addr, netif);
|
i = nd6_select_router(ip6addr, netif);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
@ -1581,8 +1559,7 @@ nd6_get_next_hop_entry(const ip6_addr_t * ip6addr, struct netif * netif)
|
|||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
/* Found a matching record, make it new cached entry. */
|
/* Found a matching record, make it new cached entry. */
|
||||||
nd6_cached_neighbor_index = i;
|
nd6_cached_neighbor_index = i;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Neighbor not in cache. Make a new entry. */
|
/* Neighbor not in cache. Make a new entry. */
|
||||||
i = nd6_new_neighbor_cache_entry();
|
i = nd6_new_neighbor_cache_entry();
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
@ -1839,8 +1816,7 @@ nd6_reachability_hint(const ip6_addr_t * ip6addr)
|
|||||||
if (ip6_addr_cmp(ip6addr, &(destination_cache[nd6_cached_destination_index].destination_addr))) {
|
if (ip6_addr_cmp(ip6addr, &(destination_cache[nd6_cached_destination_index].destination_addr))) {
|
||||||
i = nd6_cached_destination_index;
|
i = nd6_cached_destination_index;
|
||||||
ND6_STATS_INC(nd6.cachehit);
|
ND6_STATS_INC(nd6.cachehit);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
i = nd6_find_destination_cache_entry(ip6addr);
|
i = nd6_find_destination_cache_entry(ip6addr);
|
||||||
}
|
}
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
@ -1851,8 +1827,7 @@ nd6_reachability_hint(const ip6_addr_t * ip6addr)
|
|||||||
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[i].next_hop_addr), &(neighbor_cache[nd6_cached_neighbor_index].next_hop_address))) {
|
||||||
i = nd6_cached_neighbor_index;
|
i = nd6_cached_neighbor_index;
|
||||||
ND6_STATS_INC(nd6.cachehit);
|
ND6_STATS_INC(nd6.cachehit);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
i = nd6_find_neighbor_cache_entry(&(destination_cache[i].next_hop_addr));
|
i = nd6_find_neighbor_cache_entry(&(destination_cache[i].next_hop_addr));
|
||||||
}
|
}
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
@ -525,7 +525,8 @@ netif_set_default(struct netif *netif)
|
|||||||
* Bring an interface up, available for processing
|
* Bring an interface up, available for processing
|
||||||
* traffic.
|
* traffic.
|
||||||
*/
|
*/
|
||||||
void netif_set_up(struct netif *netif)
|
void
|
||||||
|
netif_set_up(struct netif *netif)
|
||||||
{
|
{
|
||||||
if (!(netif->flags & NETIF_FLAG_UP)) {
|
if (!(netif->flags & NETIF_FLAG_UP)) {
|
||||||
netif->flags |= NETIF_FLAG_UP;
|
netif->flags |= NETIF_FLAG_UP;
|
||||||
@ -581,7 +582,8 @@ netif_issue_reports(struct netif* netif, u8_t report_type)
|
|||||||
/**
|
/**
|
||||||
* Bring an interface down, disabling any traffic processing.
|
* Bring an interface down, disabling any traffic processing.
|
||||||
*/
|
*/
|
||||||
void netif_set_down(struct netif *netif)
|
void
|
||||||
|
netif_set_down(struct netif *netif)
|
||||||
{
|
{
|
||||||
if (netif->flags & NETIF_FLAG_UP) {
|
if (netif->flags & NETIF_FLAG_UP) {
|
||||||
netif->flags &= ~NETIF_FLAG_UP;
|
netif->flags &= ~NETIF_FLAG_UP;
|
||||||
@ -600,7 +602,8 @@ void netif_set_down(struct netif *netif)
|
|||||||
/**
|
/**
|
||||||
* Set callback to be called when interface is brought up/down or address is changed while up
|
* Set callback to be called when interface is brought up/down or address is changed while up
|
||||||
*/
|
*/
|
||||||
void netif_set_status_callback(struct netif *netif, netif_status_callback_fn status_callback)
|
void
|
||||||
|
netif_set_status_callback(struct netif *netif, netif_status_callback_fn status_callback)
|
||||||
{
|
{
|
||||||
if (netif) {
|
if (netif) {
|
||||||
netif->status_callback = status_callback;
|
netif->status_callback = status_callback;
|
||||||
@ -652,7 +655,8 @@ netif_set_link_up(struct netif *netif)
|
|||||||
/**
|
/**
|
||||||
* Called by a driver when its link goes down
|
* Called by a driver when its link goes down
|
||||||
*/
|
*/
|
||||||
void netif_set_link_down(struct netif *netif )
|
void
|
||||||
|
netif_set_link_down(struct netif *netif )
|
||||||
{
|
{
|
||||||
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
||||||
netif->flags &= ~NETIF_FLAG_LINK_UP;
|
netif->flags &= ~NETIF_FLAG_LINK_UP;
|
||||||
@ -664,7 +668,8 @@ void netif_set_link_down(struct netif *netif )
|
|||||||
/**
|
/**
|
||||||
* Set callback to be called when link is brought up/down
|
* Set callback to be called when link is brought up/down
|
||||||
*/
|
*/
|
||||||
void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callback)
|
void
|
||||||
|
netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callback)
|
||||||
{
|
{
|
||||||
if (netif) {
|
if (netif) {
|
||||||
netif->link_callback = link_callback;
|
netif->link_callback = link_callback;
|
||||||
|
@ -49,7 +49,8 @@
|
|||||||
|
|
||||||
struct stats_ lwip_stats;
|
struct stats_ lwip_stats;
|
||||||
|
|
||||||
void stats_init(void)
|
void
|
||||||
|
stats_init(void)
|
||||||
{
|
{
|
||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
#if MEMP_STATS
|
#if MEMP_STATS
|
||||||
|
@ -984,8 +984,7 @@ tcp_slowtmr_start:
|
|||||||
|
|
||||||
++pcb_remove;
|
++pcb_remove;
|
||||||
++pcb_reset;
|
++pcb_reset;
|
||||||
}
|
} else if ((u32_t)(tcp_ticks - pcb->tmr) >
|
||||||
else if((u32_t)(tcp_ticks - pcb->tmr) >
|
|
||||||
(pcb->keep_idle + pcb->keep_cnt_sent * TCP_KEEP_INTVL(pcb))
|
(pcb->keep_idle + pcb->keep_cnt_sent * TCP_KEEP_INTVL(pcb))
|
||||||
/ TCP_SLOW_INTERVAL)
|
/ TCP_SLOW_INTERVAL)
|
||||||
{
|
{
|
||||||
|
@ -761,9 +761,9 @@ tcp_process(struct tcp_pcb *pcb)
|
|||||||
|
|
||||||
/* If there's nothing left to acknowledge, stop the retransmit
|
/* If there's nothing left to acknowledge, stop the retransmit
|
||||||
timer, otherwise reset it to start again */
|
timer, otherwise reset it to start again */
|
||||||
if(pcb->unacked == NULL)
|
if (pcb->unacked == NULL) {
|
||||||
pcb->rtime = -1;
|
pcb->rtime = -1;
|
||||||
else {
|
} else {
|
||||||
pcb->rtime = 0;
|
pcb->rtime = 0;
|
||||||
pcb->nrtx = 0;
|
pcb->nrtx = 0;
|
||||||
}
|
}
|
||||||
@ -914,8 +914,7 @@ tcp_oos_insert_segment(struct tcp_seg *cseg, struct tcp_seg *next)
|
|||||||
/* received segment overlaps all following segments */
|
/* received segment overlaps all following segments */
|
||||||
tcp_segs_free(next);
|
tcp_segs_free(next);
|
||||||
next = NULL;
|
next = NULL;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* delete some following segments
|
/* delete some following segments
|
||||||
oos queue may have segments with FIN flag */
|
oos queue may have segments with FIN flag */
|
||||||
while (next &&
|
while (next &&
|
||||||
@ -1658,7 +1657,8 @@ tcp_receive(struct tcp_pcb *pcb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8_t tcp_getoptbyte(void)
|
static u8_t
|
||||||
|
tcp_getoptbyte(void)
|
||||||
{
|
{
|
||||||
if ((tcphdr_opt2 == NULL) || (tcp_optidx < tcphdr_opt1len)) {
|
if ((tcphdr_opt2 == NULL) || (tcp_optidx < tcphdr_opt1len)) {
|
||||||
u8_t* opts = (u8_t *)tcphdr + TCP_HLEN;
|
u8_t* opts = (u8_t *)tcphdr + TCP_HLEN;
|
||||||
|
@ -447,8 +447,7 @@ sys_check_timeouts(void)
|
|||||||
now = sys_now();
|
now = sys_now();
|
||||||
/* this cares for wraparounds */
|
/* this cares for wraparounds */
|
||||||
diff = now - timeouts_last_time;
|
diff = now - timeouts_last_time;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
#if PBUF_POOL_FREE_OOSEQ
|
#if PBUF_POOL_FREE_OOSEQ
|
||||||
PBUF_CHECK_FREE_OOSEQ();
|
PBUF_CHECK_FREE_OOSEQ();
|
||||||
#endif /* PBUF_POOL_FREE_OOSEQ */
|
#endif /* PBUF_POOL_FREE_OOSEQ */
|
||||||
|
Loading…
Reference in New Issue
Block a user