/* Finds (stable) ethernet/IP address pair from ARP table using interface and IP address index.  */
s8_t etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr **eth_ret, struct ip_addr **ip_ret)
/* Finds (stable) ethernet/IP address pair from ARP table using interface and IP address index.  */
s8_t etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr **eth_ret, struct ip_addr **ip_ret)
{
  s8_t i;
  i = 0;
  while (i < ARP_TABLE_SIZE)
  {
    if ((arp_table[i].state == ETHARP_STATE_STABLE) &&
        (arp_table[i].netif == netif) && 
        ip_addr_cmp(ipaddr, &arp_table[i].ipaddr) )
    {
      *eth_ret = &arp_table[i].ethaddr;
      *ip_ret = &arp_table[i].ipaddr;
      return i;
    }
    i++;
  }
  return -1;
}