mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-09 17:13:49 +08:00
Rename IP and Ethernet equality checkers from _cmp to _eq
Functions ending in cmp are expected to return 0 on equality but these return non-zero. eth_addr_cmp -> eth_addr_eq ip_addr_cmp -> ip_addr_eq ip4_addr_cmp -> ip4_addr_eq ip6_addr_cmp -> ip6_addr_eq ip_addr_netcmp -> ip_addr_net_eq ip4_addr_netcmp -> ip4_addr_net_eq ip6_addr_netcmp -> ip6_addr_net_eq ip_addr_cmp_zoneless -> ip_addr_zoneless_eq ip6_addr_cmp_zoneless -> ip6_addr_zoneless_eq ip6_addr_cmp_zone -> ip6_addr_zone_eq ip6_addr_netcmp_zoneless -> ip6_addr_net_zoneless_eq ip6_addr_nethostcmp -> ip6_addr_nethost_eq ip6_addr_cmp_packed -> ip6_addr_packed_eq ip6_addr_cmp_solicitednode -> ip6_addr_solicitednode_eq All call sites have been changed, and fallback macros have been added to not break external users.
This commit is contained in:
@@ -545,7 +545,7 @@ dns_local_removehost(const char *hostname, const ip_addr_t *addr)
|
||||
struct local_hostlist_entry *last_entry = NULL;
|
||||
while (entry != NULL) {
|
||||
if (((hostname == NULL) || !lwip_stricmp(entry->name, hostname)) &&
|
||||
((addr == NULL) || ip_addr_cmp(&entry->addr, addr))) {
|
||||
((addr == NULL) || ip_addr_eq(&entry->addr, addr))) {
|
||||
struct local_hostlist_entry *free_entry;
|
||||
if (last_entry != NULL) {
|
||||
last_entry->next = entry->next;
|
||||
@@ -1237,7 +1237,7 @@ dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
|
||||
{
|
||||
/* Check whether response comes from the same network address to which the
|
||||
question was sent. (RFC 5452) */
|
||||
if (!ip_addr_cmp(addr, &dns_servers[entry->server_idx])) {
|
||||
if (!ip_addr_eq(addr, &dns_servers[entry->server_idx])) {
|
||||
goto ignore_packet; /* ignore this packet */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,10 +378,10 @@ acd_arp_reply(struct netif *netif, struct etharp_hdr *hdr)
|
||||
* OR
|
||||
* ip.dst == ipaddr && hw.src != own hwaddr (someone else is probing it)
|
||||
*/
|
||||
if ((ip4_addr_cmp(&sipaddr, &acd->ipaddr)) ||
|
||||
if ((ip4_addr_eq(&sipaddr, &acd->ipaddr)) ||
|
||||
(ip4_addr_isany_val(sipaddr) &&
|
||||
ip4_addr_cmp(&dipaddr, &acd->ipaddr) &&
|
||||
!eth_addr_cmp(&netifaddr, &hdr->shwaddr))) {
|
||||
ip4_addr_eq(&dipaddr, &acd->ipaddr) &&
|
||||
!eth_addr_eq(&netifaddr, &hdr->shwaddr))) {
|
||||
LWIP_DEBUGF(ACD_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_LEVEL_WARNING,
|
||||
("acd_arp_reply(): Probe Conflict detected\n"));
|
||||
acd_restart(netif, acd);
|
||||
@@ -395,8 +395,8 @@ acd_arp_reply(struct netif *netif, struct etharp_hdr *hdr)
|
||||
* in any state we have a conflict if
|
||||
* ip.src == ipaddr && hw.src != own hwaddr (someone is using our address)
|
||||
*/
|
||||
if (ip4_addr_cmp(&sipaddr, &acd->ipaddr) &&
|
||||
!eth_addr_cmp(&netifaddr, &hdr->shwaddr)) {
|
||||
if (ip4_addr_eq(&sipaddr, &acd->ipaddr) &&
|
||||
!eth_addr_eq(&netifaddr, &hdr->shwaddr)) {
|
||||
LWIP_DEBUGF(ACD_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_LEVEL_WARNING,
|
||||
("acd_arp_reply(): Conflicting ARP-Packet detected\n"));
|
||||
acd_handle_arp_conflict(netif, acd);
|
||||
@@ -513,7 +513,7 @@ acd_netif_ip_addr_changed(struct netif *netif, const ip_addr_t *old_addr,
|
||||
|
||||
ACD_FOREACH(acd, netif->acd_list) {
|
||||
/* Find ACD module of old address */
|
||||
if(ip4_addr_cmp(&acd->ipaddr, ip_2_ip4(old_addr))) {
|
||||
if(ip4_addr_eq(&acd->ipaddr, ip_2_ip4(old_addr))) {
|
||||
/* Did we change from a LL address to a routable address? */
|
||||
if (ip_addr_islinklocal(old_addr) && !ip_addr_islinklocal(new_addr)) {
|
||||
LWIP_DEBUGF(ACD_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
|
||||
|
||||
@@ -363,7 +363,7 @@ autoip_supplied_address(struct netif *netif)
|
||||
{
|
||||
struct autoip *autoip = netif_autoip_data(netif);
|
||||
return (autoip != NULL)
|
||||
&& (ip4_addr_cmp(netif_ip4_addr(netif), &(autoip->llipaddr)))
|
||||
&& (ip4_addr_eq(netif_ip4_addr(netif), &(autoip->llipaddr)))
|
||||
&& (autoip->state == AUTOIP_STATE_BOUND);
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ autoip_accept_packet(struct netif *netif, const ip4_addr_t *addr)
|
||||
{
|
||||
struct autoip *autoip = netif_autoip_data(netif);
|
||||
return (autoip != NULL)
|
||||
&& (ip4_addr_cmp(addr, &(autoip->llipaddr)))
|
||||
&& (ip4_addr_eq(addr, &(autoip->llipaddr)))
|
||||
&& (autoip->state == AUTOIP_STATE_BOUND);
|
||||
}
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ etharp_find_entry(const ip4_addr_t *ipaddr, u8_t flags, struct netif *netif)
|
||||
LWIP_ASSERT("state == ETHARP_STATE_PENDING || state >= ETHARP_STATE_STABLE",
|
||||
state == ETHARP_STATE_PENDING || state >= ETHARP_STATE_STABLE);
|
||||
/* if given, does IP address match IP address in ARP entry? */
|
||||
if (ipaddr && ip4_addr_cmp(ipaddr, &arp_table[i].ipaddr)
|
||||
if (ipaddr && ip4_addr_eq(ipaddr, &arp_table[i].ipaddr)
|
||||
#if ETHARP_TABLE_MATCH_NETIF
|
||||
&& ((netif == NULL) || (netif == arp_table[i].netif))
|
||||
#endif /* ETHARP_TABLE_MATCH_NETIF */
|
||||
@@ -689,9 +689,9 @@ etharp_input(struct pbuf *p, struct netif *netif)
|
||||
from_us = 0;
|
||||
} else {
|
||||
/* ARP packet directed to us? */
|
||||
for_us = (u8_t)ip4_addr_cmp(&dipaddr, netif_ip4_addr(netif));
|
||||
for_us = (u8_t)ip4_addr_eq(&dipaddr, netif_ip4_addr(netif));
|
||||
/* ARP packet from us? */
|
||||
from_us = (u8_t)ip4_addr_cmp(&sipaddr, netif_ip4_addr(netif));
|
||||
from_us = (u8_t)ip4_addr_eq(&sipaddr, netif_ip4_addr(netif));
|
||||
}
|
||||
|
||||
/* ARP message directed to us?
|
||||
@@ -823,7 +823,7 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
|
||||
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)) &&
|
||||
if (!ip4_addr_net_eq(ipaddr, netif_ip4_addr(netif), netif_ip4_netmask(netif)) &&
|
||||
!ip4_addr_islinklocal(ipaddr)) {
|
||||
#if LWIP_AUTOIP
|
||||
struct ip_hdr *iphdr = LWIP_ALIGNMENT_CAST(struct ip_hdr *, q->payload);
|
||||
@@ -863,7 +863,7 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
|
||||
#if ETHARP_TABLE_MATCH_NETIF
|
||||
(arp_table[etharp_cached_entry].netif == netif) &&
|
||||
#endif
|
||||
(ip4_addr_cmp(dst_addr, &arp_table[etharp_cached_entry].ipaddr))) {
|
||||
(ip4_addr_eq(dst_addr, &arp_table[etharp_cached_entry].ipaddr))) {
|
||||
/* the per-pcb-cached entry is stable and the right one! */
|
||||
ETHARP_STATS_INC(etharp.cachehit);
|
||||
return etharp_output_to_arp_index(netif, q, etharp_cached_entry);
|
||||
@@ -880,7 +880,7 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
|
||||
#if ETHARP_TABLE_MATCH_NETIF
|
||||
(arp_table[i].netif == netif) &&
|
||||
#endif
|
||||
(ip4_addr_cmp(dst_addr, &arp_table[i].ipaddr))) {
|
||||
(ip4_addr_eq(dst_addr, &arp_table[i].ipaddr))) {
|
||||
/* found an existing, stable entry */
|
||||
ETHARP_SET_ADDRHINT(netif, i);
|
||||
return etharp_output_to_arp_index(netif, q, i);
|
||||
|
||||
@@ -220,7 +220,7 @@ igmp_lookfor_group(struct netif *ifp, const ip4_addr_t *addr)
|
||||
struct igmp_group *group = netif_igmp_data(ifp);
|
||||
|
||||
while (group != NULL) {
|
||||
if (ip4_addr_cmp(&(group->group_address), addr)) {
|
||||
if (ip4_addr_eq(&(group->group_address), addr)) {
|
||||
return group;
|
||||
}
|
||||
group = group->next;
|
||||
@@ -266,13 +266,13 @@ igmp_lookup_group(struct netif *ifp, const ip4_addr_t *addr)
|
||||
if (list_head == NULL) {
|
||||
/* this is the first entry in linked list */
|
||||
LWIP_ASSERT("igmp_lookup_group: first group must be allsystems",
|
||||
(ip4_addr_cmp(addr, &allsystems) != 0));
|
||||
(ip4_addr_eq(addr, &allsystems) != 0));
|
||||
group->next = NULL;
|
||||
netif_set_client_data(ifp, LWIP_NETIF_CLIENT_DATA_INDEX_IGMP, group);
|
||||
} else {
|
||||
/* append _after_ first entry */
|
||||
LWIP_ASSERT("igmp_lookup_group: all except first group must not be allsystems",
|
||||
(ip4_addr_cmp(addr, &allsystems) == 0));
|
||||
(ip4_addr_eq(addr, &allsystems) == 0));
|
||||
group->next = list_head->next;
|
||||
list_head->next = group;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest)
|
||||
switch (igmp->igmp_msgtype) {
|
||||
case IGMP_MEMB_QUERY:
|
||||
/* IGMP_MEMB_QUERY to the "all systems" address ? */
|
||||
if ((ip4_addr_cmp(dest, &allsystems)) && ip4_addr_isany(&igmp->igmp_group_address)) {
|
||||
if ((ip4_addr_eq(dest, &allsystems)) && ip4_addr_isany(&igmp->igmp_group_address)) {
|
||||
/* THIS IS THE GENERAL QUERY */
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: General IGMP_MEMB_QUERY on \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp)));
|
||||
|
||||
@@ -395,7 +395,7 @@ igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest)
|
||||
if (!ip4_addr_isany(&igmp->igmp_group_address)) {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_MEMB_QUERY to a specific group "));
|
||||
ip4_addr_debug_print_val(IGMP_DEBUG, igmp->igmp_group_address);
|
||||
if (ip4_addr_cmp(dest, &allsystems)) {
|
||||
if (ip4_addr_eq(dest, &allsystems)) {
|
||||
ip4_addr_t groupaddr;
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" using \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp)));
|
||||
/* we first need to re-look for the group since we used dest last time */
|
||||
@@ -455,12 +455,12 @@ igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
|
||||
|
||||
/* make sure it is multicast address */
|
||||
LWIP_ERROR("igmp_joingroup: attempt to join non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
||||
LWIP_ERROR("igmp_joingroup: attempt to join allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
||||
LWIP_ERROR("igmp_joingroup: attempt to join allsystems address", (!ip4_addr_eq(groupaddr, &allsystems)), return ERR_VAL;);
|
||||
|
||||
/* loop through netif's */
|
||||
NETIF_FOREACH(netif) {
|
||||
/* Should we join this interface ? */
|
||||
if ((netif->flags & NETIF_FLAG_IGMP) && ((ip4_addr_isany(ifaddr) || ip4_addr_cmp(netif_ip4_addr(netif), ifaddr)))) {
|
||||
if ((netif->flags & NETIF_FLAG_IGMP) && ((ip4_addr_isany(ifaddr) || ip4_addr_eq(netif_ip4_addr(netif), ifaddr)))) {
|
||||
err = igmp_joingroup_netif(netif, groupaddr);
|
||||
if (err != ERR_OK) {
|
||||
/* Return an error even if some network interfaces are joined */
|
||||
@@ -490,7 +490,7 @@ igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr)
|
||||
|
||||
/* make sure it is multicast address */
|
||||
LWIP_ERROR("igmp_joingroup_netif: attempt to join non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
||||
LWIP_ERROR("igmp_joingroup_netif: attempt to join allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
||||
LWIP_ERROR("igmp_joingroup_netif: attempt to join allsystems address", (!ip4_addr_eq(groupaddr, &allsystems)), return ERR_VAL;);
|
||||
|
||||
/* make sure it is an igmp-enabled netif */
|
||||
LWIP_ERROR("igmp_joingroup_netif: attempt to join on non-IGMP netif", netif->flags & NETIF_FLAG_IGMP, return ERR_VAL;);
|
||||
@@ -552,12 +552,12 @@ igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
|
||||
|
||||
/* make sure it is multicast address */
|
||||
LWIP_ERROR("igmp_leavegroup: attempt to leave non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
||||
LWIP_ERROR("igmp_leavegroup: attempt to leave allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
||||
LWIP_ERROR("igmp_leavegroup: attempt to leave allsystems address", (!ip4_addr_eq(groupaddr, &allsystems)), return ERR_VAL;);
|
||||
|
||||
/* loop through netif's */
|
||||
NETIF_FOREACH(netif) {
|
||||
/* Should we leave this interface ? */
|
||||
if ((netif->flags & NETIF_FLAG_IGMP) && ((ip4_addr_isany(ifaddr) || ip4_addr_cmp(netif_ip4_addr(netif), ifaddr)))) {
|
||||
if ((netif->flags & NETIF_FLAG_IGMP) && ((ip4_addr_isany(ifaddr) || ip4_addr_eq(netif_ip4_addr(netif), ifaddr)))) {
|
||||
err_t res = igmp_leavegroup_netif(netif, groupaddr);
|
||||
if (err != ERR_OK) {
|
||||
/* Store this result if we have not yet gotten a success */
|
||||
@@ -586,7 +586,7 @@ igmp_leavegroup_netif(struct netif *netif, const ip4_addr_t *groupaddr)
|
||||
|
||||
/* make sure it is multicast address */
|
||||
LWIP_ERROR("igmp_leavegroup_netif: attempt to leave non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
||||
LWIP_ERROR("igmp_leavegroup_netif: attempt to leave allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
||||
LWIP_ERROR("igmp_leavegroup_netif: attempt to leave allsystems address", (!ip4_addr_eq(groupaddr, &allsystems)), return ERR_VAL;);
|
||||
|
||||
/* make sure it is an igmp-enabled netif */
|
||||
LWIP_ERROR("igmp_leavegroup_netif: attempt to leave on non-IGMP netif", netif->flags & NETIF_FLAG_IGMP, return ERR_VAL;);
|
||||
@@ -669,7 +669,7 @@ igmp_timeout(struct netif *netif, struct igmp_group *group)
|
||||
/* If the state is IGMP_GROUP_DELAYING_MEMBER then we send a report for this group
|
||||
(unless it is the allsystems group) */
|
||||
if ((group->group_state == IGMP_GROUP_DELAYING_MEMBER) &&
|
||||
(!(ip4_addr_cmp(&(group->group_address), &allsystems)))) {
|
||||
(!(ip4_addr_eq(&(group->group_address), &allsystems)))) {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_timeout: report membership for group with address "));
|
||||
ip4_addr_debug_print_val(IGMP_DEBUG, group->group_address);
|
||||
LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", (void *)netif));
|
||||
|
||||
@@ -171,12 +171,12 @@ ip4_route(const ip4_addr_t *dest)
|
||||
/* is the netif up, does it have a link and a valid address? */
|
||||
if (netif_is_up(netif) && netif_is_link_up(netif) && !ip4_addr_isany_val(*netif_ip4_addr(netif))) {
|
||||
/* network mask matches? */
|
||||
if (ip4_addr_netcmp(dest, netif_ip4_addr(netif), netif_ip4_netmask(netif))) {
|
||||
if (ip4_addr_net_eq(dest, netif_ip4_addr(netif), netif_ip4_netmask(netif))) {
|
||||
/* return netif on which to forward IP packet */
|
||||
return netif;
|
||||
}
|
||||
/* gateway matches on a non broadcast interface? (i.e. peer in a point to point interface) */
|
||||
if (((netif->flags & NETIF_FLAG_BROADCAST) == 0) && ip4_addr_cmp(dest, netif_ip4_gw(netif))) {
|
||||
if (((netif->flags & NETIF_FLAG_BROADCAST) == 0) && ip4_addr_eq(dest, netif_ip4_gw(netif))) {
|
||||
/* return netif on which to forward IP packet */
|
||||
return netif;
|
||||
}
|
||||
@@ -416,7 +416,7 @@ ip4_input_accept(struct netif *netif)
|
||||
/* interface is up and configured? */
|
||||
if ((netif_is_up(netif)) && (!ip4_addr_isany_val(*netif_ip4_addr(netif)))) {
|
||||
/* unicast to this interface address? */
|
||||
if (ip4_addr_cmp(ip4_current_dest_addr(), netif_ip4_addr(netif)) ||
|
||||
if (ip4_addr_eq(ip4_current_dest_addr(), netif_ip4_addr(netif)) ||
|
||||
/* or broadcast on this interface network address? */
|
||||
ip4_addr_isbroadcast(ip4_current_dest_addr(), netif)
|
||||
#if LWIP_NETIF_LOOPBACK && !LWIP_HAVE_LOOPIF
|
||||
@@ -556,7 +556,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
/* IGMP snooping switches need 0.0.0.0 to be allowed as source address (RFC 4541) */
|
||||
ip4_addr_t allsystems;
|
||||
IP4_ADDR(&allsystems, 224, 0, 0, 1);
|
||||
if (ip4_addr_cmp(ip4_current_dest_addr(), &allsystems) &&
|
||||
if (ip4_addr_eq(ip4_current_dest_addr(), &allsystems) &&
|
||||
ip4_addr_isany(ip4_current_src_addr())) {
|
||||
check_ip_src = 0;
|
||||
}
|
||||
@@ -1015,7 +1015,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
ip4_debug_print(p);
|
||||
|
||||
#if ENABLE_LOOPBACK
|
||||
if (ip4_addr_cmp(dest, netif_ip4_addr(netif))
|
||||
if (ip4_addr_eq(dest, netif_ip4_addr(netif))
|
||||
#if !LWIP_HAVE_LOOPIF
|
||||
|| ip4_addr_isloopback(dest)
|
||||
#endif /* !LWIP_HAVE_LOOPIF */
|
||||
|
||||
@@ -73,7 +73,7 @@ ip4_addr_isbroadcast_u32(u32_t addr, const struct netif *netif)
|
||||
} else if (addr == ip4_addr_get_u32(netif_ip4_addr(netif))) {
|
||||
return 0;
|
||||
/* on the same (sub) network... */
|
||||
} else if (ip4_addr_netcmp(&ipaddr, netif_ip4_addr(netif), netif_ip4_netmask(netif))
|
||||
} else if (ip4_addr_net_eq(&ipaddr, netif_ip4_addr(netif), netif_ip4_netmask(netif))
|
||||
/* ...and host identifier bits are all ones? =>... */
|
||||
&& ((addr & ~ip4_addr_get_u32(netif_ip4_netmask(netif))) ==
|
||||
(IPADDR_BROADCAST & ~ip4_addr_get_u32(netif_ip4_netmask(netif))))) {
|
||||
|
||||
@@ -106,8 +106,8 @@ PACK_STRUCT_END
|
||||
#endif
|
||||
|
||||
#define IP_ADDRESSES_AND_ID_MATCH(iphdrA, iphdrB) \
|
||||
(ip4_addr_cmp(&(iphdrA)->src, &(iphdrB)->src) && \
|
||||
ip4_addr_cmp(&(iphdrA)->dest, &(iphdrB)->dest) && \
|
||||
(ip4_addr_eq(&(iphdrA)->src, &(iphdrB)->src) && \
|
||||
ip4_addr_eq(&(iphdrA)->dest, &(iphdrB)->dest) && \
|
||||
IPH_ID(iphdrA) == IPH_ID(iphdrB)) ? 1 : 0
|
||||
|
||||
/* global variables */
|
||||
|
||||
@@ -166,7 +166,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
||||
}
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
ip6_addr_cmp_zoneless(src, netif_ip6_addr(netif, i))) {
|
||||
ip6_addr_zoneless_eq(src, netif_ip6_addr(netif, i))) {
|
||||
return netif;
|
||||
}
|
||||
}
|
||||
@@ -199,9 +199,9 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
||||
}
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
ip6_addr_netcmp(dest, netif_ip6_addr(netif, i)) &&
|
||||
ip6_addr_net_eq(dest, netif_ip6_addr(netif, i)) &&
|
||||
(netif_ip6_addr_isstatic(netif, i) ||
|
||||
ip6_addr_nethostcmp(dest, netif_ip6_addr(netif, i)))) {
|
||||
ip6_addr_nethost_eq(dest, netif_ip6_addr(netif, i)))) {
|
||||
return netif;
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
||||
}
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
ip6_addr_cmp(src, netif_ip6_addr(netif, i))) {
|
||||
ip6_addr_eq(src, netif_ip6_addr(netif, i))) {
|
||||
return netif;
|
||||
}
|
||||
}
|
||||
@@ -332,8 +332,8 @@ ip6_select_source_address(struct netif *netif, const ip6_addr_t *dest)
|
||||
/* @todo compute the actual common bits, for longest matching prefix. */
|
||||
/* We cannot count on the destination address having a proper zone
|
||||
* assignment, so do not compare zones in this case. */
|
||||
cand_bits = ip6_addr_netcmp_zoneless(cand_addr, dest); /* just 1 or 0 for now */
|
||||
if (cand_bits && ip6_addr_nethostcmp(cand_addr, dest)) {
|
||||
cand_bits = ip6_addr_net_zoneless_eq(cand_addr, dest); /* just 1 or 0 for now */
|
||||
if (cand_bits && ip6_addr_nethost_eq(cand_addr, dest)) {
|
||||
return netif_ip_addr6(netif, i); /* Rule 1 */
|
||||
}
|
||||
if ((best_addr == NULL) || /* no alternative yet */
|
||||
@@ -477,7 +477,7 @@ ip6_input_accept(struct netif *netif)
|
||||
* scope as well (e.g., is this interface on the same link?). */
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
ip6_addr_cmp(ip6_current_dest_addr(), netif_ip6_addr(netif, i))
|
||||
ip6_addr_eq(ip6_current_dest_addr(), netif_ip6_addr(netif, i))
|
||||
#if IPV6_CUSTOM_SCOPES
|
||||
&& (!ip6_addr_has_zone(ip6_current_src_addr()) ||
|
||||
ip6_addr_test_zone(ip6_current_src_addr(), netif))
|
||||
@@ -611,7 +611,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
||||
netif = NULL;
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(inp, i)) &&
|
||||
ip6_addr_cmp_solicitednode(ip6_current_dest_addr(), netif_ip6_addr(inp, i))) {
|
||||
ip6_addr_solicitednode_eq(ip6_current_dest_addr(), netif_ip6_addr(inp, i))) {
|
||||
netif = inp;
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: solicited node packet accepted on interface %c%c\n",
|
||||
netif->name[0], netif->name[1]));
|
||||
@@ -1245,7 +1245,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
#endif /* !LWIP_HAVE_LOOPIF */
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
ip6_addr_cmp(dest, netif_ip6_addr(netif, i))) {
|
||||
ip6_addr_eq(dest, netif_ip6_addr(netif, i))) {
|
||||
/* Packet to self, enqueue it for loopback */
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("netif_loop_output()\n"));
|
||||
return netif_loop_output(netif, p);
|
||||
|
||||
@@ -320,8 +320,8 @@ ip6_reass(struct pbuf *p)
|
||||
in the reassembly buffer. If so, we proceed with copying the
|
||||
fragment into the buffer. */
|
||||
if ((frag_hdr->_identification == ipr->identification) &&
|
||||
ip6_addr_cmp_packed(ip6_current_src_addr(), &(IPV6_FRAG_SRC(ipr)), ipr->src_zone) &&
|
||||
ip6_addr_cmp_packed(ip6_current_dest_addr(), &(IPV6_FRAG_DEST(ipr)), ipr->dest_zone)) {
|
||||
ip6_addr_packed_eq(ip6_current_src_addr(), &(IPV6_FRAG_SRC(ipr)), ipr->src_zone) &&
|
||||
ip6_addr_packed_eq(ip6_current_dest_addr(), &(IPV6_FRAG_DEST(ipr)), ipr->dest_zone)) {
|
||||
IP6_FRAG_STATS_INC(ip6_frag.cachehit);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ mld6_lookfor_group(struct netif *ifp, const ip6_addr_t *addr)
|
||||
struct mld_group *group = netif_mld6_data(ifp);
|
||||
|
||||
while (group != NULL) {
|
||||
if (ip6_addr_cmp(&(group->group_address), addr)) {
|
||||
if (ip6_addr_eq(&(group->group_address), addr)) {
|
||||
return group;
|
||||
}
|
||||
group = group->next;
|
||||
|
||||
@@ -225,7 +225,7 @@ nd6_process_autoconfig_prefix(struct netif *netif,
|
||||
for (i = 1; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
addr_state = netif_ip6_addr_state(netif, i);
|
||||
if (!ip6_addr_isinvalid(addr_state) && !netif_ip6_addr_isstatic(netif, i) &&
|
||||
ip6_addr_netcmp(prefix_addr, netif_ip6_addr(netif, i))) {
|
||||
ip6_addr_net_eq(prefix_addr, netif_ip6_addr(netif, i))) {
|
||||
/* Update the valid lifetime, as per RFC 4862 Sec. 5.5.3 point (e).
|
||||
* The valid lifetime will never drop to zero as a result of this. */
|
||||
u32_t remaining_life = netif_ip6_addr_valid_life(netif, i);
|
||||
@@ -273,7 +273,7 @@ nd6_process_autoconfig_prefix(struct netif *netif,
|
||||
free_idx = 0;
|
||||
for (i = 1; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (!ip6_addr_isinvalid(netif_ip6_addr_state(netif, i))) {
|
||||
if (ip6_addr_cmp(&ip6addr, netif_ip6_addr(netif, i))) {
|
||||
if (ip6_addr_eq(&ip6addr, netif_ip6_addr(netif, i))) {
|
||||
return; /* formed address already exists */
|
||||
}
|
||||
} else if (free_idx == 0) {
|
||||
@@ -353,7 +353,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (!ip6_addr_isinvalid(netif_ip6_addr_state(inp, i)) &&
|
||||
!ip6_addr_isduplicated(netif_ip6_addr_state(inp, i)) &&
|
||||
ip6_addr_cmp(&target_address, netif_ip6_addr(inp, i))) {
|
||||
ip6_addr_eq(&target_address, netif_ip6_addr(inp, i))) {
|
||||
/* We are using a duplicate address. */
|
||||
nd6_duplicate_addr_detected(inp, i);
|
||||
|
||||
@@ -490,7 +490,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
if ((ip6_addr_isvalid(netif_ip6_addr_state(inp, i)) ||
|
||||
(ip6_addr_istentative(netif_ip6_addr_state(inp, i)) &&
|
||||
ip6_addr_isany(ip6_current_src_addr()))) &&
|
||||
ip6_addr_cmp(&target_address, netif_ip6_addr(inp, i))) {
|
||||
ip6_addr_eq(&target_address, netif_ip6_addr(inp, i))) {
|
||||
accepted = 1;
|
||||
break;
|
||||
}
|
||||
@@ -507,7 +507,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
/* Sender is validating this address. */
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; ++i) {
|
||||
if (!ip6_addr_isinvalid(netif_ip6_addr_state(inp, i)) &&
|
||||
ip6_addr_cmp(&target_address, netif_ip6_addr(inp, i))) {
|
||||
ip6_addr_eq(&target_address, netif_ip6_addr(inp, i))) {
|
||||
/* Send a NA back so that the sender does not use this address. */
|
||||
nd6_send_na(inp, netif_ip6_addr(inp, i), ND6_FLAG_OVERRIDE | ND6_SEND_FLAG_ALLNODES_DEST);
|
||||
if (ip6_addr_istentative(netif_ip6_addr_state(inp, i))) {
|
||||
@@ -797,7 +797,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
u8_t s;
|
||||
for (s = 0; s < DNS_MAX_SERVERS; s++) {
|
||||
const ip_addr_t *addr = dns_getserver(s);
|
||||
if(ip_addr_cmp(addr, &rdnss_address)) {
|
||||
if(ip_addr_eq(addr, &rdnss_address)) {
|
||||
dns_setserver(s, NULL);
|
||||
}
|
||||
}
|
||||
@@ -1047,7 +1047,7 @@ nd6_tmr(void)
|
||||
* its destination cache entries, as per RFC 4861 Sec. 5.3 and 6.3.5. */
|
||||
s8_t j;
|
||||
for (j = 0; j < LWIP_ND6_NUM_DESTINATIONS; j++) {
|
||||
if (ip6_addr_cmp(&destination_cache[j].next_hop_addr,
|
||||
if (ip6_addr_eq(&destination_cache[j].next_hop_addr,
|
||||
&default_router_list[i].neighbor_entry->next_hop_address)) {
|
||||
ip6_addr_set_any(&destination_cache[j].destination_addr);
|
||||
}
|
||||
@@ -1206,7 +1206,7 @@ nd6_send_ns(struct netif *netif, const ip6_addr_t *target_addr, u8_t flags)
|
||||
int i;
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
ip6_addr_netcmp(target_addr, netif_ip6_addr(netif, i))) {
|
||||
ip6_addr_net_eq(target_addr, netif_ip6_addr(netif, i))) {
|
||||
src_addr = netif_ip6_addr(netif, i);
|
||||
break;
|
||||
}
|
||||
@@ -1429,7 +1429,7 @@ nd6_find_neighbor_cache_entry(const ip6_addr_t *ip6addr)
|
||||
{
|
||||
s8_t i;
|
||||
for (i = 0; i < LWIP_ND6_NUM_NEIGHBORS; i++) {
|
||||
if (ip6_addr_cmp(ip6addr, &(neighbor_cache[i].next_hop_address))) {
|
||||
if (ip6_addr_eq(ip6addr, &(neighbor_cache[i].next_hop_address))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1591,7 +1591,7 @@ nd6_find_destination_cache_entry(const ip6_addr_t *ip6addr)
|
||||
IP6_ADDR_ZONECHECK(ip6addr);
|
||||
|
||||
for (i = 0; i < LWIP_ND6_NUM_DESTINATIONS; i++) {
|
||||
if (ip6_addr_cmp(ip6addr, &(destination_cache[i].destination_addr))) {
|
||||
if (ip6_addr_eq(ip6addr, &(destination_cache[i].destination_addr))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1662,7 +1662,7 @@ nd6_is_prefix_in_netif(const ip6_addr_t *ip6addr, struct netif *netif)
|
||||
for (i = 0; i < LWIP_ND6_NUM_PREFIXES; i++) {
|
||||
if ((prefix_list[i].netif == netif) &&
|
||||
(prefix_list[i].invalidation_timer > 0) &&
|
||||
ip6_addr_netcmp(ip6addr, &(prefix_list[i].prefix))) {
|
||||
ip6_addr_net_eq(ip6addr, &(prefix_list[i].prefix))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1673,7 +1673,7 @@ nd6_is_prefix_in_netif(const ip6_addr_t *ip6addr, struct netif *netif)
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
netif_ip6_addr_isstatic(netif, i) &&
|
||||
ip6_addr_netcmp(ip6addr, netif_ip6_addr(netif, i))) {
|
||||
ip6_addr_net_eq(ip6addr, netif_ip6_addr(netif, i))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1777,7 +1777,7 @@ nd6_find_route(const ip6_addr_t *ip6addr)
|
||||
* matches. Pick the first one that is associated with a suitable netif. */
|
||||
for (i = 0; i < LWIP_ND6_NUM_PREFIXES; ++i) {
|
||||
netif = prefix_list[i].netif;
|
||||
if ((netif != NULL) && ip6_addr_netcmp(&prefix_list[i].prefix, ip6addr) &&
|
||||
if ((netif != NULL) && ip6_addr_net_eq(&prefix_list[i].prefix, ip6addr) &&
|
||||
netif_is_up(netif) && netif_is_link_up(netif)) {
|
||||
return netif;
|
||||
}
|
||||
@@ -1812,7 +1812,7 @@ nd6_get_router(const ip6_addr_t *router_addr, struct netif *netif)
|
||||
for (i = 0; i < LWIP_ND6_NUM_ROUTERS; i++) {
|
||||
if ((default_router_list[i].neighbor_entry != NULL) &&
|
||||
((netif != NULL) ? netif == default_router_list[i].neighbor_entry->netif : 1) &&
|
||||
ip6_addr_cmp(router_addr, &(default_router_list[i].neighbor_entry->next_hop_address))) {
|
||||
ip6_addr_eq(router_addr, &(default_router_list[i].neighbor_entry->next_hop_address))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1898,7 +1898,7 @@ nd6_get_onlink_prefix(const ip6_addr_t *prefix, struct netif *netif)
|
||||
|
||||
/* Look for prefix in list. */
|
||||
for (i = 0; i < LWIP_ND6_NUM_PREFIXES; ++i) {
|
||||
if ((ip6_addr_netcmp(&(prefix_list[i].prefix), prefix)) &&
|
||||
if ((ip6_addr_net_eq(&(prefix_list[i].prefix), prefix)) &&
|
||||
(prefix_list[i].netif == netif)) {
|
||||
return i;
|
||||
}
|
||||
@@ -1973,7 +1973,7 @@ nd6_get_next_hop_entry(const ip6_addr_t *ip6addr, struct netif *netif)
|
||||
|
||||
/* Look for ip6addr in destination cache. */
|
||||
dest = &destination_cache[nd6_cached_destination_index];
|
||||
if (ip6_addr_cmp(ip6addr, &dest->destination_addr)) {
|
||||
if (ip6_addr_eq(ip6addr, &dest->destination_addr)) {
|
||||
/* the cached entry index is the right one! */
|
||||
/* do nothing. */
|
||||
ND6_STATS_INC(nd6.cachehit);
|
||||
@@ -2034,7 +2034,7 @@ nd6_get_next_hop_entry(const ip6_addr_t *ip6addr, struct netif *netif)
|
||||
}
|
||||
|
||||
/* Look in neighbor cache for the next-hop address. */
|
||||
if (ip6_addr_cmp(&dest->next_hop_addr,
|
||||
if (ip6_addr_eq(&dest->next_hop_addr,
|
||||
&(neighbor_cache[dest->cached_neighbor_idx].next_hop_address))) {
|
||||
/* Cache hit. */
|
||||
/* Do nothing. */
|
||||
@@ -2360,7 +2360,7 @@ nd6_reachability_hint(const ip6_addr_t *ip6addr)
|
||||
struct nd6_destination_cache_entry *dest;
|
||||
|
||||
/* Find destination in cache. */
|
||||
if (ip6_addr_cmp(ip6addr, &(destination_cache[nd6_cached_destination_index].destination_addr))) {
|
||||
if (ip6_addr_eq(ip6addr, &(destination_cache[nd6_cached_destination_index].destination_addr))) {
|
||||
dst_idx = nd6_cached_destination_index;
|
||||
ND6_STATS_INC(nd6.cachehit);
|
||||
} else {
|
||||
@@ -2372,7 +2372,7 @@ nd6_reachability_hint(const ip6_addr_t *ip6addr)
|
||||
|
||||
/* Find next hop neighbor in cache. */
|
||||
dest = &destination_cache[dst_idx];
|
||||
if (ip6_addr_cmp(&dest->next_hop_addr, &(neighbor_cache[dest->cached_neighbor_idx].next_hop_address))) {
|
||||
if (ip6_addr_eq(&dest->next_hop_addr, &(neighbor_cache[dest->cached_neighbor_idx].next_hop_address))) {
|
||||
i = dest->cached_neighbor_idx;
|
||||
ND6_STATS_INC(nd6.cachehit);
|
||||
} else {
|
||||
|
||||
@@ -477,7 +477,7 @@ netif_do_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr, ip_addr_t *ol
|
||||
LWIP_ASSERT("invalid pointer", old_addr != NULL);
|
||||
|
||||
/* address is actually being changed? */
|
||||
if (ip4_addr_cmp(ipaddr, netif_ip4_addr(netif)) == 0) {
|
||||
if (ip4_addr_eq(ipaddr, netif_ip4_addr(netif)) == 0) {
|
||||
ip_addr_t new_addr;
|
||||
*ip_2_ip4(&new_addr) = *ipaddr;
|
||||
IP_SET_TYPE_VAL(new_addr, IPADDR_TYPE_V4);
|
||||
@@ -544,7 +544,7 @@ static int
|
||||
netif_do_set_netmask(struct netif *netif, const ip4_addr_t *netmask, ip_addr_t *old_nm)
|
||||
{
|
||||
/* address is actually being changed? */
|
||||
if (ip4_addr_cmp(netmask, netif_ip4_netmask(netif)) == 0) {
|
||||
if (ip4_addr_eq(netmask, netif_ip4_netmask(netif)) == 0) {
|
||||
#if LWIP_NETIF_EXT_STATUS_CALLBACK
|
||||
LWIP_ASSERT("invalid pointer", old_nm != NULL);
|
||||
ip_addr_copy(*old_nm, *netif_ip_netmask4(netif));
|
||||
@@ -608,7 +608,7 @@ static int
|
||||
netif_do_set_gw(struct netif *netif, const ip4_addr_t *gw, ip_addr_t *old_gw)
|
||||
{
|
||||
/* address is actually being changed? */
|
||||
if (ip4_addr_cmp(gw, netif_ip4_gw(netif)) == 0) {
|
||||
if (ip4_addr_eq(gw, netif_ip4_gw(netif)) == 0) {
|
||||
#if LWIP_NETIF_EXT_STATUS_CALLBACK
|
||||
LWIP_ASSERT("invalid pointer", old_gw != NULL);
|
||||
ip_addr_copy(*old_gw, *netif_ip_gw4(netif));
|
||||
@@ -1532,7 +1532,7 @@ netif_get_ip6_addr_match(struct netif *netif, const ip6_addr_t *ip6addr)
|
||||
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
if (!ip6_addr_isinvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
ip6_addr_cmp_zoneless(netif_ip6_addr(netif, i), ip6addr)) {
|
||||
ip6_addr_zoneless_eq(netif_ip6_addr(netif, i), ip6addr)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1588,7 +1588,7 @@ netif_create_ip6_linklocal_address(struct netif *netif, u8_t from_mac_48bit)
|
||||
/* Set a link-local zone. Even though the zone is implied by the owning
|
||||
* netif, setting the zone anyway has two important conceptual advantages:
|
||||
* 1) it avoids the need for a ton of exceptions in internal code, allowing
|
||||
* e.g. ip6_addr_cmp() to be used on local addresses;
|
||||
* e.g. ip6_addr_eq() to be used on local addresses;
|
||||
* 2) the properly zoned address is visible externally, e.g. when any outside
|
||||
* code enumerates available addresses or uses one to bind a socket.
|
||||
* Any external code unaware of address scoping is likely to just ignore the
|
||||
|
||||
@@ -106,7 +106,7 @@ raw_input_local_match(struct raw_pcb *pcb, u8_t broadcast)
|
||||
#endif /* LWIP_IPV4 */
|
||||
/* Handle IPv4 and IPv6: catch all or exact match */
|
||||
if (ip_addr_isany(&pcb->local_ip) ||
|
||||
ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) {
|
||||
ip_addr_eq(&pcb->local_ip, ip_current_dest_addr())) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ raw_input(struct pbuf *p, struct netif *inp)
|
||||
while (pcb != NULL) {
|
||||
if ((pcb->protocol == proto) && raw_input_local_match(pcb, broadcast) &&
|
||||
(((pcb->flags & RAW_FLAGS_CONNECTED) == 0) ||
|
||||
ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()))) {
|
||||
ip_addr_eq(&pcb->remote_ip, ip_current_src_addr()))) {
|
||||
/* receive callback function available? */
|
||||
if (pcb->recv != NULL) {
|
||||
u8_t eaten;
|
||||
@@ -659,7 +659,7 @@ void raw_netif_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_a
|
||||
if (!ip_addr_isany(old_addr) && !ip_addr_isany(new_addr)) {
|
||||
for (rpcb = raw_pcbs; rpcb != NULL; rpcb = rpcb->next) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (ip_addr_cmp(&rpcb->local_ip, old_addr)) {
|
||||
if (ip_addr_eq(&rpcb->local_ip, old_addr)) {
|
||||
/* The PCB is bound to the old ipaddr and
|
||||
* is set to bound to the new one instead */
|
||||
ip_addr_copy(rpcb->local_ip, *new_addr);
|
||||
|
||||
@@ -728,7 +728,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
||||
if ((IP_IS_V6(ipaddr) == IP_IS_V6_VAL(cpcb->local_ip)) &&
|
||||
(ip_addr_isany(&cpcb->local_ip) ||
|
||||
ip_addr_isany(ipaddr) ||
|
||||
ip_addr_cmp(&cpcb->local_ip, ipaddr))) {
|
||||
ip_addr_eq(&cpcb->local_ip, ipaddr))) {
|
||||
return ERR_USE;
|
||||
}
|
||||
}
|
||||
@@ -871,7 +871,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
|
||||
this port is only used once for every local IP. */
|
||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||
if ((lpcb->local_port == pcb->local_port) &&
|
||||
ip_addr_cmp(&lpcb->local_ip, &pcb->local_ip)) {
|
||||
ip_addr_eq(&lpcb->local_ip, &pcb->local_ip)) {
|
||||
/* this address/port is already used */
|
||||
lpcb = NULL;
|
||||
res = ERR_USE;
|
||||
@@ -1134,8 +1134,8 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
|
||||
for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) {
|
||||
if ((cpcb->local_port == pcb->local_port) &&
|
||||
(cpcb->remote_port == port) &&
|
||||
ip_addr_cmp(&cpcb->local_ip, &pcb->local_ip) &&
|
||||
ip_addr_cmp(&cpcb->remote_ip, ipaddr)) {
|
||||
ip_addr_eq(&cpcb->local_ip, &pcb->local_ip) &&
|
||||
ip_addr_eq(&cpcb->remote_ip, ipaddr)) {
|
||||
/* linux returns EISCONN here, but ERR_USE should be OK for us */
|
||||
return ERR_USE;
|
||||
}
|
||||
@@ -2312,7 +2312,7 @@ tcp_netif_ip_addr_changed_pcblist(const ip_addr_t *old_addr, struct tcp_pcb *pcb
|
||||
|
||||
while (pcb != NULL) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (ip_addr_cmp(&pcb->local_ip, old_addr)
|
||||
if (ip_addr_eq(&pcb->local_ip, old_addr)
|
||||
#if LWIP_AUTOIP
|
||||
/* connections to link-local addresses must persist (RFC3927 ch. 1.9) */
|
||||
&& (!IP_IS_V4_VAL(pcb->local_ip) || !ip4_addr_islinklocal(ip_2_ip4(&pcb->local_ip)))
|
||||
@@ -2347,7 +2347,7 @@ tcp_netif_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
|
||||
/* PCB bound to current local interface address? */
|
||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (ip_addr_cmp(&lpcb->local_ip, old_addr)) {
|
||||
if (ip_addr_eq(&lpcb->local_ip, old_addr)) {
|
||||
/* The PCB is listening to the old ipaddr and
|
||||
* is set to listen to the new one instead */
|
||||
ip_addr_copy(lpcb->local_ip, *new_addr);
|
||||
|
||||
@@ -261,8 +261,8 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
if (pcb->remote_port == tcphdr->src &&
|
||||
pcb->local_port == tcphdr->dest &&
|
||||
ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()) &&
|
||||
ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) {
|
||||
ip_addr_eq(&pcb->remote_ip, ip_current_src_addr()) &&
|
||||
ip_addr_eq(&pcb->local_ip, ip_current_dest_addr())) {
|
||||
/* Move this PCB to the front of the list so that subsequent
|
||||
lookups will be faster (we exploit locality in TCP segment
|
||||
arrivals). */
|
||||
@@ -294,8 +294,8 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
if (pcb->remote_port == tcphdr->src &&
|
||||
pcb->local_port == tcphdr->dest &&
|
||||
ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()) &&
|
||||
ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) {
|
||||
ip_addr_eq(&pcb->remote_ip, ip_current_src_addr()) &&
|
||||
ip_addr_eq(&pcb->local_ip, ip_current_dest_addr())) {
|
||||
/* We don't really care enough to move this PCB to the front
|
||||
of the list since we are not very likely to receive that
|
||||
many segments for connections in TIME-WAIT. */
|
||||
@@ -333,7 +333,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
break;
|
||||
#endif /* SO_REUSE */
|
||||
} else if (IP_ADDR_PCB_VERSION_MATCH_EXACT(lpcb, ip_current_dest_addr())) {
|
||||
if (ip_addr_cmp(&lpcb->local_ip, ip_current_dest_addr())) {
|
||||
if (ip_addr_eq(&lpcb->local_ip, ip_current_dest_addr())) {
|
||||
/* found an exact match */
|
||||
break;
|
||||
} else if (ip_addr_isany(&lpcb->local_ip)) {
|
||||
|
||||
@@ -163,14 +163,14 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
|
||||
{
|
||||
if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip)) ||
|
||||
((ip4_current_dest_addr()->addr == IPADDR_BROADCAST)) ||
|
||||
ip4_addr_netcmp(ip_2_ip4(&pcb->local_ip), ip4_current_dest_addr(), netif_ip4_netmask(inp))) {
|
||||
ip4_addr_net_eq(ip_2_ip4(&pcb->local_ip), ip4_current_dest_addr(), netif_ip4_netmask(inp))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else
|
||||
#endif /* LWIP_IPV4 */
|
||||
/* Handle IPv4 and IPv6: all or exact match */
|
||||
if (ip_addr_isany(&pcb->local_ip) || ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) {
|
||||
if (ip_addr_isany(&pcb->local_ip) || ip_addr_eq(&pcb->local_ip, ip_current_dest_addr())) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -268,9 +268,9 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
#if LWIP_IPV4
|
||||
} else if (broadcast && ip4_current_dest_addr()->addr == IPADDR_BROADCAST) {
|
||||
/* global broadcast address (only valid for IPv4; match was checked before) */
|
||||
if (!IP_IS_V4_VAL(uncon_pcb->local_ip) || !ip4_addr_cmp(ip_2_ip4(&uncon_pcb->local_ip), netif_ip4_addr(inp))) {
|
||||
if (!IP_IS_V4_VAL(uncon_pcb->local_ip) || !ip4_addr_eq(ip_2_ip4(&uncon_pcb->local_ip), netif_ip4_addr(inp))) {
|
||||
/* uncon_pcb does not match the input netif, check this pcb */
|
||||
if (IP_IS_V4_VAL(pcb->local_ip) && ip4_addr_cmp(ip_2_ip4(&pcb->local_ip), netif_ip4_addr(inp))) {
|
||||
if (IP_IS_V4_VAL(pcb->local_ip) && ip4_addr_eq(ip_2_ip4(&pcb->local_ip), netif_ip4_addr(inp))) {
|
||||
/* better match */
|
||||
uncon_pcb = pcb;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
/* compare PCB remote addr+port to UDP source addr+port */
|
||||
if ((pcb->remote_port == src) &&
|
||||
(ip_addr_isany_val(pcb->remote_ip) ||
|
||||
ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()))) {
|
||||
ip_addr_eq(&pcb->remote_ip, ip_current_src_addr()))) {
|
||||
/* the first fully matching PCB */
|
||||
if (prev != NULL) {
|
||||
/* move the pcb to the front of udp_pcbs so that is
|
||||
@@ -321,7 +321,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_IPV4
|
||||
if (!ip_current_is_v6()) {
|
||||
for_us = ip4_addr_cmp(netif_ip4_addr(inp), ip4_current_dest_addr());
|
||||
for_us = ip4_addr_eq(netif_ip4_addr(inp), ip4_current_dest_addr());
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
}
|
||||
@@ -570,7 +570,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
||||
in pcb->mcast_ip4 that is used for routing. If this routing lookup
|
||||
fails, we try regular routing as though no override was set. */
|
||||
if (!ip4_addr_isany_val(pcb->mcast_ip4) &&
|
||||
!ip4_addr_cmp(&pcb->mcast_ip4, IP4_ADDR_BROADCAST)) {
|
||||
!ip4_addr_eq(&pcb->mcast_ip4, IP4_ADDR_BROADCAST)) {
|
||||
netif = ip4_route_src(ip_2_ip4(&pcb->local_ip), &pcb->mcast_ip4);
|
||||
}
|
||||
}
|
||||
@@ -678,7 +678,7 @@ udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_i
|
||||
} else {
|
||||
/* check if UDP PCB local IP address is correct
|
||||
* this could be an old address if netif->ip_addr has changed */
|
||||
if (!ip4_addr_cmp(ip_2_ip4(&(pcb->local_ip)), netif_ip4_addr(netif))) {
|
||||
if (!ip4_addr_eq(ip_2_ip4(&(pcb->local_ip)), netif_ip4_addr(netif))) {
|
||||
/* local_ip doesn't match, drop the packet */
|
||||
return ERR_RTE;
|
||||
}
|
||||
@@ -999,7 +999,7 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
||||
if ((ipcb->local_port == port) &&
|
||||
(((IP_GET_TYPE(&ipcb->local_ip) == IP_GET_TYPE(ipaddr)) &&
|
||||
/* IP address matches or any IP used? */
|
||||
(ip_addr_cmp(&ipcb->local_ip, ipaddr) ||
|
||||
(ip_addr_eq(&ipcb->local_ip, ipaddr) ||
|
||||
ip_addr_isany(ipaddr) ||
|
||||
ip_addr_isany(&ipcb->local_ip))) ||
|
||||
(IP_GET_TYPE(&ipcb->local_ip) == IPADDR_TYPE_ANY) ||
|
||||
@@ -1288,7 +1288,7 @@ void udp_netif_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_a
|
||||
if (!ip_addr_isany(old_addr) && !ip_addr_isany(new_addr)) {
|
||||
for (upcb = udp_pcbs; upcb != NULL; upcb = upcb->next) {
|
||||
/* PCB bound to current local interface address? */
|
||||
if (ip_addr_cmp(&upcb->local_ip, old_addr)) {
|
||||
if (ip_addr_eq(&upcb->local_ip, old_addr)) {
|
||||
/* The PCB is bound to the old ipaddr and
|
||||
* is set to bound to the new one instead */
|
||||
ip_addr_copy(upcb->local_ip, *new_addr);
|
||||
|
||||
Reference in New Issue
Block a user