Changeset 526 for trunk/src/sh_ipvx.c


Ignore:
Timestamp:
Jun 29, 2017, 9:20:32 PM (7 years ago)
Author:
katerina
Message:

Fix for ticket #421 (spurious port detections) and ticket #422 (PortCheckSkip bug).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_ipvx.c

    r509 r526  
    251251}
    252252
    253 int sh_ipvx_get_port(struct sockaddr * sa, int sa_family)
     253int sh_ipvx_get_port(struct sh_sockaddr * sa)
    254254{
    255255  int port = 0;
    256256#if defined(USE_IPVX)
    257257
    258   switch (sa_family)
     258  switch (sa->ss_family)
    259259    {
    260260    case AF_INET:
    261       port = ntohs(((struct sockaddr_in *)sa)->sin_port);
     261      port = ntohs((sa->sin).sin_port);
    262262      break;
    263263    case AF_INET6:
    264       port = ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
    265       break;
    266     }
    267 #else
    268   (void) sa_family;
    269   port = ntohs(((struct sockaddr_in *)sa)->sin_port);
     264      port = ntohs((sa->sin6).sin6_port);
     265      break;
     266    }
     267#else
     268  port = ntohs((sa->sin).sin_port);
    270269#endif
    271270  return port;
Note: See TracChangeset for help on using the changeset viewer.