/* This file is part of Lcrzo.
*/

/*-------------------------------------------------------------*/
int lcrzo_priv_etha_init_ipa_etcethers(const lcrzo_ipa ipa, lcrzo_etha etha)
#if LCRZODEF_HAVEFONC_ETHER_HOSTTON==1
{ struct ether_addr ea;
  int retour;
  lcrzo_ips ips;
  lcrzo_ipl ipl;
  lcrzo_etha localetha; 

  lcrzo_er(lcrzo_ips_init_ipa(ipa, ips));
  retour=ether_hostton(ips, &ea);
  if ( !retour )
  { 
#ifdef LCRZODEF_SYSTEM_FreeBSD
    memcpy(localetha, ea.octet, LCRZO_ETHA_MAXBYTES);
#elif defined LCRZODEF_SYSTEM_Linux || defined LCRZODEF_SYSTEM_OpenBSD || defined LCRZODEF_SYSTEM_Solaris
    memcpy(localetha, ea.ether_addr_octet, LCRZO_ETHA_MAXBYTES);
#else
 #error "Unknown value for LCRZODEF_SYSTEM"
#endif
    lcrzo_er(lcrzo_ipl_init_ipa(ipa, &ipl));
    lcrzo_er(lcrzo_priv_conf_arp_add_system("", localetha, ipl, LCRZO_FALSE));
    if (etha!=NULL) memcpy(etha, localetha, LCRZO_ETHA_MAXBYTES);
    return(LCRZO_ERR_OK);
  }
  lcrzo_err_purge();
  return(LCRZO_ERR_OKUNRESOLVED);
}
#else
{ return(LCRZO_ERR_OKUNRESOLVED);
  { int i; 
    /* just for the compiler warning */
    if (ipa==NULL && etha==NULL) i=0;
  }
}
#endif

