diff options
author | Michael Biebl <biebl@debian.org> | 2013-04-25 15:08:24 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2013-04-25 15:08:24 +0200 |
commit | 4b0c6b727da98c61470fa2de20396ba6f284c417 (patch) | |
tree | 022cd5fdacf7f72abf2bee6b0f4612457bb39d4b /compat | |
parent | bd9408b88c40fb9a7dc88f4b2b6f218fcb17a388 (diff) | |
download | rsyslog-4b0c6b727da98c61470fa2de20396ba6f284c417.tar.gz |
Imported Upstream version 7.3.12upstream/7.3.12
Diffstat (limited to 'compat')
-rw-r--r-- | compat/Makefile.am | 2 | ||||
-rw-r--r-- | compat/Makefile.in | 2 | ||||
-rwxr-xr-x | compat/getifaddrs.c | 10 | ||||
-rwxr-xr-x | compat/ifaddrs.h | 89 |
4 files changed, 100 insertions, 3 deletions
diff --git a/compat/Makefile.am b/compat/Makefile.am index 78c298e..f580a38 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -1,6 +1,6 @@ noinst_LTLIBRARIES = compat.la -compat_la_SOURCES = getifaddrs.c +compat_la_SOURCES = getifaddrs.c ifaddrs.h compat_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) compat_la_LDFLAGS = -module -avoid-version compat_la_LIBADD = $(IMUDP_LIBS) diff --git a/compat/Makefile.in b/compat/Makefile.in index 8fa73e6..99bcb9a 100644 --- a/compat/Makefile.in +++ b/compat/Makefile.in @@ -305,7 +305,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = compat.la -compat_la_SOURCES = getifaddrs.c +compat_la_SOURCES = getifaddrs.c ifaddrs.h compat_la_CPPFLAGS = -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) compat_la_LDFLAGS = -module -avoid-version compat_la_LIBADD = $(IMUDP_LIBS) diff --git a/compat/getifaddrs.c b/compat/getifaddrs.c index 8acd484..25d04d4 100755 --- a/compat/getifaddrs.c +++ b/compat/getifaddrs.c @@ -36,7 +36,15 @@ #include <stdlib.h> #include <net/if.h> #include <ifaddrs.h> -#include <libsocket_priv.h> + +/* Normally this is defined in <net/if.h> but was new for Solaris 11 */ +#ifndef LIFC_ENABLED +#define LIFC_ENABLED 0x20 +#endif + +int getallifaddrs(sa_family_t af, struct ifaddrs **ifap, int64_t flags); +int getallifs(int s, sa_family_t af, struct lifreq **lifr, int *numifs, + int64_t lifc_flags); /* * Create a linked list of `struct ifaddrs' structures, one for each diff --git a/compat/ifaddrs.h b/compat/ifaddrs.h new file mode 100755 index 0000000..ec359c1 --- /dev/null +++ b/compat/ifaddrs.h @@ -0,0 +1,89 @@ +#include "config.h" +#ifndef HAVE_GETIFADDRS +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + */ +#ifndef _IFADDRS_H +#define _IFADDRS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> + +/* + * The `getifaddrs' function generates a linked list of these structures. + * Each element of the list describes one network interface. + */ +#if defined(_INT64_TYPE) +struct ifaddrs { + struct ifaddrs *ifa_next; /* Pointer to the next structure. */ + char *ifa_name; /* Name of this network interface. */ + uint64_t ifa_flags; /* Flags as from SIOCGLIFFLAGS ioctl. */ + struct sockaddr *ifa_addr; /* Network address of this interface. */ + struct sockaddr *ifa_netmask; /* Netmask of this interface. */ + union { + /* + * At most one of the following two is valid. If the + * IFF_BROADCAST bit is set in `ifa_flags', then + * `ifa_broadaddr' is valid. If the IFF_POINTOPOINT bit is + * set, then `ifa_dstaddr' is valid. It is never the case that + * both these bits are set at once. + */ + struct sockaddr *ifu_broadaddr; + struct sockaddr *ifu_dstaddr; + } ifa_ifu; + void *ifa_data; /* Address-specific data (may be unused). */ +/* + * This may have been defined in <net/if.h>. + */ +#ifndef ifa_broadaddr +#define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ +#endif +#ifndef ifa_dstaddr +#define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of p-to-p link */ +#endif +}; +#endif + +/* + * Create a linked list of `struct ifaddrs' structures, one for each + * network interface on the host machine. If successful, store the + * list in *ifap and return 0. On errors, return -1 and set `errno'. + * + * The storage returned in *ifap is allocated dynamically and can + * only be properly freed by passing it to `freeifaddrs'. + */ +extern int getifaddrs(struct ifaddrs **); + +/* Reclaim the storage allocated by a previous `getifaddrs' call. */ +extern void freeifaddrs(struct ifaddrs *); + + +#ifdef __cplusplus +} +#endif + +#endif /* _IFADDRS_H */ +#endif /* HAVE_GETIFADDRS */ |