Navigation


Changeset 134:6b2989c066a6 in freeDiameter


Ignore:
Timestamp:
Dec 15, 2009, 6:15:41 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Fixed loopback test for correct network order

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/endpoints.c

    r133 r134  
    5656        switch (sa->sa_family) {
    5757                case AF_INET:
    58                         if (ptr.sin->sin_addr.s_addr == INADDR_LOOPBACK)
     58                        if (IN_IS_ADDR_LOOPBACK(&ptr.sin->sin_addr))
    5959                                return 0;
    6060                case AF_INET6:
    61                         if (!memcmp(&ptr.sin6->sin6_addr, &in6addr_loopback, sizeof(struct in6_addr)))
     61                        if (IN6_IS_ADDR_LOOPBACK(&ptr.sin6->sin6_addr))
    6262                                return 0;
    6363        }
  • include/freeDiameter/libfreeDiameter.h

    r131 r134  
    395395#endif /* INADDR_LOOPBACK */
    396396
     397/* An IP equivalent to IN6_IS_ADDR_LOOPBACK */
     398#ifndef IN_IS_ADDR_LOOPBACK
     399#define IN_IS_ADDR_LOOPBACK(a) \
     400  ((((long int) (a)->s_addr) & ntohl(0xff000000)) == ntohl(0x7f000000))
     401#endif /* IN_IS_ADDR_LOOPBACK */
     402
     403
    397404/* create a V4MAPPED address */
    398405#define IN6_ADDR_V4MAP( a6, a4 ) {                      \
Note: See TracChangeset for help on using the changeset viewer.