[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/libc/glibc/glibc-2.22/inet/Makefile b/ap/libc/glibc/glibc-2.22/inet/Makefile
new file mode 100644
index 0000000..f1d871f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/Makefile
@@ -0,0 +1,91 @@
+# Copyright (C) 1991-2015 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+#
+#	Sub-makefile for inet portion of the library.
+#
+subdir	:= inet
+
+include ../Makeconfig
+
+headers	:= netinet/ether.h netinet/in.h netinet/in_systm.h \
+	   netinet/if_ether.h netinet/igmp.h \
+	   netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \
+	   aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h
+
+routines := htonl htons		\
+	    inet_lnaof inet_mkadr	\
+	    inet_netof inet_ntoa inet_net herrno herrno-loc \
+	    gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
+	    gethstbynm_r gethstent gethstent_r \
+	    getnetbyad getnetbyad_r getnetbynm getnetent getnetent_r \
+	    getnetbynm_r \
+	    getproto getproto_r getprtent getprtent_r getprtname getprtname_r \
+	    getsrvbynm getsrvbynm_r getsrvbypt getsrvbypt_r getservent \
+	    getservent_r	\
+	    ether_aton ether_aton_r ether_hton ether_line \
+	    ether_ntoa ether_ntoa_r ether_ntoh \
+	    rcmd rexec ruserpass \
+	    getnetgrent_r getnetgrent \
+	    getaliasent_r getaliasent getaliasname getaliasname_r \
+	    in6_addr getnameinfo if_index ifaddrs inet6_option \
+	    getipv4sourcefilter setipv4sourcefilter \
+	    getsourcefilter setsourcefilter inet6_opt inet6_rth
+
+aux := check_pf check_native ifreq
+
+tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
+	 tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \
+	 tst-getni1 tst-getni2 tst-inet6_rth tst-checks
+
+include ../Rules
+
+ifeq ($(have-thread-library),yes)
+
+CFLAGS-gethstbyad_r.c = -fexceptions
+CFLAGS-gethstbyad.c = -fexceptions
+CFLAGS-gethstbynm_r.c = -fexceptions
+CFLAGS-gethstbynm.c = -fexceptions
+CFLAGS-gethstbynm2_r.c = -fexceptions
+CFLAGS-gethstbynm2.c = -fexceptions
+CFLAGS-gethstent_r.c = -fexceptions
+CFLAGS-gethstent.c = -fexceptions
+CFLAGS-rcmd.c = -fexceptions
+CFLAGS-getnetbynm_r.c = -fexceptions
+CFLAGS-getnetbynm.c = -fexceptions
+CFLAGS-getnetbyad_r.c = -fexceptions
+CFLAGS-getnetbyad.c = -fexceptions
+CFLAGS-getnetent_r.c = -fexceptions
+CFLAGS-getnetent.c = -fexceptions
+CFLAGS-getaliasent_r.c = -fexceptions
+CFLAGS-getaliasent.c = -fexceptions
+CFLAGS-getrpcent_r.c = -fexceptions
+CFLAGS-getrpcent.c = -fexceptions
+CFLAGS-getservent_r.c = -fexceptions
+CFLAGS-getservent.c = -fexceptions
+CFLAGS-getprtent_r.c = -fexceptions
+CFLAGS-getprtent.c = -fexceptions
+CFLAGS-either_ntoh.c = -fexceptions
+CFLAGS-either_hton.c = -fexceptions
+CFLAGS-getnetgrent.c = -fexceptions
+CFLAGS-getnetgrent_r.c = -fexceptions
+
+endif
+
+ifeq ($(build-static-nss),yes)
+CFLAGS += -DSTATIC_NSS
+endif
diff --git a/ap/libc/glibc/glibc-2.22/inet/Versions b/ap/libc/glibc/glibc-2.22/inet/Versions
new file mode 100644
index 0000000..56eb274
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/Versions
@@ -0,0 +1,89 @@
+libc {
+  GLIBC_2.0 {
+    # functions with required interface outside normal name space
+    __ivaliduser; __check_rhosts_file; __rcmd_errstr;
+
+    # variables in normal name space
+    rexecoptions;
+
+    # e*
+    endaliasent; endhostent; endnetent; endnetgrent; endprotoent; endservent;
+
+    # e*
+    ether_aton; ether_aton_r; ether_hostton; ether_line; ether_ntoa;
+    ether_ntoa_r; ether_ntohost;
+
+    # g*
+    getaliasbyname; getaliasbyname_r; getaliasent; getaliasent_r;
+    getdomainname; gethostbyaddr; gethostbyaddr_r; gethostbyname;
+    gethostbyname2; gethostbyname2_r; gethostbyname_r; gethostent;
+    gethostent_r; getnetbyaddr; getnetbyaddr_r; getnetbyname;
+    getnetbyname_r; getnetent; getnetent_r; getnetgrent; getnetgrent_r;
+    getprotobyname; getprotobyname_r; getprotobynumber;
+    getprotobynumber_r; getprotoent; getprotoent_r;
+    getservbyname; getservbyname_r; getservbyport;
+    getservbyport_r; getservent; getservent_r;
+
+    # h*
+    htonl; htons;
+
+    # i*
+    inet_addr; inet_aton; inet_lnaof; inet_makeaddr; inet_netof; inet_network;
+    inet_nsap_addr; inet_nsap_ntoa; inet_ntoa; inet_ntop; inet_pton; innetgr;
+    iruserok;
+
+    # n*
+    ntohl; ntohs;
+
+    # r*
+    rcmd; rexec; rresvport; ruserok; ruserpass;
+
+    # s*
+    setaliasent; setnetent; setnetgrent; setprotoent; setservent;
+  }
+  GLIBC_2.1 {
+    # variables in normal name space
+    in6addr_any; in6addr_loopback;
+
+    # i*
+    if_freenameindex; if_indextoname; if_nameindex; if_nametoindex;
+  }
+  GLIBC_2.1.2 {
+    # g*
+    getaliasbyname_r; getaliasent_r; gethostbyaddr_r; gethostbyname2_r;
+    gethostbyname_r; gethostent_r; getnetbyaddr_r; getnetbyname_r;
+    getnetent_r; getnetgrent_r; getprotobyname_r; getprotobynumber_r;
+    getprotoent_r; getservbyname_r;
+  }
+  GLIBC_2.2 {
+    # i*
+    iruserok_af;
+    # r*
+    rcmd_af; rexec_af; rresvport_af; ruserok_af;
+  }
+  GLIBC_2.3 {
+    # f*
+    freeifaddrs;
+    # g*
+    getifaddrs;
+  }
+  GLIBC_2.3.3 {
+    inet6_option_space; inet6_option_init; inet6_option_append;
+    inet6_option_alloc; inet6_option_next; inet6_option_find;
+  }
+  GLIBC_2.3.4 {
+    getipv4sourcefilter; setipv4sourcefilter;
+    getsourcefilter; setsourcefilter;
+  }
+  GLIBC_2.5 {
+    inet6_opt_init; inet6_opt_append; inet6_opt_finish; inet6_opt_set_val;
+    inet6_opt_next; inet6_opt_find; inet6_opt_get_val;
+    inet6_rth_space; inet6_rth_init; inet6_rth_add; inet6_rth_reverse;
+    inet6_rth_segments; inet6_rth_getaddr;
+  }
+  GLIBC_PRIVATE {
+    # functions used in other libraries
+    __internal_endnetgrent; __internal_getnetgrent_r;
+    __internal_setnetgrent;
+  }
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/aliases.h b/ap/libc/glibc/glibc-2.22/inet/aliases.h
new file mode 100644
index 0000000..1b9fd38
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/aliases.h
@@ -0,0 +1,63 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _ALIASES_H
+#define _ALIASES_H	1
+
+#include <features.h>
+
+#include <sys/types.h>
+
+
+__BEGIN_DECLS
+
+/* Structure to represent one entry of the alias data base.  */
+struct aliasent
+  {
+    char *alias_name;
+    size_t alias_members_len;
+    char **alias_members;
+    int alias_local;
+  };
+
+
+/* Open alias data base files.  */
+extern void setaliasent (void) __THROW;
+
+/* Close alias data base files.  */
+extern void endaliasent (void) __THROW;
+
+/* Get the next entry from the alias data base.  */
+extern struct aliasent *getaliasent (void) __THROW;
+
+/* Get the next entry from the alias data base and put it in RESULT_BUF.  */
+extern int getaliasent_r (struct aliasent *__restrict __result_buf,
+			  char *__restrict __buffer, size_t __buflen,
+			  struct aliasent **__restrict __result) __THROW;
+
+/* Get alias entry corresponding to NAME.  */
+extern struct aliasent *getaliasbyname (const char *__name) __THROW;
+
+/* Get alias entry corresponding to NAME and put it in RESULT_BUF.  */
+extern int getaliasbyname_r (const char *__restrict __name,
+			     struct aliasent *__restrict __result_buf,
+			     char *__restrict __buffer, size_t __buflen,
+			     struct aliasent **__restrict __result) __THROW;
+
+__END_DECLS
+
+#endif /* aliases.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/arpa/ftp.h b/ap/libc/glibc/glibc-2.22/inet/arpa/ftp.h
new file mode 100644
index 0000000..e5b340d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/arpa/ftp.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1983, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ftp.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ARPA_FTP_H
+#define	_ARPA_FTP_H 1
+
+/* Definitions for FTP; see RFC-765. */
+
+/*
+ * Reply codes.
+ */
+#define PRELIM		1	/* positive preliminary */
+#define COMPLETE	2	/* positive completion */
+#define CONTINUE	3	/* positive intermediate */
+#define TRANSIENT	4	/* transient negative completion */
+#define ERROR		5	/* permanent negative completion */
+
+/*
+ * Type codes
+ */
+#define	TYPE_A		1	/* ASCII */
+#define	TYPE_E		2	/* EBCDIC */
+#define	TYPE_I		3	/* image */
+#define	TYPE_L		4	/* local byte size */
+
+#ifdef FTP_NAMES
+char *typenames[] =  {"0", "ASCII", "EBCDIC", "Image", "Local" };
+#endif
+
+/*
+ * Form codes
+ */
+#define	FORM_N		1	/* non-print */
+#define	FORM_T		2	/* telnet format effectors */
+#define	FORM_C		3	/* carriage control (ASA) */
+#ifdef FTP_NAMES
+char *formnames[] =  {"0", "Nonprint", "Telnet", "Carriage-control" };
+#endif
+
+/*
+ * Structure codes
+ */
+#define	STRU_F		1	/* file (no record structure) */
+#define	STRU_R		2	/* record structure */
+#define	STRU_P		3	/* page structure */
+#ifdef FTP_NAMES
+char *strunames[] =  {"0", "File", "Record", "Page" };
+#endif
+
+/*
+ * Mode types
+ */
+#define	MODE_S		1	/* stream */
+#define	MODE_B		2	/* block */
+#define	MODE_C		3	/* compressed */
+#ifdef FTP_NAMES
+char *modenames[] =  {"0", "Stream", "Block", "Compressed" };
+#endif
+
+/*
+ * Record Tokens
+ */
+#define	REC_ESC		'\377'	/* Record-mode Escape */
+#define	REC_EOR		'\001'	/* Record-mode End-of-Record */
+#define REC_EOF		'\002'	/* Record-mode End-of-File */
+
+/*
+ * Block Header
+ */
+#define	BLK_EOR		0x80	/* Block is End-of-Record */
+#define	BLK_EOF		0x40	/* Block is End-of-File */
+#define BLK_ERRORS	0x20	/* Block is suspected of containing errors */
+#define	BLK_RESTART	0x10	/* Block is Restart Marker */
+
+#define	BLK_BYTECOUNT	2	/* Bytes in this block */
+
+#endif /* arpa/ftp.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/arpa/inet.h b/ap/libc/glibc/glibc-2.22/inet/arpa/inet.h
new file mode 100644
index 0000000..d81d87c
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/arpa/inet.h
@@ -0,0 +1,105 @@
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _ARPA_INET_H
+#define	_ARPA_INET_H	1
+
+#include <features.h>
+#include <netinet/in.h>		/* To define `struct in_addr'.  */
+
+/* Type for length arguments in socket calls.  */
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
+
+__BEGIN_DECLS
+
+/* Convert Internet host address from numbers-and-dots notation in CP
+   into binary data in network byte order.  */
+extern in_addr_t inet_addr (const char *__cp) __THROW;
+
+/* Return the local host address part of the Internet address in IN.  */
+extern in_addr_t inet_lnaof (struct in_addr __in) __THROW;
+
+/* Make Internet host address in network byte order by combining the
+   network number NET with the local address HOST.  */
+extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host)
+     __THROW;
+
+/* Return network number part of the Internet address IN.  */
+extern in_addr_t inet_netof (struct in_addr __in) __THROW;
+
+/* Extract the network number in network byte order from the address
+   in numbers-and-dots natation starting at CP.  */
+extern in_addr_t inet_network (const char *__cp) __THROW;
+
+/* Convert Internet number in IN to ASCII representation.  The return value
+   is a pointer to an internal array containing the string.  */
+extern char *inet_ntoa (struct in_addr __in) __THROW;
+
+/* Convert from presentation format of an Internet number in buffer
+   starting at CP to the binary network format and store result for
+   interface type AF in buffer starting at BUF.  */
+extern int inet_pton (int __af, const char *__restrict __cp,
+		      void *__restrict __buf) __THROW;
+
+/* Convert a Internet address in binary network format for interface
+   type AF in buffer starting at CP to presentation form and place
+   result in buffer of length LEN astarting at BUF.  */
+extern const char *inet_ntop (int __af, const void *__restrict __cp,
+			      char *__restrict __buf, socklen_t __len)
+     __THROW;
+
+
+/* The following functions are not part of XNS 5.2.  */
+#ifdef __USE_MISC
+/* Convert Internet host address from numbers-and-dots notation in CP
+   into binary data and store the result in the structure INP.  */
+extern int inet_aton (const char *__cp, struct in_addr *__inp) __THROW;
+
+/* Format a network number NET into presentation format and place result
+   in buffer starting at BUF with length of LEN bytes.  */
+extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW;
+
+/* Convert network number for interface type AF in buffer starting at
+   CP to presentation format.  The result will specifiy BITS bits of
+   the number.  */
+extern char *inet_net_ntop (int __af, const void *__cp, int __bits,
+			    char *__buf, size_t __len) __THROW;
+
+/* Convert network number for interface type AF from presentation in
+   buffer starting at CP to network format and store result int
+   buffer starting at BUF of size LEN.  */
+extern int inet_net_pton (int __af, const char *__cp,
+			  void *__buf, size_t __len) __THROW;
+
+/* Convert ASCII representation in hexadecimal form of the Internet
+   address to binary form and place result in buffer of length LEN
+   starting at BUF.  */
+extern unsigned int inet_nsap_addr (const char *__cp,
+				    unsigned char *__buf, int __len) __THROW;
+
+/* Convert internet address in binary form in LEN bytes starting at CP
+   a presentation form and place result in BUF.  */
+extern char *inet_nsap_ntoa (int __len, const unsigned char *__cp,
+			     char *__buf) __THROW;
+#endif
+
+__END_DECLS
+
+#endif /* arpa/inet.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/arpa/telnet.h b/ap/libc/glibc/glibc-2.22/inet/arpa/telnet.h
new file mode 100644
index 0000000..3774c89
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/arpa/telnet.h
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)telnet.h	8.2 (Berkeley) 12/15/93
+ */
+
+#ifndef _ARPA_TELNET_H
+#define	_ARPA_TELNET_H 1
+
+/*
+ * Definitions for the TELNET protocol.
+ */
+#define	IAC	255		/* interpret as command: */
+#define	DONT	254		/* you are not to use option */
+#define	DO	253		/* please, you use option */
+#define	WONT	252		/* I won't use option */
+#define	WILL	251		/* I will use option */
+#define	SB	250		/* interpret as subnegotiation */
+#define	GA	249		/* you may reverse the line */
+#define	EL	248		/* erase the current line */
+#define	EC	247		/* erase the current character */
+#define	AYT	246		/* are you there */
+#define	AO	245		/* abort output--but let prog finish */
+#define	IP	244		/* interrupt process--permanently */
+#define	BREAK	243		/* break */
+#define	DM	242		/* data mark--for connect. cleaning */
+#define	NOP	241		/* nop */
+#define	SE	240		/* end sub negotiation */
+#define EOR     239             /* end of record (transparent mode) */
+#define	ABORT	238		/* Abort process */
+#define	SUSP	237		/* Suspend process */
+#define	xEOF	236		/* End of file: EOF is already used... */
+
+#define SYNCH	242		/* for telfunc calls */
+
+#ifdef TELCMDS
+char *telcmds[] = {
+	"EOF", "SUSP", "ABORT", "EOR",
+	"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
+	"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
+};
+#else
+extern char *telcmds[];
+#endif
+
+#define	TELCMD_FIRST	xEOF
+#define	TELCMD_LAST	IAC
+#define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
+			 (unsigned int)(x) >= TELCMD_FIRST)
+#define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]
+
+/* telnet options */
+#define TELOPT_BINARY	0	/* 8-bit data path */
+#define TELOPT_ECHO	1	/* echo */
+#define	TELOPT_RCP	2	/* prepare to reconnect */
+#define	TELOPT_SGA	3	/* suppress go ahead */
+#define	TELOPT_NAMS	4	/* approximate message size */
+#define	TELOPT_STATUS	5	/* give status */
+#define	TELOPT_TM	6	/* timing mark */
+#define	TELOPT_RCTE	7	/* remote controlled transmission and echo */
+#define TELOPT_NAOL 	8	/* negotiate about output line width */
+#define TELOPT_NAOP 	9	/* negotiate about output page size */
+#define TELOPT_NAOCRD	10	/* negotiate about CR disposition */
+#define TELOPT_NAOHTS	11	/* negotiate about horizontal tabstops */
+#define TELOPT_NAOHTD	12	/* negotiate about horizontal tab disposition */
+#define TELOPT_NAOFFD	13	/* negotiate about formfeed disposition */
+#define TELOPT_NAOVTS	14	/* negotiate about vertical tab stops */
+#define TELOPT_NAOVTD	15	/* negotiate about vertical tab disposition */
+#define TELOPT_NAOLFD	16	/* negotiate about output LF disposition */
+#define TELOPT_XASCII	17	/* extended ascii character set */
+#define	TELOPT_LOGOUT	18	/* force logout */
+#define	TELOPT_BM	19	/* byte macro */
+#define	TELOPT_DET	20	/* data entry terminal */
+#define	TELOPT_SUPDUP	21	/* supdup protocol */
+#define	TELOPT_SUPDUPOUTPUT 22	/* supdup output */
+#define	TELOPT_SNDLOC	23	/* send location */
+#define	TELOPT_TTYPE	24	/* terminal type */
+#define	TELOPT_EOR	25	/* end or record */
+#define	TELOPT_TUID	26	/* TACACS user identification */
+#define	TELOPT_OUTMRK	27	/* output marking */
+#define	TELOPT_TTYLOC	28	/* terminal location number */
+#define	TELOPT_3270REGIME 29	/* 3270 regime */
+#define	TELOPT_X3PAD	30	/* X.3 PAD */
+#define	TELOPT_NAWS	31	/* window size */
+#define	TELOPT_TSPEED	32	/* terminal speed */
+#define	TELOPT_LFLOW	33	/* remote flow control */
+#define TELOPT_LINEMODE	34	/* Linemode option */
+#define TELOPT_XDISPLOC	35	/* X Display Location */
+#define TELOPT_OLD_ENVIRON 36	/* Old - Environment variables */
+#define	TELOPT_AUTHENTICATION 37/* Authenticate */
+#define	TELOPT_ENCRYPT	38	/* Encryption option */
+#define TELOPT_NEW_ENVIRON 39	/* New - Environment variables */
+#define	TELOPT_EXOPL	255	/* extended-options-list */
+
+
+#define	NTELOPTS	(1+TELOPT_NEW_ENVIRON)
+#ifdef TELOPTS
+char *telopts[NTELOPTS+1] = {
+	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
+	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
+	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
+	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
+	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
+	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
+	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
+	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
+	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
+	"ENCRYPT", "NEW-ENVIRON",
+	0,
+};
+#define	TELOPT_FIRST	TELOPT_BINARY
+#define	TELOPT_LAST	TELOPT_NEW_ENVIRON
+#define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
+#define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
+#endif
+
+/* sub-option qualifiers */
+#define	TELQUAL_IS	0	/* option is... */
+#define	TELQUAL_SEND	1	/* send option */
+#define	TELQUAL_INFO	2	/* ENVIRON: informational version of IS */
+#define	TELQUAL_REPLY	2	/* AUTHENTICATION: client version of IS */
+#define	TELQUAL_NAME	3	/* AUTHENTICATION: client version of IS */
+
+#define	LFLOW_OFF		0	/* Disable remote flow control */
+#define	LFLOW_ON		1	/* Enable remote flow control */
+#define	LFLOW_RESTART_ANY	2	/* Restart output on any char */
+#define	LFLOW_RESTART_XON	3	/* Restart output only on XON */
+
+/*
+ * LINEMODE suboptions
+ */
+
+#define	LM_MODE		1
+#define	LM_FORWARDMASK	2
+#define	LM_SLC		3
+
+#define	MODE_EDIT	0x01
+#define	MODE_TRAPSIG	0x02
+#define	MODE_ACK	0x04
+#define MODE_SOFT_TAB	0x08
+#define MODE_LIT_ECHO	0x10
+
+#define	MODE_MASK	0x1f
+
+/* Not part of protocol, but needed to simplify things... */
+#define MODE_FLOW		0x0100
+#define MODE_ECHO		0x0200
+#define MODE_INBIN		0x0400
+#define MODE_OUTBIN		0x0800
+#define MODE_FORCE		0x1000
+
+#define	SLC_SYNCH	1
+#define	SLC_BRK		2
+#define	SLC_IP		3
+#define	SLC_AO		4
+#define	SLC_AYT		5
+#define	SLC_EOR		6
+#define	SLC_ABORT	7
+#define	SLC_EOF		8
+#define	SLC_SUSP	9
+#define	SLC_EC		10
+#define	SLC_EL		11
+#define	SLC_EW		12
+#define	SLC_RP		13
+#define	SLC_LNEXT	14
+#define	SLC_XON		15
+#define	SLC_XOFF	16
+#define	SLC_FORW1	17
+#define	SLC_FORW2	18
+
+#define	NSLC		18
+
+/*
+ * For backwards compatibility, we define SLC_NAMES to be the
+ * list of names if SLC_NAMES is not defined.
+ */
+#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
+			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
+			"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
+#ifdef	SLC_NAMES
+char *slc_names[] = {
+	SLC_NAMELIST
+};
+#else
+extern char *slc_names[];
+#define	SLC_NAMES SLC_NAMELIST
+#endif
+
+#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
+#define SLC_NAME(x)	slc_names[x]
+
+#define	SLC_NOSUPPORT	0
+#define	SLC_CANTCHANGE	1
+#define	SLC_VARIABLE	2
+#define	SLC_DEFAULT	3
+#define	SLC_LEVELBITS	0x03
+
+#define	SLC_FUNC	0
+#define	SLC_FLAGS	1
+#define	SLC_VALUE	2
+
+#define	SLC_ACK		0x80
+#define	SLC_FLUSHIN	0x40
+#define	SLC_FLUSHOUT	0x20
+
+#define	OLD_ENV_VAR	1
+#define	OLD_ENV_VALUE	0
+#define	NEW_ENV_VAR	0
+#define	NEW_ENV_VALUE	1
+#define	ENV_ESC		2
+#define ENV_USERVAR	3
+
+/*
+ * AUTHENTICATION suboptions
+ */
+
+/*
+ * Who is authenticating who ...
+ */
+#define	AUTH_WHO_CLIENT		0	/* Client authenticating server */
+#define	AUTH_WHO_SERVER		1	/* Server authenticating client */
+#define	AUTH_WHO_MASK		1
+
+/*
+ * amount of authentication done
+ */
+#define	AUTH_HOW_ONE_WAY	0
+#define	AUTH_HOW_MUTUAL		2
+#define	AUTH_HOW_MASK		2
+
+#define	AUTHTYPE_NULL		0
+#define	AUTHTYPE_KERBEROS_V4	1
+#define	AUTHTYPE_KERBEROS_V5	2
+#define	AUTHTYPE_SPX		3
+#define	AUTHTYPE_MINK		4
+#define	AUTHTYPE_CNT		5
+
+#define	AUTHTYPE_TEST		99
+
+#ifdef	AUTH_NAMES
+char *authtype_names[] = {
+	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
+};
+#else
+extern char *authtype_names[];
+#endif
+
+#define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
+#define	AUTHTYPE_NAME(x)	authtype_names[x]
+
+/*
+ * ENCRYPTion suboptions
+ */
+#define	ENCRYPT_IS		0	/* I pick encryption type ... */
+#define	ENCRYPT_SUPPORT		1	/* I support encryption types ... */
+#define	ENCRYPT_REPLY		2	/* Initial setup response */
+#define	ENCRYPT_START		3	/* Am starting to send encrypted */
+#define	ENCRYPT_END		4	/* Am ending encrypted */
+#define	ENCRYPT_REQSTART	5	/* Request you start encrypting */
+#define	ENCRYPT_REQEND		6	/* Request you send encrypting */
+#define	ENCRYPT_ENC_KEYID	7
+#define	ENCRYPT_DEC_KEYID	8
+#define	ENCRYPT_CNT		9
+
+#define	ENCTYPE_ANY		0
+#define	ENCTYPE_DES_CFB64	1
+#define	ENCTYPE_DES_OFB64	2
+#define	ENCTYPE_CNT		3
+
+#ifdef	ENCRYPT_NAMES
+char *encrypt_names[] = {
+	"IS", "SUPPORT", "REPLY", "START", "END",
+	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
+	0,
+};
+char *enctype_names[] = {
+	"ANY", "DES_CFB64",  "DES_OFB64",  0,
+};
+#else
+extern char *encrypt_names[];
+extern char *enctype_names[];
+#endif
+
+
+#define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
+#define	ENCRYPT_NAME(x)		encrypt_names[x]
+
+#define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
+#define	ENCTYPE_NAME(x)		enctype_names[x]
+
+#endif /* arpa/telnet.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/arpa/tftp.h b/ap/libc/glibc/glibc-2.22/inet/arpa/tftp.h
new file mode 100644
index 0000000..86e0b6e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/arpa/tftp.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)tftp.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ARPA_TFTP_H
+#define	_ARPA_TFTP_H 1
+
+/*
+ * Trivial File Transfer Protocol (IEN-133)
+ */
+#define	SEGSIZE		512		/* data segment size */
+
+/*
+ * Packet types.
+ */
+#define	RRQ	01				/* read request */
+#define	WRQ	02				/* write request */
+#define	DATA	03				/* data packet */
+#define	ACK	04				/* acknowledgement */
+#define	ERROR	05				/* error code */
+
+struct	tftphdr {
+	short	th_opcode;			/* packet type */
+	union {
+		char	tu_padding[3];		/* sizeof() compat */
+		struct {
+			union {
+				unsigned short	tu_block;	/* block # */
+				short	tu_code;		/* error code */
+			} __attribute__ ((__packed__)) th_u3;
+			char tu_data[0];	/* data or error string */
+		} __attribute__ ((__packed__)) th_u2;
+		char	tu_stuff[0];		/* request packet stuff */
+	} __attribute__ ((__packed__)) th_u1;
+} __attribute__ ((__packed__));
+
+#define	th_block	th_u1.th_u2.th_u3.tu_block
+#define	th_code		th_u1.th_u2.th_u3.tu_code
+#define	th_stuff	th_u1.tu_stuff
+#define	th_data		th_u1.th_u2.tu_data
+#define	th_msg		th_u1.th_u2.tu_data
+
+/*
+ * Error codes.
+ */
+#define	EUNDEF		0		/* not defined */
+#define	ENOTFOUND	1		/* file not found */
+#define	EACCESS		2		/* access violation */
+#define	ENOSPACE	3		/* disk full or allocation exceeded */
+#define	EBADOP		4		/* illegal TFTP operation */
+#define	EBADID		5		/* unknown transfer ID */
+#define	EEXISTS		6		/* file already exists */
+#define	ENOUSER		7		/* no such user */
+
+#endif /* arpa/tftp.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/bug-if1.c b/ap/libc/glibc/glibc-2.22/inet/bug-if1.c
new file mode 100644
index 0000000..61bead4
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/bug-if1.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <net/if.h>
+
+
+static int
+do_test (void)
+{
+  char buf[IF_NAMESIZE];
+  /* Index 0 is always invalid (see RFC 3493).  */
+  char *cp = if_indextoname (0, buf);
+  if (cp != NULL)
+    {
+      printf ("invalid index returned result \"%s\"\n", cp);
+      return 1;
+    }
+  else if (errno != ENXIO)
+    {
+      int err = errno;
+      char errbuf1[256];
+      char errbuf2[256];
+
+      printf ("errno = %d (%s), expected %d (%s)\n",
+	      err, strerror_r (err, errbuf1, sizeof (errbuf1)),
+	      ENXIO, strerror_r (ENXIO, errbuf2, sizeof (errbuf2)));
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/check_native.c b/ap/libc/glibc/glibc-2.22/inet/check_native.c
new file mode 100644
index 0000000..ee65b12
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/check_native.c
@@ -0,0 +1,27 @@
+/* Determine whether interfaces use native transport.  Generic version.
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ifaddrs.h>
+#include <stdint.h>
+
+void
+attribute_hidden
+__check_native (uint32_t a1_index, int *a1_native,
+		uint32_t a2_index, int *a2_native)
+{
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/check_pf.c b/ap/libc/glibc/glibc-2.22/inet/check_pf.c
new file mode 100644
index 0000000..3739a95
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/check_pf.c
@@ -0,0 +1,71 @@
+/* Determine protocol families for which interfaces exist.  Generic version.
+   Copyright (C) 2003-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ifaddrs.h>
+#include <netdb.h>
+#include <stdint.h>
+
+void
+attribute_hidden
+__check_pf (bool *seen_ipv4, bool *seen_ipv6,
+	    struct in6addrinfo **in6ai, size_t *in6ailen)
+{
+  /* 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);
+}
+
+
+void
+__free_in6ai (struct in6addrinfo *in6ai)
+{
+  /* Nothing to do.  */
+}
+
+
+#if IS_IN (nscd)
+uint32_t
+__bump_nl_timestamp (void)
+{
+  return 0;
+}
+#endif
diff --git a/ap/libc/glibc/glibc-2.22/inet/ether_aton.c b/ap/libc/glibc/glibc-2.22/inet/ether_aton.c
new file mode 100644
index 0000000..de6c2e5
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ether_aton.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netinet/ether.h>
+
+
+struct ether_addr *
+ether_aton (const char *asc)
+{
+  static struct ether_addr result;
+
+  return ether_aton_r (asc, &result);
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/ether_aton_r.c b/ap/libc/glibc/glibc-2.22/inet/ether_aton_r.c
new file mode 100644
index 0000000..2d33f29
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ether_aton_r.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <netinet/ether.h>
+#include <netinet/if_ether.h>
+
+
+struct ether_addr *
+ether_aton_r (const char *asc, struct ether_addr *addr)
+{
+  size_t cnt;
+
+  for (cnt = 0; cnt < 6; ++cnt)
+    {
+      unsigned int number;
+      char ch;
+
+      ch = _tolower (*asc++);
+      if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
+	return NULL;
+      number = isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
+
+      ch = _tolower (*asc);
+      if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace (ch)))
+	{
+	  ++asc;
+	  if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
+	    return NULL;
+	  number <<= 4;
+	  number += isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
+
+	  ch = *asc;
+	  if (cnt < 5 && ch != ':')
+	    return NULL;
+	}
+
+      /* Store result.  */
+      addr->ether_addr_octet[cnt] = (unsigned char) number;
+
+      /* Skip ':'.  */
+      ++asc;
+    }
+
+  return addr;
+}
+libc_hidden_def (ether_aton_r)
diff --git a/ap/libc/glibc/glibc-2.22/inet/ether_hton.c b/ap/libc/glibc/glibc-2.22/inet/ether_hton.c
new file mode 100644
index 0000000..a1b31a3
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ether_hton.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <netinet/ether.h>
+#include <netinet/if_ether.h>
+#include <string.h>
+
+#include "../nss/nsswitch.h"
+
+/* Type of the lookup function we need here.  */
+typedef int (*lookup_function) (const char *, struct etherent *, char *, int,
+				int *);
+
+/* The lookup function for the first entry of this service.  */
+extern int __nss_ethers_lookup (service_user **nip, const char *name,
+				void **fctp) internal_function;
+
+
+int
+ether_hostton (const char *hostname, struct ether_addr *addr)
+{
+  static service_user *startp;
+  static lookup_function start_fct;
+  service_user *nip;
+  union
+  {
+    lookup_function f;
+    void *ptr;
+  } fct;
+  int no_more;
+  enum nss_status status = NSS_STATUS_UNAVAIL;
+  struct etherent etherent;
+
+  if (startp == NULL)
+    {
+      no_more = __nss_ethers_lookup (&nip, "gethostton_r", &fct.ptr);
+      if (no_more)
+	startp = (service_user *) -1;
+      else
+	{
+	  startp = nip;
+	  start_fct = fct.f;
+	}
+    }
+  else
+    {
+      fct.f = start_fct;
+      no_more = (nip = startp) == (service_user *) -1;
+    }
+
+  while (no_more == 0)
+    {
+      char buffer[1024];
+
+      status = (*fct.f) (hostname, &etherent, buffer, sizeof buffer, &errno);
+
+      no_more = __nss_next2 (&nip, "gethostton_r", NULL, &fct.ptr, status, 0);
+    }
+
+  if (status == NSS_STATUS_SUCCESS)
+    memcpy (addr, etherent.e_addr.ether_addr_octet,
+	    sizeof (struct ether_addr));
+
+  return status == NSS_STATUS_SUCCESS ? 0 : -1;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/ether_line.c b/ap/libc/glibc/glibc-2.22/inet/ether_line.c
new file mode 100644
index 0000000..707b218
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ether_line.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/ether.h>
+#include <netinet/if_ether.h>
+
+
+int
+ether_line (const char *line, struct ether_addr *addr, char *hostname)
+{
+  for (size_t cnt = 0; cnt < 6; ++cnt)
+    {
+      unsigned int number;
+      char ch;
+
+      ch = _tolower (*line++);
+      if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
+	return -1;
+      number = isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
+
+      ch = _tolower (*line);
+      if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace (ch)))
+	{
+	  ++line;
+	  if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
+	    return -1;
+	  number <<= 4;
+	  number += isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
+
+	  ch = *line;
+	  if (cnt < 5 && ch != ':')
+	    return -1;
+	}
+
+      /* Store result.  */
+      addr->ether_addr_octet[cnt] = (unsigned char) number;
+
+      /* Skip ':'.  */
+      if (ch != '\0')
+	++line;
+    }
+
+  /* Skip initial whitespace.  */
+  while (isspace (*line))
+    ++line;
+
+  if (*line == '#' || *line == '\0')
+    /* No hostname.  */
+    return -1;
+
+  /* The hostname is up to the next non-space character.  */
+  /* XXX This can cause trouble because the hostname might be too long
+     but we have no possibility to check it here.  */
+  while (*line != '\0' && *line != '#' && !isspace (*line))
+    *hostname++ = *line++;
+  *hostname = '\0';
+
+  return 0;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/ether_ntoa.c b/ap/libc/glibc/glibc-2.22/inet/ether_ntoa.c
new file mode 100644
index 0000000..2988569
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ether_ntoa.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netinet/ether.h>
+#include <netinet/if_ether.h>
+
+
+char *
+ether_ntoa (const struct ether_addr *addr)
+{
+  static char asc[18];
+
+  return ether_ntoa_r (addr, asc);
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/ether_ntoa_r.c b/ap/libc/glibc/glibc-2.22/inet/ether_ntoa_r.c
new file mode 100644
index 0000000..edd2793
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ether_ntoa_r.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <netinet/ether.h>
+#include <netinet/if_ether.h>
+
+
+char *
+ether_ntoa_r (const struct ether_addr *addr, char *buf)
+{
+  sprintf (buf, "%x:%x:%x:%x:%x:%x",
+	   addr->ether_addr_octet[0], addr->ether_addr_octet[1],
+	   addr->ether_addr_octet[2], addr->ether_addr_octet[3],
+	   addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
+  return buf;
+}
+libc_hidden_def (ether_ntoa_r)
diff --git a/ap/libc/glibc/glibc-2.22/inet/ether_ntoh.c b/ap/libc/glibc/glibc-2.22/inet/ether_ntoh.c
new file mode 100644
index 0000000..cf46b4e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ether_ntoh.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <netinet/ether.h>
+#include <netinet/if_ether.h>
+#include <string.h>
+
+#include <nss/nsswitch.h>
+
+
+/* Type of the lookup function we need here.  */
+typedef int (*lookup_function) (const struct ether_addr *, struct etherent *,
+				char *, size_t, int *);
+
+/* The lookup function for the first entry of this service.  */
+extern int __nss_ethers_lookup (service_user **nip, const char *name,
+				void **fctp) internal_function;
+
+
+int
+ether_ntohost (char *hostname, const struct ether_addr *addr)
+{
+  static service_user *startp;
+  static lookup_function start_fct;
+  service_user *nip;
+  union
+  {
+    lookup_function f;
+    void *ptr;
+  } fct;
+  int no_more;
+  enum nss_status status = NSS_STATUS_UNAVAIL;
+  struct etherent etherent;
+
+  if (startp == NULL)
+    {
+      no_more = __nss_ethers_lookup (&nip, "getntohost_r", &fct.ptr);
+      if (no_more)
+	startp = (service_user *) -1;
+      else
+	{
+	  startp = nip;
+	  start_fct = fct.f;
+	}
+    }
+  else
+    {
+      fct.f = start_fct;
+      no_more = (nip = startp) == (service_user *) -1;
+    }
+
+  while (no_more == 0)
+    {
+      char buffer[1024];
+
+      status = (*fct.f) (addr, &etherent, buffer, sizeof buffer, &errno);
+
+      no_more = __nss_next2 (&nip, "getntohost_r", NULL, &fct.ptr, status, 0);
+    }
+
+  if (status == NSS_STATUS_SUCCESS)
+    /* XXX This is a potential cause of trouble because the size of
+       the HOSTNAME buffer is not known but the interface does not
+       provide this information.  */
+    strcpy (hostname, etherent.e_name);
+
+  return status == NSS_STATUS_SUCCESS ? 0 : -1;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/getaliasent.c b/ap/libc/glibc/glibc-2.22/inet/getaliasent.c
new file mode 100644
index 0000000..5cfb51a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getaliasent.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <aliases.h>
+
+
+#define LOOKUP_TYPE	struct aliasent
+#define	GETFUNC_NAME	getaliasent
+#define BUFLEN		1024
+
+/* There is no nscd support for the aliases file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXent.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getaliasent_r.c b/ap/libc/glibc/glibc-2.22/inet/getaliasent_r.c
new file mode 100644
index 0000000..dfdf6c6
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getaliasent_r.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <aliases.h>
+
+
+#define LOOKUP_TYPE		struct aliasent
+#define SETFUNC_NAME		setaliasent
+#define	GETFUNC_NAME		getaliasent
+#define	ENDFUNC_NAME		endaliasent
+#define DATABASE_NAME		aliases
+
+/* There is no nscd support for the aliases file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXent_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getaliasname.c b/ap/libc/glibc/glibc-2.22/inet/getaliasname.c
new file mode 100644
index 0000000..8b59b2b
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getaliasname.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <aliases.h>
+
+
+#define LOOKUP_TYPE	struct aliasent
+#define FUNCTION_NAME	getaliasbyname
+#define DATABASE_NAME	aliases
+#define ADD_PARAMS	const char *name
+#define ADD_VARIABLES	name
+#define BUFLEN		1024
+
+/* There is no nscd support for the aliases file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getaliasname_r.c b/ap/libc/glibc/glibc-2.22/inet/getaliasname_r.c
new file mode 100644
index 0000000..dc3f5d6
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getaliasname_r.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <aliases.h>
+
+
+#define LOOKUP_TYPE		struct aliasent
+#define FUNCTION_NAME		getaliasbyname
+#define DATABASE_NAME		aliases
+#define ADD_PARAMS		const char *name
+#define ADD_VARIABLES		name
+
+/* There is no nscd support for the aliases file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/gethstbyad.c b/ap/libc/glibc/glibc-2.22/inet/gethstbyad.c
new file mode 100644
index 0000000..d7c36d7
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/gethstbyad.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define FUNCTION_NAME	gethostbyaddr
+#define DATABASE_NAME	hosts
+#define ADD_PARAMS	const void *addr, socklen_t len, int type
+#define ADD_VARIABLES	addr, len, type
+#define BUFLEN		1024
+#define NEED_H_ERRNO	1
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/gethstbyad_r.c b/ap/libc/glibc/glibc-2.22/inet/gethstbyad_r.c
new file mode 100644
index 0000000..06d3906
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/gethstbyad_r.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+#include <string.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define FUNCTION_NAME	gethostbyaddr
+#define DATABASE_NAME	hosts
+#define ADD_PARAMS	const void *addr, socklen_t len, int type
+#define ADD_VARIABLES	addr, len, type
+#define NEED_H_ERRNO	1
+#define NEED__RES	1
+#define NEED__RES_HCONF	1
+/* If the addr parameter is the IPv6 unspecified address no query must
+   be performed.  */
+#define PREPROCESS \
+  if (len == sizeof (struct in6_addr)					      \
+      && __builtin_expect (memcmp (&__in6addr_any, addr,		      \
+				   sizeof (struct in6_addr)), 1) == 0)	      \
+    {									      \
+      *h_errnop = HOST_NOT_FOUND;					      \
+      *result = NULL;							      \
+      return ENOENT;							      \
+    }
+#define POSTPROCESS \
+  if (status == NSS_STATUS_SUCCESS)					      \
+    {									      \
+      _res_hconf_reorder_addrs (resbuf);				      \
+      _res_hconf_trim_domains (resbuf);					      \
+    }
+
+/* Special name for the lookup function.  */
+#define DB_LOOKUP_FCT __nss_hosts_lookup2
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/gethstbynm.c b/ap/libc/glibc/glibc-2.22/inet/gethstbynm.c
new file mode 100644
index 0000000..cb12f2a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/gethstbynm.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define FUNCTION_NAME	gethostbyname
+#define DATABASE_NAME	hosts
+#define ADD_PARAMS	const char *name
+#define ADD_VARIABLES	name
+#define BUFLEN		1024
+#define NEED_H_ERRNO	1
+
+#define HANDLE_DIGITS_DOTS	1
+
+#include <nss/getXXbyYY.c>
diff --git a/ap/libc/glibc/glibc-2.22/inet/gethstbynm2.c b/ap/libc/glibc/glibc-2.22/inet/gethstbynm2.c
new file mode 100644
index 0000000..4eae094
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/gethstbynm2.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define FUNCTION_NAME	gethostbyname2
+#define DATABASE_NAME	hosts
+#define ADD_PARAMS	const char *name, int af
+#define ADD_VARIABLES	name, af
+#define BUFLEN		1024
+#define NEED_H_ERRNO	1
+
+#define HANDLE_DIGITS_DOTS	1
+#define HAVE_AF			1
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/gethstbynm2_r.c b/ap/libc/glibc/glibc-2.22/inet/gethstbynm2_r.c
new file mode 100644
index 0000000..d5fb50a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/gethstbynm2_r.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define FUNCTION_NAME	gethostbyname2
+#define DATABASE_NAME	hosts
+#define ADD_PARAMS	const char *name, int af
+#define ADD_VARIABLES	name, af
+#define NEED_H_ERRNO	1
+#define NEED__RES_HCONF	1
+#define POSTPROCESS \
+  if (status == NSS_STATUS_SUCCESS)					      \
+    _res_hconf_reorder_addrs (resbuf);
+
+#define HANDLE_DIGITS_DOTS	1
+#define HAVE_LOOKUP_BUFFER	1
+#define HAVE_AF			1
+
+/* Special name for the lookup function.  */
+#define DB_LOOKUP_FCT __nss_hosts_lookup2
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/gethstbynm_r.c b/ap/libc/glibc/glibc-2.22/inet/gethstbynm_r.c
new file mode 100644
index 0000000..999c0bb
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/gethstbynm_r.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define FUNCTION_NAME	gethostbyname
+#define DATABASE_NAME	hosts
+#define ADD_PARAMS	const char *name
+#define ADD_VARIABLES	name
+#define NEED_H_ERRNO	1
+#define NEED__RES_HCONF	1
+#define POSTPROCESS \
+  if (status == NSS_STATUS_SUCCESS)					      \
+    _res_hconf_reorder_addrs (resbuf);
+
+#define HANDLE_DIGITS_DOTS	1
+#define HAVE_LOOKUP_BUFFER	1
+
+/* Special name for the lookup function.  */
+#define DB_LOOKUP_FCT __nss_hosts_lookup2
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/gethstent.c b/ap/libc/glibc/glibc-2.22/inet/gethstent.c
new file mode 100644
index 0000000..62a0199
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/gethstent.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define	GETFUNC_NAME	gethostent
+#define BUFLEN		1024
+#define NEED_H_ERRNO	1
+
+#include "../nss/getXXent.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/gethstent_r.c b/ap/libc/glibc/glibc-2.22/inet/gethstent_r.c
new file mode 100644
index 0000000..9255263
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/gethstent_r.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define SETFUNC_NAME	sethostent
+#define	GETFUNC_NAME	gethostent
+#define	ENDFUNC_NAME	endhostent
+#define DATABASE_NAME	hosts
+#define STAYOPEN	int stayopen
+#define STAYOPEN_VAR	stayopen
+#define NEED_H_ERRNO	1
+#define NEED__RES	1
+
+/* Special name for the lookup function.  */
+#define DB_LOOKUP_FCT __nss_hosts_lookup2
+
+#include "../nss/getXXent_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getipv4sourcefilter.c b/ap/libc/glibc/glibc-2.22/inet/getipv4sourcefilter.c
new file mode 100644
index 0000000..b47f272
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getipv4sourcefilter.c
@@ -0,0 +1,32 @@
+/* Get source filter.  Stub version.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stdint.h>
+#include <netinet/in.h>
+
+
+int
+getipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
+		     uint32_t *fmode, uint32_t *numsrc, struct in_addr *slist)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (getipv4sourcefilter)
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnameinfo.c b/ap/libc/glibc/glibc-2.22/inet/getnameinfo.c
new file mode 100644
index 0000000..0126f20
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnameinfo.c
@@ -0,0 +1,469 @@
+/* The Inner Net License, Version 2.00
+
+  The author(s) grant permission for redistribution and use in source and
+binary forms, with or without modification, of the software and documentation
+provided that the following conditions are met:
+
+0. If you receive a version of the software that is specifically labelled
+   as not being for redistribution (check the version message and/or README),
+   you are not permitted to redistribute that version of the software in any
+   way or form.
+1. All terms of the all other applicable copyrights and licenses must be
+   followed.
+2. Redistributions of source code must retain the authors' copyright
+   notice(s), this list of conditions, and the following disclaimer.
+3. Redistributions in binary form must reproduce the authors' copyright
+   notice(s), this list of conditions, and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+4. [The copyright holder has authorized the removal of this clause.]
+5. Neither the name(s) of the author(s) nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  If these license terms cause you a real problem, contact the author.  */
+
+/* This software is Copyright 1996 by Craig Metz, All Rights Reserved.  */
+
+#include <errno.h>
+#include <netdb.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <sys/utsname.h>
+#include <bits/libc-lock.h>
+#include <scratch_buffer.h>
+
+#ifdef HAVE_LIBIDN
+# include <libidn/idna.h>
+extern int __idna_to_unicode_lzlz (const char *input, char **output,
+				   int flags);
+#endif
+
+#ifndef min
+# define min(x,y) (((x) > (y)) ? (y) : (x))
+#endif /* min */
+
+libc_freeres_ptr (static char *domain);
+
+
+static char *
+internal_function
+nrl_domainname (void)
+{
+  static int not_first;
+
+  if (! not_first)
+    {
+      __libc_lock_define_initialized (static, lock);
+      __libc_lock_lock (lock);
+
+      if (! not_first)
+	{
+	  char *c;
+	  struct hostent *h, th;
+	  int herror;
+	  struct scratch_buffer tmpbuf;
+
+	  scratch_buffer_init (&tmpbuf);
+	  not_first = 1;
+
+	  while (__gethostbyname_r ("localhost", &th,
+				    tmpbuf.data, tmpbuf.length,
+				    &h, &herror))
+	    {
+	      if (herror == NETDB_INTERNAL && errno == ERANGE)
+		{
+		  if (!scratch_buffer_grow (&tmpbuf))
+		    goto done;
+		}
+	      else
+		break;
+	    }
+
+	  if (h && (c = strchr (h->h_name, '.')))
+	    domain = __strdup (++c);
+	  else
+	    {
+	      /* The name contains no domain information.  Use the name
+		 now to get more information.  */
+	      while (__gethostname (tmpbuf.data, tmpbuf.length))
+		if (!scratch_buffer_grow (&tmpbuf))
+		  goto done;
+
+	      if ((c = strchr (tmpbuf.data, '.')))
+		domain = __strdup (++c);
+	      else
+		{
+		  /* We need to preserve the hostname.  */
+		  const char *hstname = strdupa (tmpbuf.data);
+
+		  while (__gethostbyname_r (hstname, &th,
+					    tmpbuf.data, tmpbuf.length,
+					    &h, &herror))
+		    {
+		      if (herror == NETDB_INTERNAL && errno == ERANGE)
+			{
+			  if (!scratch_buffer_grow (&tmpbuf))
+			    goto done;
+			}
+		      else
+			break;
+		    }
+
+		  if (h && (c = strchr(h->h_name, '.')))
+		    domain = __strdup (++c);
+		  else
+		    {
+		      struct in_addr in_addr;
+
+		      in_addr.s_addr = htonl (INADDR_LOOPBACK);
+
+		      while (__gethostbyaddr_r ((const char *) &in_addr,
+						sizeof (struct in_addr),
+						AF_INET, &th,
+						tmpbuf.data, tmpbuf.length,
+						&h, &herror))
+			{
+			  if (herror == NETDB_INTERNAL && errno == ERANGE)
+			    {
+			      if (!scratch_buffer_grow (&tmpbuf))
+				goto done;
+			    }
+			  else
+			    break;
+			}
+
+		      if (h && (c = strchr (h->h_name, '.')))
+			domain = __strdup (++c);
+		    }
+		}
+	    }
+	done:
+	  scratch_buffer_free (&tmpbuf);
+	}
+
+      __libc_lock_unlock (lock);
+    }
+
+  return domain;
+};
+
+
+int
+getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
+	     socklen_t hostlen, char *serv, socklen_t servlen,
+	     int flags)
+{
+  int serrno = errno;
+  int herrno;
+  struct hostent th;
+  int ok = 0;
+  struct scratch_buffer tmpbuf;
+
+  scratch_buffer_init (&tmpbuf);
+
+  if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM
+#ifdef HAVE_LIBIDN
+		|NI_IDN|NI_IDN_ALLOW_UNASSIGNED|NI_IDN_USE_STD3_ASCII_RULES
+#endif
+		))
+    return EAI_BADFLAGS;
+
+  if (sa == NULL || addrlen < sizeof (sa_family_t))
+    return EAI_FAMILY;
+
+  if ((flags & NI_NAMEREQD) && host == NULL && serv == NULL)
+    return EAI_NONAME;
+
+  switch (sa->sa_family)
+    {
+    case AF_LOCAL:
+      if (addrlen < (socklen_t) offsetof (struct sockaddr_un, sun_path))
+	return EAI_FAMILY;
+      break;
+    case AF_INET:
+      if (addrlen < sizeof (struct sockaddr_in))
+	return EAI_FAMILY;
+      break;
+    case AF_INET6:
+      if (addrlen < sizeof (struct sockaddr_in6))
+	return EAI_FAMILY;
+      break;
+    default:
+      return EAI_FAMILY;
+    }
+
+  if (host != NULL && hostlen > 0)
+    switch (sa->sa_family)
+      {
+      case AF_INET:
+      case AF_INET6:
+	if (!(flags & NI_NUMERICHOST))
+	  {
+	    struct hostent *h = NULL;
+	    if (sa->sa_family == AF_INET6)
+	      {
+		while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+					  sizeof(struct in6_addr),
+					  AF_INET6, &th,
+					  tmpbuf.data, tmpbuf.length,
+					  &h, &herrno))
+		  if (herrno == NETDB_INTERNAL && errno == ERANGE)
+		    {
+		      if (!scratch_buffer_grow (&tmpbuf))
+			{
+			  __set_h_errno (herrno);
+			  return EAI_MEMORY;
+			}
+		    }
+		  else
+		    break;
+	      }
+	    else
+	      {
+		while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr),
+					  sizeof(struct in_addr),
+					  AF_INET, &th,
+					  tmpbuf.data, tmpbuf.length,
+					  &h, &herrno))
+		  if (herrno == NETDB_INTERNAL && errno == ERANGE)
+		    {
+		      if (!scratch_buffer_grow (&tmpbuf))
+			{
+			  __set_h_errno (herrno);
+			  return EAI_MEMORY;
+			}
+		    }
+		  else
+		    break;
+	      }
+
+	    if (h == NULL)
+	      {
+		if (herrno == NETDB_INTERNAL)
+		  {
+		    __set_h_errno (herrno);
+		    return EAI_SYSTEM;
+		  }
+		if (herrno == TRY_AGAIN)
+		  {
+		    __set_h_errno (herrno);
+		    return EAI_AGAIN;
+		  }
+	      }
+
+	    if (h)
+	      {
+		char *c;
+		if ((flags & NI_NOFQDN)
+		    && (c = nrl_domainname ())
+		    && (c = strstr (h->h_name, c))
+		    && (c != h->h_name) && (*(--c) == '.'))
+		  /* Terminate the string after the prefix.  */
+		  *c = '\0';
+
+#ifdef HAVE_LIBIDN
+		/* If requested, convert from the IDN format.  */
+		if (flags & NI_IDN)
+		  {
+		    int idn_flags = 0;
+		    if  (flags & NI_IDN_ALLOW_UNASSIGNED)
+		      idn_flags |= IDNA_ALLOW_UNASSIGNED;
+		    if (flags & NI_IDN_USE_STD3_ASCII_RULES)
+		      idn_flags |= IDNA_USE_STD3_ASCII_RULES;
+
+		    char *out;
+		    int rc = __idna_to_unicode_lzlz (h->h_name, &out,
+						     idn_flags);
+		    if (rc != IDNA_SUCCESS)
+		      {
+			if (rc == IDNA_MALLOC_ERROR)
+			  return EAI_MEMORY;
+			if (rc == IDNA_DLOPEN_ERROR)
+			  return EAI_SYSTEM;
+			return EAI_IDN_ENCODE;
+		      }
+
+		    if (out != h->h_name)
+		      {
+			h->h_name = strdupa (out);
+			free (out);
+		      }
+		  }
+#endif
+
+		size_t len = strlen (h->h_name) + 1;
+		if (len > hostlen)
+		  return EAI_OVERFLOW;
+
+		memcpy (host, h->h_name, len);
+
+		ok = 1;
+	      }
+	  }
+
+	if (!ok)
+	  {
+	    if (flags & NI_NAMEREQD)
+	      {
+		__set_errno (serrno);
+		return EAI_NONAME;
+	      }
+	    else
+	      {
+		const char *c;
+		if (sa->sa_family == AF_INET6)
+		  {
+		    const struct sockaddr_in6 *sin6p;
+		    uint32_t scopeid;
+
+		    sin6p = (const struct sockaddr_in6 *) sa;
+
+		    c = inet_ntop (AF_INET6,
+				   (const void *) &sin6p->sin6_addr, host, hostlen);
+		    scopeid = sin6p->sin6_scope_id;
+		    if (scopeid != 0)
+		      {
+			/* Buffer is >= IFNAMSIZ+1.  */
+			char scopebuf[IFNAMSIZ + 1];
+			char *scopeptr;
+			int ni_numericscope = 0;
+			size_t real_hostlen = __strnlen (host, hostlen);
+			size_t scopelen = 0;
+
+			scopebuf[0] = SCOPE_DELIMITER;
+			scopebuf[1] = '\0';
+			scopeptr = &scopebuf[1];
+
+			if (IN6_IS_ADDR_LINKLOCAL (&sin6p->sin6_addr)
+			    || IN6_IS_ADDR_MC_LINKLOCAL (&sin6p->sin6_addr))
+			  {
+			    if (if_indextoname (scopeid, scopeptr) == NULL)
+			      ++ni_numericscope;
+			    else
+			      scopelen = strlen (scopebuf);
+			  }
+			else
+			  ++ni_numericscope;
+
+			if (ni_numericscope)
+			  scopelen = 1 + __snprintf (scopeptr,
+						     (scopebuf
+						      + sizeof scopebuf
+						      - scopeptr),
+						     "%u", scopeid);
+
+			if (real_hostlen + scopelen + 1 > hostlen)
+			  /* Signal the buffer is too small.  This is
+			     what inet_ntop does.  */
+			  c = NULL;
+			else
+			  memcpy (host + real_hostlen, scopebuf, scopelen + 1);
+		      }
+		  }
+		else
+		  c = inet_ntop (AF_INET,
+				 (const void *) &(((const struct sockaddr_in *) sa)->sin_addr),
+				 host, hostlen);
+		if (c == NULL)
+		  return EAI_OVERFLOW;
+	      }
+	    ok = 1;
+	  }
+	break;
+
+      case AF_LOCAL:
+	if (!(flags & NI_NUMERICHOST))
+	  {
+	    struct utsname utsname;
+
+	    if (!uname (&utsname))
+	      {
+		strncpy (host, utsname.nodename, hostlen);
+		break;
+	      };
+	  };
+
+	if (flags & NI_NAMEREQD)
+	   {
+	    __set_errno (serrno);
+	    return EAI_NONAME;
+	  }
+
+	strncpy (host, "localhost", hostlen);
+	break;
+
+      default:
+	return EAI_FAMILY;
+    }
+
+  if (serv && (servlen > 0))
+    switch (sa->sa_family)
+      {
+      case AF_INET:
+      case AF_INET6:
+	if (!(flags & NI_NUMERICSERV))
+	  {
+	    struct servent *s, ts;
+	    int e;
+	    while ((e = __getservbyport_r (((const struct sockaddr_in *) sa)->sin_port,
+					   ((flags & NI_DGRAM)
+					    ? "udp" : "tcp"), &ts,
+					   tmpbuf.data, tmpbuf.length, &s)))
+	      {
+		if (e == ERANGE)
+		  {
+		    if (!scratch_buffer_grow (&tmpbuf))
+		      return EAI_MEMORY;
+		  }
+		else
+		  break;
+	      }
+	    if (s)
+	      {
+		strncpy (serv, s->s_name, servlen);
+		break;
+	      }
+	  }
+
+	if (__snprintf (serv, servlen, "%d",
+			ntohs (((const struct sockaddr_in *) sa)->sin_port))
+	    + 1 > servlen)
+	  return EAI_OVERFLOW;
+
+	break;
+
+      case AF_LOCAL:
+	strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen);
+	break;
+    }
+
+  if (host && (hostlen > 0))
+    host[hostlen-1] = 0;
+  if (serv && (servlen > 0))
+    serv[servlen-1] = 0;
+  errno = serrno;
+  return 0;
+}
+libc_hidden_def (getnameinfo)
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnetbyad.c b/ap/libc/glibc/glibc-2.22/inet/getnetbyad.c
new file mode 100644
index 0000000..a03d1ec
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnetbyad.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+#include <stdint.h>
+
+
+#define LOOKUP_TYPE	struct netent
+#define FUNCTION_NAME	getnetbyaddr
+#define DATABASE_NAME	networks
+#define ADD_PARAMS	uint32_t net, int type
+#define ADD_VARIABLES	net, type
+#define BUFLEN		1024
+#define NEED_H_ERRNO	1
+
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnetbyad_r.c b/ap/libc/glibc/glibc-2.22/inet/getnetbyad_r.c
new file mode 100644
index 0000000..909ebc7
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnetbyad_r.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+#include <stdint.h>
+
+
+#define LOOKUP_TYPE		struct netent
+#define FUNCTION_NAME		getnetbyaddr
+#define DATABASE_NAME		networks
+#define ADD_PARAMS		uint32_t net, int type
+#define ADD_VARIABLES		net, type
+#define NEED__RES		1
+#define NEED_H_ERRNO		1
+
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnetbynm.c b/ap/libc/glibc/glibc-2.22/inet/getnetbynm.c
new file mode 100644
index 0000000..5e92759
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnetbynm.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct netent
+#define FUNCTION_NAME	getnetbyname
+#define DATABASE_NAME	networks
+#define ADD_PARAMS	const char *name
+#define ADD_VARIABLES	name
+#define BUFLEN		1024
+#define NEED_H_ERRNO	1
+
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnetbynm_r.c b/ap/libc/glibc/glibc-2.22/inet/getnetbynm_r.c
new file mode 100644
index 0000000..a10c4be
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnetbynm_r.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE		struct netent
+#define FUNCTION_NAME		getnetbyname
+#define DATABASE_NAME		networks
+#define ADD_PARAMS		const char *name
+#define ADD_VARIABLES		name
+#define NEED__RES		1
+#define NEED_H_ERRNO		1
+
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnetent.c b/ap/libc/glibc/glibc-2.22/inet/getnetent.c
new file mode 100644
index 0000000..5858755
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnetent.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct netent
+#define	GETFUNC_NAME	getnetent
+#define BUFLEN		1024
+#define NEED_H_ERRNO	1
+
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXent.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnetent_r.c b/ap/libc/glibc/glibc-2.22/inet/getnetent_r.c
new file mode 100644
index 0000000..539d79f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnetent_r.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE		struct netent
+#define SETFUNC_NAME		setnetent
+#define	GETFUNC_NAME		getnetent
+#define	ENDFUNC_NAME		endnetent
+#define DATABASE_NAME		networks
+#define STAYOPEN		int stayopen
+#define STAYOPEN_VAR		stayopen
+#define NEED__RES		1
+#define NEED_H_ERRNO		1
+
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXent_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnetgrent.c b/ap/libc/glibc/glibc-2.22/inet/getnetgrent.c
new file mode 100644
index 0000000..094f34f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnetgrent.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <netdb.h>
+#include <stdlib.h>
+#include <bits/libc-lock.h>
+
+/* Static buffer for return value.  We allocate it when needed.  */
+libc_freeres_ptr (static char *buffer);
+/* All three strings should fit in a block of 1kB size.  */
+#define BUFSIZE 1024
+
+
+
+static void
+allocate (void)
+{
+  buffer = (char *) malloc (BUFSIZE);
+}
+
+int
+getnetgrent (char **hostp, char **userp, char **domainp)
+{
+  __libc_once_define (static, once);
+  __libc_once (once, allocate);
+
+  if (buffer == NULL)
+    {
+      __set_errno (ENOMEM);
+      return -1;
+    }
+
+  return __getnetgrent_r (hostp, userp, domainp, buffer, BUFSIZE);
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/getnetgrent_r.c b/ap/libc/glibc/glibc-2.22/inet/getnetgrent_r.c
new file mode 100644
index 0000000..53ae648
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getnetgrent_r.c
@@ -0,0 +1,535 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <assert.h>
+#include <atomic.h>
+#include <bits/libc-lock.h>
+#include <errno.h>
+#include <netdb.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include "netgroup.h"
+#include "nsswitch.h"
+#include <sysdep.h>
+#include <nscd/nscd_proto.h>
+
+
+/* Protect above variable against multiple uses at the same time.  */
+__libc_lock_define_initialized (static, lock)
+
+/* The whole information for the set/get/endnetgrent functions are
+   kept in this structure.  */
+static struct __netgrent dataset;
+
+/* The lookup function for the first entry of this service.  */
+extern int __nss_netgroup_lookup (service_user **nipp, const char *name,
+				  void **fctp) internal_function;
+
+/* Set up NIP to run through the services.  Return nonzero if there are no
+   services (left).  */
+static int
+setup (void **fctp, service_user **nipp)
+{
+  /* Remember the first service_entry, it's always the same.  */
+  static bool startp_initialized;
+  static service_user *startp;
+  int no_more;
+
+  if (!startp_initialized)
+    {
+      /* Executing this more than once at the same time must yield the
+	 same result every time.  So we need no locking.  */
+      no_more = __nss_netgroup_lookup (nipp, "setnetgrent", fctp);
+      startp = no_more ? (service_user *) -1 : *nipp;
+#ifdef PTR_MANGLE
+      PTR_MANGLE (startp);
+#endif
+      atomic_write_barrier ();
+      startp_initialized = true;
+    }
+  else
+    {
+      service_user *nip = startp;
+#ifdef PTR_DEMANGLE
+      PTR_DEMANGLE (nip);
+#endif
+      if (nip == (service_user *) -1)
+	/* No services at all.  */
+	return 1;
+
+      /* Reset to the beginning of the service list.  */
+      *nipp = nip;
+      /* Look up the first function.  */
+      no_more = __nss_lookup (nipp, "setnetgrent", NULL, fctp);
+    }
+  return no_more;
+}
+
+/* Free used memory.  */
+static void
+free_memory (struct __netgrent *data)
+{
+  while (data->known_groups != NULL)
+    {
+      struct name_list *tmp = data->known_groups;
+      data->known_groups = data->known_groups->next;
+      free (tmp);
+    }
+
+  while (data->needed_groups != NULL)
+    {
+      struct name_list *tmp = data->needed_groups;
+      data->needed_groups = data->needed_groups->next;
+      free (tmp);
+    }
+}
+
+static void
+endnetgrent_hook (struct __netgrent *datap)
+{
+  enum nss_status (*endfct) (struct __netgrent *);
+
+  if (datap->nip == NULL || datap->nip == (service_user *) -1l)
+    return;
+
+  endfct = __nss_lookup_function (datap->nip, "endnetgrent");
+  if (endfct != NULL)
+    (void) (*endfct) (datap);
+  datap->nip = NULL;
+}
+
+static int
+internal_function
+__internal_setnetgrent_reuse (const char *group, struct __netgrent *datap,
+			      int *errnop)
+{
+  union
+  {
+    enum nss_status (*f) (const char *, struct __netgrent *);
+    void *ptr;
+  } fct;
+  enum nss_status status = NSS_STATUS_UNAVAIL;
+  struct name_list *new_elem;
+
+  /* Free data from previous service.  */
+  endnetgrent_hook (datap);
+
+  /* Cycle through all the services and run their setnetgrent functions.  */
+  int no_more = setup (&fct.ptr, &datap->nip);
+  while (! no_more)
+    {
+      assert (datap->data == NULL);
+
+      /* Ignore status, we force check in `__nss_next2'.  */
+      status = DL_CALL_FCT (*fct.f, (group, datap));
+
+      service_user *old_nip = datap->nip;
+      no_more = __nss_next2 (&datap->nip, "setnetgrent", NULL, &fct.ptr,
+			     status, 0);
+
+      if (status == NSS_STATUS_SUCCESS && ! no_more)
+	{
+	  enum nss_status (*endfct) (struct __netgrent *);
+
+	  endfct = __nss_lookup_function (old_nip, "endnetgrent");
+	  if (endfct != NULL)
+	    (void) DL_CALL_FCT (*endfct, (datap));
+	}
+    }
+
+  /* Add the current group to the list of known groups.  */
+  size_t group_len = strlen (group) + 1;
+  new_elem = (struct name_list *) malloc (sizeof (struct name_list)
+					  + group_len);
+  if (new_elem == NULL)
+    {
+      *errnop = errno;
+      status = NSS_STATUS_TRYAGAIN;
+    }
+  else
+    {
+      new_elem->next = datap->known_groups;
+      memcpy (new_elem->name, group, group_len);
+      datap->known_groups = new_elem;
+    }
+
+  return status == NSS_STATUS_SUCCESS;
+}
+
+int
+internal_function
+__internal_setnetgrent (const char *group, struct __netgrent *datap)
+{
+  /* Free list of all netgroup names from last run.  */
+  free_memory (datap);
+
+  return __internal_setnetgrent_reuse (group, datap, &errno);
+}
+libc_hidden_def (__internal_setnetgrent)
+
+static int
+nscd_setnetgrent (const char *group)
+{
+#ifdef USE_NSCD
+  if (__nss_not_use_nscd_netgroup > 0
+      && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY)
+    __nss_not_use_nscd_netgroup = 0;
+
+  if (!__nss_not_use_nscd_netgroup
+      && !__nss_database_custom[NSS_DBSIDX_netgroup])
+    return __nscd_setnetgrent (group, &dataset);
+#endif
+  return -1;
+}
+
+int
+setnetgrent (const char *group)
+{
+  int result;
+
+  __libc_lock_lock (lock);
+
+  result = nscd_setnetgrent (group);
+  if (result < 0)
+    result = __internal_setnetgrent (group, &dataset);
+
+  __libc_lock_unlock (lock);
+
+  return result;
+}
+
+void
+internal_function
+__internal_endnetgrent (struct __netgrent *datap)
+{
+  endnetgrent_hook (datap);
+  /* Now free list of all netgroup names from last run.  */
+  free_memory (datap);
+}
+libc_hidden_def (__internal_endnetgrent)
+
+
+void
+endnetgrent (void)
+{
+  __libc_lock_lock (lock);
+
+  __internal_endnetgrent (&dataset);
+
+  __libc_lock_unlock (lock);
+}
+
+#ifdef USE_NSCD
+static const char *
+get_nonempty_val (const char *in)
+{
+  if (*in == '\0')
+    return NULL;
+  return in;
+}
+
+static enum nss_status
+nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen,
+		  int *errnop)
+{
+  if (datap->cursor >= datap->data + datap->data_size)
+    return NSS_STATUS_UNAVAIL;
+
+  datap->type = triple_val;
+  datap->val.triple.host = get_nonempty_val (datap->cursor);
+  datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1;
+  datap->val.triple.user = get_nonempty_val (datap->cursor);
+  datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1;
+  datap->val.triple.domain = get_nonempty_val (datap->cursor);
+  datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1;
+
+  return NSS_STATUS_SUCCESS;
+}
+#endif
+
+int
+internal_function
+__internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
+			  struct __netgrent *datap,
+			  char *buffer, size_t buflen, int *errnop)
+{
+  enum nss_status (*fct) (struct __netgrent *, char *, size_t, int *);
+
+  /* Initialize status to return if no more functions are found.  */
+  enum nss_status status = NSS_STATUS_NOTFOUND;
+
+  /* Run through available functions, starting with the same function last
+     run.  We will repeat each function as long as it succeeds, and then go
+     on to the next service action.  */
+  int no_more = datap->nip == NULL;
+  if (! no_more)
+    {
+#ifdef USE_NSCD
+      /* This bogus function pointer is a special marker left by
+	 __nscd_setnetgrent to tell us to use the data it left
+	 before considering any modules.  */
+      if (datap->nip == (service_user *) -1l)
+	fct = nscd_getnetgrent;
+      else
+#endif
+	{
+	  fct = __nss_lookup_function (datap->nip, "getnetgrent_r");
+	  no_more = fct == NULL;
+	}
+
+      while (! no_more)
+	{
+	  status = DL_CALL_FCT (*fct, (datap, buffer, buflen, &errno));
+
+	  if (status == NSS_STATUS_RETURN
+	      /* The service returned a NOTFOUND, but there are more groups that
+		 we need to resolve before we give up.  */
+	      || (status == NSS_STATUS_NOTFOUND && datap->needed_groups != NULL))
+	    {
+	      /* This was the last one for this group.  Look at next group
+		 if available.  */
+	      int found = 0;
+	      while (datap->needed_groups != NULL && ! found)
+		{
+		  struct name_list *tmp = datap->needed_groups;
+		  datap->needed_groups = datap->needed_groups->next;
+		  tmp->next = datap->known_groups;
+		  datap->known_groups = tmp;
+
+		  found = __internal_setnetgrent_reuse (datap->known_groups->name,
+							datap, errnop);
+		}
+
+	      if (found && datap->nip != NULL)
+		{
+		  fct = __nss_lookup_function (datap->nip, "getnetgrent_r");
+		  if (fct != NULL)
+		    continue;
+		}
+	    }
+	  else if (status == NSS_STATUS_SUCCESS && datap->type == group_val)
+	    {
+	      /* The last entry was a name of another netgroup.  */
+	      struct name_list *namep;
+
+	      /* Ignore if we've seen the name before.  */
+	      for (namep = datap->known_groups; namep != NULL;
+		   namep = namep->next)
+		if (strcmp (datap->val.group, namep->name) == 0)
+		  break;
+	      if (namep == NULL)
+		for (namep = datap->needed_groups; namep != NULL;
+		     namep = namep->next)
+		  if (strcmp (datap->val.group, namep->name) == 0)
+		    break;
+	      if (namep != NULL)
+		/* Really ignore.  */
+		continue;
+
+	      size_t group_len = strlen (datap->val.group) + 1;
+	      namep = (struct name_list *) malloc (sizeof (struct name_list)
+						  + group_len);
+	      if (namep == NULL)
+		/* We are out of memory.  */
+		status = NSS_STATUS_RETURN;
+	      else
+		{
+		  namep->next = datap->needed_groups;
+		  memcpy (namep->name, datap->val.group, group_len);
+		  datap->needed_groups = namep;
+		  /* And get the next entry.  */
+		  continue;
+		}
+	    }
+	  break;
+	}
+    }
+
+  if (status == NSS_STATUS_SUCCESS)
+    {
+      *hostp = (char *) datap->val.triple.host;
+      *userp = (char *) datap->val.triple.user;
+      *domainp = (char *) datap->val.triple.domain;
+    }
+
+  return status == NSS_STATUS_SUCCESS ? 1 : 0;
+}
+libc_hidden_def (__internal_getnetgrent_r)
+
+/* The real entry point.  */
+int
+__getnetgrent_r (char **hostp, char **userp, char **domainp,
+		 char *buffer, size_t buflen)
+{
+  enum nss_status status;
+
+  __libc_lock_lock (lock);
+
+  status = __internal_getnetgrent_r (hostp, userp, domainp, &dataset,
+				     buffer, buflen, &errno);
+
+  __libc_lock_unlock (lock);
+
+  return status;
+}
+weak_alias (__getnetgrent_r, getnetgrent_r)
+
+/* Test whether given (host,user,domain) triple is in NETGROUP.  */
+int
+innetgr (const char *netgroup, const char *host, const char *user,
+	 const char *domain)
+{
+#ifdef USE_NSCD
+  if (__nss_not_use_nscd_netgroup > 0
+      && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY)
+    __nss_not_use_nscd_netgroup = 0;
+
+  if (!__nss_not_use_nscd_netgroup
+      && !__nss_database_custom[NSS_DBSIDX_netgroup])
+    {
+      int result = __nscd_innetgr (netgroup, host, user, domain);
+      if (result >= 0)
+	return result;
+    }
+#endif
+
+  union
+  {
+    enum nss_status (*f) (const char *, struct __netgrent *);
+    void *ptr;
+  } setfct;
+  void (*endfct) (struct __netgrent *);
+  int (*getfct) (struct __netgrent *, char *, size_t, int *);
+  struct __netgrent entry;
+  int result = 0;
+  const char *current_group = netgroup;
+
+  memset (&entry, '\0', sizeof (entry));
+
+  /* Walk through the services until we found an answer or we shall
+     not work further.  We can do some optimization here.  Since all
+     services must provide the `setnetgrent' function we can do all
+     the work during one walk through the service list.  */
+  while (1)
+    {
+      int no_more = setup (&setfct.ptr, &entry.nip);
+      while (! no_more)
+	{
+	  assert (entry.data == NULL);
+
+	  /* Open netgroup.  */
+	  enum nss_status status = DL_CALL_FCT (*setfct.f,
+						(current_group, &entry));
+
+	  if (status == NSS_STATUS_SUCCESS
+	      && (getfct = __nss_lookup_function (entry.nip, "getnetgrent_r"))
+		 != NULL)
+	    {
+	      char buffer[1024];
+
+	      while (DL_CALL_FCT (*getfct,
+				  (&entry, buffer, sizeof buffer, &errno))
+		     == NSS_STATUS_SUCCESS)
+		{
+		  if (entry.type == group_val)
+		    {
+		      /* Make sure we haven't seen the name before.  */
+		      struct name_list *namep;
+
+		      for (namep = entry.known_groups; namep != NULL;
+			   namep = namep->next)
+			if (strcmp (entry.val.group, namep->name) == 0)
+			  break;
+		      if (namep == NULL)
+			for (namep = entry.needed_groups; namep != NULL;
+			     namep = namep->next)
+			  if (strcmp (entry.val.group, namep->name) == 0)
+			    break;
+		      if (namep == NULL
+			  && strcmp (netgroup, entry.val.group) != 0)
+			{
+			  size_t group_len = strlen (entry.val.group) + 1;
+			  namep =
+			    (struct name_list *) malloc (sizeof (*namep)
+							 + group_len);
+			  if (namep == NULL)
+			    {
+			      /* Out of memory, simply return.  */
+			      result = -1;
+			      break;
+			    }
+
+			  namep->next = entry.needed_groups;
+			  memcpy (namep->name, entry.val.group, group_len);
+			  entry.needed_groups = namep;
+			}
+		    }
+		  else
+		    {
+		      if ((entry.val.triple.host == NULL || host == NULL
+			   || __strcasecmp (entry.val.triple.host, host) == 0)
+			  && (entry.val.triple.user == NULL || user == NULL
+			      || strcmp (entry.val.triple.user, user) == 0)
+			  && (entry.val.triple.domain == NULL || domain == NULL
+			      || __strcasecmp (entry.val.triple.domain,
+					       domain) == 0))
+			{
+			  result = 1;
+			  break;
+			}
+		    }
+		}
+
+	      /* If we found one service which does know the given
+		 netgroup we don't try further.  */
+	      status = NSS_STATUS_RETURN;
+	    }
+
+	  /* Free all resources of the service.  */
+	  endfct = __nss_lookup_function (entry.nip, "endnetgrent");
+	  if (endfct != NULL)
+	    DL_CALL_FCT (*endfct, (&entry));
+
+	  if (result != 0)
+	    break;
+
+	  /* Look for the next service.  */
+	  no_more = __nss_next2 (&entry.nip, "setnetgrent", NULL,
+				 &setfct.ptr, status, 0);
+	}
+
+      if (result == 0 && entry.needed_groups != NULL)
+	{
+	  struct name_list *tmp = entry.needed_groups;
+	  entry.needed_groups = tmp->next;
+	  tmp->next = entry.known_groups;
+	  entry.known_groups = tmp;
+	  current_group = tmp->name;
+	  continue;
+	}
+
+      /* No way out.  */
+      break;
+    }
+
+  /* Free the memory.  */
+  free_memory (&entry);
+
+  return result == 1;
+}
+libc_hidden_def (innetgr)
diff --git a/ap/libc/glibc/glibc-2.22/inet/getproto.c b/ap/libc/glibc/glibc-2.22/inet/getproto.c
new file mode 100644
index 0000000..32dcd13
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getproto.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct protoent
+#define FUNCTION_NAME	getprotobynumber
+#define DATABASE_NAME	protocols
+#define ADD_PARAMS	int proto
+#define ADD_VARIABLES	proto
+#define BUFLEN		1024
+
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getproto_r.c b/ap/libc/glibc/glibc-2.22/inet/getproto_r.c
new file mode 100644
index 0000000..7dc08a7
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getproto_r.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE		struct protoent
+#define FUNCTION_NAME		getprotobynumber
+#define DATABASE_NAME		protocols
+#define ADD_PARAMS		int proto
+#define ADD_VARIABLES		proto
+
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getprtent.c b/ap/libc/glibc/glibc-2.22/inet/getprtent.c
new file mode 100644
index 0000000..3c4f4e5
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getprtent.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct protoent
+#define	GETFUNC_NAME	getprotoent
+#define BUFLEN		1024
+
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXent.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getprtent_r.c b/ap/libc/glibc/glibc-2.22/inet/getprtent_r.c
new file mode 100644
index 0000000..965e4b8
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getprtent_r.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE		struct protoent
+#define SETFUNC_NAME		setprotoent
+#define	GETFUNC_NAME		getprotoent
+#define	ENDFUNC_NAME		endprotoent
+#define DATABASE_NAME		protocols
+#define STAYOPEN		int stayopen
+#define STAYOPEN_VAR		stayopen
+
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXent_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getprtname.c b/ap/libc/glibc/glibc-2.22/inet/getprtname.c
new file mode 100644
index 0000000..78a96df
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getprtname.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct protoent
+#define FUNCTION_NAME	getprotobyname
+#define DATABASE_NAME	protocols
+#define ADD_PARAMS	const char *name
+#define ADD_VARIABLES	name
+#define BUFLEN		1024
+
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getprtname_r.c b/ap/libc/glibc/glibc-2.22/inet/getprtname_r.c
new file mode 100644
index 0000000..9512261
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getprtname_r.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE		struct protoent
+#define FUNCTION_NAME		getprotobyname
+#define DATABASE_NAME		protocols
+#define ADD_PARAMS		const char *name
+#define ADD_VARIABLES		name
+
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getservent.c b/ap/libc/glibc/glibc-2.22/inet/getservent.c
new file mode 100644
index 0000000..1c24ba4
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getservent.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct servent
+#define	GETFUNC_NAME	getservent
+#define BUFLEN		1024
+
+#include "../nss/getXXent.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getservent_r.c b/ap/libc/glibc/glibc-2.22/inet/getservent_r.c
new file mode 100644
index 0000000..b315c8d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getservent_r.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE		struct servent
+#define SETFUNC_NAME		setservent
+#define	GETFUNC_NAME		getservent
+#define	ENDFUNC_NAME		endservent
+#define DATABASE_NAME		services
+#define STAYOPEN		int stayopen
+#define STAYOPEN_VAR		stayopen
+
+#include "../nss/getXXent_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getsourcefilter.c b/ap/libc/glibc/glibc-2.22/inet/getsourcefilter.c
new file mode 100644
index 0000000..1fb9dc7
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getsourcefilter.c
@@ -0,0 +1,32 @@
+/* Get source filter.  Stub version.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <netinet/in.h>
+#include <stdint.h>
+
+int
+getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
+		 socklen_t grouplen, uint32_t *fmode, uint32_t *numsrc,
+		 struct sockaddr_storage *slist)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (getsourcefilter)
diff --git a/ap/libc/glibc/glibc-2.22/inet/getsrvbynm.c b/ap/libc/glibc/glibc-2.22/inet/getsrvbynm.c
new file mode 100644
index 0000000..c367c9e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getsrvbynm.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct servent
+#define FUNCTION_NAME	getservbyname
+#define DATABASE_NAME	services
+#define ADD_PARAMS	const char *name, const char *proto
+#define ADD_VARIABLES	name, proto
+#define BUFLEN		1024
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getsrvbynm_r.c b/ap/libc/glibc/glibc-2.22/inet/getsrvbynm_r.c
new file mode 100644
index 0000000..498539d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getsrvbynm_r.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE		struct servent
+#define FUNCTION_NAME		getservbyname
+#define DATABASE_NAME		services
+#define ADD_PARAMS		const char *name, const char *proto
+#define ADD_VARIABLES		name, proto
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getsrvbypt.c b/ap/libc/glibc/glibc-2.22/inet/getsrvbypt.c
new file mode 100644
index 0000000..cde5986
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getsrvbypt.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE	struct servent
+#define FUNCTION_NAME	getservbyport
+#define DATABASE_NAME	services
+#define ADD_PARAMS	int port, const char *proto
+#define ADD_VARIABLES	port, proto
+#define BUFLEN		1024
+
+#include "../nss/getXXbyYY.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/getsrvbypt_r.c b/ap/libc/glibc/glibc-2.22/inet/getsrvbypt_r.c
new file mode 100644
index 0000000..7cde45d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/getsrvbypt_r.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE		struct servent
+#define FUNCTION_NAME		getservbyport
+#define DATABASE_NAME		services
+#define ADD_PARAMS		int port, const char *proto
+#define ADD_VARIABLES		port, proto
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/herrno-loc.c b/ap/libc/glibc/glibc-2.22/inet/herrno-loc.c
new file mode 100644
index 0000000..bff195c
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/herrno-loc.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netdb.h>
+#include <tls.h>
+
+
+/* When threaded, h_errno may be a per-thread variable.  */
+int *
+weak_const_function
+__h_errno_location (void)
+{
+  return &h_errno;
+}
+libc_hidden_def (__h_errno_location)
diff --git a/ap/libc/glibc/glibc-2.22/inet/herrno.c b/ap/libc/glibc/glibc-2.22/inet/herrno.c
new file mode 100644
index 0000000..672a91d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/herrno.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <features.h>
+#include <netdb.h>
+#undef h_errno
+
+#include <tls.h>
+
+/* We need to have the error status variable of the resolver
+   accessible in the libc.  */
+
+__thread int __h_errno;
+extern __thread int __libc_h_errno __attribute__ ((alias ("__h_errno")))
+  attribute_hidden;
+#define h_errno __libc_h_errno
diff --git a/ap/libc/glibc/glibc-2.22/inet/htonl.c b/ap/libc/glibc/glibc-2.22/inet/htonl.c
new file mode 100644
index 0000000..f70283a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/htonl.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1993-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+#undef	htonl
+#undef	ntohl
+
+uint32_t
+htonl (uint32_t x)
+{
+#if BYTE_ORDER == BIG_ENDIAN
+  return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+  return __bswap_32 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
+weak_alias (htonl, ntohl)
diff --git a/ap/libc/glibc/glibc-2.22/inet/htons.c b/ap/libc/glibc/glibc-2.22/inet/htons.c
new file mode 100644
index 0000000..dd0186e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/htons.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1993-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netinet/in.h>
+
+#undef	htons
+#undef	ntohs
+
+uint16_t
+htons (uint16_t x)
+{
+#if BYTE_ORDER == BIG_ENDIAN
+  return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+  return __bswap_16 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
+weak_alias (htons, ntohs)
diff --git a/ap/libc/glibc/glibc-2.22/inet/htontest.c b/ap/libc/glibc/glibc-2.22/inet/htontest.c
new file mode 100644
index 0000000..f99f012
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/htontest.c
@@ -0,0 +1,70 @@
+/* Test hton/ntoh functions.
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <endian.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#if BYTE_ORDER == BIG_ENDIAN
+# define TEST(orig, swapped, fct) \
+  if ((fct (orig)) != (orig)) {						      \
+    printf ("Failed for %s -> %#x\n", #fct "(" #orig ")", fct (orig));	      \
+    result = 1;								      \
+  }
+#elif BYTE_ORDER == LITTLE_ENDIAN
+# define TEST(orig, swapped, fct) \
+  if ((fct (orig)) != (swapped)) {					      \
+    printf ("Failed for %s -> %#x\n", #fct "(" #orig ")", fct (orig));	      \
+    result = 1;								      \
+  }
+#else
+# error "Bah, what kind of system do you use?"
+#endif
+
+u_int32_t lo = 0x67452301;
+u_int16_t foo = 0x1234;
+
+int
+main (void)
+{
+  int result = 0;
+
+  TEST (0x67452301, 0x01234567, htonl);
+  TEST (0x67452301, 0x01234567, (htonl));
+  TEST (0x67452301, 0x01234567, ntohl);
+  TEST (0x67452301, 0x01234567, (ntohl));
+
+  TEST (lo, 0x01234567, htonl);
+  TEST (lo, 0x01234567, (htonl));
+  TEST (lo, 0x01234567, ntohl);
+  TEST (lo, 0x01234567, (ntohl));
+
+  TEST (0x1234, 0x3412, htons);
+  TEST (0x1234, 0x3412, (htons));
+  TEST (0x1234, 0x3412, ntohs);
+  TEST (0x1234, 0x3412, (ntohs));
+
+  TEST (foo, 0x3412, htons);
+  TEST (foo, 0x3412, (htons));
+  TEST (foo, 0x3412, ntohs);
+  TEST (foo, 0x3412, (ntohs));
+
+  return result;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/if_index.c b/ap/libc/glibc/glibc-2.22/inet/if_index.c
new file mode 100644
index 0000000..73b1efe
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/if_index.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <net/if.h>
+#include <errno.h>
+#include <stddef.h>
+
+unsigned int
+__if_nametoindex (const char *ifname)
+{
+  __set_errno (ENOSYS);
+  return 0;
+}
+libc_hidden_def (__if_nametoindex)
+weak_alias (__if_nametoindex, if_nametoindex)
+libc_hidden_weak (if_nametoindex)
+stub_warning (if_nametoindex)
+
+char *
+__if_indextoname (unsigned int ifindex, char *ifname)
+{
+  __set_errno (ENOSYS);
+  return NULL;
+}
+weak_alias (__if_indextoname, if_indextoname)
+libc_hidden_weak (if_indextoname)
+stub_warning (if_indextoname)
+
+void
+__if_freenameindex (struct if_nameindex *ifn)
+{
+}
+libc_hidden_def (__if_freenameindex)
+weak_alias (__if_freenameindex, if_freenameindex)
+libc_hidden_weak (if_freenameindex)
+stub_warning (if_freenameindex)
+
+struct if_nameindex *
+__if_nameindex (void)
+{
+  __set_errno (ENOSYS);
+  return NULL;
+}
+weak_alias (__if_nameindex, if_nameindex)
+libc_hidden_weak (if_nameindex)
+stub_warning (if_nameindex)
+
+#if 0
+void
+internal_function
+__protocol_available (int *have_inet, int *have_inet6)
+{
+  /* By default we assume that IPv4 is available, IPv6 not.  */
+  *have_inet = 1;
+  *have_inet6 = 0;
+}
+#endif
diff --git a/ap/libc/glibc/glibc-2.22/inet/ifaddrs.c b/ap/libc/glibc/glibc-2.22/inet/ifaddrs.c
new file mode 100644
index 0000000..3b47804
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ifaddrs.c
@@ -0,0 +1,47 @@
+/* getifaddrs -- get names and addresses of all network interfaces
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <ifaddrs.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* 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'.  */
+int
+__getifaddrs (struct ifaddrs **ifap)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__getifaddrs, getifaddrs)
+libc_hidden_weak (getifaddrs)
+stub_warning (getifaddrs)
+
+void
+__freeifaddrs (struct ifaddrs *ifa)
+{
+  if (ifa == NULL)
+    return;			/* a la free, why not? */
+
+  /* Can't be called properly if getifaddrs never succeeded.  */
+  abort ();
+}
+weak_alias (__freeifaddrs, freeifaddrs)
+libc_hidden_weak (freeifaddrs)
+stub_warning (freeifaddrs)
diff --git a/ap/libc/glibc/glibc-2.22/inet/ifaddrs.h b/ap/libc/glibc/glibc-2.22/inet/ifaddrs.h
new file mode 100644
index 0000000..222a0a1
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ifaddrs.h
@@ -0,0 +1,73 @@
+/* ifaddrs.h -- declarations for getting network interface addresses
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _IFADDRS_H
+#define _IFADDRS_H	1
+
+#include <features.h>
+#include <sys/socket.h>
+
+__BEGIN_DECLS
+
+/* The `getifaddrs' function generates a linked list of these structures.
+   Each element of the list describes one network interface.  */
+struct ifaddrs
+{
+  struct ifaddrs *ifa_next;	/* Pointer to the next structure.  */
+
+  char *ifa_name;		/* Name of this network interface.  */
+  unsigned int ifa_flags;	/* Flags as from SIOCGIFFLAGS 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; /* Broadcast address of this interface. */
+    struct sockaddr *ifu_dstaddr; /* Point-to-point destination address.  */
+  } ifa_ifu;
+  /* These very same macros are defined by <net/if.h> for `struct ifaddr'.
+     So if they are defined already, the existing definitions will be fine.  */
+# ifndef ifa_broadaddr
+#  define ifa_broadaddr	ifa_ifu.ifu_broadaddr
+# endif
+# ifndef ifa_dstaddr
+#  define ifa_dstaddr	ifa_ifu.ifu_dstaddr
+# endif
+
+  void *ifa_data;		/* Address-specific data (may be unused).  */
+};
+
+
+/* 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 **__ifap) __THROW;
+
+/* Reclaim the storage allocated by a previous `getifaddrs' call.  */
+extern void freeifaddrs (struct ifaddrs *__ifa)  __THROW;
+
+__END_DECLS
+
+#endif /* ifaddrs.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/ifreq.c b/ap/libc/glibc/glibc-2.22/inet/ifreq.c
new file mode 100644
index 0000000..398e445
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ifreq.c
@@ -0,0 +1,26 @@
+/* Collect network interface list.  Stub version.
+   Copyright (C) 2013-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "ifreq.h"
+
+void
+__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
+{
+  *num_ifs = 0;
+  *ifreqs = NULL;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/in6_addr.c b/ap/libc/glibc/glibc-2.22/inet/in6_addr.c
new file mode 100644
index 0000000..fb77290
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/in6_addr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <netinet/in.h>
+
+const struct in6_addr __in6addr_any =
+{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
+libc_hidden_data_def (__in6addr_any)
+weak_alias (__in6addr_any, in6addr_any)
+libc_hidden_data_weak (in6addr_any)
+const struct in6_addr __in6addr_loopback =
+{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } };
+libc_hidden_data_def (__in6addr_loopback)
+weak_alias (__in6addr_loopback, in6addr_loopback)
+libc_hidden_data_weak (in6addr_loopback)
diff --git a/ap/libc/glibc/glibc-2.22/inet/inet6_opt.c b/ap/libc/glibc/glibc-2.22/inet/inet6_opt.c
new file mode 100644
index 0000000..9a6bb0a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/inet6_opt.c
@@ -0,0 +1,281 @@
+/* Copyright (C) 2006-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <string.h>
+#include <netinet/in.h>
+#include <netinet/ip6.h>
+
+
+/* RFC 3542, 10.1
+
+   This function returns the number of bytes needed for the empty
+   extension header i.e., without any options.  If EXTBUF is not NULL it
+   also initializes the extension header to have the correct length
+   field.  In that case if the EXTLEN value is not a positive (i.e.,
+   non-zero) multiple of 8 the function fails and returns -1.  */
+int
+inet6_opt_init (void *extbuf, socklen_t extlen)
+{
+  if (extbuf != NULL)
+    {
+      if (extlen <= 0 || (extlen % 8) != 0 || extlen > 256 * 8)
+	return -1;
+
+      /* Fill in the length in units of 8 octets.  */
+      struct ip6_hbh *extp = (struct ip6_hbh *) extbuf;
+
+      /* RFC 2460 requires that the header extension length is the
+	 length of the option header in 8-byte units, not including
+	 the first 8 bytes.  Hence we have to subtract one.  */
+      extp->ip6h_len = extlen / 8 - 1;
+    }
+
+  return sizeof (struct ip6_hbh);
+}
+
+
+static void
+add_padding (uint8_t *extbuf, int offset, int npad)
+{
+  if (npad == 1)
+    extbuf[offset] = IP6OPT_PAD1;
+  else if (npad > 0)
+    {
+      struct ip6_opt *pad_opt = (struct ip6_opt *) (extbuf + offset);
+
+      pad_opt->ip6o_type = IP6OPT_PADN;
+      pad_opt->ip6o_len = npad - sizeof (struct ip6_opt);
+      /* Clear the memory used by the padding.  */
+      memset (pad_opt + 1, '\0', pad_opt->ip6o_len);
+    }
+}
+
+
+
+/* RFC 3542, 10.2
+
+   This function returns the updated total length taking into account
+   adding an option with length 'len' and alignment 'align'.  If
+   EXTBUF is not NULL then, in addition to returning the length, the
+   function inserts any needed pad option, initializes the option
+   (setting the type and length fields) and returns a pointer to the
+   location for the option content in databufp.  If the option does
+   not fit in the extension header buffer the function returns -1.  */
+int
+inet6_opt_append (void *extbuf, socklen_t extlen, int offset, uint8_t type,
+		  socklen_t len, uint8_t align, void **databufp)
+{
+  /* Check minimum offset.  */
+  if (offset < sizeof (struct ip6_hbh))
+    return -1;
+
+  /* One cannot add padding options.  */
+  if (type == IP6OPT_PAD1 || type == IP6OPT_PADN)
+    return -1;
+
+  /* The option length must fit in one octet.  */
+  if (len > 255)
+    return -1;
+
+  /* The alignment can only by 1, 2, 4, or 8 and must not exceed the
+     option length.  */
+  if (align == 0 || align > 8 || (align & (align - 1)) != 0 || align > len)
+    return -1;
+
+  /* Determine the needed padding for alignment.  Following the
+     current content of the buffer we have the is the IPv6 option type
+     and length, followed immediately by the data.  The data has the
+     alignment constraints.  Therefore padding must be inserted in the
+     form of padding options before the new option. */
+  int data_offset = offset + sizeof (struct ip6_opt);
+  int npad = (align - data_offset % align) & (align - 1);
+
+  if (extbuf != NULL)
+    {
+      /* Now we can check whether the buffer is large enough.  */
+      if (data_offset + npad + len > extlen)
+	return -1;
+
+      add_padding (extbuf, offset, npad);
+
+      offset += npad;
+
+      /* Now prepare the option itself.  */
+      struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset);
+
+      opt->ip6o_type = type;
+      opt->ip6o_len = len;
+
+      *databufp = opt + 1;
+    }
+  else
+    offset += npad;
+
+  return offset + sizeof (struct ip6_opt) + len;
+}
+
+
+/* RFC 3542, 10.3
+
+   This function returns the updated total length taking into account
+   the final padding of the extension header to make it a multiple of
+   8 bytes.  If EXTBUF is not NULL the function also initializes the
+   option by inserting a Pad1 or PadN option of the proper length.  */
+int
+inet6_opt_finish (void *extbuf, socklen_t extlen, int offset)
+{
+  /* Check minimum offset.  */
+  if (offset < sizeof (struct ip6_hbh))
+    return -1;
+
+  /* Required padding at the end.  */
+  int npad = (8 - (offset & 7)) & 7;
+
+  if (extbuf != NULL)
+    {
+      /* Make sure the buffer is large enough.  */
+      if (offset + npad > extlen)
+	return -1;
+
+      add_padding (extbuf, offset, npad);
+    }
+
+  return offset + npad;
+}
+
+
+/* RFC 3542, 10.4
+
+   This function inserts data items of various sizes in the data
+   portion of the option.  VAL should point to the data to be
+   inserted.  OFFSET specifies where in the data portion of the option
+   the value should be inserted; the first byte after the option type
+   and length is accessed by specifying an offset of zero.  */
+int
+inet6_opt_set_val (void *databuf, int offset, void *val, socklen_t vallen)
+{
+  memcpy ((uint8_t *) databuf + offset, val, vallen);
+
+  return offset + vallen;
+}
+
+
+/* RFC 3542, 10.5
+
+   This function parses received option extension headers returning
+   the next option.  EXTBUF and EXTLEN specifies the extension header.
+   OFFSET should either be zero (for the first option) or the length
+   returned by a previous call to 'inet6_opt_next' or
+   'inet6_opt_find'.  It specifies the position where to continue
+   scanning the extension buffer.  */
+int
+inet6_opt_next (void *extbuf, socklen_t extlen, int offset, uint8_t *typep,
+		socklen_t *lenp, void **databufp)
+{
+  if (offset == 0)
+    offset = sizeof (struct ip6_hbh);
+  else if (offset < sizeof (struct ip6_hbh))
+    return -1;
+
+  while (offset < extlen)
+    {
+      struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset);
+
+      if (opt->ip6o_type == IP6OPT_PAD1)
+	/* Single byte padding.  */
+	++offset;
+      else if (opt->ip6o_type == IP6OPT_PADN)
+	offset += sizeof (struct ip6_opt) + opt->ip6o_len;
+      else
+	{
+	  /* Check whether the option is valid.  */
+	  offset += sizeof (struct ip6_opt) + opt->ip6o_len;
+	  if (offset > extlen)
+	    return -1;
+
+	  *typep = opt->ip6o_type;
+	  *lenp = opt->ip6o_len;
+	  *databufp = opt + 1;
+	  return offset;
+	}
+    }
+
+  return -1;
+}
+
+
+/* RFC 3542, 10.6
+
+   This function is similar to the previously described
+   'inet6_opt_next' function, except this function lets the caller
+   specify the option type to be searched for, instead of always
+   returning the next option in the extension header.  */
+int
+inet6_opt_find (void *extbuf, socklen_t extlen, int offset, uint8_t type,
+		socklen_t *lenp, void **databufp)
+{
+  if (offset == 0)
+    offset = sizeof (struct ip6_hbh);
+  else if (offset < sizeof (struct ip6_hbh))
+    return -1;
+
+  while (offset < extlen)
+    {
+      struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset);
+
+      if (opt->ip6o_type == IP6OPT_PAD1)
+	{
+	  /* Single byte padding.  */
+	  ++offset;
+	  if (type == IP6OPT_PAD1)
+	    {
+	      *lenp = 0;
+	      *databufp = (uint8_t *) extbuf + offset;
+	      return offset;
+	    }
+	}
+      else if (opt->ip6o_type != type)
+	offset += sizeof (struct ip6_opt) + opt->ip6o_len;
+      else
+	{
+	  /* Check whether the option is valid.  */
+	  offset += sizeof (struct ip6_opt) + opt->ip6o_len;
+	  if (offset > extlen)
+	    return -1;
+
+	  *lenp = opt->ip6o_len;
+	  *databufp = opt + 1;
+	  return offset;
+	}
+    }
+
+  return -1;
+}
+
+
+/* RFC 3542, 10.7
+
+   This function extracts data items of various sizes in the data
+   portion of the option.  */
+int
+inet6_opt_get_val (void *databuf, int offset, void *val, socklen_t vallen)
+{
+  memcpy (val, (uint8_t *) databuf + offset, vallen);
+
+  return offset + vallen;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/inet6_option.c b/ap/libc/glibc/glibc-2.22/inet/inet6_option.c
new file mode 100644
index 0000000..47ca82f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/inet6_option.c
@@ -0,0 +1,365 @@
+/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <assert.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <netinet/ip6.h>
+#include <sys/param.h>
+
+
+static void
+internal_function
+add_pad (struct cmsghdr *cmsg, int len)
+{
+  unsigned char *p = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0);
+
+  if (len == 1)
+    /* Special handling for 1, a one-byte solution.  */
+    *p++ = IP6OPT_PAD1;
+  else if (len != 0)
+    {
+      /* Multibyte padding.  */
+      *p++ = IP6OPT_PADN;
+      *p++ = len - 2;	/* Discount the two header bytes.  */
+      /* The rest is filled with zero.  */
+      memset (p, '\0', len - 2);
+      p += len - 2;
+    }
+
+  /* Account for the bytes.  */
+  cmsg->cmsg_len += len;
+}
+
+
+static int
+get_opt_end (const uint8_t **result, const uint8_t *startp,
+	     const uint8_t *endp)
+{
+  if (startp >= endp)
+    /* Out of bounds.  */
+    return -1;
+
+  if (*startp == IP6OPT_PAD1)
+    {
+      /* Just this one byte.  */
+      *result = startp + 1;
+      return 0;
+    }
+
+  /* Now we know there must be at least two bytes.  */
+  if (startp + 2 > endp
+      /* Now we can get the length byte.  */
+      || startp + startp[1] + 2 > endp)
+    return -1;
+
+  *result = startp + startp[1] + 2;
+
+  return 0;
+}
+
+
+static uint8_t *option_alloc (struct cmsghdr *cmsg, int datalen, int multx,
+			      int plusy);
+
+
+/* RFC 2292, 6.3.1
+
+   This function returns the number of bytes required to hold an option
+   when it is stored as ancillary data, including the cmsghdr structure
+   at the beginning, and any padding at the end (to make its size a
+   multiple of 8 bytes).  The argument is the size of the structure
+   defining the option, which must include any pad bytes at the
+   beginning (the value y in the alignment term "xn + y"), the type
+   byte, the length byte, and the option data.  */
+int
+inet6_option_space (nbytes)
+     int nbytes;
+{
+  /* Add room for the extension header.  */
+  nbytes += sizeof (struct ip6_ext);
+
+  return CMSG_SPACE (roundup (nbytes, 8));
+}
+link_warning (inet6_option_space,
+	      "inet6_option_space is obsolete, use the RFC 3542 interfaces")
+
+
+/* RFC 2292, 6.3.2
+
+   This function is called once per ancillary data object that will
+   contain either Hop-by-Hop or Destination options.  It returns 0 on
+   success or -1 on an error.  */
+int
+inet6_option_init (bp, cmsgp, type)
+     void *bp;
+     struct cmsghdr **cmsgp;
+     int type;
+{
+  /* Only Hop-by-Hop or Destination options allowed.  */
+  if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS)
+    return -1;
+
+  /* BP is a pointer to the previously allocated space.  */
+  struct cmsghdr *newp = (struct cmsghdr *) bp;
+
+  /* Initialize the message header.
+
+     Length: No data yet, only the cmsghdr struct.  */
+  newp->cmsg_len = CMSG_LEN (0);
+  /* Originating protocol: obviously IPv6.  */
+  newp->cmsg_level = IPPROTO_IPV6;
+  /* Message type.  */
+  newp->cmsg_type = type;
+
+  /* Pass up the result.  */
+  *cmsgp = newp;
+
+  return 0;
+}
+link_warning (inet6_option_init,
+	      "inet6_option_init is obsolete, use the RFC 3542 interfaces")
+
+
+/* RFC 2292, 6.3.3
+
+   This function appends a Hop-by-Hop option or a Destination option
+   into an ancillary data object that has been initialized by
+   inet6_option_init().  This function returns 0 if it succeeds or -1 on
+   an error.  */
+int
+inet6_option_append (cmsg, typep, multx, plusy)
+     struct cmsghdr *cmsg;
+     const uint8_t *typep;
+     int multx;
+     int plusy;
+{
+  /* typep is a pointer to the 8-bit option type.  It is assumed that this
+     field is immediately followed by the 8-bit option data length field,
+     which is then followed immediately by the option data.
+
+     The option types IP6OPT_PAD1 and IP6OPT_PADN also must be handled.  */
+  int len = typep[0] == IP6OPT_PAD1 ? 1 : typep[1] + 2;
+
+  /* Get the pointer to the space in the message.  */
+  uint8_t *ptr = option_alloc (cmsg, len, multx, plusy);
+  if (ptr == NULL)
+    /* Some problem with the parameters.  */
+    return -1;
+
+  /* Copy the content.  */
+  memcpy (ptr, typep, len);
+
+  return 0;
+}
+link_warning (inet6_option_append,
+	      "inet6_option_append is obsolete, use the RFC 3542 interfaces")
+
+
+/* RFC 2292, 6.3.4
+
+   This function appends a Hop-by-Hop option or a Destination option
+   into an ancillary data object that has been initialized by
+   inet6_option_init().  This function returns a pointer to the 8-bit
+   option type field that starts the option on success, or NULL on an
+   error.  */
+static uint8_t *
+option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy)
+{
+  /* The RFC limits the value of the alignment values.  */
+  if ((multx != 1 && multx != 2 && multx != 4 && multx != 8)
+      || ! (plusy >= 0 && plusy <= 7))
+    return NULL;
+
+  /* Current data size.  */
+  int dsize = cmsg->cmsg_len - CMSG_LEN (0);
+
+  /* The first two bytes of the option are for the extended header.  */
+  if (__glibc_unlikely (dsize == 0))
+    {
+      cmsg->cmsg_len += sizeof (struct ip6_ext);
+      dsize = sizeof (struct ip6_ext);
+    }
+
+  /* First add padding.  */
+  add_pad (cmsg, ((multx - (dsize & (multx - 1))) & (multx - 1)) + plusy);
+
+  /* Return the pointer to the start of the option space.  */
+  uint8_t *result = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0);
+  cmsg->cmsg_len += datalen;
+
+  /* The extended option header length is measured in 8-byte groups.
+     To represent the current length we might have to add padding.  */
+  dsize = cmsg->cmsg_len - CMSG_LEN (0);
+  add_pad (cmsg, (8 - (dsize & (8 - 1))) & (8 - 1));
+
+  /* Record the new length of the option.  */
+  assert (((cmsg->cmsg_len - CMSG_LEN (0)) % 8) == 0);
+  int len8b = (cmsg->cmsg_len - CMSG_LEN (0)) / 8 - 1;
+  if (len8b >= 256)
+    /* Too long.  */
+    return NULL;
+
+  struct ip6_ext *ie = (void *) CMSG_DATA (cmsg);
+  ie->ip6e_len = len8b;
+
+  return result;
+}
+
+
+uint8_t *
+inet6_option_alloc (cmsg, datalen, multx, plusy)
+     struct cmsghdr *cmsg;
+     int datalen;
+     int multx;
+     int plusy;
+{
+  return option_alloc (cmsg, datalen, multx, plusy);
+}
+link_warning (inet6_option_alloc,
+	      "inet6_option_alloc is obsolete, use the RFC 3542 interfaces")
+
+
+/* RFC 2292, 6.3.5
+
+   This function processes the next Hop-by-Hop option or Destination
+   option in an ancillary data object.  If another option remains to be
+   processed, the return value of the function is 0 and *tptrp points to
+   the 8-bit option type field (which is followed by the 8-bit option
+   data length, followed by the option data).  If no more options remain
+   to be processed, the return value is -1 and *tptrp is NULL.  If an
+   error occurs, the return value is -1 and *tptrp is not NULL.  */
+int
+inet6_option_next (cmsg, tptrp)
+     const struct cmsghdr *cmsg;
+     uint8_t **tptrp;
+{
+  /* Make sure it is an option of the right type.  */
+  if (cmsg->cmsg_level != IPPROTO_IPV6
+      || (cmsg->cmsg_type != IPV6_HOPOPTS && cmsg->cmsg_type != IPV6_DSTOPTS))
+    return -1;
+
+  /* Pointer to the extension header.  We only compute the address, we
+     don't access anything yet.  */
+  const struct ip6_ext *ip6e = (const struct ip6_ext *) CMSG_DATA (cmsg);
+
+  /* Make sure the message is long enough.  */
+  if (cmsg->cmsg_len < CMSG_LEN (sizeof (struct ip6_ext))
+      /* Now we can access the extension header.  */
+      || cmsg->cmsg_len < CMSG_LEN ((ip6e->ip6e_len + 1) * 8))
+    /* Too small.  */
+    return -1;
+
+  /* Determine the address of the byte past the message.  */
+  const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8;
+
+  const uint8_t *result;
+  if (*tptrp == NULL)
+    /* This is the first call, return the first option if there is one.  */
+    result = (const uint8_t *) (ip6e + 1);
+  else
+    {
+      /* Make sure *TPTRP points to a beginning of a new option in
+	 the message.  The upper limit is checked in get_opt_end.  */
+      if (*tptrp < (const uint8_t *) (ip6e + 1))
+	return -1;
+
+      /* Get the beginning of the next option.  */
+      if (get_opt_end (&result, *tptrp, endp) != 0)
+	return -1;
+    }
+
+  /* We know where the next option starts.  */
+  *tptrp = (uint8_t *) result;
+
+  /* Check the option is fully represented in the message.  */
+  return get_opt_end (&result, result, endp);
+}
+link_warning (inet6_option_next,
+	      "inet6_option_next is obsolete, use the RFC 3542 interfaces")
+
+
+/* RFC 2292, 6.3.6
+
+   This function is similar to the previously described
+   inet6_option_next() function, except this function lets the caller
+   specify the option type to be searched for, instead of always
+   returning the next option in the ancillary data object.  cmsg is a
+   pointer to cmsghdr structure of which cmsg_level equals IPPROTO_IPV6
+   and cmsg_type equals either IPV6_HOPOPTS or IPV6_DSTOPTS.  */
+int
+inet6_option_find (cmsg, tptrp, type)
+     const struct cmsghdr *cmsg;
+     uint8_t **tptrp;
+     int type;
+{
+  /* Make sure it is an option of the right type.  */
+  if (cmsg->cmsg_level != IPPROTO_IPV6
+      || (cmsg->cmsg_type != IPV6_HOPOPTS && cmsg->cmsg_type != IPV6_DSTOPTS))
+    return -1;
+
+  /* Pointer to the extension header.  We only compute the address, we
+     don't access anything yet.  */
+  const struct ip6_ext *ip6e = (const struct ip6_ext *) CMSG_DATA (cmsg);
+
+  /* Make sure the message is long enough.  */
+  if (cmsg->cmsg_len < CMSG_LEN (sizeof (struct ip6_ext))
+      /* Now we can access the extension header.  */
+      || cmsg->cmsg_len < CMSG_LEN ((ip6e->ip6e_len + 1) * 8))
+    /* Too small.  */
+    return -1;
+
+  /* Determine the address of the byte past the message.  */
+  const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8;
+
+  const uint8_t *next;
+  if (*tptrp == NULL)
+    /* This is the first call, return the first option if there is one.  */
+    next = (const uint8_t *) (ip6e + 1);
+  else
+    {
+      /* Make sure *TPTRP points to a beginning of a new option in
+	 the message.  The upper limit is checked in get_opt_end.  */
+      if (*tptrp < (const uint8_t *) (ip6e + 1))
+	return -1;
+
+      /* Get the beginning of the next option.  */
+      if (get_opt_end (&next, *tptrp, endp) != 0)
+	return -1;
+    }
+
+  /* Now search for the appropriate typed entry.  */
+  const uint8_t *result;
+  do
+    {
+      result = next;
+
+      /* Get the end of this entry.  */
+      if (get_opt_end (&next, result, endp) != 0)
+	return -1;
+    }
+  while (*result != type);
+
+  /* We know where the next option starts.  */
+  *tptrp = (uint8_t *) result;
+
+  /* Success.  */
+  return 0;
+}
+link_warning (inet6_option_find,
+	      "inet6_option_find is obsolete, use the RFC 3542 interfaces")
diff --git a/ap/libc/glibc/glibc-2.22/inet/inet6_rth.c b/ap/libc/glibc/glibc-2.22/inet/inet6_rth.c
new file mode 100644
index 0000000..4094b7d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/inet6_rth.c
@@ -0,0 +1,196 @@
+/* Copyright (C) 2006-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <string.h>
+#include <netinet/in.h>
+#include <netinet/ip6.h>
+
+
+/* RFC 3542, 7.1
+
+   This function returns the number of bytes required to hold a
+   Routing header of the specified type containing the specified
+   number of segments (addresses).  For an IPv6 Type 0 Routing header,
+   the number of segments must be between 0 and 127, inclusive.  */
+socklen_t
+inet6_rth_space (int type, int segments)
+{
+  switch (type)
+    {
+    case IPV6_RTHDR_TYPE_0:
+      if (segments < 0 || segments > 127)
+	return 0;
+
+      return sizeof (struct ip6_rthdr0) + segments * sizeof (struct in6_addr);
+    }
+
+  return 0;
+}
+
+
+/* RFC 3542, 7.2
+
+   This function initializes the buffer pointed to by BP to contain a
+   Routing header of the specified type and sets ip6r_len based on the
+   segments parameter.  */
+void *
+inet6_rth_init (void *bp, socklen_t bp_len, int type, int segments)
+{
+  struct ip6_rthdr *rthdr = (struct ip6_rthdr *) bp;
+
+  switch (type)
+    {
+    case IPV6_RTHDR_TYPE_0:
+      /* Make sure the parameters are valid and the buffer is large enough.  */
+      if (segments < 0 || segments > 127)
+	break;
+
+      socklen_t len = (sizeof (struct ip6_rthdr0)
+		       + segments * sizeof (struct in6_addr));
+      if (len > bp_len)
+	break;
+
+      /* Some implementations seem to initialize the whole memory area.  */
+      memset (bp, '\0', len);
+
+      /* Length in units of 8 octets.  */
+      rthdr->ip6r_len = segments * sizeof (struct in6_addr) / 8;
+      rthdr->ip6r_type = IPV6_RTHDR_TYPE_0;
+      return bp;
+    }
+
+  return NULL;
+}
+
+
+/* RFC 3542, 7.3
+
+   This function adds the IPv6 address pointed to by addr to the end of
+   the Routing header being constructed.  */
+int
+inet6_rth_add (void *bp, const struct in6_addr *addr)
+{
+  struct ip6_rthdr *rthdr = (struct ip6_rthdr *) bp;
+
+  switch (rthdr->ip6r_type)
+    {
+      struct ip6_rthdr0 *rthdr0;
+    case IPV6_RTHDR_TYPE_0:
+      rthdr0 = (struct ip6_rthdr0 *) rthdr;
+      if (rthdr0->ip6r0_len * 8 / sizeof (struct in6_addr)
+	  - rthdr0->ip6r0_segleft < 1)
+        return -1;
+
+      memcpy (&rthdr0->ip6r0_addr[rthdr0->ip6r0_segleft++],
+	      addr, sizeof (struct in6_addr));
+
+      return 0;
+    }
+
+  return -1;
+}
+
+
+/* RFC 3542, 7.4
+
+   This function takes a Routing header extension header (pointed to by
+   the first argument) and writes a new Routing header that sends
+   datagrams along the reverse of that route.  The function reverses the
+   order of the addresses and sets the segleft member in the new Routing
+   header to the number of segments.  */
+int
+inet6_rth_reverse (const void *in, void *out)
+{
+  struct ip6_rthdr *in_rthdr = (struct ip6_rthdr *) in;
+
+  switch (in_rthdr->ip6r_type)
+    {
+      struct ip6_rthdr0 *in_rthdr0;
+      struct ip6_rthdr0 *out_rthdr0;
+    case IPV6_RTHDR_TYPE_0:
+      in_rthdr0 = (struct ip6_rthdr0 *) in;
+      out_rthdr0 = (struct ip6_rthdr0 *) out;
+
+      /* Copy header, not the addresses.  The memory regions can overlap.  */
+      memmove (out_rthdr0, in_rthdr0, sizeof (struct ip6_rthdr0));
+
+      int total = in_rthdr0->ip6r0_len * 8 / sizeof (struct in6_addr);
+      for (int i = 0; i < total / 2; ++i)
+	{
+	  /* Remember, IN_RTHDR0 and OUT_RTHDR0 might overlap.  */
+	  struct in6_addr temp = in_rthdr0->ip6r0_addr[i];
+	  out_rthdr0->ip6r0_addr[i] = in_rthdr0->ip6r0_addr[total - 1 - i];
+	  out_rthdr0->ip6r0_addr[total - 1 - i] = temp;
+	}
+      if (total % 2 != 0 && in != out)
+	out_rthdr0->ip6r0_addr[total / 2] = in_rthdr0->ip6r0_addr[total / 2];
+
+      out_rthdr0->ip6r0_segleft = total;
+
+      return 0;
+    }
+
+  return -1;
+}
+
+
+/* RFC 3542, 7.5
+
+   This function returns the number of segments (addresses) contained in
+   the Routing header described by BP.  */
+int
+inet6_rth_segments (const void *bp)
+{
+  struct ip6_rthdr *rthdr = (struct ip6_rthdr *) bp;
+
+  switch (rthdr->ip6r_type)
+    {
+    case IPV6_RTHDR_TYPE_0:
+
+      return rthdr->ip6r_len * 8 / sizeof (struct in6_addr);
+    }
+
+  return -1;
+}
+
+
+/* RFC 3542, 7.6
+
+   This function returns a pointer to the IPv6 address specified by
+   index (which must have a value between 0 and one less than the
+   value returned by 'inet6_rth_segments') in the Routing header
+   described by BP.  */
+struct in6_addr *
+inet6_rth_getaddr (const void *bp, int index)
+{
+  struct ip6_rthdr *rthdr = (struct ip6_rthdr *) bp;
+
+  switch (rthdr->ip6r_type)
+    {
+       struct ip6_rthdr0 *rthdr0;
+    case IPV6_RTHDR_TYPE_0:
+      rthdr0 = (struct ip6_rthdr0 *) rthdr;
+
+      if (index >= rthdr0->ip6r0_len * 8 / sizeof (struct in6_addr))
+	break;
+
+      return &rthdr0->ip6r0_addr[index];
+    }
+
+  return NULL;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/inet_lnaof.c b/ap/libc/glibc/glibc-2.22/inet/inet_lnaof.c
new file mode 100644
index 0000000..c993c8b
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/inet_lnaof.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)inet_lnaof.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+/*
+ * Return the local network address portion of an
+ * internet address; handles class a/b/c network
+ * number formats.
+ */
+in_addr_t
+inet_lnaof(in)
+	struct in_addr in;
+{
+	u_int32_t i = ntohl(in.s_addr);
+
+	if (IN_CLASSA(i))
+		return ((i)&IN_CLASSA_HOST);
+	else if (IN_CLASSB(i))
+		return ((i)&IN_CLASSB_HOST);
+	else
+		return ((i)&IN_CLASSC_HOST);
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/inet_mkadr.c b/ap/libc/glibc/glibc-2.22/inet/inet_mkadr.c
new file mode 100644
index 0000000..580a9cd
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/inet_mkadr.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)inet_makeaddr.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+/*
+ * Formulate an Internet address from network + host.  Used in
+ * building addresses stored in the ifnet structure.
+ */
+struct in_addr
+__inet_makeaddr(net, host)
+	in_addr_t net, host;
+{
+	struct in_addr in;
+
+	if (net < 128)
+		in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
+	else if (net < 65536)
+		in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
+	else if (net < 16777216L)
+		in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
+	else
+		in.s_addr = net | host;
+	in.s_addr = htonl(in.s_addr);
+	return in;
+}
+libc_hidden_def (__inet_makeaddr)
+weak_alias (__inet_makeaddr, inet_makeaddr)
diff --git a/ap/libc/glibc/glibc-2.22/inet/inet_net.c b/ap/libc/glibc/glibc-2.22/inet/inet_net.c
new file mode 100644
index 0000000..b28fdb1
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/inet_net.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* Copyright (C) 2013-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)inet_network.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <ctype.h>
+
+/*
+ * Internet network address interpretation routine.
+ * The library routines call this routine to interpret
+ * network numbers.
+ */
+u_int32_t
+inet_network(cp)
+	const char *cp;
+{
+	u_int32_t val, base, n, i;
+	char c;
+	u_int32_t parts[4], *pp = parts;
+	int digit;
+
+again:
+	val = 0; base = 10; digit = 0;
+	if (*cp == '0')
+		digit = 1, base = 8, cp++;
+	if (*cp == 'x' || *cp == 'X')
+		digit = 0, base = 16, cp++;
+	while ((c = *cp) != 0) {
+		if (isdigit(c)) {
+			if (base == 8 && (c == '8' || c == '9'))
+				return (INADDR_NONE);
+			val = (val * base) + (c - '0');
+			cp++;
+			digit = 1;
+			continue;
+		}
+		if (base == 16 && isxdigit(c)) {
+			val = (val << 4) + (tolower (c) + 10 - 'a');
+			cp++;
+			digit = 1;
+			continue;
+		}
+		break;
+	}
+	if (!digit)
+		return (INADDR_NONE);
+	if (pp >= parts + 4 || val > 0xff)
+		return (INADDR_NONE);
+	if (*cp == '.') {
+		*pp++ = val, cp++;
+		goto again;
+	}
+	while (isspace(*cp))
+		cp++;
+	if (*cp)
+		return (INADDR_NONE);
+	if (pp >= parts + 4 || val > 0xff)
+		return (INADDR_NONE);
+	*pp++ = val;
+	n = pp - parts;
+	for (val = 0, i = 0; i < n; i++) {
+		val <<= 8;
+		val |= parts[i] & 0xff;
+	}
+	return (val);
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/inet_netof.c b/ap/libc/glibc/glibc-2.22/inet/inet_netof.c
new file mode 100644
index 0000000..9b0aed9
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/inet_netof.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)inet_netof.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+/*
+ * Return the network number from an internet
+ * address; handles class a/b/c network #'s.
+ */
+in_addr_t
+inet_netof(in)
+	struct in_addr in;
+{
+	u_int32_t i = ntohl(in.s_addr);
+
+	if (IN_CLASSA(i))
+		return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
+	else if (IN_CLASSB(i))
+		return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT);
+	else
+		return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT);
+}
+libc_hidden_def (inet_netof)
diff --git a/ap/libc/glibc/glibc-2.22/inet/inet_ntoa.c b/ap/libc/glibc/glibc-2.22/inet/inet_ntoa.c
new file mode 100644
index 0000000..306e12f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/inet_ntoa.c
@@ -0,0 +1,38 @@
+/* Convert Inet number to ASCII representation.
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <arpa/inet.h>
+
+/* The interface of this function is completely stupid, it requires a
+   static buffer.  We relax this a bit in that we allow one buffer for
+   each thread.  */
+static __thread char buffer[18];
+
+
+char *
+inet_ntoa (struct in_addr in)
+{
+  unsigned char *bytes = (unsigned char *) &in;
+  __snprintf (buffer, sizeof (buffer), "%d.%d.%d.%d",
+	      bytes[0], bytes[1], bytes[2], bytes[3]);
+
+  return buffer;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/netgroup.h b/ap/libc/glibc/glibc-2.22/inet/netgroup.h
new file mode 100644
index 0000000..3022f5a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/netgroup.h
@@ -0,0 +1,85 @@
+/* Internal header for netgroup related functions.
+   Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _NETGROUP_H
+#define _NETGROUP_H	1
+
+#include <nsswitch.h>
+
+/* A netgroup can consist of names of other netgroups.  We have to
+   track which netgroups were read and which still have to be read.  */
+struct name_list
+{
+  struct name_list *next;
+  char name[];
+};
+
+
+/* Dataset for iterating netgroups.  */
+struct __netgrent
+{
+  enum { triple_val, group_val } type;
+
+  union
+  {
+    struct
+    {
+      const char *host;
+      const char *user;
+      const char *domain;
+    }
+    triple;
+
+    const char *group;
+  } val;
+
+  /* Room for the data kept between the calls to the netgroup
+     functions.  We must avoid global variables.  */
+  char *data;
+  size_t data_size;
+  union
+  {
+    char *cursor;
+    unsigned long int position;
+  };
+  int first;
+
+  struct name_list *known_groups;
+  struct name_list *needed_groups;
+
+  /* This handle for the NSS data base is shared between all
+     set/get/endXXXent functions.  */
+  service_user *nip;
+};
+
+
+/* The internal netgroup handling functions might be called from outside.  */
+extern int __internal_setnetgrent (const char *group,
+				   struct __netgrent *datap)
+  internal_function;
+libc_hidden_proto (__internal_setnetgrent)
+extern void __internal_endnetgrent (struct __netgrent *datap)
+  internal_function;
+libc_hidden_proto (__internal_endnetgrent)
+extern int __internal_getnetgrent_r (char **hostp, char **userp,
+				     char **domainp, struct __netgrent *datap,
+				     char *buffer, size_t buflen, int *errnop)
+  internal_function;
+libc_hidden_proto (__internal_getnetgrent_r)
+
+#endif /* netgroup.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/netinet/ether.h b/ap/libc/glibc/glibc-2.22/inet/netinet/ether.h
new file mode 100644
index 0000000..f0e3821
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/netinet/ether.h
@@ -0,0 +1,53 @@
+/* Functions for storing Ethernet addresses in ASCII and mapping to hostnames.
+   Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _NETINET_ETHER_H
+#define _NETINET_ETHER_H	1
+
+#include <features.h>
+
+/* Get definition of `struct ether_addr'.  */
+#include <netinet/if_ether.h>
+
+__BEGIN_DECLS
+
+/* Convert 48 bit Ethernet ADDRess to ASCII.  */
+extern char *ether_ntoa (const struct ether_addr *__addr) __THROW;
+extern char *ether_ntoa_r (const struct ether_addr *__addr, char *__buf)
+     __THROW;
+
+/* Convert ASCII string S to 48 bit Ethernet address.  */
+extern struct ether_addr *ether_aton (const char *__asc) __THROW;
+extern struct ether_addr *ether_aton_r (const char *__asc,
+					struct ether_addr *__addr) __THROW;
+
+/* Map 48 bit Ethernet number ADDR to HOSTNAME.  */
+extern int ether_ntohost (char *__hostname, const struct ether_addr *__addr)
+     __THROW;
+
+/* Map HOSTNAME to 48 bit Ethernet address.  */
+extern int ether_hostton (const char *__hostname, struct ether_addr *__addr)
+     __THROW;
+
+/* Scan LINE and set ADDR and HOSTNAME.  */
+extern int ether_line (const char *__line, struct ether_addr *__addr,
+		       char *__hostname) __THROW;
+
+__END_DECLS
+
+#endif /* netinet/ether.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/netinet/icmp6.h b/ap/libc/glibc/glibc-2.22/inet/netinet/icmp6.h
new file mode 100644
index 0000000..dfdf4bb
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/netinet/icmp6.h
@@ -0,0 +1,345 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _NETINET_ICMP6_H
+#define _NETINET_ICMP6_H 1
+
+#include <inttypes.h>
+#include <string.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#define ICMP6_FILTER 1
+
+#define ICMP6_FILTER_BLOCK		1
+#define ICMP6_FILTER_PASS		2
+#define ICMP6_FILTER_BLOCKOTHERS	3
+#define ICMP6_FILTER_PASSONLY		4
+
+struct icmp6_filter
+  {
+    uint32_t icmp6_filt[8];
+  };
+
+struct icmp6_hdr
+  {
+    uint8_t     icmp6_type;   /* type field */
+    uint8_t     icmp6_code;   /* code field */
+    uint16_t    icmp6_cksum;  /* checksum field */
+    union
+      {
+	uint32_t  icmp6_un_data32[1]; /* type-specific field */
+	uint16_t  icmp6_un_data16[2]; /* type-specific field */
+	uint8_t   icmp6_un_data8[4];  /* type-specific field */
+      } icmp6_dataun;
+  };
+
+#define icmp6_data32    icmp6_dataun.icmp6_un_data32
+#define icmp6_data16    icmp6_dataun.icmp6_un_data16
+#define icmp6_data8     icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr      icmp6_data32[0]  /* parameter prob */
+#define icmp6_mtu       icmp6_data32[0]  /* packet too big */
+#define icmp6_id        icmp6_data16[0]  /* echo request/reply */
+#define icmp6_seq       icmp6_data16[1]  /* echo request/reply */
+#define icmp6_maxdelay  icmp6_data16[0]  /* mcast group membership */
+
+#define ICMP6_DST_UNREACH             1
+#define ICMP6_PACKET_TOO_BIG          2
+#define ICMP6_TIME_EXCEEDED           3
+#define ICMP6_PARAM_PROB              4
+
+#define ICMP6_INFOMSG_MASK  0x80    /* all informational messages */
+
+#define ICMP6_ECHO_REQUEST          128
+#define ICMP6_ECHO_REPLY            129
+#define MLD_LISTENER_QUERY          130
+#define MLD_LISTENER_REPORT         131
+#define MLD_LISTENER_REDUCTION      132
+
+#define ICMP6_DST_UNREACH_NOROUTE     0 /* no route to destination */
+#define ICMP6_DST_UNREACH_ADMIN       1 /* communication with destination */
+                                        /* administratively prohibited */
+#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
+#define ICMP6_DST_UNREACH_ADDR        3 /* address unreachable */
+#define ICMP6_DST_UNREACH_NOPORT      4 /* bad port */
+
+#define ICMP6_TIME_EXCEED_TRANSIT     0 /* Hop Limit == 0 in transit */
+#define ICMP6_TIME_EXCEED_REASSEMBLY  1 /* Reassembly time out */
+
+#define ICMP6_PARAMPROB_HEADER        0 /* erroneous header field */
+#define ICMP6_PARAMPROB_NEXTHEADER    1 /* unrecognized Next Header */
+#define ICMP6_PARAMPROB_OPTION        2 /* unrecognized IPv6 option */
+
+#define ICMP6_FILTER_WILLPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+
+#define ICMP6_FILTER_SETPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) |=  (1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+	memset (filterp, 0, sizeof (struct icmp6_filter));
+
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+	memset (filterp, 0xFF, sizeof (struct icmp6_filter));
+
+#define ND_ROUTER_SOLICIT           133
+#define ND_ROUTER_ADVERT            134
+#define ND_NEIGHBOR_SOLICIT         135
+#define ND_NEIGHBOR_ADVERT          136
+#define ND_REDIRECT                 137
+
+struct nd_router_solicit      /* router solicitation */
+  {
+    struct icmp6_hdr  nd_rs_hdr;
+    /* could be followed by options */
+  };
+
+#define nd_rs_type               nd_rs_hdr.icmp6_type
+#define nd_rs_code               nd_rs_hdr.icmp6_code
+#define nd_rs_cksum              nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved           nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert       /* router advertisement */
+  {
+    struct icmp6_hdr  nd_ra_hdr;
+    uint32_t   nd_ra_reachable;   /* reachable time */
+    uint32_t   nd_ra_retransmit;  /* retransmit timer */
+    /* could be followed by options */
+  };
+
+#define nd_ra_type               nd_ra_hdr.icmp6_type
+#define nd_ra_code               nd_ra_hdr.icmp6_code
+#define nd_ra_cksum              nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit        nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved     nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED       0x80
+#define ND_RA_FLAG_OTHER         0x40
+#define ND_RA_FLAG_HOME_AGENT    0x20
+#define nd_ra_router_lifetime    nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit    /* neighbor solicitation */
+  {
+    struct icmp6_hdr  nd_ns_hdr;
+    struct in6_addr   nd_ns_target; /* target address */
+    /* could be followed by options */
+  };
+
+#define nd_ns_type               nd_ns_hdr.icmp6_type
+#define nd_ns_code               nd_ns_hdr.icmp6_code
+#define nd_ns_cksum              nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved           nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert     /* neighbor advertisement */
+  {
+    struct icmp6_hdr  nd_na_hdr;
+    struct in6_addr   nd_na_target; /* target address */
+    /* could be followed by options */
+  };
+
+#define nd_na_type               nd_na_hdr.icmp6_type
+#define nd_na_code               nd_na_hdr.icmp6_code
+#define nd_na_cksum              nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved     nd_na_hdr.icmp6_data32[0]
+#if     BYTE_ORDER == BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER        0x80000000
+#define ND_NA_FLAG_SOLICITED     0x40000000
+#define ND_NA_FLAG_OVERRIDE      0x20000000
+#else   /* BYTE_ORDER == LITTLE_ENDIAN */
+#define ND_NA_FLAG_ROUTER        0x00000080
+#define ND_NA_FLAG_SOLICITED     0x00000040
+#define ND_NA_FLAG_OVERRIDE      0x00000020
+#endif
+
+struct nd_redirect            /* redirect */
+  {
+    struct icmp6_hdr  nd_rd_hdr;
+    struct in6_addr   nd_rd_target; /* target address */
+    struct in6_addr   nd_rd_dst;    /* destination address */
+    /* could be followed by options */
+  };
+
+#define nd_rd_type               nd_rd_hdr.icmp6_type
+#define nd_rd_code               nd_rd_hdr.icmp6_code
+#define nd_rd_cksum              nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved           nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr             /* Neighbor discovery option header */
+  {
+    uint8_t  nd_opt_type;
+    uint8_t  nd_opt_len;        /* in units of 8 octets */
+    /* followed by option specific data */
+  };
+
+#define ND_OPT_SOURCE_LINKADDR		1
+#define ND_OPT_TARGET_LINKADDR		2
+#define ND_OPT_PREFIX_INFORMATION	3
+#define ND_OPT_REDIRECTED_HEADER	4
+#define ND_OPT_MTU			5
+#define ND_OPT_RTR_ADV_INTERVAL		7
+#define ND_OPT_HOME_AGENT_INFO		8
+
+struct nd_opt_prefix_info     /* prefix information */
+  {
+    uint8_t   nd_opt_pi_type;
+    uint8_t   nd_opt_pi_len;
+    uint8_t   nd_opt_pi_prefix_len;
+    uint8_t   nd_opt_pi_flags_reserved;
+    uint32_t  nd_opt_pi_valid_time;
+    uint32_t  nd_opt_pi_preferred_time;
+    uint32_t  nd_opt_pi_reserved2;
+    struct in6_addr  nd_opt_pi_prefix;
+  };
+
+#define ND_OPT_PI_FLAG_ONLINK	0x80
+#define ND_OPT_PI_FLAG_AUTO	0x40
+#define ND_OPT_PI_FLAG_RADDR	0x20
+
+struct nd_opt_rd_hdr          /* redirected header */
+  {
+    uint8_t   nd_opt_rh_type;
+    uint8_t   nd_opt_rh_len;
+    uint16_t  nd_opt_rh_reserved1;
+    uint32_t  nd_opt_rh_reserved2;
+    /* followed by IP header and data */
+  };
+
+struct nd_opt_mtu             /* MTU option */
+  {
+    uint8_t   nd_opt_mtu_type;
+    uint8_t   nd_opt_mtu_len;
+    uint16_t  nd_opt_mtu_reserved;
+    uint32_t  nd_opt_mtu_mtu;
+  };
+
+struct mld_hdr
+  {
+    struct icmp6_hdr    mld_icmp6_hdr;
+    struct in6_addr     mld_addr; /* multicast address */
+  };
+
+#define mld_type        mld_icmp6_hdr.icmp6_type
+#define mld_code        mld_icmp6_hdr.icmp6_code
+#define mld_cksum       mld_icmp6_hdr.icmp6_cksum
+#define mld_maxdelay    mld_icmp6_hdr.icmp6_data16[0]
+#define mld_reserved    mld_icmp6_hdr.icmp6_data16[1]
+
+#define ICMP6_ROUTER_RENUMBERING    138
+
+struct icmp6_router_renum    /* router renumbering header */
+  {
+    struct icmp6_hdr    rr_hdr;
+    uint8_t             rr_segnum;
+    uint8_t             rr_flags;
+    uint16_t            rr_maxdelay;
+    uint32_t            rr_reserved;
+  };
+
+#define rr_type		rr_hdr.icmp6_type
+#define rr_code         rr_hdr.icmp6_code
+#define rr_cksum        rr_hdr.icmp6_cksum
+#define rr_seqnum       rr_hdr.icmp6_data32[0]
+
+/* Router renumbering flags */
+#define ICMP6_RR_FLAGS_TEST             0x80
+#define ICMP6_RR_FLAGS_REQRESULT        0x40
+#define ICMP6_RR_FLAGS_FORCEAPPLY       0x20
+#define ICMP6_RR_FLAGS_SPECSITE         0x10
+#define ICMP6_RR_FLAGS_PREVDONE         0x08
+
+struct rr_pco_match    /* match prefix part */
+  {
+    uint8_t             rpm_code;
+    uint8_t             rpm_len;
+    uint8_t             rpm_ordinal;
+    uint8_t             rpm_matchlen;
+    uint8_t             rpm_minlen;
+    uint8_t             rpm_maxlen;
+    uint16_t            rpm_reserved;
+    struct in6_addr     rpm_prefix;
+  };
+
+/* PCO code values */
+#define RPM_PCO_ADD             1
+#define RPM_PCO_CHANGE          2
+#define RPM_PCO_SETGLOBAL       3
+
+struct rr_pco_use      /* use prefix part */
+  {
+    uint8_t             rpu_uselen;
+    uint8_t             rpu_keeplen;
+    uint8_t             rpu_ramask;
+    uint8_t             rpu_raflags;
+    uint32_t            rpu_vltime;
+    uint32_t            rpu_pltime;
+    uint32_t            rpu_flags;
+    struct in6_addr     rpu_prefix;
+  };
+
+#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x20
+#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x10
+
+#if BYTE_ORDER == BIG_ENDIAN
+# define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
+# define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
+#elif BYTE_ORDER == LITTLE_ENDIAN
+# define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
+# define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
+#endif
+
+struct rr_result       /* router renumbering result message */
+  {
+    uint16_t            rrr_flags;
+    uint8_t             rrr_ordinal;
+    uint8_t             rrr_matchedlen;
+    uint32_t            rrr_ifid;
+    struct in6_addr     rrr_prefix;
+  };
+
+#if BYTE_ORDER == BIG_ENDIAN
+# define ICMP6_RR_RESULT_FLAGS_OOB       0x0002
+# define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
+#elif BYTE_ORDER == LITTLE_ENDIAN
+# define ICMP6_RR_RESULT_FLAGS_OOB       0x0200
+# define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
+#endif
+
+/* Mobile IPv6 extension: Advertisement Interval.  */
+struct nd_opt_adv_interval
+  {
+    uint8_t   nd_opt_adv_interval_type;
+    uint8_t   nd_opt_adv_interval_len;
+    uint16_t  nd_opt_adv_interval_reserved;
+    uint32_t  nd_opt_adv_interval_ival;
+  };
+
+/* Mobile IPv6 extension: Home Agent Info.  */
+struct nd_opt_home_agent_info
+  {
+    uint8_t   nd_opt_home_agent_info_type;
+    uint8_t   nd_opt_home_agent_info_len;
+    uint16_t  nd_opt_home_agent_info_reserved;
+    uint16_t  nd_opt_home_agent_info_preference;
+    uint16_t  nd_opt_home_agent_info_lifetime;
+  };
+
+#endif /* netinet/icmpv6.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/netinet/igmp.h b/ap/libc/glibc/glibc-2.22/inet/netinet/igmp.h
new file mode 100644
index 0000000..55988f9
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/netinet/igmp.h
@@ -0,0 +1,125 @@
+/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _NETINET_IGMP_H
+#define	_NETINET_IGMP_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#ifdef __USE_MISC
+
+#include <netinet/in.h>
+
+__BEGIN_DECLS
+
+/*
+ * Copyright (c) 1988 Stephen Deering.
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)igmp.h	8.1 (Berkeley) 6/10/93
+ *	$FreeBSD$
+ */
+
+struct igmp {
+  u_int8_t igmp_type;             /* IGMP type */
+  u_int8_t igmp_code;             /* routing code */
+  u_int16_t igmp_cksum;           /* checksum */
+  struct in_addr igmp_group;      /* group address */
+};
+
+#define IGMP_MINLEN			8
+
+/*
+ * Message types, including version number.
+ */
+#define IGMP_MEMBERSHIP_QUERY   	0x11	/* membership query         */
+#define IGMP_V1_MEMBERSHIP_REPORT	0x12	/* Ver. 1 membership report */
+#define IGMP_V2_MEMBERSHIP_REPORT	0x16	/* Ver. 2 membership report */
+#define IGMP_V2_LEAVE_GROUP		0x17	/* Leave-group message	    */
+
+#define IGMP_DVMRP			0x13	/* DVMRP routing message    */
+#define IGMP_PIM			0x14	/* PIM routing message      */
+#define IGMP_TRACE			0x15
+
+#define IGMP_MTRACE_RESP		0x1e	/* traceroute resp.(to sender)*/
+#define IGMP_MTRACE			0x1f	/* mcast traceroute messages  */
+
+#define IGMP_MAX_HOST_REPORT_DELAY	10	/* max delay for response to     */
+						/*  query (in seconds) according */
+						/*  to RFC1112                   */
+#define IGMP_TIMER_SCALE		10	/* denotes that the igmp code field */
+						/* specifies time in 10th of seconds*/
+
+/*
+ * States for the IGMP v2 state table.
+ */
+#define IGMP_DELAYING_MEMBER	1
+#define IGMP_IDLE_MEMBER	2
+#define IGMP_LAZY_MEMBER	3
+#define IGMP_SLEEPING_MEMBER	4
+#define IGMP_AWAKENING_MEMBER	5
+
+/*
+ * States for IGMP router version cache.
+ */
+#define IGMP_v1_ROUTER		1
+#define IGMP_v2_ROUTER		2
+
+/*
+ * The following four defininitions are for backwards compatibility.
+ * They should be removed as soon as all applications are updated to
+ * use the new constant names.
+ */
+#define IGMP_HOST_MEMBERSHIP_QUERY	IGMP_MEMBERSHIP_QUERY
+#define IGMP_HOST_MEMBERSHIP_REPORT	IGMP_V1_MEMBERSHIP_REPORT
+#define IGMP_HOST_NEW_MEMBERSHIP_REPORT	IGMP_V2_MEMBERSHIP_REPORT
+#define IGMP_HOST_LEAVE_MESSAGE		IGMP_V2_LEAVE_GROUP
+
+__END_DECLS
+
+#endif
+
+#endif	/* netinet/igmp.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/netinet/in.h b/ap/libc/glibc/glibc-2.22/inet/netinet/in.h
new file mode 100644
index 0000000..f541c58
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/netinet/in.h
@@ -0,0 +1,631 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_NETINET_IN_H
+#define	_NETINET_IN_H	1
+
+#include <features.h>
+#include <stdint.h>
+#include <sys/socket.h>
+#include <bits/types.h>
+
+
+__BEGIN_DECLS
+
+/* Internet address.  */
+typedef uint32_t in_addr_t;
+struct in_addr
+  {
+    in_addr_t s_addr;
+  };
+
+/* Get system-specific definitions.  */
+#include <bits/in.h>
+
+/* Standard well-defined IP protocols.  */
+enum
+  {
+    IPPROTO_IP = 0,	   /* Dummy protocol for TCP.  */
+#define IPPROTO_IP		IPPROTO_IP
+    IPPROTO_ICMP = 1,	   /* Internet Control Message Protocol.  */
+#define IPPROTO_ICMP		IPPROTO_ICMP
+    IPPROTO_IGMP = 2,	   /* Internet Group Management Protocol. */
+#define IPPROTO_IGMP		IPPROTO_IGMP
+    IPPROTO_IPIP = 4,	   /* IPIP tunnels (older KA9Q tunnels use 94).  */
+#define IPPROTO_IPIP		IPPROTO_IPIP
+    IPPROTO_TCP = 6,	   /* Transmission Control Protocol.  */
+#define IPPROTO_TCP		IPPROTO_TCP
+    IPPROTO_EGP = 8,	   /* Exterior Gateway Protocol.  */
+#define IPPROTO_EGP		IPPROTO_EGP
+    IPPROTO_PUP = 12,	   /* PUP protocol.  */
+#define IPPROTO_PUP		IPPROTO_PUP
+    IPPROTO_UDP = 17,	   /* User Datagram Protocol.  */
+#define IPPROTO_UDP		IPPROTO_UDP
+    IPPROTO_IDP = 22,	   /* XNS IDP protocol.  */
+#define IPPROTO_IDP		IPPROTO_IDP
+    IPPROTO_TP = 29,	   /* SO Transport Protocol Class 4.  */
+#define IPPROTO_TP		IPPROTO_TP
+    IPPROTO_DCCP = 33,	   /* Datagram Congestion Control Protocol.  */
+#define IPPROTO_DCCP		IPPROTO_DCCP
+    IPPROTO_IPV6 = 41,     /* IPv6 header.  */
+#define IPPROTO_IPV6		IPPROTO_IPV6
+    IPPROTO_RSVP = 46,	   /* Reservation Protocol.  */
+#define IPPROTO_RSVP		IPPROTO_RSVP
+    IPPROTO_GRE = 47,	   /* General Routing Encapsulation.  */
+#define IPPROTO_GRE		IPPROTO_GRE
+    IPPROTO_ESP = 50,      /* encapsulating security payload.  */
+#define IPPROTO_ESP		IPPROTO_ESP
+    IPPROTO_AH = 51,       /* authentication header.  */
+#define IPPROTO_AH		IPPROTO_AH
+    IPPROTO_MTP = 92,	   /* Multicast Transport Protocol.  */
+#define IPPROTO_MTP		IPPROTO_MTP
+    IPPROTO_BEETPH = 94,   /* IP option pseudo header for BEET.  */
+#define IPPROTO_BEETPH		IPPROTO_BEETPH
+    IPPROTO_ENCAP = 98,	   /* Encapsulation Header.  */
+#define IPPROTO_ENCAP		IPPROTO_ENCAP
+    IPPROTO_PIM = 103,	   /* Protocol Independent Multicast.  */
+#define IPPROTO_PIM		IPPROTO_PIM
+    IPPROTO_COMP = 108,	   /* Compression Header Protocol.  */
+#define IPPROTO_COMP		IPPROTO_COMP
+    IPPROTO_SCTP = 132,	   /* Stream Control Transmission Protocol.  */
+#define IPPROTO_SCTP		IPPROTO_SCTP
+    IPPROTO_UDPLITE = 136, /* UDP-Lite protocol.  */
+#define IPPROTO_UDPLITE		IPPROTO_UDPLITE
+    IPPROTO_RAW = 255,	   /* Raw IP packets.  */
+#define IPPROTO_RAW		IPPROTO_RAW
+    IPPROTO_MAX
+  };
+
+/* If __USE_KERNEL_IPV6_DEFS is defined then the user has included the kernel
+   network headers first and we should use those ABI-identical definitions
+   instead of our own.  */
+#ifndef __USE_KERNEL_IPV6_DEFS
+enum
+  {
+    IPPROTO_HOPOPTS = 0,   /* IPv6 Hop-by-Hop options.  */
+#define IPPROTO_HOPOPTS		IPPROTO_HOPOPTS
+    IPPROTO_ROUTING = 43,  /* IPv6 routing header.  */
+#define IPPROTO_ROUTING		IPPROTO_ROUTING
+    IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header.  */
+#define IPPROTO_FRAGMENT	IPPROTO_FRAGMENT
+    IPPROTO_ICMPV6 = 58,   /* ICMPv6.  */
+#define IPPROTO_ICMPV6		IPPROTO_ICMPV6
+    IPPROTO_NONE = 59,     /* IPv6 no next header.  */
+#define IPPROTO_NONE		IPPROTO_NONE
+    IPPROTO_DSTOPTS = 60,  /* IPv6 destination options.  */
+#define IPPROTO_DSTOPTS		IPPROTO_DSTOPTS
+    IPPROTO_MH = 135       /* IPv6 mobility header.  */
+#define IPPROTO_MH		IPPROTO_MH
+  };
+#endif /* !__USE_KERNEL_IPV6_DEFS */
+
+/* Type to represent a port.  */
+typedef uint16_t in_port_t;
+
+/* Standard well-known ports.  */
+enum
+  {
+    IPPORT_ECHO = 7,		/* Echo service.  */
+    IPPORT_DISCARD = 9,		/* Discard transmissions service.  */
+    IPPORT_SYSTAT = 11,		/* System status service.  */
+    IPPORT_DAYTIME = 13,	/* Time of day service.  */
+    IPPORT_NETSTAT = 15,	/* Network status service.  */
+    IPPORT_FTP = 21,		/* File Transfer Protocol.  */
+    IPPORT_TELNET = 23,		/* Telnet protocol.  */
+    IPPORT_SMTP = 25,		/* Simple Mail Transfer Protocol.  */
+    IPPORT_TIMESERVER = 37,	/* Timeserver service.  */
+    IPPORT_NAMESERVER = 42,	/* Domain Name Service.  */
+    IPPORT_WHOIS = 43,		/* Internet Whois service.  */
+    IPPORT_MTP = 57,
+
+    IPPORT_TFTP = 69,		/* Trivial File Transfer Protocol.  */
+    IPPORT_RJE = 77,
+    IPPORT_FINGER = 79,		/* Finger service.  */
+    IPPORT_TTYLINK = 87,
+    IPPORT_SUPDUP = 95,		/* SUPDUP protocol.  */
+
+
+    IPPORT_EXECSERVER = 512,	/* execd service.  */
+    IPPORT_LOGINSERVER = 513,	/* rlogind service.  */
+    IPPORT_CMDSERVER = 514,
+    IPPORT_EFSSERVER = 520,
+
+    /* UDP ports.  */
+    IPPORT_BIFFUDP = 512,
+    IPPORT_WHOSERVER = 513,
+    IPPORT_ROUTESERVER = 520,
+
+    /* Ports less than this value are reserved for privileged processes.  */
+    IPPORT_RESERVED = 1024,
+
+    /* Ports greater this value are reserved for (non-privileged) servers.  */
+    IPPORT_USERRESERVED = 5000
+  };
+
+/* Definitions of the bits in an Internet address integer.
+
+   On subnets, host and network parts are found according to
+   the subnet mask, not these masks.  */
+
+#define	IN_CLASSA(a)		((((in_addr_t)(a)) & 0x80000000) == 0)
+#define	IN_CLASSA_NET		0xff000000
+#define	IN_CLASSA_NSHIFT	24
+#define	IN_CLASSA_HOST		(0xffffffff & ~IN_CLASSA_NET)
+#define	IN_CLASSA_MAX		128
+
+#define	IN_CLASSB(a)		((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
+#define	IN_CLASSB_NET		0xffff0000
+#define	IN_CLASSB_NSHIFT	16
+#define	IN_CLASSB_HOST		(0xffffffff & ~IN_CLASSB_NET)
+#define	IN_CLASSB_MAX		65536
+
+#define	IN_CLASSC(a)		((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
+#define	IN_CLASSC_NET		0xffffff00
+#define	IN_CLASSC_NSHIFT	8
+#define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
+
+#define	IN_CLASSD(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
+#define	IN_MULTICAST(a)		IN_CLASSD(a)
+
+#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
+#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
+
+/* Address to accept any incoming messages.  */
+#define	INADDR_ANY		((in_addr_t) 0x00000000)
+/* Address to send to all hosts.  */
+#define	INADDR_BROADCAST	((in_addr_t) 0xffffffff)
+/* Address indicating an error return.  */
+#define	INADDR_NONE		((in_addr_t) 0xffffffff)
+
+/* Network number for local host loopback.  */
+#define	IN_LOOPBACKNET		127
+/* Address to loopback in software to local host.  */
+#ifndef INADDR_LOOPBACK
+# define INADDR_LOOPBACK	((in_addr_t) 0x7f000001) /* Inet 127.0.0.1.  */
+#endif
+
+/* Defines for Multicast INADDR.  */
+#define INADDR_UNSPEC_GROUP	((in_addr_t) 0xe0000000) /* 224.0.0.0 */
+#define INADDR_ALLHOSTS_GROUP	((in_addr_t) 0xe0000001) /* 224.0.0.1 */
+#define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
+#define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
+
+#ifndef __USE_KERNEL_IPV6_DEFS
+/* IPv6 address */
+struct in6_addr
+  {
+    union
+      {
+	uint8_t	__u6_addr8[16];
+#ifdef __USE_MISC
+	uint16_t __u6_addr16[8];
+	uint32_t __u6_addr32[4];
+#endif
+      } __in6_u;
+#define s6_addr			__in6_u.__u6_addr8
+#ifdef __USE_MISC
+# define s6_addr16		__in6_u.__u6_addr16
+# define s6_addr32		__in6_u.__u6_addr32
+#endif
+  };
+#endif /* !__USE_KERNEL_IPV6_DEFS */
+
+extern const struct in6_addr in6addr_any;        /* :: */
+extern const struct in6_addr in6addr_loopback;   /* ::1 */
+#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
+
+#define INET_ADDRSTRLEN 16
+#define INET6_ADDRSTRLEN 46
+
+
+/* Structure describing an Internet socket address.  */
+struct sockaddr_in
+  {
+    __SOCKADDR_COMMON (sin_);
+    in_port_t sin_port;			/* Port number.  */
+    struct in_addr sin_addr;		/* Internet address.  */
+
+    /* Pad to size of `struct sockaddr'.  */
+    unsigned char sin_zero[sizeof (struct sockaddr) -
+			   __SOCKADDR_COMMON_SIZE -
+			   sizeof (in_port_t) -
+			   sizeof (struct in_addr)];
+  };
+
+#ifndef __USE_KERNEL_IPV6_DEFS
+/* Ditto, for IPv6.  */
+struct sockaddr_in6
+  {
+    __SOCKADDR_COMMON (sin6_);
+    in_port_t sin6_port;	/* Transport layer port # */
+    uint32_t sin6_flowinfo;	/* IPv6 flow information */
+    struct in6_addr sin6_addr;	/* IPv6 address */
+    uint32_t sin6_scope_id;	/* IPv6 scope-id */
+  };
+#endif /* !__USE_KERNEL_IPV6_DEFS */
+
+#ifdef __USE_MISC
+/* IPv4 multicast request.  */
+struct ip_mreq
+  {
+    /* IP multicast address of group.  */
+    struct in_addr imr_multiaddr;
+
+    /* Local IP address of interface.  */
+    struct in_addr imr_interface;
+  };
+
+struct ip_mreq_source
+  {
+    /* IP multicast address of group.  */
+    struct in_addr imr_multiaddr;
+
+    /* IP address of source.  */
+    struct in_addr imr_interface;
+
+    /* IP address of interface.  */
+    struct in_addr imr_sourceaddr;
+  };
+#endif
+
+#ifndef __USE_KERNEL_IPV6_DEFS
+/* Likewise, for IPv6.  */
+struct ipv6_mreq
+  {
+    /* IPv6 multicast address of group */
+    struct in6_addr ipv6mr_multiaddr;
+
+    /* local interface */
+    unsigned int ipv6mr_interface;
+  };
+#endif /* !__USE_KERNEL_IPV6_DEFS */
+
+#ifdef __USE_MISC
+/* Multicast group request.  */
+struct group_req
+  {
+    /* Interface index.  */
+    uint32_t gr_interface;
+
+    /* Group address.  */
+    struct sockaddr_storage gr_group;
+  };
+
+struct group_source_req
+  {
+    /* Interface index.  */
+    uint32_t gsr_interface;
+
+    /* Group address.  */
+    struct sockaddr_storage gsr_group;
+
+    /* Source address.  */
+    struct sockaddr_storage gsr_source;
+  };
+
+
+/* Full-state filter operations.  */
+struct ip_msfilter
+  {
+    /* IP multicast address of group.  */
+    struct in_addr imsf_multiaddr;
+
+    /* Local IP address of interface.  */
+    struct in_addr imsf_interface;
+
+    /* Filter mode.  */
+    uint32_t imsf_fmode;
+
+    /* Number of source addresses.  */
+    uint32_t imsf_numsrc;
+    /* Source addresses.  */
+    struct in_addr imsf_slist[1];
+  };
+
+#define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
+				  - sizeof (struct in_addr)		      \
+				  + (numsrc) * sizeof (struct in_addr))
+
+struct group_filter
+  {
+    /* Interface index.  */
+    uint32_t gf_interface;
+
+    /* Group address.  */
+    struct sockaddr_storage gf_group;
+
+    /* Filter mode.  */
+    uint32_t gf_fmode;
+
+    /* Number of source addresses.  */
+    uint32_t gf_numsrc;
+    /* Source addresses.  */
+    struct sockaddr_storage gf_slist[1];
+};
+
+#define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
+				   - sizeof (struct sockaddr_storage)	      \
+				   + ((numsrc)				      \
+				      * sizeof (struct sockaddr_storage)))
+#endif
+
+/* Functions to convert between host and network byte order.
+
+   Please note that these functions normally take `unsigned long int' or
+   `unsigned short int' values as arguments and also return them.  But
+   this was a short-sighted decision since on different systems the types
+   may have different representations but the values are always the same.  */
+
+extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
+extern uint16_t ntohs (uint16_t __netshort)
+     __THROW __attribute__ ((__const__));
+extern uint32_t htonl (uint32_t __hostlong)
+     __THROW __attribute__ ((__const__));
+extern uint16_t htons (uint16_t __hostshort)
+     __THROW __attribute__ ((__const__));
+
+#include <endian.h>
+
+/* Get machine dependent optimized versions of byte swapping functions.  */
+#include <bits/byteswap.h>
+
+#ifdef __OPTIMIZE__
+/* We can optimize calls to the conversion functions.  Either nothing has
+   to be done or we are using directly the byte-swapping functions which
+   often can be inlined.  */
+# if __BYTE_ORDER == __BIG_ENDIAN
+/* The host byte order is the same as network byte order,
+   so these functions are all just identity.  */
+# define ntohl(x)	(x)
+# define ntohs(x)	(x)
+# define htonl(x)	(x)
+# define htons(x)	(x)
+# else
+#  if __BYTE_ORDER == __LITTLE_ENDIAN
+#   define ntohl(x)	__bswap_32 (x)
+#   define ntohs(x)	__bswap_16 (x)
+#   define htonl(x)	__bswap_32 (x)
+#   define htons(x)	__bswap_16 (x)
+#  endif
+# endif
+#endif
+
+#ifdef __GNUC__
+# define IN6_IS_ADDR_UNSPECIFIED(a) \
+  (__extension__							      \
+   ({ const struct in6_addr *__a = (const struct in6_addr *) (a);	      \
+      __a->s6_addr32[0] == 0						      \
+      && __a->s6_addr32[1] == 0						      \
+      && __a->s6_addr32[2] == 0						      \
+      && __a->s6_addr32[3] == 0; }))
+
+# define IN6_IS_ADDR_LOOPBACK(a) \
+  (__extension__							      \
+   ({ const struct in6_addr *__a = (const struct in6_addr *) (a);	      \
+      __a->s6_addr32[0] == 0						      \
+      && __a->s6_addr32[1] == 0						      \
+      && __a->s6_addr32[2] == 0						      \
+      && __a->s6_addr32[3] == htonl (1); }))
+
+# define IN6_IS_ADDR_LINKLOCAL(a) \
+  (__extension__							      \
+   ({ const struct in6_addr *__a = (const struct in6_addr *) (a);	      \
+      (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); }))
+
+# define IN6_IS_ADDR_SITELOCAL(a) \
+  (__extension__							      \
+   ({ const struct in6_addr *__a = (const struct in6_addr *) (a);	      \
+      (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); }))
+
+# define IN6_IS_ADDR_V4MAPPED(a) \
+  (__extension__							      \
+   ({ const struct in6_addr *__a = (const struct in6_addr *) (a);	      \
+      __a->s6_addr32[0] == 0						      \
+      && __a->s6_addr32[1] == 0						      \
+      && __a->s6_addr32[2] == htonl (0xffff); }))
+
+# define IN6_IS_ADDR_V4COMPAT(a) \
+  (__extension__							      \
+   ({ const struct in6_addr *__a = (const struct in6_addr *) (a);	      \
+      __a->s6_addr32[0] == 0						      \
+      && __a->s6_addr32[1] == 0						      \
+      && __a->s6_addr32[2] == 0						      \
+      && ntohl (__a->s6_addr32[3]) > 1; }))
+
+# define IN6_ARE_ADDR_EQUAL(a,b) \
+  (__extension__							      \
+   ({ const struct in6_addr *__a = (const struct in6_addr *) (a);	      \
+      const struct in6_addr *__b = (const struct in6_addr *) (b);	      \
+      __a->s6_addr32[0] == __b->s6_addr32[0]				      \
+      && __a->s6_addr32[1] == __b->s6_addr32[1]				      \
+      && __a->s6_addr32[2] == __b->s6_addr32[2]				      \
+      && __a->s6_addr32[3] == __b->s6_addr32[3]; }))
+#else
+# define IN6_IS_ADDR_UNSPECIFIED(a) \
+	(((const uint32_t *) (a))[0] == 0				      \
+	 && ((const uint32_t *) (a))[1] == 0				      \
+	 && ((const uint32_t *) (a))[2] == 0				      \
+	 && ((const uint32_t *) (a))[3] == 0)
+
+# define IN6_IS_ADDR_LOOPBACK(a) \
+	(((const uint32_t *) (a))[0] == 0				      \
+	 && ((const uint32_t *) (a))[1] == 0				      \
+	 && ((const uint32_t *) (a))[2] == 0				      \
+	 && ((const uint32_t *) (a))[3] == htonl (1))
+
+# define IN6_IS_ADDR_LINKLOCAL(a) \
+	((((const uint32_t *) (a))[0] & htonl (0xffc00000))		      \
+	 == htonl (0xfe800000))
+
+# define IN6_IS_ADDR_SITELOCAL(a) \
+	((((const uint32_t *) (a))[0] & htonl (0xffc00000))		      \
+	 == htonl (0xfec00000))
+
+# define IN6_IS_ADDR_V4MAPPED(a) \
+	((((const uint32_t *) (a))[0] == 0)				      \
+	 && (((const uint32_t *) (a))[1] == 0)				      \
+	 && (((const uint32_t *) (a))[2] == htonl (0xffff)))
+
+# define IN6_IS_ADDR_V4COMPAT(a) \
+	((((const uint32_t *) (a))[0] == 0)				      \
+	 && (((const uint32_t *) (a))[1] == 0)				      \
+	 && (((const uint32_t *) (a))[2] == 0)				      \
+	 && (ntohl (((const uint32_t *) (a))[3]) > 1))
+
+# define IN6_ARE_ADDR_EQUAL(a,b) \
+	((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0])	      \
+	 && (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1])      \
+	 && (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2])      \
+	 && (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3]))
+#endif
+
+#define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff)
+
+#ifdef __USE_MISC
+/* Bind socket to a privileged IP port.  */
+extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
+
+/* The IPv6 version of this function.  */
+extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
+     __THROW;
+#endif
+
+
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((const uint8_t *) (a))[1] & 0xf) == 0x1))
+
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((const uint8_t *) (a))[1] & 0xf) == 0x2))
+
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((const uint8_t *) (a))[1] & 0xf) == 0x5))
+
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((const uint8_t *) (a))[1] & 0xf) == 0x8))
+
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((const uint8_t *) (a))[1] & 0xf) == 0xe))
+
+
+#ifdef __USE_GNU
+struct cmsghdr;			/* Forward declaration.  */
+
+#ifndef __USE_KERNEL_IPV6_DEFS
+/* IPv6 packet information.  */
+struct in6_pktinfo
+  {
+    struct in6_addr ipi6_addr;	/* src/dst IPv6 address */
+    unsigned int ipi6_ifindex;	/* send/recv interface index */
+  };
+
+/* IPv6 MTU information.  */
+struct ip6_mtuinfo
+  {
+    struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
+    uint32_t ip6m_mtu;		   /* path MTU in host byte order */
+  };
+#endif /* !__USE_KERNEL_IPV6_DEFS */
+
+/* Obsolete hop-by-hop and Destination Options Processing (RFC 2292).  */
+extern int inet6_option_space (int __nbytes)
+     __THROW __attribute_deprecated__;
+extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
+			      int __type) __THROW __attribute_deprecated__;
+extern int inet6_option_append (struct cmsghdr *__cmsg,
+				const uint8_t *__typep, int __multx,
+				int __plusy) __THROW __attribute_deprecated__;
+extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
+				    int __multx, int __plusy)
+     __THROW __attribute_deprecated__;
+extern int inet6_option_next (const struct cmsghdr *__cmsg,
+			      uint8_t **__tptrp)
+     __THROW __attribute_deprecated__;
+extern int inet6_option_find (const struct cmsghdr *__cmsg,
+			      uint8_t **__tptrp, int __type)
+     __THROW __attribute_deprecated__;
+
+
+/* Hop-by-Hop and Destination Options Processing (RFC 3542).  */
+extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW;
+extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset,
+			     uint8_t __type, socklen_t __len, uint8_t __align,
+			     void **__databufp) __THROW;
+extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset)
+     __THROW;
+extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val,
+			      socklen_t __vallen) __THROW;
+extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset,
+			   uint8_t *__typep, socklen_t *__lenp,
+			   void **__databufp) __THROW;
+extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset,
+			   uint8_t __type, socklen_t *__lenp,
+			   void **__databufp) __THROW;
+extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
+			      socklen_t __vallen) __THROW;
+
+
+/* Routing Header Option (RFC 3542).  */
+extern socklen_t inet6_rth_space (int __type, int __segments) __THROW;
+extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
+			     int __segments) __THROW;
+extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __THROW;
+extern int inet6_rth_reverse (const void *__in, void *__out) __THROW;
+extern int inet6_rth_segments (const void *__bp) __THROW;
+extern struct in6_addr *inet6_rth_getaddr (const void *__bp, int __index)
+     __THROW;
+
+
+/* Multicast source filter support.  */
+
+/* Get IPv4 source filter.  */
+extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
+				struct in_addr __group, uint32_t *__fmode,
+				uint32_t *__numsrc, struct in_addr *__slist)
+     __THROW;
+
+/* Set IPv4 source filter.  */
+extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
+				struct in_addr __group, uint32_t __fmode,
+				uint32_t __numsrc,
+				const struct in_addr *__slist)
+     __THROW;
+
+
+/* Get source filter.  */
+extern int getsourcefilter (int __s, uint32_t __interface_addr,
+			    const struct sockaddr *__group,
+			    socklen_t __grouplen, uint32_t *__fmode,
+			    uint32_t *__numsrc,
+			    struct sockaddr_storage *__slist) __THROW;
+
+/* Set source filter.  */
+extern int setsourcefilter (int __s, uint32_t __interface_addr,
+			    const struct sockaddr *__group,
+			    socklen_t __grouplen, uint32_t __fmode,
+			    uint32_t __numsrc,
+			    const struct sockaddr_storage *__slist) __THROW;
+#endif	/* use GNU */
+
+__END_DECLS
+
+#endif	/* netinet/in.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/netinet/ip6.h b/ap/libc/glibc/glibc-2.22/inet/netinet/ip6.h
new file mode 100644
index 0000000..30f7e74
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/netinet/ip6.h
@@ -0,0 +1,188 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _NETINET_IP6_H
+#define _NETINET_IP6_H 1
+
+#include <inttypes.h>
+#include <netinet/in.h>
+
+struct ip6_hdr
+  {
+    union
+      {
+	struct ip6_hdrctl
+	  {
+	    uint32_t ip6_un1_flow;   /* 4 bits version, 8 bits TC,
+					20 bits flow-ID */
+	    uint16_t ip6_un1_plen;   /* payload length */
+	    uint8_t  ip6_un1_nxt;    /* next header */
+	    uint8_t  ip6_un1_hlim;   /* hop limit */
+	  } ip6_un1;
+	uint8_t ip6_un2_vfc;       /* 4 bits version, top 4 bits tclass */
+      } ip6_ctlun;
+    struct in6_addr ip6_src;      /* source address */
+    struct in6_addr ip6_dst;      /* destination address */
+  };
+
+#define ip6_vfc   ip6_ctlun.ip6_un2_vfc
+#define ip6_flow  ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen  ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt   ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim  ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+/* Generic extension header.  */
+struct ip6_ext
+  {
+    uint8_t  ip6e_nxt;		/* next header.  */
+    uint8_t  ip6e_len;		/* length in units of 8 octets.  */
+  };
+
+/* Hop-by-Hop options header.  */
+struct ip6_hbh
+  {
+    uint8_t  ip6h_nxt;		/* next header.  */
+    uint8_t  ip6h_len;		/* length in units of 8 octets.  */
+    /* followed by options */
+  };
+
+/* Destination options header */
+struct ip6_dest
+  {
+    uint8_t  ip6d_nxt;		/* next header */
+    uint8_t  ip6d_len;		/* length in units of 8 octets */
+    /* followed by options */
+  };
+
+/* Routing header */
+struct ip6_rthdr
+  {
+    uint8_t  ip6r_nxt;		/* next header */
+    uint8_t  ip6r_len;		/* length in units of 8 octets */
+    uint8_t  ip6r_type;		/* routing type */
+    uint8_t  ip6r_segleft;	/* segments left */
+    /* followed by routing type specific data */
+  };
+
+/* Type 0 Routing header */
+struct ip6_rthdr0
+  {
+    uint8_t  ip6r0_nxt;		/* next header */
+    uint8_t  ip6r0_len;		/* length in units of 8 octets */
+    uint8_t  ip6r0_type;	/* always zero */
+    uint8_t  ip6r0_segleft;	/* segments left */
+    uint8_t  ip6r0_reserved;	/* reserved field */
+    uint8_t  ip6r0_slmap[3];	/* strict/loose bit map */
+    /* followed by up to 127 struct in6_addr */
+    struct in6_addr ip6r0_addr[0];
+  };
+
+/* Fragment header */
+struct ip6_frag
+  {
+    uint8_t   ip6f_nxt;		/* next header */
+    uint8_t   ip6f_reserved;	/* reserved field */
+    uint16_t  ip6f_offlg;	/* offset, reserved, and flag */
+    uint32_t  ip6f_ident;	/* identification */
+  };
+
+#if BYTE_ORDER == BIG_ENDIAN
+# define IP6F_OFF_MASK       0xfff8  /* mask out offset from _offlg */
+# define IP6F_RESERVED_MASK  0x0006  /* reserved bits in ip6f_offlg */
+# define IP6F_MORE_FRAG      0x0001  /* more-fragments flag */
+#else   /* BYTE_ORDER == LITTLE_ENDIAN */
+# define IP6F_OFF_MASK       0xf8ff  /* mask out offset from _offlg */
+# define IP6F_RESERVED_MASK  0x0600  /* reserved bits in ip6f_offlg */
+# define IP6F_MORE_FRAG      0x0100  /* more-fragments flag */
+#endif
+
+/* IPv6 options */
+struct ip6_opt
+  {
+    uint8_t  ip6o_type;
+    uint8_t  ip6o_len;
+  };
+
+/* The high-order 3 bits of the option type define the behavior
+ * when processing an unknown option and whether or not the option
+ * content changes in flight.
+ */
+#define IP6OPT_TYPE(o)		((o) & 0xc0)
+#define IP6OPT_TYPE_SKIP	0x00
+#define IP6OPT_TYPE_DISCARD	0x40
+#define IP6OPT_TYPE_FORCEICMP	0x80
+#define IP6OPT_TYPE_ICMP	0xc0
+#define IP6OPT_TYPE_MUTABLE	0x20
+
+/* Special option types for padding.  */
+#define IP6OPT_PAD1	0
+#define IP6OPT_PADN	1
+
+#define IP6OPT_JUMBO		0xc2
+#define IP6OPT_NSAP_ADDR	0xc3
+#define IP6OPT_TUNNEL_LIMIT	0x04
+#define IP6OPT_ROUTER_ALERT	0x05
+
+/* Jumbo Payload Option */
+struct ip6_opt_jumbo
+  {
+    uint8_t  ip6oj_type;
+    uint8_t  ip6oj_len;
+    uint8_t  ip6oj_jumbo_len[4];
+  };
+#define IP6OPT_JUMBO_LEN	6
+
+/* NSAP Address Option */
+struct ip6_opt_nsap
+  {
+    uint8_t  ip6on_type;
+    uint8_t  ip6on_len;
+    uint8_t  ip6on_src_nsap_len;
+    uint8_t  ip6on_dst_nsap_len;
+      /* followed by source NSAP */
+      /* followed by destination NSAP */
+  };
+
+/* Tunnel Limit Option */
+struct ip6_opt_tunnel
+  {
+    uint8_t  ip6ot_type;
+    uint8_t  ip6ot_len;
+    uint8_t  ip6ot_encap_limit;
+  };
+
+/* Router Alert Option */
+struct ip6_opt_router
+  {
+    uint8_t  ip6or_type;
+    uint8_t  ip6or_len;
+    uint8_t  ip6or_value[2];
+  };
+
+/* Router alert values (in network byte order) */
+#if BYTE_ORDER == BIG_ENDIAN
+# define IP6_ALERT_MLD	0x0000
+# define IP6_ALERT_RSVP	0x0001
+# define IP6_ALERT_AN	0x0002
+#else /* BYTE_ORDER == LITTLE_ENDING */
+# define IP6_ALERT_MLD	0x0000
+# define IP6_ALERT_RSVP	0x0100
+# define IP6_ALERT_AN	0x0200
+#endif
+
+#endif /* netinet/ip6.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/protocols/routed.h b/ap/libc/glibc/glibc-2.22/inet/protocols/routed.h
new file mode 100644
index 0000000..befd865
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/protocols/routed.h
@@ -0,0 +1,101 @@
+/*-
+ * Copyright (c) 1983, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)routed.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PROTOCOLS_ROUTED_H
+#define	_PROTOCOLS_ROUTED_H 1
+
+#include <sys/socket.h>
+/*
+ * Routing Information Protocol
+ *
+ * Derived from Xerox NS Routing Information Protocol
+ * by changing 32-bit net numbers to sockaddr's and
+ * padding stuff to 32-bit boundaries.
+ */
+#define	RIPVERSION	1
+
+struct netinfo {
+	struct	sockaddr rip_dst;	/* destination net/host */
+	int	rip_metric;		/* cost of route */
+};
+
+struct rip {
+	u_char	rip_cmd;		/* request/response */
+	u_char	rip_vers;		/* protocol version # */
+	u_char	rip_res1[2];		/* pad to 32-bit boundary */
+	union {
+		struct	netinfo ru_nets[1];	/* variable length... */
+		char	ru_tracefile[1];	/* ditto ... */
+	} ripun;
+#define	rip_nets	ripun.ru_nets
+#define	rip_tracefile	ripun.ru_tracefile
+};
+
+/*
+ * Packet types.
+ */
+#define	RIPCMD_REQUEST		1	/* want info */
+#define	RIPCMD_RESPONSE		2	/* responding to request */
+#define	RIPCMD_TRACEON		3	/* turn tracing on */
+#define	RIPCMD_TRACEOFF		4	/* turn it off */
+
+#define	RIPCMD_MAX		5
+#ifdef RIPCMDS
+char *ripcmds[RIPCMD_MAX] =
+  { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" };
+#endif
+
+#define	HOPCNT_INFINITY		16	/* per Xerox NS */
+#define	MAXPACKETSIZE		512	/* max broadcast size */
+
+/*
+ * Timer values used in managing the routing table.
+ * Complete tables are broadcast every SUPPLY_INTERVAL seconds.
+ * If changes occur between updates, dynamic updates containing only changes
+ * may be sent.  When these are sent, a timer is set for a random value
+ * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
+ * are sent until the timer expires.
+ *
+ * Every update of a routing entry forces an entry's timer to be reset.
+ * After EXPIRE_TIME without updates, the entry is marked invalid,
+ * but held onto until GARBAGE_TIME so that others may
+ * see it "be deleted".
+ */
+#define	TIMER_RATE		30	/* alarm clocks every 30 seconds */
+
+#define	SUPPLY_INTERVAL		30	/* time to supply tables */
+#define	MIN_WAITTIME		2	/* min. interval to broadcast changes */
+#define	MAX_WAITTIME		5	/* max. time to delay changes */
+
+#define	EXPIRE_TIME		180	/* time to mark entry invalid */
+#define	GARBAGE_TIME		240	/* time to garbage collect */
+
+#endif /* protocols/routed.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/protocols/rwhod.h b/ap/libc/glibc/glibc-2.22/inet/protocols/rwhod.h
new file mode 100644
index 0000000..446d6f9
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/protocols/rwhod.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)rwhod.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PROTOCOLS_RWHOD_H
+#define	_PROTOCOLS_RWHOD_H 1
+
+#include <sys/types.h>
+
+/*
+ * rwho protocol packet format.
+ */
+struct	outmp {
+	char	out_line[8];		/* tty name */
+	char	out_name[8];		/* user id */
+	int32_t	out_time;		/* time on */
+};
+
+struct	whod {
+	char	wd_vers;		/* protocol version # */
+	char	wd_type;		/* packet type, see below */
+	char	wd_pad[2];
+	int	wd_sendtime;		/* time stamp by sender */
+	int	wd_recvtime;		/* time stamp applied by receiver */
+	char	wd_hostname[32];	/* hosts's name */
+	int	wd_loadav[3];		/* load average as in uptime */
+	int	wd_boottime;		/* time system booted */
+	struct	whoent {
+		struct	outmp we_utmp;	/* active tty info */
+		int	we_idle;	/* tty idle time */
+	} wd_we[1024 / sizeof (struct whoent)];
+};
+
+#define	WHODVERSION	1
+#define	WHODTYPE_STATUS	1		/* host status */
+
+/* We used to define _PATH_RWHODIR here but it's now in <paths.h>.  */
+#include <paths.h>
+
+#endif /* protocols/rwhod.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/protocols/talkd.h b/ap/libc/glibc/glibc-2.22/inet/protocols/talkd.h
new file mode 100644
index 0000000..a8f33b1
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/protocols/talkd.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)talkd.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PROTOCOLS_TALKD_H
+#define	_PROTOCOLS_TALKD_H 1
+
+/*
+ * This describes the protocol used by the talk server and clients.
+ *
+ * The talk server acts a repository of invitations, responding to
+ * requests by clients wishing to rendezvous for the purpose of
+ * holding a conversation.  In normal operation, a client, the caller,
+ * initiates a rendezvous by sending a CTL_MSG to the server of
+ * type LOOK_UP.  This causes the server to search its invitation
+ * tables to check if an invitation currently exists for the caller
+ * (to speak to the callee specified in the message).  If the lookup
+ * fails, the caller then sends an ANNOUNCE message causing the server
+ * to broadcast an announcement on the callee's login ports requesting
+ * contact.  When the callee responds, the local server uses the
+ * recorded invitation to respond with the appropriate rendezvous
+ * address and the caller and callee client programs establish a
+ * stream connection through which the conversation takes place.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+/*
+ * Client->server request message format.
+ */
+typedef struct {
+	u_char	vers;		/* protocol version */
+	u_char	type;		/* request type, see below */
+	u_char	answer;		/* not used */
+	u_char	pad;
+	u_int32_t id_num;	/* message id */
+	struct	osockaddr addr;		/* old (4.3) style */
+	struct	osockaddr ctl_addr;	/* old (4.3) style */
+	int32_t	pid;		/* caller's process id */
+#define	NAME_SIZE	12
+	char	l_name[NAME_SIZE];/* caller's name */
+	char	r_name[NAME_SIZE];/* callee's name */
+#define	TTY_SIZE	16
+	char	r_tty[TTY_SIZE];/* callee's tty name */
+} CTL_MSG;
+
+/*
+ * Server->client response message format.
+ */
+typedef struct {
+	u_char	vers;		/* protocol version */
+	u_char	type;		/* type of request message, see below */
+	u_char	answer;		/* response to request message, see below */
+	u_char	pad;
+	u_int32_t id_num;	/* message id */
+	struct	osockaddr addr;	/* address for establishing conversation */
+} CTL_RESPONSE;
+
+#define	TALK_VERSION	1		/* protocol version */
+
+/* message type values */
+#define LEAVE_INVITE	0	/* leave invitation with server */
+#define LOOK_UP		1	/* check for invitation by callee */
+#define DELETE		2	/* delete invitation by caller */
+#define ANNOUNCE	3	/* announce invitation by caller */
+
+/* answer values */
+#define SUCCESS		0	/* operation completed properly */
+#define NOT_HERE	1	/* callee not logged in */
+#define FAILED		2	/* operation failed for unexplained reason */
+#define MACHINE_UNKNOWN	3	/* caller's machine name unknown */
+#define PERMISSION_DENIED 4	/* callee's tty doesn't permit announce */
+#define UNKNOWN_REQUEST	5	/* request has invalid type value */
+#define	BADVERSION	6	/* request has invalid protocol version */
+#define	BADADDR		7	/* request has invalid addr value */
+#define	BADCTLADDR	8	/* request has invalid ctl_addr value */
+
+/*
+ * Operational parameters.
+ */
+#define MAX_LIFE	60	/* max time daemon saves invitations */
+/* RING_WAIT should be 10's of seconds less than MAX_LIFE */
+#define RING_WAIT	30	/* time to wait before resending invitation */
+
+#endif /* protocols/talkd.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/protocols/timed.h b/ap/libc/glibc/glibc-2.22/inet/protocols/timed.h
new file mode 100644
index 0000000..b5d4702
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/protocols/timed.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1983, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)timed.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_PROTOCOLS_TIMED_H
+#define	_PROTOCOLS_TIMED_H 1
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+/*
+ * Time Synchronization Protocol
+ */
+
+#define	TSPVERSION	1
+#define ANYADDR 	NULL
+#define MAXHOSTNAMELEN	64
+
+struct tsp {
+	u_char	tsp_type;
+	u_char	tsp_vers;
+	u_short	tsp_seq;
+	union {
+		struct timeval tspu_time;
+		char tspu_hopcnt;
+	} tsp_u;
+	char tsp_name[MAXHOSTNAMELEN];
+};
+
+#define	tsp_time	tsp_u.tspu_time
+#define	tsp_hopcnt	tsp_u.tspu_hopcnt
+
+/*
+ * Command types.
+ */
+#define	TSP_ANY			0	/* match any types */
+#define	TSP_ADJTIME		1	/* send adjtime */
+#define	TSP_ACK			2	/* generic acknowledgement */
+#define	TSP_MASTERREQ		3	/* ask for master's name */
+#define	TSP_MASTERACK		4	/* acknowledge master request */
+#define	TSP_SETTIME		5	/* send network time */
+#define	TSP_MASTERUP		6	/* inform slaves that master is up */
+#define	TSP_SLAVEUP		7	/* slave is up but not polled */
+#define	TSP_ELECTION		8	/* advance candidature for master */
+#define	TSP_ACCEPT		9	/* support candidature of master */
+#define	TSP_REFUSE		10	/* reject candidature of master */
+#define	TSP_CONFLICT		11	/* two or more masters present */
+#define	TSP_RESOLVE		12	/* masters' conflict resolution */
+#define	TSP_QUIT		13	/* reject candidature if master is up */
+#define	TSP_DATE		14	/* reset the time (date command) */
+#define	TSP_DATEREQ		15	/* remote request to reset the time */
+#define	TSP_DATEACK		16	/* acknowledge time setting  */
+#define	TSP_TRACEON		17	/* turn tracing on */
+#define	TSP_TRACEOFF		18	/* turn tracing off */
+#define	TSP_MSITE		19	/* find out master's site */
+#define	TSP_MSITEREQ		20	/* remote master's site request */
+#define	TSP_TEST		21	/* for testing election algo */
+#define	TSP_SETDATE		22	/* New from date command */
+#define	TSP_SETDATEREQ		23	/* New remote for above */
+#define	TSP_LOOP		24	/* loop detection packet */
+
+#define	TSPTYPENUMBER		25
+
+#ifdef TSPTYPES
+char *tsptype[TSPTYPENUMBER] =
+  { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
+  "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
+  "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
+  "TEST", "SETDATE", "SETDATEREQ", "LOOP" };
+#endif
+
+#endif /* protocols/timed.h */
diff --git a/ap/libc/glibc/glibc-2.22/inet/rcmd.c b/ap/libc/glibc/glibc-2.22/inet/rcmd.c
new file mode 100644
index 0000000..035cb0d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/rcmd.c
@@ -0,0 +1,855 @@
+/*
+ * Copyright (C) 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
+ * Copyright (c) 1983, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)rcmd.c	8.3 (Berkeley) 3/26/94";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/param.h>
+#include <sys/poll.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <alloca.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <ctype.h>
+#include <string.h>
+#include <libintl.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <sys/uio.h>
+
+
+int __ivaliduser (FILE *, u_int32_t, const char *, const char *);
+static int __validuser2_sa (FILE *, struct sockaddr *, size_t,
+			    const char *, const char *, const char *);
+static int ruserok2_sa (struct sockaddr *ra, size_t ralen,
+			int superuser, const char *ruser,
+			const char *luser, const char *rhost);
+static int ruserok_sa (struct sockaddr *ra, size_t ralen,
+			int superuser, const char *ruser,
+			const char *luser);
+int iruserok_af (const void *raddr, int superuser, const char *ruser,
+		 const char *luser, sa_family_t af);
+int iruserok (u_int32_t raddr, int superuser, const char *ruser,
+	      const char *luser);
+
+libc_hidden_proto (iruserok_af)
+
+libc_freeres_ptr(static char *ahostbuf);
+
+int
+rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
+	char **ahost;
+	u_short rport;
+	const char *locuser, *remuser, *cmd;
+	int *fd2p;
+	sa_family_t af;
+{
+	char paddr[INET6_ADDRSTRLEN];
+	struct addrinfo hints, *res, *ai;
+	union
+	{
+		struct sockaddr sa;
+		struct sockaddr_storage ss;
+		struct sockaddr_in sin;
+		struct sockaddr_in6 sin6;
+	} from;
+	struct pollfd pfd[2];
+	int32_t oldmask;
+	pid_t pid;
+	int s, lport, timo, error;
+	char c;
+	int refused;
+	char num[8];
+	ssize_t n;
+
+	if (af != AF_INET && af != AF_INET6 && af != AF_UNSPEC)
+	  {
+	    __set_errno (EAFNOSUPPORT);
+	    return -1;
+	  }
+
+	pid = __getpid();
+
+	memset(&hints, '\0', sizeof(hints));
+	hints.ai_flags = AI_CANONNAME;
+	hints.ai_family = af;
+	hints.ai_socktype = SOCK_STREAM;
+	(void)__snprintf(num, sizeof(num), "%d", ntohs(rport));
+	error = getaddrinfo(*ahost, num, &hints, &res);
+	if (error) {
+		if (error == EAI_NONAME && *ahost != NULL)
+			__fxprintf(NULL, "%s: Unknown host\n", *ahost);
+		else
+			__fxprintf(NULL, "rcmd: getaddrinfo: %s\n",
+				   gai_strerror(error));
+
+		return -1;
+	}
+
+	pfd[0].events = POLLIN;
+	pfd[1].events = POLLIN;
+
+	if (res->ai_canonname){
+		free (ahostbuf);
+		ahostbuf = strdup (res->ai_canonname);
+		if (ahostbuf == NULL) {
+			__fxprintf(NULL, "%s",
+				   _("rcmd: Cannot allocate memory\n"));
+			return -1;
+		}
+		*ahost = ahostbuf;
+	} else
+		*ahost = NULL;
+	ai = res;
+	refused = 0;
+	oldmask = __sigblock(sigmask(SIGURG));
+	for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
+		char errbuf[200];
+
+		s = rresvport_af(&lport, ai->ai_family);
+		if (s < 0) {
+			if (errno == EAGAIN)
+				__fxprintf(NULL, "%s", _("\
+rcmd: socket: All ports in use\n"));
+			else
+				__fxprintf(NULL, "rcmd: socket: %m\n");
+
+			__sigsetmask(oldmask);
+			freeaddrinfo(res);
+			return -1;
+		}
+		__fcntl(s, F_SETOWN, pid);
+		if (__connect(s, ai->ai_addr, ai->ai_addrlen) >= 0)
+			break;
+		(void)__close(s);
+		if (errno == EADDRINUSE) {
+			lport--;
+			continue;
+		}
+		if (errno == ECONNREFUSED)
+			refused = 1;
+		if (ai->ai_next != NULL) {
+			int oerrno = errno;
+			char *buf = NULL;
+
+			getnameinfo(ai->ai_addr, ai->ai_addrlen,
+				    paddr, sizeof(paddr),
+				    NULL, 0,
+				    NI_NUMERICHOST);
+
+			if (__asprintf (&buf, _("connect to address %s: "),
+					paddr) >= 0)
+			  {
+			    __fxprintf(NULL, "%s", buf);
+			    free (buf);
+			  }
+			__set_errno (oerrno);
+			perror(0);
+			ai = ai->ai_next;
+			getnameinfo(ai->ai_addr, ai->ai_addrlen,
+				    paddr, sizeof(paddr),
+				    NULL, 0,
+				    NI_NUMERICHOST);
+			if (__asprintf (&buf, _("Trying %s...\n"), paddr) >= 0)
+			  {
+			    __fxprintf (NULL, "%s", buf);
+			    free (buf);
+			  }
+			continue;
+		}
+		if (refused && timo <= 16) {
+			(void)__sleep(timo);
+			timo *= 2;
+			ai = res;
+			refused = 0;
+			continue;
+		}
+		freeaddrinfo(res);
+		(void)__fxprintf(NULL, "%s: %s\n", *ahost,
+				 __strerror_r(errno, errbuf, sizeof (errbuf)));
+		__sigsetmask(oldmask);
+		return -1;
+	}
+	lport--;
+	if (fd2p == 0) {
+		__write(s, "", 1);
+		lport = 0;
+	} else {
+		char num[8];
+		int s2 = rresvport_af(&lport, ai->ai_family), s3;
+		socklen_t len = ai->ai_addrlen;
+
+		if (s2 < 0)
+			goto bad;
+		__listen(s2, 1);
+		(void)__snprintf(num, sizeof(num), "%d", lport);
+		if (__write(s, num, strlen(num)+1) != (ssize_t)strlen(num)+1) {
+			char *buf = NULL;
+
+			if (__asprintf (&buf, _("\
+rcmd: write (setting up stderr): %m\n")) >= 0)
+			  {
+			    __fxprintf(NULL, "%s", buf);
+			    free (buf);
+			  }
+			(void)__close(s2);
+			goto bad;
+		}
+		pfd[0].fd = s;
+		pfd[1].fd = s2;
+		__set_errno (0);
+		if (__poll (pfd, 2, -1) < 1 || (pfd[1].revents & POLLIN) == 0){
+			char *buf = NULL;
+
+			if ((errno != 0
+			     && __asprintf(&buf, _("\
+rcmd: poll (setting up stderr): %m\n")) >= 0)
+			    || (errno == 0
+				&& __asprintf(&buf, _("\
+poll: protocol failure in circuit setup\n")) >= 0))
+			  {
+			    __fxprintf (NULL, "%s", buf);
+			    free  (buf);
+			  }
+			(void)__close(s2);
+			goto bad;
+		}
+		s3 = TEMP_FAILURE_RETRY (accept(s2, &from.sa, &len));
+		switch (from.sa.sa_family) {
+		case AF_INET:
+			rport = ntohs(from.sin.sin_port);
+			break;
+		case AF_INET6:
+			rport = ntohs(from.sin6.sin6_port);
+			break;
+		default:
+			rport = 0;
+			break;
+		}
+		(void)__close(s2);
+		if (s3 < 0) {
+			(void)__fxprintf(NULL, "rcmd: accept: %m\n");
+			lport = 0;
+			goto bad;
+		}
+		*fd2p = s3;
+
+		if (rport >= IPPORT_RESERVED || rport < IPPORT_RESERVED / 2){
+			char *buf = NULL;
+
+			if (__asprintf(&buf, _("\
+socket: protocol failure in circuit setup\n")) >= 0)
+			  {
+			    __fxprintf (NULL, "%s", buf);
+			    free (buf);
+			  }
+			goto bad2;
+		}
+	}
+	struct iovec iov[3] =
+	  {
+	    [0] = { .iov_base = (void *) locuser,
+		    .iov_len = strlen (locuser) + 1 },
+	    [1] = { .iov_base = (void *) remuser,
+		    .iov_len = strlen (remuser) + 1 },
+	    [2] = { .iov_base = (void *) cmd,
+		    .iov_len = strlen (cmd) + 1 }
+	  };
+	(void) TEMP_FAILURE_RETRY (__writev (s, iov, 3));
+	n = TEMP_FAILURE_RETRY (__read(s, &c, 1));
+	if (n != 1) {
+		char *buf = NULL;
+
+		if ((n == 0
+		     && __asprintf(&buf, _("rcmd: %s: short read"),
+				   *ahost) >= 0)
+		    || (n != 0
+			&& __asprintf(&buf, "rcmd: %s: %m\n", *ahost) >= 0))
+		  {
+		    __fxprintf (NULL, "%s", buf);
+		    free (buf);
+		  }
+		goto bad2;
+	}
+	if (c != 0) {
+		while (__read(s, &c, 1) == 1) {
+			(void)__write(STDERR_FILENO, &c, 1);
+			if (c == '\n')
+				break;
+		}
+		goto bad2;
+	}
+	__sigsetmask(oldmask);
+	freeaddrinfo(res);
+	return s;
+bad2:
+	if (lport)
+		(void)__close(*fd2p);
+bad:
+	(void)__close(s);
+	__sigsetmask(oldmask);
+	freeaddrinfo(res);
+	return -1;
+}
+libc_hidden_def (rcmd_af)
+
+int
+rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
+	char **ahost;
+	u_short rport;
+	const char *locuser, *remuser, *cmd;
+	int *fd2p;
+{
+  return rcmd_af (ahost, rport, locuser, remuser, cmd, fd2p, AF_INET);
+}
+
+int
+rresvport_af(alport, family)
+	int *alport;
+	sa_family_t family;
+{
+	union {
+		struct sockaddr generic;
+		struct sockaddr_in in;
+		struct sockaddr_in6 in6;
+	} ss;
+	int s;
+	size_t len;
+	uint16_t *sport;
+
+	switch(family){
+	case AF_INET:
+		len = sizeof(struct sockaddr_in);
+		sport = &ss.in.sin_port;
+		break;
+	case AF_INET6:
+		len = sizeof(struct sockaddr_in6);
+		sport = &ss.in6.sin6_port;
+		break;
+	default:
+		__set_errno (EAFNOSUPPORT);
+		return -1;
+	}
+	s = __socket(family, SOCK_STREAM, 0);
+	if (s < 0)
+		return -1;
+
+	memset (&ss, '\0', sizeof(ss));
+#ifdef SALEN
+	ss.generic.__ss_len = len;
+#endif
+	ss.generic.sa_family = family;
+
+	/* Ignore invalid values.  */
+	if (*alport < IPPORT_RESERVED / 2)
+		*alport = IPPORT_RESERVED / 2;
+	else if (*alport >= IPPORT_RESERVED)
+		*alport = IPPORT_RESERVED - 1;
+
+	int start = *alport;
+	do {
+		*sport = htons((uint16_t) *alport);
+		if (__bind(s, &ss.generic, len) >= 0)
+			return s;
+		if (errno != EADDRINUSE) {
+			(void)__close(s);
+			return -1;
+		}
+		if ((*alport)-- == IPPORT_RESERVED/2)
+			*alport = IPPORT_RESERVED - 1;
+	} while (*alport != start);
+	(void)__close(s);
+	__set_errno (EAGAIN);
+	return -1;
+}
+libc_hidden_def (rresvport_af)
+
+int
+rresvport(alport)
+	int *alport;
+{
+	return rresvport_af(alport, AF_INET);
+}
+
+int	__check_rhosts_file = 1;
+char	*__rcmd_errstr;
+
+int
+ruserok_af(rhost, superuser, ruser, luser, af)
+	const char *rhost, *ruser, *luser;
+	int superuser;
+	sa_family_t af;
+{
+	struct addrinfo hints, *res, *res0;
+	int gai;
+	int ret;
+
+	memset (&hints, '\0', sizeof(hints));
+	hints.ai_family = af;
+	gai = getaddrinfo(rhost, NULL, &hints, &res0);
+	if (gai)
+		return -1;
+	ret = -1;
+	for (res=res0; res; res=res->ai_next)
+		if (ruserok2_sa(res->ai_addr, res->ai_addrlen,
+				superuser, ruser, luser, rhost) == 0){
+			ret = 0;
+			break;
+		}
+	freeaddrinfo(res0);
+	return (ret);
+}
+libc_hidden_def (ruserok_af)
+
+int
+ruserok(rhost, superuser, ruser, luser)
+	const char *rhost, *ruser, *luser;
+	int superuser;
+{
+	return ruserok_af(rhost, superuser, ruser, luser, AF_INET);
+}
+
+/* Extremely paranoid file open function. */
+static FILE *
+iruserfopen (const char *file, uid_t okuser)
+{
+  struct stat64 st;
+  char *cp = NULL;
+  FILE *res = NULL;
+
+  /* If not a regular file, if owned by someone other than user or
+     root, if writeable by anyone but the owner, or if hardlinked
+     anywhere, quit.  */
+  if (__lxstat64 (_STAT_VER, file, &st))
+    cp = _("lstat failed");
+  else if (!S_ISREG (st.st_mode))
+    cp = _("not regular file");
+  else
+    {
+      res = fopen (file, "rce");
+      if (!res)
+	cp = _("cannot open");
+      else if (__fxstat64 (_STAT_VER, fileno (res), &st) < 0)
+	cp = _("fstat failed");
+      else if (st.st_uid && st.st_uid != okuser)
+	cp = _("bad owner");
+      else if (st.st_mode & (S_IWGRP|S_IWOTH))
+	cp = _("writeable by other than owner");
+      else if (st.st_nlink > 1)
+	cp = _("hard linked somewhere");
+    }
+
+  /* If there were any problems, quit.  */
+  if (cp != NULL)
+    {
+      __rcmd_errstr = cp;
+      if (res)
+	fclose (res);
+      return NULL;
+    }
+
+  /* No threads use this stream.  */
+  __fsetlocking (res, FSETLOCKING_BYCALLER);
+
+  return res;
+}
+
+/*
+ * New .rhosts strategy: We are passed an ip address. We spin through
+ * hosts.equiv and .rhosts looking for a match. When the .rhosts only
+ * has ip addresses, we don't have to trust a nameserver.  When it
+ * contains hostnames, we spin through the list of addresses the nameserver
+ * gives us and look for a match.
+ *
+ * Returns 0 if ok, -1 if not ok.
+ */
+static int
+ruserok2_sa (ra, ralen, superuser, ruser, luser, rhost)
+     struct sockaddr *ra;
+     size_t ralen;
+     int superuser;
+     const char *ruser, *luser, *rhost;
+{
+  FILE *hostf = NULL;
+  int isbad = -1;
+
+  if (!superuser)
+    hostf = iruserfopen (_PATH_HEQUIV, 0);
+
+  if (hostf)
+    {
+      isbad = __validuser2_sa (hostf, ra, ralen, luser, ruser, rhost);
+      fclose (hostf);
+
+      if (!isbad)
+	return 0;
+    }
+
+  if (__check_rhosts_file || superuser)
+    {
+      char *pbuf;
+      struct passwd pwdbuf, *pwd;
+      size_t dirlen;
+      size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
+      char *buffer = __alloca (buflen);
+      uid_t uid;
+
+      if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) != 0
+	  || pwd == NULL)
+	return -1;
+
+      dirlen = strlen (pwd->pw_dir);
+      pbuf = alloca (dirlen + sizeof "/.rhosts");
+      __mempcpy (__mempcpy (pbuf, pwd->pw_dir, dirlen),
+		 "/.rhosts", sizeof "/.rhosts");
+
+       /* Change effective uid while reading .rhosts.  If root and
+	  reading an NFS mounted file system, can't read files that
+	  are protected read/write owner only.  */
+       uid = __geteuid ();
+       seteuid (pwd->pw_uid);
+       hostf = iruserfopen (pbuf, pwd->pw_uid);
+
+       if (hostf != NULL)
+	 {
+	   isbad = __validuser2_sa (hostf, ra, ralen, luser, ruser, rhost);
+	   fclose (hostf);
+	 }
+
+       seteuid (uid);
+       return isbad;
+    }
+  return -1;
+}
+/*
+ * ruserok_sa() is now discussed on ipng, so
+ * currently disabled for external use
+ */
+static int ruserok_sa(ra, ralen, superuser, ruser, luser)
+     struct sockaddr *ra;
+     size_t ralen;
+     int superuser;
+     const char *ruser, *luser;
+{
+  return ruserok2_sa(ra, ralen, superuser, ruser, luser, "-");
+}
+
+/* This is the exported version.  */
+int
+iruserok_af (raddr, superuser, ruser, luser, af)
+     const void *raddr;
+     int superuser;
+     const char *ruser, *luser;
+     sa_family_t af;
+{
+  union {
+    struct sockaddr generic;
+    struct sockaddr_in in;
+    struct sockaddr_in6 in6;
+  } ra;
+  size_t ralen;
+
+  memset (&ra, '\0', sizeof(ra));
+  switch (af){
+  case AF_INET:
+    ra.in.sin_family = AF_INET;
+    memcpy (&ra.in.sin_addr, raddr, sizeof(struct in_addr));
+    ralen = sizeof(struct sockaddr_in);
+    break;
+  case AF_INET6:
+    ra.in6.sin6_family = AF_INET6;
+    memcpy (&ra.in6.sin6_addr, raddr, sizeof(struct in6_addr));
+    ralen = sizeof(struct sockaddr_in6);
+    break;
+  default:
+    return 0;
+  }
+  return ruserok_sa (&ra.generic, ralen, superuser, ruser, luser);
+}
+libc_hidden_def (iruserok_af)
+
+int
+iruserok (raddr, superuser, ruser, luser)
+     u_int32_t raddr;
+     int superuser;
+     const char *ruser, *luser;
+{
+  return iruserok_af (&raddr, superuser, ruser, luser, AF_INET);
+}
+
+/*
+ * XXX
+ * Don't make static, used by lpd(8).
+ *
+ * This function is not used anymore. It is only present because lpd(8)
+ * calls it (!?!). We simply call __invaliduser2() with an illegal rhost
+ * argument. This means that netgroups won't work in .rhost/hosts.equiv
+ * files. If you want lpd to work with netgroups, fix lpd to use ruserok()
+ * or PAM.
+ * Returns 0 if ok, -1 if not ok.
+ */
+int
+__ivaliduser(hostf, raddr, luser, ruser)
+	FILE *hostf;
+	u_int32_t raddr;
+	const char *luser, *ruser;
+{
+	struct sockaddr_in ra;
+	memset(&ra, '\0', sizeof(ra));
+	ra.sin_family = AF_INET;
+	ra.sin_addr.s_addr = raddr;
+	return __validuser2_sa(hostf, (struct sockaddr *)&ra, sizeof(ra),
+			       luser, ruser, "-");
+}
+
+
+/* Returns 1 on positive match, 0 on no match, -1 on negative match.  */
+static int
+internal_function
+__checkhost_sa (struct sockaddr *ra, size_t ralen, char *lhost,
+		const char *rhost)
+{
+	struct addrinfo hints, *res0, *res;
+	char raddr[INET6_ADDRSTRLEN];
+	int match;
+	int negate=1;    /* Multiply return with this to get -1 instead of 1 */
+
+	/* Check nis netgroup.  */
+	if (strncmp ("+@", lhost, 2) == 0)
+		return innetgr (&lhost[2], rhost, NULL, NULL);
+
+	if (strncmp ("-@", lhost, 2) == 0)
+		return -innetgr (&lhost[2], rhost, NULL, NULL);
+
+	/* -host */
+	if (strncmp ("-", lhost,1) == 0) {
+		negate = -1;
+		lhost++;
+	} else if (strcmp ("+",lhost) == 0) {
+		return 1;                    /* asking for trouble, but ok.. */
+	}
+
+	/* Try for raw ip address first. */
+	/* XXX */
+	if (getnameinfo(ra, ralen,
+			raddr, sizeof(raddr), NULL, 0,
+			NI_NUMERICHOST) == 0
+	    && strcmp(raddr, lhost) == 0)
+		return negate;
+
+	/* Better be a hostname. */
+	match = 0;
+	memset(&hints, '\0', sizeof(hints));
+	hints.ai_family = ra->sa_family;
+	if (getaddrinfo(lhost, NULL, &hints, &res0) == 0){
+		/* Spin through ip addresses. */
+		for (res = res0; res; res = res->ai_next)
+		  {
+		    if (res->ai_family == ra->sa_family
+			&& !memcmp(res->ai_addr, ra, res->ai_addrlen))
+		      {
+			match = 1;
+			break;
+		      }
+		  }
+		freeaddrinfo (res0);
+	}
+	return negate * match;
+}
+
+/* Returns 1 on positive match, 0 on no match, -1 on negative match.  */
+static int
+internal_function
+__icheckuser (const char *luser, const char *ruser)
+{
+    /*
+      luser is user entry from .rhosts/hosts.equiv file
+      ruser is user id on remote host
+      */
+
+    /* [-+]@netgroup */
+    if (strncmp ("+@", luser, 2) == 0)
+	return innetgr (&luser[2], NULL, ruser, NULL);
+
+    if (strncmp ("-@", luser,2) == 0)
+	return -innetgr (&luser[2], NULL, ruser, NULL);
+
+    /* -user */
+    if (strncmp ("-", luser, 1) == 0)
+	return -(strcmp (&luser[1], ruser) == 0);
+
+    /* + */
+    if (strcmp ("+", luser) == 0)
+	return 1;
+
+    /* simple string match */
+    return strcmp (ruser, luser) == 0;
+}
+
+/*
+ * Returns 1 for blank lines (or only comment lines) and 0 otherwise
+ */
+static int
+__isempty (char *p)
+{
+    while (*p && isspace (*p)) {
+	++p;
+    }
+
+    return (*p == '\0' || *p == '#') ? 1 : 0 ;
+}
+
+/*
+ * Returns 0 if positive match, -1 if _not_ ok.
+ */
+static int
+__validuser2_sa(hostf, ra, ralen, luser, ruser, rhost)
+	FILE *hostf;
+	struct sockaddr *ra;
+	size_t ralen;
+	const char *luser, *ruser, *rhost;
+{
+    const char *user;
+    char *p;
+    int hcheck, ucheck;
+    char *buf = NULL;
+    size_t bufsize = 0;
+    int retval = -1;
+
+    while (__getline (&buf, &bufsize, hostf) > 0) {
+	buf[bufsize - 1] = '\0'; /* Make sure it's terminated.  */
+	p = buf;
+
+	/* Skip empty or comment lines */
+	if (__isempty (p)) {
+	    continue;
+	}
+
+	for (;*p && !isspace(*p); ++p) {
+	    *p = _tolower (*p);
+	}
+
+	/* Next we want to find the permitted name for the remote user.  */
+	if (*p == ' ' || *p == '\t') {
+	    /* <nul> terminate hostname and skip spaces */
+	    for (*p++='\0'; *p && isspace (*p); ++p);
+
+	    user = p;                   /* this is the user's name */
+	    while (*p && !isspace (*p))
+		++p;                    /* find end of user's name */
+	} else
+	    user = p;
+
+	*p = '\0';              /* <nul> terminate username (+host?) */
+
+	/* buf -> host(?) ; user -> username(?) */
+	if (*buf == '\0')
+	  break;
+	if (*user == '\0')
+	  user = luser;
+
+	/* First check the user part.  In a naive implementation we
+	   would check the host part first, then the user.  However,
+	   if we check the user first and reject the entry we will
+	   have saved doing any host lookups to normalize the comparison
+	   and that likely saves several DNS queries.  Therefore we
+	   check the user first.  */
+	ucheck = __icheckuser (user, ruser);
+
+	/* Either we found the user, or we didn't and this is a
+	   negative host check.  We must do the negative host lookup
+	   in order to preserve the semantics of stopping on this line
+	   before processing others.  */
+	if (ucheck != 0 || *buf == '-') {
+
+	    /* Next check host part.  */
+	    hcheck = __checkhost_sa (ra, ralen, buf, rhost);
+
+	    /* Negative '-host user(?)' match?  */
+	    if (hcheck < 0)
+		break;
+
+	    /* Positive 'host user' match?  */
+	    if (hcheck > 0 && ucheck > 0) {
+		retval = 0;
+		break;
+	    }
+
+	    /* Negative 'host -user' match?  */
+	    if (hcheck > 0 && ucheck < 0)
+	      break;
+
+	    /* Neither, go on looking for match.  */
+	}
+    }
+
+    free (buf);
+
+    return retval;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/rexec.c b/ap/libc/glibc/glibc-2.22/inet/rexec.c
new file mode 100644
index 0000000..75bb470
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/rexec.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 1980, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)rexec.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+
+#include <alloca.h>
+#include <stdio.h>
+#include <netdb.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+int	rexecoptions;
+libc_freeres_ptr (static char *ahostbuf);
+
+int
+rexec_af(ahost, rport, name, pass, cmd, fd2p, af)
+	char **ahost;
+	int rport;
+	const char *name, *pass, *cmd;
+	int *fd2p;
+	sa_family_t af;
+{
+	struct sockaddr_storage from;
+	struct addrinfo hints, *res0;
+	const char *orig_name = name;
+	const char *orig_pass = pass;
+	u_short port = 0;
+	int s, timo = 1, s3;
+	char c;
+	int gai;
+	char servbuff[NI_MAXSERV];
+
+	__snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport));
+	servbuff[sizeof(servbuff) - 1] = '\0';
+
+	memset(&hints, '\0', sizeof(hints));
+	hints.ai_family = af;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_flags = AI_CANONNAME;
+	gai = getaddrinfo(*ahost, servbuff, &hints, &res0);
+	if (gai){
+		/* XXX: set errno? */
+		return -1;
+	}
+
+	if (res0->ai_canonname){
+		free (ahostbuf);
+		ahostbuf = strdup (res0->ai_canonname);
+		if (ahostbuf == NULL) {
+			perror ("rexec: strdup");
+			return (-1);
+		}
+		*ahost = ahostbuf;
+	} else {
+		*ahost = NULL;
+		__set_errno (ENOENT);
+		return -1;
+	}
+	ruserpass(res0->ai_canonname, &name, &pass);
+retry:
+	s = __socket(res0->ai_family, res0->ai_socktype, 0);
+	if (s < 0) {
+		perror("rexec: socket");
+		return (-1);
+	}
+	if (__connect(s, res0->ai_addr, res0->ai_addrlen) < 0) {
+		if (errno == ECONNREFUSED && timo <= 16) {
+			(void) __close(s);
+			__sleep(timo);
+			timo *= 2;
+			goto retry;
+		}
+		perror(res0->ai_canonname);
+		return (-1);
+	}
+	if (fd2p == 0) {
+		(void) __write(s, "", 1);
+		port = 0;
+	} else {
+		char num[32];
+		int s2;
+		union
+		{
+		  struct sockaddr_storage ss;
+		  struct sockaddr sa;
+		} sa2;
+		socklen_t sa2len;
+
+		s2 = __socket(res0->ai_family, res0->ai_socktype, 0);
+		if (s2 < 0) {
+			(void) __close(s);
+			return (-1);
+		}
+		__listen(s2, 1);
+		sa2len = sizeof (sa2);
+		if (__getsockname(s2, &sa2.sa, &sa2len) < 0) {
+			perror("getsockname");
+			(void) __close(s2);
+			goto bad;
+		} else if (sa2len != SA_LEN(&sa2.sa)) {
+			__set_errno(EINVAL);
+			(void) __close(s2);
+			goto bad;
+		}
+		port = 0;
+		if (!getnameinfo(&sa2.sa, sa2len,
+				 NULL, 0, servbuff, sizeof(servbuff),
+				 NI_NUMERICSERV))
+			port = atoi(servbuff);
+		(void) sprintf(num, "%u", port);
+		(void) __write(s, num, strlen(num)+1);
+		{ socklen_t len = sizeof (from);
+		  s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
+						  &len));
+		  __close(s2);
+		  if (s3 < 0) {
+			perror("accept");
+			port = 0;
+			goto bad;
+		  }
+		}
+		*fd2p = s3;
+	}
+
+	struct iovec iov[3] =
+	  {
+	    [0] = { .iov_base = (void *) name, .iov_len = strlen (name) + 1 },
+	    /* should public key encypt the password here */
+	    [1] = { .iov_base = (void *) pass, .iov_len = strlen (pass) + 1 },
+	    [2] = { .iov_base = (void *) cmd, .iov_len = strlen (cmd) + 1 }
+	  };
+	(void) TEMP_FAILURE_RETRY (__writev (s, iov, 3));
+
+	/* We don't need the memory allocated for the name and the password
+	   in ruserpass anymore.  */
+	if (name != orig_name)
+	  free ((char *) name);
+	if (pass != orig_pass)
+	  free ((char *) pass);
+
+	if (__read(s, &c, 1) != 1) {
+		perror(*ahost);
+		goto bad;
+	}
+	if (c != 0) {
+		while (__read(s, &c, 1) == 1) {
+			(void) __write(2, &c, 1);
+			if (c == '\n')
+				break;
+		}
+		goto bad;
+	}
+	freeaddrinfo(res0);
+	return (s);
+bad:
+	if (port)
+		(void) __close(*fd2p);
+	(void) __close(s);
+	freeaddrinfo(res0);
+	return (-1);
+}
+libc_hidden_def (rexec_af)
+
+int
+rexec(ahost, rport, name, pass, cmd, fd2p)
+	char **ahost;
+	int rport;
+	const char *name, *pass, *cmd;
+	int *fd2p;
+{
+	return rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET);
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/ruserpass.c b/ap/libc/glibc/glibc-2.22/inet/ruserpass.c
new file mode 100644
index 0000000..2669a88
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/ruserpass.c
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 1985, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ruserpass.c	8.3 (Berkeley) 4/2/94";
+#endif /* not lint */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <libintl.h>
+
+/* #include "ftp_var.h" */
+
+static	int token (void);
+static	FILE *cfile;
+
+#define	DEFAULT	1
+#define	LOGIN	2
+#define	PASSWD	3
+#define	ACCOUNT 4
+#define MACDEF  5
+#define	ID	10
+#define	MACHINE	11
+
+static char tokval[100];
+
+static const char tokstr[] =
+{
+#define TOK_DEFAULT_IDX	0
+  "default\0"
+#define TOK_LOGIN_IDX	(TOK_DEFAULT_IDX + sizeof "default")
+  "login\0"
+#define TOK_PASSWORD_IDX (TOK_LOGIN_IDX + sizeof "login")
+  "password\0"
+#define TOK_PASSWD_IDX	(TOK_PASSWORD_IDX + sizeof "password")
+  "passwd\0"
+#define TOK_ACCOUNT_IDX	(TOK_PASSWD_IDX + sizeof "passwd")
+  "account\0"
+#define TOK_MACHINE_IDX	(TOK_ACCOUNT_IDX + sizeof "account")
+  "machine\0"
+#define TOK_MACDEF_IDX	(TOK_MACHINE_IDX + sizeof "machine")
+  "macdef"
+};
+
+static const struct toktab {
+	int tokstr_off;
+	int tval;
+} toktab[]= {
+	{ TOK_DEFAULT_IDX,	DEFAULT },
+	{ TOK_LOGIN_IDX,	LOGIN },
+	{ TOK_PASSWORD_IDX,	PASSWD },
+	{ TOK_PASSWD_IDX,	PASSWD },
+	{ TOK_ACCOUNT_IDX,	ACCOUNT },
+	{ TOK_MACHINE_IDX,	MACHINE },
+	{ TOK_MACDEF_IDX,	MACDEF }
+};
+
+
+
+int
+ruserpass(host, aname, apass)
+	const char *host, **aname, **apass;
+{
+	char *hdir, *buf, *tmp;
+	char myname[1024], *mydomain;
+	int t, usedefault = 0;
+	struct stat64 stb;
+
+	hdir = __libc_secure_getenv("HOME");
+	if (hdir == NULL) {
+		/* If we can't get HOME, fail instead of trying ".",
+		   which is no improvement. This really should call
+		   getpwuid(getuid()).  */
+		/*hdir = ".";*/
+		return -1;
+	}
+
+	buf = alloca (strlen (hdir) + 8);
+
+	__stpcpy (__stpcpy (buf, hdir), "/.netrc");
+	cfile = fopen(buf, "rce");
+	if (cfile == NULL) {
+		if (errno != ENOENT)
+			warn("%s", buf);
+		return (0);
+	}
+	/* No threads use this stream.  */
+	__fsetlocking (cfile, FSETLOCKING_BYCALLER);
+	if (__gethostname(myname, sizeof(myname)) < 0)
+		myname[0] = '\0';
+	mydomain = __strchrnul(myname, '.');
+next:
+	while ((t = token())) switch(t) {
+
+	case DEFAULT:
+		usedefault = 1;
+		/* FALL THROUGH */
+
+	case MACHINE:
+		if (!usedefault) {
+			if (token() != ID)
+				continue;
+			/*
+			 * Allow match either for user's input host name
+			 * or official hostname.  Also allow match of
+			 * incompletely-specified host in local domain.
+			 */
+			if (__strcasecmp(host, tokval) == 0)
+				goto match;
+/*			if (__strcasecmp(hostname, tokval) == 0)
+				goto match;
+			if ((tmp = strchr(hostname, '.')) != NULL &&
+			    __strcasecmp(tmp, mydomain) == 0 &&
+			    __strncasecmp(hostname, tokval, tmp-hostname) == 0 &&
+			    tokval[tmp - hostname] == '\0')
+				goto match; */
+			if ((tmp = strchr(host, '.')) != NULL &&
+			    __strcasecmp(tmp, mydomain) == 0 &&
+			    __strncasecmp(host, tokval, tmp - host) == 0 &&
+			    tokval[tmp - host] == '\0')
+				goto match;
+			continue;
+		}
+	match:
+		while ((t = token()) && t != MACHINE && t != DEFAULT) switch(t) {
+
+		case LOGIN:
+			if (token()) {
+				if (*aname == 0) {
+				  char *newp;
+				  newp = malloc((unsigned) strlen(tokval) + 1);
+				  if (newp == NULL)
+				    {
+				      warnx(_("out of memory"));
+				      goto bad;
+				    }
+				  *aname = strcpy(newp, tokval);
+				} else {
+					if (strcmp(*aname, tokval))
+						goto next;
+				}
+			}
+			break;
+		case PASSWD:
+			if (strcmp(*aname, "anonymous") &&
+			    fstat64(fileno(cfile), &stb) >= 0 &&
+			    (stb.st_mode & 077) != 0) {
+	warnx(_("Error: .netrc file is readable by others."));
+	warnx(_("Remove password or make file unreadable by others."));
+				goto bad;
+			}
+			if (token() && *apass == 0) {
+				char *newp;
+				newp = malloc((unsigned) strlen(tokval) + 1);
+				if (newp == NULL)
+				  {
+				    warnx(_("out of memory"));
+				    goto bad;
+				  }
+				*apass = strcpy(newp, tokval);
+			}
+			break;
+		case ACCOUNT:
+#if 0
+			if (fstat64(fileno(cfile), &stb) >= 0
+			    && (stb.st_mode & 077) != 0) {
+	warnx("Error: .netrc file is readable by others.");
+	warnx("Remove account or make file unreadable by others.");
+				goto bad;
+			}
+			if (token() && *aacct == 0) {
+				*aacct = malloc((unsigned) strlen(tokval) + 1);
+				(void) strcpy(*aacct, tokval);
+			}
+#endif
+			break;
+		case MACDEF:
+#if 0
+			if (proxy) {
+				(void) fclose(cfile);
+				return (0);
+			}
+			while ((c=getc_unlocked(cfile)) != EOF && c == ' '
+			       || c == '\t');
+			if (c == EOF || c == '\n') {
+				printf("Missing macdef name argument.\n");
+				goto bad;
+			}
+			if (macnum == 16) {
+				printf("Limit of 16 macros have already been defined\n");
+				goto bad;
+			}
+			tmp = macros[macnum].mac_name;
+			*tmp++ = c;
+			for (i=0; i < 8 && (c=getc_unlocked(cfile)) != EOF &&
+			    !isspace(c); ++i) {
+				*tmp++ = c;
+			}
+			if (c == EOF) {
+				printf("Macro definition missing null line terminator.\n");
+				goto bad;
+			}
+			*tmp = '\0';
+			if (c != '\n') {
+				while ((c=getc_unlocked(cfile)) != EOF
+				       && c != '\n');
+			}
+			if (c == EOF) {
+				printf("Macro definition missing null line terminator.\n");
+				goto bad;
+			}
+			if (macnum == 0) {
+				macros[macnum].mac_start = macbuf;
+			}
+			else {
+				macros[macnum].mac_start = macros[macnum-1].mac_end + 1;
+			}
+			tmp = macros[macnum].mac_start;
+			while (tmp != macbuf + 4096) {
+				if ((c=getc_unlocked(cfile)) == EOF) {
+				printf("Macro definition missing null line terminator.\n");
+					goto bad;
+				}
+				*tmp = c;
+				if (*tmp == '\n') {
+					if (*(tmp-1) == '\0') {
+					   macros[macnum++].mac_end = tmp - 1;
+					   break;
+					}
+					*tmp = '\0';
+				}
+				tmp++;
+			}
+			if (tmp == macbuf + 4096) {
+				printf("4K macro buffer exceeded\n");
+				goto bad;
+			}
+#endif
+			break;
+		default:
+			warnx(_("Unknown .netrc keyword %s"), tokval);
+			break;
+		}
+		goto done;
+	}
+done:
+	(void) fclose(cfile);
+	return (0);
+bad:
+	(void) fclose(cfile);
+	return (-1);
+}
+libc_hidden_def (ruserpass)
+
+static int
+token (void)
+{
+	char *cp;
+	int c;
+	int i;
+
+	if (feof_unlocked(cfile) || ferror_unlocked(cfile))
+		return (0);
+	while ((c = getc_unlocked(cfile)) != EOF &&
+	    (c == '\n' || c == '\t' || c == ' ' || c == ','))
+		continue;
+	if (c == EOF)
+		return (0);
+	cp = tokval;
+	if (c == '"') {
+		while ((c = getc_unlocked(cfile)) != EOF && c != '"') {
+			if (c == '\\')
+				c = getc_unlocked(cfile);
+			*cp++ = c;
+		}
+	} else {
+		*cp++ = c;
+		while ((c = getc_unlocked(cfile)) != EOF
+		    && c != '\n' && c != '\t' && c != ' ' && c != ',') {
+			if (c == '\\')
+				c = getc_unlocked(cfile);
+			*cp++ = c;
+		}
+	}
+	*cp = 0;
+	if (tokval[0] == 0)
+		return (0);
+	for (i = 0; i < (int) (sizeof (toktab) / sizeof (toktab[0])); ++i)
+		if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval))
+			return toktab[i].tval;
+	return (ID);
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/setipv4sourcefilter.c b/ap/libc/glibc/glibc-2.22/inet/setipv4sourcefilter.c
new file mode 100644
index 0000000..1bcc728
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/setipv4sourcefilter.c
@@ -0,0 +1,33 @@
+/* Set source filter.  Stub version.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stdint.h>
+#include <netinet/in.h>
+
+
+int
+setipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
+		     uint32_t fmode, uint32_t numsrc,
+		     const struct in_addr *slist)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (setipv4sourcefilter)
diff --git a/ap/libc/glibc/glibc-2.22/inet/setsourcefilter.c b/ap/libc/glibc/glibc-2.22/inet/setsourcefilter.c
new file mode 100644
index 0000000..4a2749b
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/setsourcefilter.c
@@ -0,0 +1,33 @@
+/* Set source filter.  Stub version.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stdint.h>
+#include <netinet/in.h>
+
+
+int
+setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
+		 socklen_t grouplen, uint32_t fmode, uint32_t numsrc,
+		 const struct sockaddr_storage *slist)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (setsourcefilter)
diff --git a/ap/libc/glibc/glibc-2.22/inet/test-ifaddrs.c b/ap/libc/glibc/glibc-2.22/inet/test-ifaddrs.c
new file mode 100644
index 0000000..6e6c015
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/test-ifaddrs.c
@@ -0,0 +1,99 @@
+/* Test listing of network interface addresses.
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ifaddrs.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+static int failures;
+
+static const char *
+addr_string (struct sockaddr *sa, char *buf, size_t size)
+{
+  if (sa == NULL)
+    return "<none>";
+
+  switch (sa->sa_family)
+    {
+    case AF_INET:
+      return inet_ntop (AF_INET, &((struct sockaddr_in *) sa)->sin_addr,
+			buf, size);
+    case AF_INET6:
+      return inet_ntop (AF_INET6, &((struct sockaddr_in6 *) sa)->sin6_addr,
+			buf, size);
+#ifdef AF_LINK
+    case AF_LINK:
+      return "<link>";
+#endif
+    case AF_UNSPEC:
+      return "---";
+
+#ifdef AF_PACKET
+    case AF_PACKET:
+      return "<packet>";
+#endif
+
+    default:
+      ++failures;
+      printf ("sa_family=%d %08x\n", sa->sa_family,
+	      *(int*)&((struct sockaddr_in *) sa)->sin_addr.s_addr);
+      return "<unexpected sockaddr family>";
+    }
+}
+
+
+static int
+do_test (void)
+{
+  struct ifaddrs *ifaces, *ifa;
+
+  if (getifaddrs (&ifaces) < 0)
+    {
+      if (errno != ENOSYS)
+	{
+	  printf ("Couldn't get any interfaces: %s.\n", strerror (errno));
+	  exit (1);
+	}
+      /* The function is simply not implemented.  */
+      exit (0);
+    }
+
+  puts ("\
+Name           Flags   Address         Netmask         Broadcast/Destination");
+
+  for (ifa = ifaces; ifa != NULL; ifa = ifa->ifa_next)
+    {
+      char abuf[64], mbuf[64], dbuf[64];
+      printf ("%-15s%#.4x  %-15s %-15s %-15s\n",
+	      ifa->ifa_name, ifa->ifa_flags,
+	      addr_string (ifa->ifa_addr, abuf, sizeof (abuf)),
+	      addr_string (ifa->ifa_netmask, mbuf, sizeof (mbuf)),
+	      addr_string (ifa->ifa_broadaddr, dbuf, sizeof (dbuf)));
+    }
+
+  freeifaddrs (ifaces);
+
+  return failures ? 1 : 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/test-inet6_opt.c b/ap/libc/glibc/glibc-2.22/inet/test-inet6_opt.c
new file mode 100644
index 0000000..a7ebf00
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/test-inet6_opt.c
@@ -0,0 +1,211 @@
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+#define OPT_X	42
+#define OPT_Y	43
+#define OPT_Z	44
+
+static void *
+encode_inet6_opt (socklen_t *elp)
+{
+  void *eb = NULL;
+  socklen_t el;
+  int cl;
+  void *db;
+  int offset;
+  uint8_t val1;
+  uint16_t val2;
+  uint32_t val4;
+  uint64_t val8;
+
+  *elp = 0;
+#define CHECK() \
+  if (cl == -1)						\
+    {							\
+      printf ("cl == -1 on line %d\n", __LINE__);	\
+      free (eb);					\
+      return NULL;					\
+    }
+
+  /* Estimate the length */
+  cl = inet6_opt_init (NULL, 0);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_X, 12, 8, NULL);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_Y, 7, 4, NULL);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_Z, 7, 1, NULL);
+  CHECK ();
+  cl = inet6_opt_finish (NULL, 0, cl);
+  CHECK ();
+  el = cl;
+
+  eb = malloc (el + 8);
+  if (eb == NULL)
+    {
+      puts ("malloc failed");
+      return NULL;
+    }
+  /* Canary.  */
+  memcpy (eb + el, "deadbeef", 8);
+
+  cl = inet6_opt_init (eb, el);
+  CHECK ();
+
+  cl = inet6_opt_append (eb, el, cl, OPT_X, 12, 8, &db);
+  CHECK ();
+  val4 = 0x12345678;
+  offset = inet6_opt_set_val (db, 0, &val4, sizeof  (val4));
+  val8 = 0x0102030405060708LL;
+  inet6_opt_set_val (db, offset, &val8, sizeof  (val8));
+
+  cl = inet6_opt_append (eb, el, cl, OPT_Y, 7, 4, &db);
+  CHECK ();
+  val1 = 0x01;
+  offset = inet6_opt_set_val (db, 0, &val1, sizeof  (val1));
+  val2 = 0x1331;
+  offset = inet6_opt_set_val (db, offset, &val2, sizeof  (val2));
+  val4 = 0x01020304;
+  inet6_opt_set_val (db, offset, &val4, sizeof  (val4));
+
+  cl = inet6_opt_append (eb, el, cl, OPT_Z, 7, 1, &db);
+  CHECK ();
+  inet6_opt_set_val (db, 0, (void *) "abcdefg", 7);
+
+  cl = inet6_opt_finish (eb, el, cl);
+  CHECK ();
+
+  if (memcmp (eb + el, "deadbeef", 8) != 0)
+    {
+      puts ("Canary corrupted");
+      free (eb);
+      return NULL;
+    }
+  *elp = el;
+  return eb;
+}
+
+int
+decode_inet6_opt (void *eb, socklen_t el)
+{
+  int ret = 0;
+  int seq = 0;
+  int cl = 0;
+  int offset;
+  uint8_t type;
+  socklen_t len;
+  uint8_t val1;
+  uint16_t val2;
+  uint32_t val4;
+  uint64_t val8;
+  void *db;
+  char buf[8];
+
+  while ((cl = inet6_opt_next (eb, el, cl, &type, &len, &db)) != -1)
+    switch (type)
+      {
+      case OPT_X:
+	if (seq++ != 0)
+	  {
+	    puts ("OPT_X is not first");
+	    ret = 1;
+	  }
+	if (len != 12)
+	  {
+	    printf ("OPT_X's length %d != 12\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, &val4, sizeof (val4));
+	if (val4 != 0x12345678)
+	  {
+	    printf ("OPT_X's val4 %x != 0x12345678\n", val4);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val8, sizeof (val8));
+	if (offset != len || val8 != 0x0102030405060708LL)
+	  {
+	    printf ("OPT_X's val8 %llx != 0x0102030405060708\n",
+		    (long long) val8);
+	    ret = 1;
+	  }
+	break;
+      case OPT_Y:
+	if (seq++ != 1)
+	  {
+	    puts ("OPT_Y is not second");
+	    ret = 1;
+	  }
+	if (len != 7)
+	  {
+	    printf ("OPT_Y's length %d != 7\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, &val1, sizeof (val1));
+	if (val1 != 0x01)
+	  {
+	    printf ("OPT_Y's val1 %x != 0x01\n", val1);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val2, sizeof (val2));
+	if (val2 != 0x1331)
+	  {
+	    printf ("OPT_Y's val2 %x != 0x1331\n", val2);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val4, sizeof (val4));
+	if (offset != len || val4 != 0x01020304)
+	  {
+	    printf ("OPT_Y's val4 %x != 0x01020304\n", val4);
+	    ret = 1;
+	  }
+	break;
+      case OPT_Z:
+	if (seq++ != 2)
+	  {
+	    puts ("OPT_Z is not third");
+	    ret = 1;
+	  }
+	if (len != 7)
+	  {
+	    printf ("OPT_Z's length %d != 7\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, buf, 7);
+	if (offset != len || memcmp (buf, "abcdefg", 7) != 0)
+	  {
+	    buf[7] = '\0';
+	    printf ("OPT_Z's buf \"%s\" != \"abcdefg\"\n", buf);
+	    ret = 1;
+	  }
+	break;
+      default:
+	printf ("Unknown option %d\n", type);
+	ret = 1;
+	break;
+      }
+  if (seq != 3)
+    {
+      puts ("Didn't see all of OPT_X, OPT_Y and OPT_Z");
+      ret = 1;
+    }
+  return ret;
+}
+
+static int
+do_test (void)
+{
+  void *eb;
+  socklen_t el;
+  eb = encode_inet6_opt (&el);
+  if (eb == NULL)
+    return 1;
+  if (decode_inet6_opt (eb, el))
+    return 1;
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/test_ifindex.c b/ap/libc/glibc/glibc-2.22/inet/test_ifindex.c
new file mode 100644
index 0000000..ef4dbc4
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/test_ifindex.c
@@ -0,0 +1,67 @@
+/* Test interface name <-> index conversions.
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Philip Blundell <Philip.Blundell@pobox.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <net/if.h>
+
+static int
+do_test (void)
+{
+  int failures = 0;
+  struct if_nameindex *idx = if_nameindex (), *p;
+  if (idx == NULL)
+    {
+      if (errno != ENOSYS)
+	{
+	  printf ("Couldn't get any interfaces.\n");
+	  exit (1);
+	}
+      /* The function is simply not implemented.  */
+      exit (0);
+    }
+
+  printf ("Idx            Name | Idx           Name\n");
+
+  for (p = idx; p->if_index || p->if_name; ++p)
+    {
+      char buf[IFNAMSIZ];
+      unsigned int ni;
+      int result;
+      printf ("%3d %15s | ", p->if_index, p->if_name);
+      printf ("%3d", ni = if_nametoindex (p->if_name));
+      printf ("%15s", if_indextoname (p->if_index, buf));
+      result = (ni != p->if_index || (strcmp (buf, p->if_name)));
+      if (ni == p->if_index)
+	/* We have to make sure that this is not an alias with the
+	   same interface number.  */
+	if (p->if_index == if_nametoindex (buf))
+	  result = 0;
+      printf ("%10s", result ? "fail" : "okay");
+      printf ("\n");
+      failures += result;
+    }
+  if_freenameindex (idx);
+  return failures ? 1 : 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-checks.c b/ap/libc/glibc/glibc-2.22/inet/tst-checks.c
new file mode 100644
index 0000000..5d97564
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-checks.c
@@ -0,0 +1,173 @@
+#include <stdio.h>
+#include <string.h>
+#include <netinet/in.h>
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  char buf[16];
+  memset (buf, '\0', 16);
+
+  if (! IN6_IS_ADDR_UNSPECIFIED (buf))
+    {
+      puts ("positive IN6_IS_ADDR_UNSPECIFIED failed");
+      result = 1;
+    }
+  for (size_t i = 0; i < 16; ++i)
+    {
+      buf[i] = 1;
+      if (IN6_IS_ADDR_UNSPECIFIED (buf))
+	{
+	  printf ("negative IN6_IS_ADDR_UNSPECIFIED with byte %zu failed\n",
+		  i);
+	  result = 1;
+	}
+      buf[i] = 0;
+    }
+
+  if (IN6_IS_ADDR_LOOPBACK (buf))
+    {
+      puts ("negative IN6_IS_ADDR_UNSPECIFIED failed");
+      result = 1;
+    }
+  buf[15] = 1;
+  if (! IN6_IS_ADDR_LOOPBACK (buf))
+    {
+      puts ("positive IN6_IS_ADDR_UNSPECIFIED failed");
+      result = 1;
+    }
+  buf[15] = 0;
+
+  buf[0] = 0xfe;
+  buf[1] = 0x80;
+  if (! IN6_IS_ADDR_LINKLOCAL (buf))
+    {
+      puts ("positive IN6_IS_ADDR_LINKLOCAL failed");
+      result = 1;
+    }
+  for (size_t i = 1; i < 16; ++i)
+    {
+      buf[i] ^= 1;
+      if (! IN6_IS_ADDR_LINKLOCAL (buf))
+	{
+	  printf ("positive IN6_IS_ADDR_LINKLOCAL byte %zu failed\n", i);
+	  result = 1;
+	}
+      buf[i] ^= 1;
+    }
+  buf[0] = 0xff;
+  buf[1] = 0x80;
+  if (IN6_IS_ADDR_LINKLOCAL (buf))
+    {
+      puts ("negative IN6_IS_ADDR_LINKLOCAL failed");
+      result = 1;
+    }
+  buf[0] = 0xfe;
+  buf[1] = 0xc0;
+  if (IN6_IS_ADDR_LINKLOCAL (buf))
+    {
+      puts ("negative IN6_IS_ADDR_LINKLOCAL #2 failed");
+      result = 1;
+    }
+
+  buf[0] = 0xfe;
+  buf[1] = 0xc0;
+  if (! IN6_IS_ADDR_SITELOCAL (buf))
+    {
+      puts ("positive IN6_IS_ADDR_SITELOCAL failed");
+      result = 1;
+    }
+  for (size_t i = 1; i < 16; ++i)
+    {
+      buf[i] ^= 1;
+      if (! IN6_IS_ADDR_SITELOCAL (buf))
+	{
+	  printf ("positive IN6_IS_ADDR_SITELOCAL byte %zu failed\n", i);
+	  result = 1;
+	}
+      buf[i] ^= 1;
+    }
+  buf[0] = 0xff;
+  buf[1] = 0x80;
+  if (IN6_IS_ADDR_SITELOCAL (buf))
+    {
+      puts ("negative IN6_IS_ADDR_SITELOCAL failed");
+      result = 1;
+    }
+  buf[0] = 0xf8;
+  buf[1] = 0xc0;
+  if (IN6_IS_ADDR_SITELOCAL (buf))
+    {
+      puts ("negative IN6_IS_ADDR_SITELOCAL #2 failed");
+      result = 1;
+    }
+
+  memset (buf, '\0', 16);
+  buf[10] = 0xff;
+  buf[11] = 0xff;
+  if (! IN6_IS_ADDR_V4MAPPED (buf))
+    {
+      puts ("positive IN6_IS_ADDR_V4MAPPED failed");
+      result = 1;
+    }
+  for (size_t i = 12; i < 16; ++i)
+    {
+      buf[i] ^= 1;
+      if (! IN6_IS_ADDR_V4MAPPED (buf))
+	{
+	  printf ("positive IN6_IS_ADDR_V4MAPPED byte %zu failed\n", i);
+	  result = 1;
+	}
+      buf[i] ^= 1;
+    }
+  for (size_t i = 0; i < 12; ++i)
+    {
+      buf[i] ^= 1;
+      if (IN6_IS_ADDR_V4MAPPED (buf))
+	{
+	  printf ("negative IN6_IS_ADDR_V4MAPPED byte %zu failed\n", i);
+	  result = 1;
+	}
+      buf[i] ^= 1;
+    }
+
+  memset (buf, '\0', 16);
+  for (size_t i = 12; i < 16; ++i)
+    {
+      buf[i] ^= 2;
+      if (! IN6_IS_ADDR_V4COMPAT (buf))
+	{
+	  printf ("positive IN6_IS_ADDR_V4COMPAT byte %zu failed\n", i);
+	  result = 1;
+	}
+      buf[i] ^= 2;
+    }
+  for (size_t i = 0; i < 12; ++i)
+    {
+      buf[i] ^= 1;
+      if (IN6_IS_ADDR_V4COMPAT (buf))
+	{
+	  printf ("negative IN6_IS_ADDR_V4COMPAT byte %zu failed\n", i);
+	  result = 1;
+	}
+      buf[i] ^= 1;
+    }
+  if (IN6_IS_ADDR_V4COMPAT (buf))
+    {
+      puts ("negative IN6_IS_ADDR_V4COMPAT #2 failed");
+      result = 1;
+    }
+  buf[15] = 1;
+  if (IN6_IS_ADDR_V4COMPAT (buf))
+    {
+      puts ("negative IN6_IS_ADDR_V4COMPAT #3 failed");
+      result = 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-ether_aton.c b/ap/libc/glibc/glibc-2.22/inet/tst-ether_aton.c
new file mode 100644
index 0000000..94ceec8
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-ether_aton.c
@@ -0,0 +1,57 @@
+#include <stdio.h>
+#include <string.h>
+#include <netinet/ether.h>
+
+int
+main (int argc, char *argv[])
+{
+  struct ether_addr *valp, val;
+  int result, r;
+  char hostname[32], buf[64], *p;
+
+  valp = ether_aton ("12:34:56:78:9a:bc");
+
+  printf ("ether_aton (\"12:34:56:78:9a:bc\") = %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\n",
+	  valp->ether_addr_octet[0],
+	  valp->ether_addr_octet[1],
+	  valp->ether_addr_octet[2],
+	  valp->ether_addr_octet[3],
+	  valp->ether_addr_octet[4],
+	  valp->ether_addr_octet[5]);
+
+  result = (valp->ether_addr_octet[0] != 0x12
+	    || valp->ether_addr_octet[1] != 0x34
+	    || valp->ether_addr_octet[2] != 0x56
+	    || valp->ether_addr_octet[3] != 0x78
+	    || valp->ether_addr_octet[4] != 0x9a
+	    || valp->ether_addr_octet[5] != 0xbc);
+
+  if ((r = ether_line ("0:c0:f0:46:5f:97 host.ether.com \t# comment",
+		       &val, hostname)) == 0)
+    {
+      ether_ntoa_r (&val, buf);
+      p = strchr (buf, '\0');
+      *p++ = ' ';
+      strcpy (p, hostname);
+
+      printf ("ether_line (\"0:c0:f0:46:5f:97 host.ether.com\") = \"%s\"\n",
+	      buf);
+
+      result |= strcmp ("0:c0:f0:46:5f:97 host.ether.com", buf) != 0;
+    }
+  else
+    {
+      printf ("ether_line (\"0:c0:f0:46:5f:97 host.ether.com\") = %d\n", r);
+      result |= 1;
+    }
+
+  r = ether_line ("0:c0:2:d0 foo.bar   ", &val, hostname);
+  printf ("ether_line (\"0:c0:2:d0 foo.bar   \") = %d\n", r);
+  result |= r != -1;
+
+  r = ether_line ("0:c0:2:d0:1a:2a  ", &val, hostname);
+  printf ("ether_line (\"0:c0:2:d0:1a:2a  \") = %d\n", r);
+  result |= r != -1;
+
+  return result;
+}
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-ether_line.c b/ap/libc/glibc/glibc-2.22/inet/tst-ether_line.c
new file mode 100644
index 0000000..ff0560b
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-ether_line.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <string.h>
+#include <netinet/ether.h>
+
+
+static int
+do_test (void)
+{
+  struct ether_addr a;
+  char buf[1000];
+  if (ether_line ("00:01:02:03:04:05       aaaaa   \n", &a, buf) != 0)
+    {
+      puts ("ether_line failed");
+      return 1;
+    }
+
+  int res = 0;
+  int i;
+  for (i = 0; i < ETH_ALEN; ++i)
+    {
+      printf ("%02x%s",
+	      (int) a.ether_addr_octet[i], i + 1 == ETH_ALEN ? "" : ":");
+      if (a.ether_addr_octet[i] != i)
+	{
+	  printf ("octet %d is %d, expected %d\n",
+		  i, (int) a.ether_addr_octet[i], i);
+	  res = 1;
+	}
+    }
+
+  printf (" \"%s\"\n", buf);
+  res |= strcmp (buf, "aaaaa") != 0;
+
+  return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-gethnm.c b/ap/libc/glibc/glibc-2.22/inet/tst-gethnm.c
new file mode 100644
index 0000000..dd3a547
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-gethnm.c
@@ -0,0 +1,67 @@
+/* Based on a test case by grd@algonet.se.  */
+
+#include <netdb.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+static int
+do_test (void)
+{
+  struct hostent *ent;
+  struct in_addr hostaddr;
+  int result = 0;
+
+  inet_aton ("127.0.0.1", (struct in_addr *) &hostaddr.s_addr);
+  ent = gethostbyaddr (&hostaddr, sizeof (hostaddr), AF_INET);
+  if (ent == NULL)
+    puts ("gethostbyaddr (...) == NULL");
+  else
+    {
+      puts ("Using gethostbyaddr(..):");
+      printf ("h_name: %s\n", ent->h_name);
+
+      if (ent->h_aliases == NULL)
+	puts ("ent->h_aliases == NULL");
+      else
+	printf ("h_aliases[0]: %s\n", ent->h_aliases[0]);
+    }
+
+  ent = gethostbyname ("127.0.0.1");
+  if (ent == NULL)
+    {
+      puts ("gethostbyname (\"127.0.0.1\") == NULL");
+      result = 1;
+    }
+  else
+    {
+      printf ("\nNow using gethostbyname(..):\n");
+      printf ("h_name: %s\n", ent->h_name);
+      if (strcmp (ent->h_name, "127.0.0.1") != 0)
+	{
+	  puts ("ent->h_name != \"127.0.0.1\"");
+	  result = 1;
+	}
+
+      if (ent->h_aliases == NULL)
+	{
+	  puts ("ent->h_aliases == NULL");
+	  result = 1;
+	}
+      else
+	{
+	  printf ("h_aliases[0]: %s\n", ent->h_aliases[0]);
+	  result |= ent->h_aliases[0] != NULL;
+	}
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-getni1.c b/ap/libc/glibc/glibc-2.22/inet/tst-getni1.c
new file mode 100644
index 0000000..3960f71
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-getni1.c
@@ -0,0 +1,36 @@
+#include <netdb.h>
+#include <stdio.h>
+#include <sys/socket.h>
+
+static int
+do_test (void)
+{
+  int retval = 0;
+
+  struct sockaddr_in s;
+  s.sin_family = AF_INET;
+  s.sin_port = 80;
+  s.sin_addr.s_addr = INADDR_LOOPBACK;
+  int r = getnameinfo((struct sockaddr *) &s, sizeof (s), NULL, 0, NULL, 0,
+		      NI_NUMERICHOST | NI_NUMERICSERV);
+  printf("r = %d\n", r);
+  if (r != 0)
+    {
+      puts ("failed without NI_NAMEREQD");
+      retval = 1;
+    }
+
+  r = getnameinfo((struct sockaddr *) &s, sizeof (s), NULL, 0, NULL, 0,
+		  NI_NUMERICHOST | NI_NUMERICSERV | NI_NAMEREQD);
+  printf("r = %d\n", r);
+  if (r != EAI_NONAME)
+    {
+      puts ("did not fail with EAI_NONAME with NI_NAMEREQD set");
+      retval = 1;
+    }
+
+  return retval;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-getni2.c b/ap/libc/glibc/glibc-2.22/inet/tst-getni2.c
new file mode 100644
index 0000000..66e7806
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-getni2.c
@@ -0,0 +1,41 @@
+#include <netdb.h>
+#include <stdio.h>
+#include <sys/socket.h>
+
+static int
+do_test (void)
+{
+  int retval = 0;
+
+  struct sockaddr_in6 s;
+  s.sin6_family = AF_INET6;
+  s.sin6_port = htons (80);
+  s.sin6_flowinfo = 0;
+  s.sin6_addr = (struct in6_addr) IN6ADDR_ANY_INIT;
+  s.sin6_scope_id = 0;
+  char buf[1000];
+  buf[0] = '\0';
+  int r = getnameinfo((struct sockaddr *) &s, sizeof (s), buf, sizeof (buf),
+		      NULL, 0, NI_NUMERICSERV);
+  printf("r = %d, buf = \"%s\"\n", r, buf);
+  if (r != 0)
+    {
+      puts ("failed without NI_NAMEREQD");
+      retval = 1;
+    }
+
+  buf[0] = '\0';
+  r = getnameinfo((struct sockaddr *) &s, sizeof (s), buf, sizeof (buf),
+		  NULL, 0, NI_NUMERICSERV | NI_NAMEREQD);
+  printf("r = %d, buf = \"%s\"\n", r, buf);
+  if (r != EAI_NONAME)
+    {
+      puts ("did not fail with EAI_NONAME with NI_NAMEREQD set");
+      retval = 1;
+    }
+
+  return retval;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-inet6_rth.c b/ap/libc/glibc/glibc-2.22/inet/tst-inet6_rth.c
new file mode 100644
index 0000000..549d717
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-inet6_rth.c
@@ -0,0 +1,192 @@
+#include <stdio.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/ip6.h>
+
+static int
+do_test (void)
+{
+  int res = 0;
+  char buf[1000];
+  void *p = inet6_rth_init (buf, 24, IPV6_RTHDR_TYPE_0, 0);
+  if (p == NULL)
+    {
+      puts ("first inet6_rth_init failed");
+      res = 1;
+    }
+  else if (inet6_rth_add (p, &in6addr_any) == 0)
+    {
+      puts ("first inet6_rth_add succeeded");
+      res = 1;
+    }
+
+  p = inet6_rth_init (buf, 24, IPV6_RTHDR_TYPE_0, 1);
+  if (p == NULL)
+    {
+      puts ("second inet6_rth_init failed");
+      res = 1;
+    }
+  else if (inet6_rth_add (p, &in6addr_any) != 0)
+    {
+      puts ("second inet6_rth_add failed");
+      res = 1;
+    }
+
+  for (int nseg = 4; nseg < 6; ++nseg)
+    {
+      printf ("nseg = %d\n", nseg);
+
+      p = inet6_rth_init (buf, sizeof (buf), IPV6_RTHDR_TYPE_0, nseg);
+      if (p == NULL)
+	{
+	  puts ("third inet6_rth_init failed");
+	  res = 1;
+	}
+      else
+	{
+	  struct in6_addr tmp;
+	  memset (&tmp, '\0', sizeof (tmp));
+
+	  for (int i = 0; i < nseg; ++i)
+	    {
+	      tmp.s6_addr[0] = i;
+	      if (inet6_rth_add (p, &tmp) != 0)
+		{
+		  printf ("call %d of third inet6_rth_add failed\n", i + 1);
+		  res = 1;
+		  goto out;
+		}
+	    }
+	  ((struct ip6_rthdr0 *) p)->ip6r0_segleft = 0;
+	  if (inet6_rth_segments (p) != nseg)
+	    {
+	      puts ("\
+inet6_rth_segments returned wrong value after loop with third inet6_rth_add");
+	      res = 1;
+	      goto out;
+	    }
+
+          union
+          {
+            char buffer[1000];
+            struct ip6_rthdr0 rthdr0;
+          } buf2;
+	  if (inet6_rth_reverse (p, buf2.buffer) != 0)
+	    {
+	      puts ("first inet6_rth_reverse call failed");
+	      res = 1;
+	      goto out;
+	    }
+	  if (buf2.rthdr0.ip6r0_segleft != nseg)
+	    {
+	      puts ("segleft after first inet6_rth_reverse wrong");
+	      res = 1;
+	    }
+
+	  if (inet6_rth_segments (p) != inet6_rth_segments (buf2.buffer))
+	    {
+	      puts ("number of seconds after first inet6_rth_reverse differs");
+	      res = 1;
+	      goto out;
+	    }
+
+	  for (int i = 0; i < nseg; ++i)
+	    {
+	      struct in6_addr *addr = inet6_rth_getaddr (buf2.buffer, i);
+	      if (addr == NULL)
+		{
+		  printf ("call %d of first inet6_rth_getaddr failed\n",
+			  i + 1);
+		  res = 1;
+		}
+	      else if (addr->s6_addr[0] != nseg - 1 - i
+		       || memcmp (&addr->s6_addr[1], &in6addr_any.s6_addr[1],
+				  sizeof (in6addr_any)
+				  - sizeof (in6addr_any.s6_addr[0])) != 0)
+		{
+		  char addrbuf[100];
+		  inet_ntop (AF_INET6, addr, addrbuf, sizeof (addrbuf));
+		  printf ("\
+address %d after first inet6_rth_reverse wrong (%s)\n",
+			  i + 1, addrbuf);
+		  res = 1;
+		}
+	    }
+	out:
+	  ;
+	}
+
+      p = inet6_rth_init (buf, sizeof (buf), IPV6_RTHDR_TYPE_0, nseg);
+      if (p == NULL)
+	{
+	  puts ("fourth inet6_rth_init failed");
+	  res = 1;
+	}
+      else
+	{
+	  struct in6_addr tmp;
+	  memset (&tmp, '\0', sizeof (tmp));
+
+	  for (int i = 0; i < nseg; ++i)
+	    {
+	      tmp.s6_addr[0] = i;
+	      if (inet6_rth_add (p, &tmp) != 0)
+		{
+		  printf ("call %d of fourth inet6_rth_add failed\n", i + 1);
+		  res = 1;
+		  goto out2;
+		}
+	    }
+	  ((struct ip6_rthdr0 *) p)->ip6r0_segleft = 0;
+	  if (inet6_rth_segments (p) != nseg)
+	    {
+	      puts ("\
+inet6_rth_segments returned wrong value after loop with fourth inet6_rth_add");
+	      res = 1;
+	      goto out2;
+	    }
+
+	  if (inet6_rth_reverse (p, p) != 0)
+	    {
+	      puts ("second inet6_rth_reverse call failed");
+	      res = 1;
+	      goto out2;
+	    }
+	  if (((struct ip6_rthdr0 *) p)->ip6r0_segleft != nseg)
+	    {
+	      puts ("segleft after second inet6_rth_reverse wrong");
+	      res = 1;
+	    }
+
+	  for (int i = 0; i < nseg; ++i)
+	    {
+	      struct in6_addr *addr = inet6_rth_getaddr (p, i);
+	      if (addr == NULL)
+		{
+		  printf ("call %d of second inet6_rth_getaddr failed\n",
+			  i + 1);
+		  res = 1;
+		}
+	      else if (addr->s6_addr[0] != nseg - 1 - i
+		       || memcmp (&addr->s6_addr[1], &in6addr_any.s6_addr[1],
+				  sizeof (in6addr_any)
+				  - sizeof (in6addr_any.s6_addr[0])) != 0)
+		{
+		  char addrbuf[100];
+		  inet_ntop (AF_INET6, addr, addrbuf, sizeof (addrbuf));
+		  printf ("\
+address %d after second inet6_rth_reverse wrong (%s)\n",
+			  i + 1, addrbuf);
+		  res = 1;
+		}
+	    }
+	out2:
+	  ;
+	}
+    }
+
+  return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-network.c b/ap/libc/glibc/glibc-2.22/inet/tst-network.c
new file mode 100644
index 0000000..71d49c2
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-network.c
@@ -0,0 +1,81 @@
+/* Test for inet_network.
+   Copyright (C) 2000-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+struct
+{
+  const char *network;
+  uint32_t number;
+} tests [] =
+{
+  {"1.0.0.0", 0x1000000},
+  {"1.0.0", 0x10000},
+  {"1.0", 0x100},
+  {"1", 0x1},
+  {"192.168.0.0", 0xC0A80000},
+  {"0", 0},
+  {"0x0", 0},
+  /* Now some invalid addresses.  */
+  {"0x", INADDR_NONE},
+  {"1 bar", INADDR_NONE}, /* Bug 15277.  */
+  {"141.30.225.2800", INADDR_NONE},
+  {"141.76.1.1.1", INADDR_NONE},
+  {"141.76.1.11.", INADDR_NONE},
+  {"1410", INADDR_NONE},
+  {"1.1410", INADDR_NONE},
+  {"1.1410.", INADDR_NONE},
+  {"1.1410", INADDR_NONE},
+  {"141.76.1111", INADDR_NONE},
+  {"141.76.1111.", INADDR_NONE}
+};
+
+
+static int
+do_test (void)
+{
+  int errors = 0;
+  size_t i;
+  uint32_t res;
+
+  for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+    {
+      printf ("Testing: %s\n", tests[i].network);
+      res = inet_network (tests[i].network);
+
+      if (res != tests[i].number)
+	{
+	  ++errors;
+	  printf ("Test failed for inet_network (\"%s\"):\n",
+		  tests[i].network);
+	  printf ("Expected return value %u (0x%x) but got %u (0x%x).\n",
+		  tests[i].number, tests[i].number, res, res);
+	}
+
+    }
+
+  return errors != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/inet/tst-ntoa.c b/ap/libc/glibc/glibc-2.22/inet/tst-ntoa.c
new file mode 100644
index 0000000..ef82d4d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/inet/tst-ntoa.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+
+static int
+test (unsigned int inaddr, const char *expected)
+{
+  struct in_addr addr;
+  char *res;
+  int fail;
+
+  addr.s_addr = htonl (inaddr);
+  res = inet_ntoa (addr);
+  fail = strcmp (res, expected);
+
+  printf ("%#010x -> \"%s\" -> %s%s\n", inaddr, res,
+	  fail ? "fail, expected" : "ok", fail ? expected : "");
+
+  return fail;
+}
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+
+  result |= test (INADDR_LOOPBACK, "127.0.0.1");
+  result |= test (INADDR_BROADCAST, "255.255.255.255");
+  result |= test (INADDR_ANY, "0.0.0.0");
+  result |= test (0xc0060746, "192.6.7.70");
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"