Back to index

glibc  2.9
Functions
check_pf.c File Reference
#include <ifaddrs.h>
#include <netdb.h>

Go to the source code of this file.

Functions

void attribute_hidden __check_pf (bool *seen_ipv4, bool *seen_ipv6, struct in6addrinfo **in6ai, size_t *in6ailen)

Function Documentation

void attribute_hidden __check_pf ( bool *  seen_ipv4,
bool *  seen_ipv6,
struct in6addrinfo **  in6ai,
size_t in6ailen 
)

Definition at line 26 of file check_pf.c.

{
  /* By default we have no way to determine information about
     deprecated and temporary addresses.  */
  *in6ai = NULL;
  *in6ailen = 0;

  /* Get the interface list via getifaddrs.  */
  struct ifaddrs *ifa = NULL;
  if (getifaddrs (&ifa) != 0)
    {
      /* We cannot determine what interfaces are available.  Be
        pessimistic.  */
      *seen_ipv4 = true;
      *seen_ipv6 = true;
      return;
    }

  *seen_ipv4 = false;
  *seen_ipv6 = false;

  struct ifaddrs *runp;
  for (runp = ifa; runp != NULL; runp = runp->ifa_next)
    if (runp->ifa_addr->sa_family == PF_INET)
      *seen_ipv4 = true;
    else if (runp->ifa_addr->sa_family == PF_INET6)
      *seen_ipv6 = true;

  (void) freeifaddrs (ifa);
}

Here is the call graph for this function: