Diff for /libelwix/src/net.c between versions 1.16.2.1 and 1.19

version 1.16.2.1, 2017/01/09 12:40:40 version 1.19, 2018/04/04 01:25:26
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004 - 2017Copyright 2004 - 2018
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 50  SUCH DAMAGE. Line 50  SUCH DAMAGE.
 static char hexlist[] = "0123456789abcdef";  static char hexlist[] = "0123456789abcdef";
   
 #ifndef HAVE_LINK_ADDR  #ifndef HAVE_LINK_ADDR
   
   /* States*/
   #define NAMING  0
   #define GOTONE  1
   #define GOTTWO  2
   #define RESET   3
   /* Inputs */
   #define DIGIT   (4*0)
   #define END     (4*1)
   #define DELIM   (4*2)
   #define LETTER  (4*3)
   
 void  void
 link_addr(const char *addr, struct sockaddr_dl *sdl)  link_addr(const char *addr, struct sockaddr_dl *sdl)
 {  {
Line 486  e_innet(netaddr_t * __restrict net, inaddr_t * __restr Line 498  e_innet(netaddr_t * __restrict net, inaddr_t * __restr
                 case AF_INET:                  case AF_INET:
                         for (i = 0; i < sizeof(struct in_addr); i++) {                          for (i = 0; i < sizeof(struct in_addr); i++) {
                                 ret = ((caddr_t) &net->addr.sin.sin_addr.s_addr)[i] &                                   ret = ((caddr_t) &net->addr.sin.sin_addr.s_addr)[i] & 
                                        net->mask.in.s4_addr[i];                                        net->mask.in4.s4_addr[i];
                                ret -= addr->in.s4_addr[i] & net->mask.in.s4_addr[i];                                ret -= addr->in4.s4_addr[i] & net->mask.in4.s4_addr[i];
                                 if (ret)                                  if (ret)
                                         break;                                          break;
                         }                          }
Line 551  e_getnet(const char *net) Line 563  e_getnet(const char *net)
 #endif  #endif
                         n->addr.sin.sin_family = host->h_addrtype;                          n->addr.sin.sin_family = host->h_addrtype;
                         memcpy(&n->addr.sin.sin_addr, host->h_addr, sizeof n->addr.sin.sin_addr);                          memcpy(&n->addr.sin.sin_addr, host->h_addr, sizeof n->addr.sin.sin_addr);
                        if (wrk)                        if (wrk && strtol(wrk, NULL, 10) != 32)
                                 n->mask.in.s_addr = E_CIDRMASK(strtol(wrk, NULL, 10));                                  n->mask.in.s_addr = E_CIDRMASK(strtol(wrk, NULL, 10));
                         else                          else
                                 n->mask.in.s_addr = 0xFFFFFFFF;                                  n->mask.in.s_addr = 0xFFFFFFFF;

Removed from v.1.16.2.1  
changed lines
  Added in v.1.19


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