Navigation


Changeset 135:bbb8ddba4c85 in freeDiameter


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

Filter out more invalid addresses

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/endpoints.c

    r134 r135  
    5252        CHECK_PARAMS( list && sa && (sl <= sizeof(sSS)) );
    5353       
    54         /* Filter out loopback addresses */
     54        /* Filter out loopback addresses, unspecified addresses, and invalid families */
    5555        ptr.sa = sa;
    5656        switch (sa->sa_family) {
    5757                case AF_INET:
    58                         if (IN_IS_ADDR_LOOPBACK(&ptr.sin->sin_addr))
     58                        if (IN_IS_ADDR_UNSPECIFIED(&ptr.sin->sin_addr) || IN_IS_ADDR_LOOPBACK(&ptr.sin->sin_addr))
    5959                                return 0;
     60                        break;
     61                       
    6062                case AF_INET6:
    61                         if (IN6_IS_ADDR_LOOPBACK(&ptr.sin6->sin6_addr))
     63                        if (IN6_IS_ADDR_UNSPECIFIED(&ptr.sin6->sin6_addr) || IN6_IS_ADDR_LOOPBACK(&ptr.sin6->sin6_addr))
    6264                                return 0;
     65                        break;
     66                       
     67                default:
     68                        return 0;
    6369        }
    6470       
  • include/freeDiameter/libfreeDiameter.h

    r134 r135  
    401401#endif /* IN_IS_ADDR_LOOPBACK */
    402402
     403/* An IP equivalent to IN6_IS_ADDR_UNSPECIFIED */
     404#ifndef IN_IS_ADDR_UNSPECIFIED
     405#define IN_IS_ADDR_UNSPECIFIED(a) \
     406  (((long int) (a)->s_addr) == 0x00000000)
     407#endif /* IN_IS_ADDR_UNSPECIFIED */
     408
    403409
    404410/* create a V4MAPPED address */
Note: See TracChangeset for help on using the changeset viewer.