Diff for /libelwix/src/net.c between versions 1.6 and 1.6.4.2

version 1.6, 2013/06/20 14:55:23 version 1.6.4.2, 2013/07/08 11:45:01
Line 100  e_link_ntoa(const struct sockaddr_dl *sdl) Line 100  e_link_ntoa(const struct sockaddr_dl *sdl)
  * return: NULL error or !=NULL string a   * return: NULL error or !=NULL string a
  */   */
 char *  char *
e_ether_ntoa(const struct e_ether_addr *n, char * __restrict a, int len)e_ether_ntoa(const ether_addr_t * __restrict n, char * __restrict a, int len)
 {  {
         if (!n || !a)          if (!n || !a)
                 return NULL;                  return NULL;
Line 122  e_ether_ntoa(const struct e_ether_addr *n, char * __re Line 122  e_ether_ntoa(const struct e_ether_addr *n, char * __re
  * @e = ethernet address structure, like struct ether_addr   * @e = ethernet address structure, like struct ether_addr
  * return: NULL error or !=NULL ethernet address structure   * return: NULL error or !=NULL ethernet address structure
  */   */
struct e_ether_addr *ether_addr_t *
e_ether_aton(const char *a, struct e_ether_addr *e)e_ether_aton(const char *a, ether_addr_t * __restrict e)
 {                         {                       
         int i;          int i;
         u_int o0, o1, o2, o3, o4, o5;          u_int o0, o1, o2, o3, o4, o5;
Line 437  e_getnet(const char *net) Line 437  e_getnet(const char *net)
   
         e_free(str);          e_free(str);
         return n;          return n;
   }
   
   /*
    * e_ether_addr() - Get or set ethernet address from interface name
    *
    * @ifname = interface name
    * @addr = if addr is !=NULL then set this for new address
    * return: NULL error or !=NULL get ethernet address
    */
   ether_addr_t *
   e_ether_addr(const char *ifname, ether_addr_t * __restrict addr)
   {
           ether_addr_t *a = NULL;
           struct ifaddrs *p, *ifa = NULL;
   
           if (!ifname)
                   return NULL;
   
           a = e_malloc(sizeof(ether_addr_t));
           if (!a)
                   return NULL;
           else
                   memset(a, 0, sizeof(ether_addr_t));
   
           getifaddrs(&ifa);
           for (p = ifa; p && p->ifa_name; p++)
                   if (p->ifa_name && !strcmp(p->ifa_name, ifname) && p->ifa_addr && 
                                   p->ifa_addr->sa_family == AF_LINK) {
                           memcpy(a, LLADDR((struct sockaddr_dl*) p->ifa_addr), sizeof(ether_addr_t));
                           break;
                   }
           freeifaddrs(ifa);
   
           return a;
 }  }

Removed from v.1.6  
changed lines
  Added in v.1.6.4.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>