NET: Rename some address comparison macros
This commit is contained in:
parent
52dbbe76b2
commit
3e0bd1f1b0
@ -400,11 +400,15 @@ int net_lockedwait(sem_t *sem);
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_IPv6
|
||||
# define net_ipaddr_cmp(addr1, addr2) (addr1 == addr2)
|
||||
# define uiphdr_ipaddr_cmp(addr1, addr2) net_ipaddr_cmp(net_ip4addr_conv32(addr1), net_ip4addr_conv32(addr2))
|
||||
# define net_ipaddr_cmp(addr1, addr2) \
|
||||
(addr1 == addr2)
|
||||
# define net_ipaddr_hdrcmp(addr1, addr2) \
|
||||
net_ipaddr_cmp(net_ip4addr_conv32(addr1), net_ip4addr_conv32(addr2))
|
||||
#else /* !CONFIG_NET_IPv6 */
|
||||
# define net_ipaddr_cmp(addr1, addr2) (memcmp(&addr1, &addr2, sizeof(net_ip6addr_t)) == 0)
|
||||
# define uiphdr_ipaddr_cmp(addr1, addr2) net_ipaddr_cmp(addr, addr2)
|
||||
# define net_ipaddr_cmp(addr1, addr2) \
|
||||
(memcmp(&addr1, &addr2, sizeof(net_ip6addr_t)) == 0)
|
||||
# define net_ipaddr_hdrcmp(addr1, addr2) \
|
||||
net_ipaddr_cmp(addr, addr2)
|
||||
#endif /* !CONFIG_NET_IPv6 */
|
||||
|
||||
/* Compare two IP addresses with netmasks
|
||||
|
@ -351,7 +351,7 @@ void arp_out(struct net_driver_s *dev)
|
||||
|
||||
/* First check if destination is a local broadcast. */
|
||||
|
||||
if (uiphdr_ipaddr_cmp(pip->eh_destipaddr, g_broadcast_ipaddr))
|
||||
if (net_ipaddr_hdrcmp(pip->eh_destipaddr, g_broadcast_ipaddr))
|
||||
{
|
||||
memcpy(peth->dest, g_broadcast_ethaddr.ether_addr_octet, ETHER_ADDR_LEN);
|
||||
}
|
||||
|
@ -176,8 +176,8 @@ static uint8_t devif_reassembly(void)
|
||||
* fragment into the buffer.
|
||||
*/
|
||||
|
||||
if (uiphdr_addr_cmp(pbuf->srcipaddr, pfbuf->srcipaddr) &&
|
||||
uiphdr_addr_cmp(pbuf->destipaddr == pfbuf->destipaddr) &&
|
||||
if (net_ipaddr_hdrcmp(pbuf->srcipaddr, pfbuf->srcipaddr) &&
|
||||
net_ipaddr_hdrcmp(pbuf->destipaddr, pfbuf->destipaddr) &&
|
||||
pbuf->g_ipid[0] == pfbuf->g_ipid[0] && pbuf->g_ipid[1] == pfbuf->g_ipid[1])
|
||||
{
|
||||
len = (pbuf->len[0] << 8) + pbuf->len[1] - (pbuf->vhl & 0x0f) * 4;
|
||||
|
@ -220,7 +220,7 @@ typeerr:
|
||||
{
|
||||
/* Save the sender's address in our neighbor list. */
|
||||
|
||||
uiphdr_neighbor_add(picmp->srcipaddr, &(picmp->options[2]));
|
||||
net_neighbor_add(picmp->srcipaddr, &(picmp->options[2]));
|
||||
}
|
||||
|
||||
/* We should now send a neighbor advertisement back to where the
|
||||
|
@ -321,7 +321,7 @@ FAR struct udp_conn_s *udp_active(FAR struct udp_iphdr_s *buf)
|
||||
(conn->rport == 0 || buf->srcport == conn->rport) &&
|
||||
(net_ipaddr_cmp(conn->ripaddr, g_allzeroaddr) ||
|
||||
net_ipaddr_cmp(conn->ripaddr, g_alloneaddr) ||
|
||||
uiphdr_ipaddr_cmp(buf->srcipaddr, &conn->ripaddr)))
|
||||
net_ipaddr_hdrcmp(buf->srcipaddr, &conn->ripaddr)))
|
||||
{
|
||||
/* Matching connection found.. return a reference to it */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user