version 1.1.1.2, 2012/05/29 12:26:49
|
version 1.1.1.4, 2013/10/14 07:56:35
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 1996, 1998-2005, 2007-2010 | * Copyright (c) 1996, 1998-2005, 2007-2013 |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 32 struct rtentry;
|
Line 32 struct rtentry;
|
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <sys/param.h> |
|
#include <sys/time.h> |
#include <sys/time.h> |
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
#if defined(HAVE_SYS_SOCKIO_H) && !defined(SIOCGIFCONF) |
#if defined(HAVE_SYS_SOCKIO_H) && !defined(SIOCGIFCONF) |
Line 82 struct rtentry;
|
Line 81 struct rtentry;
|
|
|
#include "missing.h" |
#include "missing.h" |
#include "alloc.h" |
#include "alloc.h" |
#include "error.h" | #include "fatal.h" |
#include "sudo_debug.h" |
#include "sudo_debug.h" |
|
|
#define DEFAULT_TEXT_DOMAIN "sudo" |
#define DEFAULT_TEXT_DOMAIN "sudo" |
Line 112 get_net_ifs(char **addrinfo)
|
Line 111 get_net_ifs(char **addrinfo)
|
struct sockaddr_in6 *sin6; |
struct sockaddr_in6 *sin6; |
char addrbuf[INET6_ADDRSTRLEN]; |
char addrbuf[INET6_ADDRSTRLEN]; |
#endif |
#endif |
int ailen, i, len, num_interfaces = 0; | int ailen, len, num_interfaces = 0; |
char *cp; |
char *cp; |
debug_decl(get_net_ifs, SUDO_DEBUG_NETIF) |
debug_decl(get_net_ifs, SUDO_DEBUG_NETIF) |
|
|
Line 141 get_net_ifs(char **addrinfo)
|
Line 140 get_net_ifs(char **addrinfo)
|
*addrinfo = cp = emalloc(ailen); |
*addrinfo = cp = emalloc(ailen); |
|
|
/* Store the IP addr/netmask pairs. */ |
/* Store the IP addr/netmask pairs. */ |
for (ifa = ifaddrs, i = 0; ifa != NULL; ifa = ifa -> ifa_next) { | for (ifa = ifaddrs; ifa != NULL; ifa = ifa -> ifa_next) { |
/* Skip interfaces marked "down" and "loopback". */ |
/* Skip interfaces marked "down" and "loopback". */ |
if (ifa->ifa_addr == NULL || ifa->ifa_netmask == NULL || |
if (ifa->ifa_addr == NULL || ifa->ifa_netmask == NULL || |
!ISSET(ifa->ifa_flags, IFF_UP) || ISSET(ifa->ifa_flags, IFF_LOOPBACK)) |
!ISSET(ifa->ifa_flags, IFF_UP) || ISSET(ifa->ifa_flags, IFF_LOOPBACK)) |
Line 224 get_net_ifs(char **addrinfo)
|
Line 223 get_net_ifs(char **addrinfo)
|
|
|
sock = socket(AF_INET, SOCK_DGRAM, 0); |
sock = socket(AF_INET, SOCK_DGRAM, 0); |
if (sock < 0) |
if (sock < 0) |
error(1, _("unable to open socket")); | fatal(_("unable to open socket")); |
|
|
/* |
/* |
* Get interface configuration or return. |
* Get interface configuration or return. |