about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/netinet
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-02-19 04:43:53 +0000
committerUlrich Drepper <drepper@redhat.com>1997-02-19 04:43:53 +0000
commit1fb05e3db1891142410bc58c320dfe281749fffe (patch)
tree46299dbecec282055e3493787910444e77099fe7 /sysdeps/unix/sysv/linux/netinet
parentc84142e8fe3cbcce43ae35ac957a74ac8216d11d (diff)
downloadglibc-1fb05e3db1891142410bc58c320dfe281749fffe.tar.gz
glibc-1fb05e3db1891142410bc58c320dfe281749fffe.tar.xz
glibc-1fb05e3db1891142410bc58c320dfe281749fffe.zip
update from main archive 970218 cvs/libc-970221 cvs/libc-970220 cvs/libc-970219
1997-02-19 03:28  Miles Bader  <miles@gnu.ai.mit.edu>

	* argp/argp-help.c: Add support for user provided filter of help
	messages.
	* argp/argp-parse.c: Likewise.
	* argp/argp.h: Likewise.
	* argp/argp-namefrob.h: Define __argp_input.

	* argp/argp-test.c: Add example for filter.

1997-02-19 02:58  Ulrich Drepper  <drepper@cygnus.com>

	* argp.h: New file.
	* locale/programs/locale.c: Switch to use argp.

	* errno.h: Make it possible to get definition of error_t even
	after having errno.h already.

	* elf/dl-hash.h: New file.  ELF hashing function.  Extracted
	from dl-lookup.c.
	* elf/dl-lookup.c (_dl_elf_hash): Remove definition.

	* elf/dl-load.c: Rename _dl_does_name_match_p to _dl_name_match_p.
	* elf/dl-version.c: Likewise.

	* elf/dl-lookup.c: Implement new versioning lookup scheme.
	* elf/dl-version.c (_dl_check_map_versions): Initialize new field
	in l_versions member.

	* elf/dlvsym.c: Correct call of _dl_lookup_versioned_symbol_skip
	and _dl_lookup_versioned_symbol.

	* elf/link.h: Rename hash_name_pair to struct r_found_version.
	* sysdeps/alpha/dl-machine.h: Likewise.
	* sysdeps/i386/dl-machine.h: Likewise.
	* sysdeps/m68k/dl-machine.h: Likewise.
	* sysdeps/mips/dl-machine.h: Likewise.

	* intl/l10nflist.c: (_nl_make_l10nflist): Fix bug in computation of
	length of abs_filename.

	* locale/Makefile (CPPFLAGS): Define LOCALE_ALIAS_PATH.

	* locale/programs/ld-monetary.c (monetary_add): Allow value 0
	in mon_grouping information.  This means no more grouping.
	* locale/programs/ld-numeric.c (numeric_add): Write value \377
	when seein value 0 in grouping information.
	* locale/programs/linereader.c (lr_close): Don't free fname since
	it might be used in error messages.

	* locale/programs/locale.c: Check whether output of `locale -a'
	really is locale directory.  Also print locale aliases.

	* misc/search.h (__action_fn_t): Parameters VALUE and LEVEL cannot
	be const.

1997-02-19 02:16  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/bsd/sun/sunos4/resourcebits.h: Correct #defin to
	#define.  Reported by Rick Flower <FLOWER@sdvax2.sdd.TRW.COM>.

1997-02-19 01:37  Erik Troan  <ewt@redhat.com>

	* shadow/sgetspent_r.c: Accept empty third, fourth and fifth fields.

1997-02-19 01:02  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/mman/syscalls.list: msync takes 3 arguments.
	Reported by Andreas Jaeger <aj@arthur.pfalz.de>.

	* sysdeps/stub/msync.c (msync): Add missing third parameter.

1997-02-19 00:29  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/bsd/sigsuspend.c: Call __sigpause with needed
	additional argument.

1997-02-18 22:13  Ulrich Drepper  <drepper@cygnus.com>

	* inet/net/ethernet.h: New file.
	* sysdeps/unix/sysv/linux/netinet/if_ether.c: Add BSD compatibility.
	* sysdeps/unix/sysv/linux/net/if_slip.h: New file.
	Contributed by a sun <asun@zoology.washington.edu>.

	* sysdeps/unix/sysv/linux/net/if_arp.h: Include <sys/socket.h>.
	* sunrpc/rpc/rpc_msg.h: Include <rpc/clnt.h>.
	Reported by a sun <asun@zoology.washington.edu>.

1997-02-16 14:25  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makerules ((common-objpfx)distinfo-$(subdir)): Depend on sysdep
	makefiles which may change the distinfo variables.

1997-02-16 14:03  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
	[$(subdir)=misc]: Add sys/quota.h.
	(sysdep_headers) [$(subdir)=inet]: Add netinet/udp.h.

1997-02-17 13:12  aleph1@dfw.net

	* sunrpc/clnt_simp.c (callrpc): Prevent buffer overflow by using
	strncpy.

1997-02-18 03:28  Ulrich Drepper  <drepper@cygnus.com>

	* stdio-common/bug10.c (main): Correct parameter.

1997-02-17 02:51  Ulrich Drepper  <drepper@cygnus.com>

	* malloc/obstack.h: Add `extern "C"' protection.
	* posix/regex.h: Likewise.
	* io/ftw.h: Likewise.
	* misc/libgen.h: Likewise.
	* login/utmp.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/reboot.h: Likewise.
	* sysdeps/unix/sysv/linux/netinet/in.h: Likewise.
	* sunrpc/rpc/pmap_rmt.h: Likewise.
	* sunrpc/rpc/auth_des.h: Likewise.
	* elf/link.h: Likewise.
	Reported by HJ Lu.

1997-02-17 01:45  a sun  <asun@zoology.washington.edu>

	Linux specific network headers.
	* sysdeps/unix/sysv/linux/netinet/if_fddi.h: New file.
	* sysdeps/unix/sysv/linux/netinet/if_tr.h: New file.
	* sysdeps/unix/sysv/linux/netinet/ip_icmp.h: New file.
	* sysdeps/unix/sysv/linux/netinet/ip_fw.h: New file.
	* sysdeps/unix/sysv/linux/netinet/igmp.h: New file.
	* sysdeps/unix/sysv/linux/netinet/icmp.h: New file.
	* sysdeps/unix/sysv/linux/netinet/ip.h: New file.
	* sysdeps/unix/sysv/linux/netinet/tcp.h: New file.
	* sysdeps/unix/sysv/linux/netipx/ipx.h: New file.
	* sysdeps/unix/sysv/linux/netatalk/atalk.h: New file.
	* sysdeps/unix/sysv/linux/Dist: Add new network headers.
	* sysdeps/unix/sysv/linux/Makefile [$(subdir)=misc] (sysdep_headers):
	Add sys/quota.h.
	[$(subdir)=inet] (sysdep_headers): Add new network header.

	* sysdeps/unix/sysv/linux/netinet/udp.h: Add Linux specific changes.

	* inet/netinet/ip.h: Move to sysdeps/generic.
	* inet/netinet/tcp.h: Likewise.
	* sysdeps/generic/netinet/ip.h: Moved to here from inet/netinet.
	* sysdeps/generic/netinet/tcp.h: Likewise.

1997-02-17 01:18  Ulrich Drepper  <drepper@cygnus.com>

	* misc/sys/syslog.h (prioritynames): Correct definition to use
	braces where necessary.
	(facilitynames): Likewise.
	Patch by Ronald F. Guilmette <rfg@monkeys.com>.
	Comment and beautify declarations.

1997-02-16 19:54 1997  Philip Blundell  <Philip.Blundell@pobox.com>

	* inet/Makefile (routines): Add in6_addr, getnameinfo.
	* inet/getnameinfo.c: New file.  Implementation of getnameinfo()
	by Craig Metz.
	* inet/in6_addr.c: New file.  IPv6 addressing constants.
	* posix/Makefile (routines): Add gai_strerror.
	* resolv/netdb.h: Add more constants for IPv6 basic API.
	* sysdeps/posix/gai_strerror.c: New file.
	* sysdeps/stub/gai_strerror.c New file.
	* sysdeps/unix/sysv/linux/netinet/in.h: Add definitions for IPv6
	basic API.

	* sysdeps/posix/getaddrinfo.c: Update from latest version by
	Craig Metz and use reentrant getXXbyYY functions.

1997-02-15 14:32 Andreas Jaeger  <aj@arthur.pfalz.de>

	* argp/argp.h: Declare argp_program_version as const char.
	* argp/argp-test.c: Likewise

	* stdlib/testrand.c (main): Declare main prototype.
	* stdlib/testdiv.c (main): Likewise.
	* string/testcopy.c (main): Likewise.
	* string/test-ffs.c (main): Likewise.
	* time/test_time.c (main): Likewise.

	* locale/duplocale.c (__duplocale): Return result.

1997-02-16 03:54  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/netinet/in.h: Declare bindresvport.
	Reported by fabsoft@fabserver1.zarm.uni-bremen.de.

	* nss/nss.h: Remove declaration of __nss_shlib_revision.
	* nss/nsswitch.c: Don't use NSS_SHLIB_VERSION macro.

1997-02-16 03:48  Thorsten Kukuk  <kukuk@weber.uni-paderborn.de>

	* nis/nss_nis/nis-ethers.c (_nss_nis_getethernam_r): Rename to
	_nss_nis_gethostton_r.
	(_nss_nis_getetherbyaddr_r): Rename to _nss_nis_getntohost_r.

1997-02-15 22:37  Andy Berkheimer  <andy@tho.org>

	* resolv/gethnamaddr.c (gethostbyname2): Test for ':' in name before
	trying to resolv name as numeric IPv6 address.
	* nss/digits_dots.c: Likewise.

Sat Feb 15 04:51:08 1997  Ulrich Drepper  <drepper@cygnus.com>

	* locale/setlocale.c (setlocale): Don't try to be clever about
	unused locales.  When the existence of the locale files isn't
	tested the result of setlocale might be different.

1997-02-15 03:34  Ulrich Drepper  <drepper@cygnus.com>

	* locale/setlocale.c (setlocale): Don't increment usage_count of
	new locale if it already has the value MAX_USAGE_COUNT (it might
	be the C locale data which is read-only).
Diffstat (limited to 'sysdeps/unix/sysv/linux/netinet')
-rw-r--r--sysdeps/unix/sysv/linux/netinet/icmp.h25
-rw-r--r--sysdeps/unix/sysv/linux/netinet/if_ether.h112
-rw-r--r--sysdeps/unix/sysv/linux/netinet/if_fddi.h37
-rw-r--r--sysdeps/unix/sysv/linux/netinet/if_tr.h41
-rw-r--r--sysdeps/unix/sysv/linux/netinet/igmp.h93
-rw-r--r--sysdeps/unix/sysv/linux/netinet/in.h100
-rw-r--r--sysdeps/unix/sysv/linux/netinet/ip.h254
-rw-r--r--sysdeps/unix/sysv/linux/netinet/ip_fw.h187
-rw-r--r--sysdeps/unix/sysv/linux/netinet/ip_icmp.h210
-rw-r--r--sysdeps/unix/sysv/linux/netinet/tcp.h162
-rw-r--r--sysdeps/unix/sysv/linux/netinet/udp.h46
11 files changed, 1235 insertions, 32 deletions
diff --git a/sysdeps/unix/sysv/linux/netinet/icmp.h b/sysdeps/unix/sysv/linux/netinet/icmp.h
new file mode 100644
index 0000000000..f6b2d8ad94
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netinet/icmp.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _NETINET_ICMP_H
+#define	_NETINET_ICMP_H 1
+
+#include <asm/types.h>
+#include <linux/icmp.h>
+
+#endif	/* netinet/icmp.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/if_ether.h b/sysdeps/unix/sysv/linux/netinet/if_ether.h
index 0da5a5aea9..7194490f53 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_ether.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_ether.h
@@ -1,35 +1,109 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef __NETINET_IF_ETHER_H
 
 #define __NETINET_IF_ETHER_H	1
 #include <features.h>
+#include <sys/types.h>
 
 /* Get definitions from kernel header file.  */
 #include <linux/if_ether.h>
 
+#ifdef __USE_BSD
+/*
+ * Copyright (c) 1982, 1986, 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 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_ether.h	8.3 (Berkeley) 5/2/95
+ *	$FreeBSD$
+ */
 
-/* This is a name for the 48 bit ethernet address available on many
-   systems.  */
-struct ether_addr
-{
-  unsigned char ether_addr_octet[ETH_ALEN];
+#include <net/ethernet.h>
+#include <net/if_arp.h>
+
+__BEGIN_DECLS
+/*
+ * Ethernet Address Resolution Protocol.
+ *
+ * See RFC 826 for protocol description.  Structure below is adapted
+ * to resolving internet addresses.  Field names used correspond to
+ * RFC 826.
+ */
+struct	ether_arp {
+	struct	arphdr ea_hdr;		/* fixed-size header */
+	u_int8_t arp_sha[ETH_ALEN];	/* sender hardware address */
+	u_int8_t arp_spa[4];		/* sender protocol address */
+	u_int8_t arp_tha[ETH_ALEN];	/* target hardware address */
+	u_int8_t arp_tpa[4];		/* target protocol address */
 };
+#define	arp_hrd	ea_hdr.ar_hrd
+#define	arp_pro	ea_hdr.ar_pro
+#define	arp_hln	ea_hdr.ar_hln
+#define	arp_pln	ea_hdr.ar_pln
+#define	arp_op	ea_hdr.ar_op
+
+/*
+ * Macro to map an IP multicast address to an Ethernet multicast address.
+ * The high-order 25 bits of the Ethernet address are statically assigned,
+ * and the low-order 23 bits are taken from the low end of the IP address.
+ */
+#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
+	/* struct in_addr *ipaddr; */ \
+	/* u_char enaddr[ETH_ALEN];	   */ \
+{ \
+	(enaddr)[0] = 0x01; \
+	(enaddr)[1] = 0x00; \
+	(enaddr)[2] = 0x5e; \
+	(enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \
+	(enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \
+	(enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \
+}
+
+__END_DECLS
+#endif /* __USE_BSD */
 
 #endif /* netinet/if_ether.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/if_fddi.h b/sysdeps/unix/sysv/linux/netinet/if_fddi.h
new file mode 100644
index 0000000000..d5d6dbdbe2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netinet/if_fddi.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 1997 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _NETINET_IF_FDDI_H
+#define	_NETINET_IF_FDDI_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <asm/types.h>
+
+#include <linux/if_fddi.h>
+
+#ifdef __USE_BSD
+
+struct fddi_header {
+  u_int8_t fddi_fc;                    /* Frame Control (FC) value */
+  u_int8_t fddi_dhost[FDDI_K_ALEN];    /* Destination host */
+  u_int8_t fddi_shost[FDDI_K_ALEN];    /* Source host */
+};
+#endif
+
+#endif	/* netinet/if_fddi.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h
new file mode 100644
index 0000000000..3c1be2102f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 1997 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _NETINET_IF_TR_H
+#define	_NETINET_IF_TR_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <asm/types.h>
+
+#include <linux/if_tr.h>
+
+#ifdef __USE_BSD
+
+struct trn_hdr {
+  u_int8_t trn_ac;                /* access control field */
+  u_int8_t trn_fc;                /* field control field */
+  u_int8_t trn_dhost[TR_ALEN];    /* destination host */
+  u_int8_t trn_shost[TR_ALEN];    /* source host */
+  u_int16_t trn_rcf;              /* route control field */
+  u_int16_t trn_rseg[8];          /* routing registers */
+};
+
+#endif
+
+#endif	/* netinet/if_tr.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/igmp.h b/sysdeps/unix/sysv/linux/netinet/igmp.h
new file mode 100644
index 0000000000..7a6ed6e8c6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netinet/igmp.h
@@ -0,0 +1,93 @@
+/* Copyright (C) 1997 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _NETINET_IGMP_H
+#define	_NETINET_IGMP_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <asm/types.h>
+#include <linux/igmp.h>
+
+#ifdef __USE_BSD
+
+#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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 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 */
+};
+
+/*
+ * 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	    */
+
+__END_DECLS
+
+#endif
+
+#endif	/* netinet/igmp.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/in.h b/sysdeps/unix/sysv/linux/netinet/in.h
index 0fec8ce3dd..53be934968 100644
--- a/sysdeps/unix/sysv/linux/netinet/in.h
+++ b/sysdeps/unix/sysv/linux/netinet/in.h
@@ -22,8 +22,11 @@
 #include <features.h>
 
 #include <sys/socket.h>
+#include <sys/types.h>
 
 
+__BEGIN_DECLS
+
 /* Standard well-defined IP protocols.  */
 enum
   {
@@ -134,6 +137,32 @@ struct in_addr
 #endif
 
 
+/* IPv6 address */
+struct in6_addr
+  {
+    union
+      {
+	u_int8_t	u6_addr8[16];
+	u_int16_t	u6_addr16[8];
+	u_int32_t	u6_addr32[4];
+#if (~0UL) > 0xffffffff
+	u_int64_t	u6_addr64[2];
+#endif
+      } in6_u;
+#define s6_addr			in6_u.u6_addr8
+#define s6_addr16		in6_u.u6_addr16
+#define s6_addr32		in6_u.u6_addr32
+#define s6_addr64		in6_u.u6_addr64
+  };
+
+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
+
 /* Get the definition of the macro to define the common sockaddr members.  */
 #include <sockaddrcom.h>
 
@@ -152,6 +181,25 @@ struct sockaddr_in
 			   sizeof(struct in_addr)];
   };
 
+/* Ditto, for IPv6.  */
+struct sockaddr_in6
+  {
+    __SOCKADDR_COMMON (sin6_);
+    u_int16_t		sin6_port;      /* Transport layer port # */
+    u_int32_t		sin6_flowinfo;  /* IPv6 flow information */
+    struct in6_addr	sin6_addr;      /* IPv6 address */
+  };
+
+/* IPv6 multicast request.  */
+struct ipv6_mreq
+  {
+    /* IPv6 multicast address of group */
+    struct in6_addr ipv6mr_multiaddr;
+
+    /* local IPv6 address of interface */
+    int		ipv6mr_ifindex;
+  };
+
 
 /* Options for use with `getsockopt' and `setsockopt' at the IP level.
    The first word in the comment at the right is the data type used;
@@ -203,4 +251,56 @@ extern unsigned short int htons __P ((unsigned short int));
 #define	htons(x)	(x)
 #endif
 
+
+/* IPV6 socket options.  */
+#define IPV6_ADDRFORM		1
+#define IPV6_RXINFO		2
+#define IPV6_RXHOPOPTS		3
+#define IPV6_RXDSTOPTS		4
+#define IPV6_RXSRCRT		5
+#define IPV6_PKTOPTIONS		6
+#define IPV6_CHECKSUM		7
+#define IPV6_HOPLIMIT		8
+
+#define IPV6_TXINFO		IPV6_RXINFO
+#define SCM_SRCINFO		IPV6_TXINFO
+#define SCM_SRCRT		IPV6_RXSRCRT
+
+#define IPV6_UNICAST_HOPS	16
+#define IPV6_MULTICAST_IF	17
+#define IPV6_MULTICAST_HOPS	18
+#define IPV6_MULTICAST_LOOP	19
+#define IPV6_ADD_MEMBERSHIP	20
+#define IPV6_DROP_MEMBERSHIP	21
+
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+        ((((u_int32_t *)(a))[0] == 0) && ((u_int32_t *)(a))[1] == 0) && \
+         (((u_int32_t *)(a))[2] == 0) && ((u_int32_t *)(a))[3] == 0))
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+        ((((u_int32_t *)(a))[0] == 0) && ((u_int32_t *)(a))[1] == 0) && \
+         (((u_int32_t *)(a))[2] == 0) && ((u_int32_t *)(a))[3] == htonl(1)))
+
+#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *)(a))[0] == 0xff)
+
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+        ((((u_int32_t *)(a))[0] & htonl(0xffc00000)) == htonl(0xfe800000))
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+        ((((u_int32_t *)(a))[0] & htonl(0xffc00000)) == htonl(0xfec00000))
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+        ((((u_int32_t *)(a))[0] == 0) && (((u_int32_t *)(a))[1] == 0) && \
+         (((u_int32_t *)(a))[2] == htonl(0xffff)))
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+        ((((u_int32_t *)(a))[0] == 0) && (((u_int32_t *)(a))[1] == 0) && \
+         (((u_int32_t *)(a))[2] == 0) && (ntohl(((u_int32_t *)(a))[3]) > 1))
+
+
+/* Bind socket to a priviledged IP port.  */
+extern int bindresvport __P ((int __sockfd, struct sockaddr_in *__sin));
+
+__END_DECLS
+
 #endif	/* netinet/in.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/ip.h b/sysdeps/unix/sysv/linux/netinet/ip.h
new file mode 100644
index 0000000000..c779db4e87
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netinet/ip.h
@@ -0,0 +1,254 @@
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef __NETINET_IP_H
+#define __NETINET_IP_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <netinet/in.h>
+
+__BEGIN_DECLS
+
+struct timestamp {
+	u_int8_t	len;
+	u_int8_t	ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	u_int8_t	flags:4,
+		overflow:4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+	u_int8_t	overflow:4,
+		flags:4;
+#else
+#error	"Please fix <bytesex.h>"
+#endif						
+	u_int32_t	data[9];
+};
+
+struct ip_options {
+  u_int32_t	faddr;		/* Saved first hop address */
+  u_int8_t	optlen;
+  u_int8_t srr;
+  u_int8_t rr;
+  u_int8_t ts;
+  u_int8_t is_setbyuser:1,	/* Set by setsockopt?			*/
+                is_data:1,	/* Options in __data, rather than skb	*/
+                is_strictroute:1, /* Strict source route		*/
+                srr_is_hit:1,	/* Packet destination addr was our one	*/
+                is_changed:1,	/* IP checksum more not valid		*/	
+                rr_needaddr:1,	/* Need to record addr of outgoing dev	*/
+                ts_needtime:1,	/* Need to record timestamp		*/
+                ts_needaddr:1;	/* Need to record addr of outgoing dev  */
+  u_int8_t router_alert;
+  u_int8_t __pad1;
+  u_int8_t __pad2;
+  u_int8_t __data[0];
+};
+
+struct iphdr {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	u_int8_t	ihl:4,
+		version:4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+	u_int8_t	version:4,
+  		ihl:4;
+#else
+#error	"Please fix <bytesex.h>"
+#endif
+	u_int8_t	tos;
+	u_int16_t	tot_len;
+	u_int16_t	id;
+	u_int16_t	frag_off;
+	u_int8_t	ttl;
+	u_int8_t	protocol;
+	u_int16_t	check;
+	u_int32_t	saddr;
+	u_int32_t	daddr;
+	/*The options start here. */
+};
+
+#ifdef __USE_BSD
+/*
+ * Copyright (c) 1982, 1986, 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 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.
+ *
+ *	@(#)ip.h	8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Definitions for internet protocol version 4.
+ * Per RFC 791, September 1981.
+ */
+
+/*
+ * Structure of an internet header, naked of options.
+ */
+struct ip {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	u_int8_t  ip_hl:4,		/* header length */
+		  ip_v:4;		/* version */
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+	u_int8_t  ip_v:4,		/* version */
+		  ip_hl:4;		/* header length */
+#endif
+	u_int8_t  ip_tos;		/* type of service */
+	u_short ip_len;		/* total length */
+	u_short ip_id;		/* identification */
+	u_short ip_off;		/* fragment offset field */
+#define	IP_RF 0x8000			/* reserved fragment flag */
+#define	IP_DF 0x4000			/* dont fragment flag */
+#define	IP_MF 0x2000			/* more fragments flag */
+#define	IP_OFFMASK 0x1fff		/* mask for fragmenting bits */
+	u_int8_t  ip_ttl;		/* time to live */
+	u_int8_t  ip_p;			/* protocol */
+	u_short ip_sum;		/* checksum */
+	struct	  in_addr ip_src, ip_dst; /* source and dest address */
+};
+
+/*
+ * Time stamp option structure.
+ */
+struct	ip_timestamp {
+	u_int8_t ipt_code;		/* IPOPT_TS */
+	u_int8_t ipt_len;		/* size of structure (variable) */
+	u_int8_t ipt_ptr;		/* index of current entry */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	u_int8_t ipt_flg:4,		/* flags, see below */
+		 ipt_oflw:4;		/* overflow counter */
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+	u_int8_t ipt_oflw:4,		/* overflow counter */
+		 ipt_flg:4;		/* flags, see below */
+#endif
+	u_int32_t data[9];
+};
+#endif /* __USE_BSD */
+
+#define	IPVERSION	4               /* IP version number */
+#define	IP_MAXPACKET	65535		/* maximum packet size */
+
+/*
+ * Definitions for IP type of service (ip_tos)
+ */
+#define	IPTOS_LOWDELAY		0x10
+#define	IPTOS_THROUGHPUT	0x08
+#define	IPTOS_RELIABILITY	0x04
+#define	IPTOS_LOWCOST		0x02
+#define	IPTOS_MINCOST		IPTOS_LOWCOST
+
+/*
+ * Definitions for IP precedence (also in ip_tos) (hopefully unused)
+ */
+#define	IPTOS_PREC_NETCONTROL		0xe0
+#define	IPTOS_PREC_INTERNETCONTROL	0xc0
+#define	IPTOS_PREC_CRITIC_ECP		0xa0
+#define	IPTOS_PREC_FLASHOVERRIDE	0x80
+#define	IPTOS_PREC_FLASH		0x60
+#define	IPTOS_PREC_IMMEDIATE		0x40
+#define	IPTOS_PREC_PRIORITY		0x20
+#define	IPTOS_PREC_ROUTINE		0x00
+
+/*
+ * Definitions for options.
+ */
+#define	IPOPT_COPIED(o)		((o)&0x80)
+#define	IPOPT_CLASS(o)		((o)&0x60)
+#define	IPOPT_NUMBER(o)		((o)&0x1f)
+
+#define	IPOPT_CONTROL		0x00
+#define	IPOPT_RESERVED1		0x20
+#define	IPOPT_DEBMEAS		0x40
+#define	IPOPT_RESERVED2		0x60
+
+#define	IPOPT_EOL		0		/* end of option list */
+#define	IPOPT_NOP		1		/* no operation */
+
+#define	IPOPT_RR		7		/* record packet route */
+#define	IPOPT_TS		68		/* timestamp */
+#define	IPOPT_SECURITY		130		/* provide s,c,h,tcc */
+#define	IPOPT_LSRR		131		/* loose source route */
+#define	IPOPT_SATID		136		/* satnet id */
+#define	IPOPT_SSRR		137		/* strict source route */
+
+/*
+ * Offsets to fields in options other than EOL and NOP.
+ */
+#define	IPOPT_OPTVAL		0		/* option ID */
+#define	IPOPT_OLEN		1		/* option length */
+#define	IPOPT_OFFSET		2		/* offset within option */
+#define	IPOPT_MINOFF		4		/* min value of above */
+
+#define	MAX_IPOPTLEN		40
+
+/* flag bits for ipt_flg */
+#define	IPOPT_TS_TSONLY		0		/* timestamps only */
+#define	IPOPT_TS_TSANDADDR	1		/* timestamps and addresses */
+#define	IPOPT_TS_PRESPEC	3		/* specified modules only */
+
+/* bits for security (not byte swapped) */
+#define	IPOPT_SECUR_UNCLASS	0x0000
+#define	IPOPT_SECUR_CONFID	0xf135
+#define	IPOPT_SECUR_EFTO	0x789a
+#define	IPOPT_SECUR_MMMM	0xbc4d
+#define	IPOPT_SECUR_RESTR	0xaf13
+#define	IPOPT_SECUR_SECRET	0xd788
+#define	IPOPT_SECUR_TOPSECRET	0x6bc5
+
+/*
+ * Internet implementation parameters.
+ */
+#define	MAXTTL		255		/* maximum time to live (seconds) */
+#define	IPDEFTTL	64		/* default ttl, from RFC 1340 */
+#define	IPFRAGTTL	60		/* time to live for frags, slowhz */
+#define	IPTTLDEC	1		/* subtracted when forwarding */
+
+#define	IP_MSS		576		/* default maximum segment size */
+
+__END_DECLS
+
+#endif /* netinet/ip.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/ip_fw.h b/sysdeps/unix/sysv/linux/netinet/ip_fw.h
new file mode 100644
index 0000000000..3887ca8992
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netinet/ip_fw.h
@@ -0,0 +1,187 @@
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* This header file was taken from linux (2.1.26) sources and modified
+ * to work under GNU LIBC 2.0.
+ */
+
+/*
+ * Copyright (c) 1993 Daniel Boulet
+ * Copyright (c) 1994 Ugen J.S.Antsilevich
+ *
+ * Redistribution and use in source forms, with and without modification,
+ * are permitted provided that this entire comment appears intact.
+ *
+ * Redistribution in binary form may occur without any restrictions.
+ * Obviously, it would be nice if you gave credit where credit is due
+ * but requiring it would be too onerous.
+ *
+ * This software is provided ``AS IS'' without any warranties of any kind.
+ */
+
+/*
+ * 	Format of an IP firewall descriptor
+ *
+ * 	src, dst, src_mask, dst_mask are always stored in network byte order.
+ * 	flags and num_*_ports are stored in host byte order (of course).
+ * 	Port numbers are stored in HOST byte order.
+ */
+ 
+#ifndef _NETINET_FW_H
+#define _NETINET_FW_H
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <netinet/icmp.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+
+__BEGIN_DECLS
+
+struct ip_fw {
+  struct ip_fw  *fw_next;		/* Next firewall on chain */
+  struct in_addr fw_src, fw_dst;	/* Source and destination IP addr */
+  struct in_addr fw_smsk, fw_dmsk;	/* Mask for src and dest IP addr */
+  struct in_addr fw_via;		/* IP address of interface "via" */
+  void *fw_viadev;	                /* device of interface "via" */
+  u_int16_t fw_flg;		        /* Flags word */
+  u_int16_t fw_nsp, fw_ndp;             /* N'of src ports and # of dst ports */
+					/* in ports array (dst ports follow */
+    					/* src ports; max of 10 ports in all;*/
+    					/* count of 0 means match all ports) */
+#define IP_FW_MAX_PORTS	10      	/* A reasonable maximum */
+  u_int16_t fw_pts[IP_FW_MAX_PORTS];    /* Array of port numbers to match */
+  u_int32_t fw_pcnt, fw_bcnt;		/* Packet and byte counters */
+  u_int8_t fw_tosand, fw_tosxor;	/* Revised packet priority */
+  char fw_vianame[IFNAMSIZ];	        /* name of interface "via" */
+};
+
+/*
+ *	Values for "flags" field .
+ */
+
+#define IP_FW_F_ALL	0x0000	/* This is a universal packet firewall*/
+#define IP_FW_F_TCP	0x0001	/* This is a TCP packet firewall      */
+#define IP_FW_F_UDP	0x0002	/* This is a UDP packet firewall      */
+#define IP_FW_F_ICMP	0x0003	/* This is a ICMP packet firewall     */
+#define IP_FW_F_KIND	0x0003	/* Mask to isolate firewall kind      */
+#define IP_FW_F_ACCEPT	0x0004	/* This is an accept firewall (as     *
+				 *         opposed to a deny firewall)*
+				 *                                    */
+#define IP_FW_F_SRNG	0x0008	/* The first two src ports are a min  *
+				 * and max range (stored in host byte *
+				 * order).                            *
+				 *                                    */
+#define IP_FW_F_DRNG	0x0010	/* The first two dst ports are a min  *
+				 * and max range (stored in host byte *
+				 * order).                            *
+				 * (ports[0] <= port <= ports[1])     *
+				 *                                    */
+#define IP_FW_F_PRN	0x0020	/* In verbose mode print this firewall*/
+#define IP_FW_F_BIDIR	0x0040	/* For bidirectional firewalls        */
+#define IP_FW_F_TCPSYN	0x0080	/* For tcp packets-check SYN only     */
+#define IP_FW_F_ICMPRPL 0x0100	/* Send back icmp unreachable packet  */
+#define IP_FW_F_MASQ	0x0200	/* Masquerading			      */
+#define IP_FW_F_TCPACK	0x0400	/* For tcp-packets match if ACK is set*/
+#define IP_FW_F_REDIR	0x0800	/* Redirect to local port fw_pts[n]   */
+#define IP_FW_F_ACCTIN  0x1000	/* Account incoming packets only.     */
+#define IP_FW_F_ACCTOUT 0x2000	/* Account outgoing packets only.     */
+
+#define IP_FW_F_MASK	0x3FFF	/* All possible flag bits mask        */
+
+/*    
+ *	New IP firewall options for [gs]etsockopt at the RAW IP level.
+ *	Unlike BSD Linux inherits IP options so you don't have to use
+ *	a raw socket for this. Instead we check rights in the calls.
+ */     
+
+#define IP_FW_BASE_CTL  	64	/* base for firewall socket options */
+
+#define IP_FW_COMMAND		0x00FF	/* mask for command without chain */
+#define IP_FW_TYPE		0x0300	/* mask for type (chain) */
+#define IP_FW_SHIFT		8	/* shift count for type (chain) */
+
+#define IP_FW_FWD		0
+#define IP_FW_IN		1
+#define IP_FW_OUT		2
+#define IP_FW_ACCT		3
+#define IP_FW_CHAINS		4	/* total number of ip_fw chains */
+
+#define IP_FW_INSERT		(IP_FW_BASE_CTL)
+#define IP_FW_APPEND		(IP_FW_BASE_CTL+1)
+#define IP_FW_DELETE		(IP_FW_BASE_CTL+2)
+#define IP_FW_FLUSH		(IP_FW_BASE_CTL+3)
+#define IP_FW_ZERO		(IP_FW_BASE_CTL+4)
+#define IP_FW_POLICY		(IP_FW_BASE_CTL+5)
+#define IP_FW_CHECK		(IP_FW_BASE_CTL+6)
+#define IP_FW_MASQ_TIMEOUTS	(IP_FW_BASE_CTL+7)
+
+#define IP_FW_INSERT_FWD	(IP_FW_INSERT | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_APPEND_FWD	(IP_FW_APPEND | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_DELETE_FWD	(IP_FW_DELETE | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_FLUSH_FWD		(IP_FW_FLUSH  | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_ZERO_FWD		(IP_FW_ZERO   | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_POLICY_FWD	(IP_FW_POLICY | (IP_FW_FWD << IP_FW_SHIFT))
+#define IP_FW_CHECK_FWD		(IP_FW_CHECK  | (IP_FW_FWD << IP_FW_SHIFT))
+
+#define IP_FW_INSERT_IN		(IP_FW_INSERT | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_APPEND_IN		(IP_FW_APPEND | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_DELETE_IN		(IP_FW_DELETE | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_FLUSH_IN		(IP_FW_FLUSH  | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_ZERO_IN		(IP_FW_ZERO   | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_POLICY_IN		(IP_FW_POLICY | (IP_FW_IN << IP_FW_SHIFT))
+#define IP_FW_CHECK_IN		(IP_FW_CHECK  | (IP_FW_IN << IP_FW_SHIFT))
+
+#define IP_FW_INSERT_OUT	(IP_FW_INSERT | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_APPEND_OUT	(IP_FW_APPEND | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_DELETE_OUT	(IP_FW_DELETE | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_FLUSH_OUT		(IP_FW_FLUSH  | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_ZERO_OUT		(IP_FW_ZERO   | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_POLICY_OUT	(IP_FW_POLICY | (IP_FW_OUT << IP_FW_SHIFT))
+#define IP_FW_CHECK_OUT		(IP_FW_CHECK  | (IP_FW_OUT << IP_FW_SHIFT))
+
+#define IP_ACCT_INSERT		(IP_FW_INSERT | (IP_FW_ACCT << IP_FW_SHIFT))
+#define IP_ACCT_APPEND		(IP_FW_APPEND | (IP_FW_ACCT << IP_FW_SHIFT))
+#define IP_ACCT_DELETE		(IP_FW_DELETE | (IP_FW_ACCT << IP_FW_SHIFT))
+#define IP_ACCT_FLUSH		(IP_FW_FLUSH  | (IP_FW_ACCT << IP_FW_SHIFT))
+#define IP_ACCT_ZERO		(IP_FW_ZERO   | (IP_FW_ACCT << IP_FW_SHIFT))
+
+struct ip_fwpkt
+{
+  struct iphdr fwp_iph;			/* IP header */
+  union {
+    struct tcphdr fwp_tcph;		/* TCP header or */
+    struct udphdr fwp_udph;		/* UDP header */
+    struct icmphdr fwp_icmph;	        /* ICMP header */
+  } fwp_protoh;
+  struct in_addr fwp_via;	        /* interface address */
+  char fwp_vianame[IFNAMSIZ];	        /* interface name */
+};
+
+/*
+ * timeouts for ip masquerading
+ */
+
+struct ip_fw_masq;
+  
+__END_DECLS
+
+#endif /* _NETINET_IP_FW_H */
diff --git a/sysdeps/unix/sysv/linux/netinet/ip_icmp.h b/sysdeps/unix/sysv/linux/netinet/ip_icmp.h
new file mode 100644
index 0000000000..cb50193b37
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netinet/ip_icmp.h
@@ -0,0 +1,210 @@
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef __NETINET_IP_ICMP_H
+#define __NETINET_IP_ICMP_H    1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+/*
+ * Copyright (c) 1982, 1986, 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 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.
+ *
+ *	@(#)ip_icmp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#include <netinet/in.h>
+#include <netinet/ip.h>
+
+/*
+ * Internal of an ICMP Router Advertisement
+ */
+struct icmp_ra_addr {
+	u_int32_t ira_addr;
+	u_int32_t ira_preference;
+};
+
+struct icmp {
+  u_int8_t  icmp_type;	/* type of message, see below */
+  u_int8_t  icmp_code;	/* type sub code */
+  u_int16_t icmp_cksum;	/* ones complement checksum of struct */
+  union {
+    u_char ih_pptr;		/* ICMP_PARAMPROB */
+    struct in_addr ih_gwaddr;	/* gateway address */
+    struct ih_idseq {		/* echo datagram */	
+      u_int16_t icd_id;
+      u_int16_t icd_seq;
+    } ih_idseq;
+    u_int32_t ih_void;
+
+    /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
+    struct ih_pmtu {	
+      u_int16_t ipm_void;
+      u_int16_t ipm_nextmtu;
+    } ih_pmtu;
+
+    struct ih_rtradv {
+      u_int8_t irt_num_addrs;
+      u_int8_t irt_wpa;
+      u_int16_t irt_lifetime;
+    } ih_rtradv;
+  } icmp_hun;
+#define	icmp_pptr	icmp_hun.ih_pptr
+#define	icmp_gwaddr	icmp_hun.ih_gwaddr
+#define	icmp_id		icmp_hun.ih_idseq.icd_id
+#define	icmp_seq	icmp_hun.ih_idseq.icd_seq
+#define	icmp_void	icmp_hun.ih_void
+#define	icmp_pmvoid	icmp_hun.ih_pmtu.ipm_void
+#define	icmp_nextmtu	icmp_hun.ih_pmtu.ipm_nextmtu
+#define	icmp_num_addrs	icmp_hun.ih_rtradv.irt_num_addrs
+#define	icmp_wpa	icmp_hun.ih_rtradv.irt_wpa
+#define	icmp_lifetime	icmp_hun.ih_rtradv.irt_lifetime
+  union {
+    struct {
+      u_int32_t its_otime;
+      u_int32_t its_rtime;
+      u_int32_t its_ttime;
+    } id_ts;
+    struct {
+      struct ip idi_ip;
+      /* options and then 64 bits of data */
+    } id_ip;
+    struct icmp_ra_addr id_radv;
+    u_int32_t   id_mask;
+    u_int8_t    id_data[1];
+  } icmp_dun;
+#define	icmp_otime	icmp_dun.id_ts.its_otime
+#define	icmp_rtime	icmp_dun.id_ts.its_rtime
+#define	icmp_ttime	icmp_dun.id_ts.its_ttime
+#define	icmp_ip		icmp_dun.id_ip.idi_ip
+#define	icmp_radv	icmp_dun.id_radv
+#define	icmp_mask	icmp_dun.id_mask
+#define	icmp_data	icmp_dun.id_data
+};
+
+/*
+ * Lower bounds on packet lengths for various types.
+ * For the error advice packets must first insure that the
+ * packet is large enough to contain the returned ip header.
+ * Only then can we do the check to see if 64 bits of packet
+ * data have been returned, since we need to check the returned
+ * ip header length.
+ */
+#define	ICMP_MINLEN	8				/* abs minimum */
+#define	ICMP_TSLEN	(8 + 3 * sizeof (n_time))	/* timestamp */
+#define	ICMP_MASKLEN	12				/* address mask */
+#define	ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)	/* min */
+#ifndef _IP_VHL
+#define	ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+	/* N.B.: must separately check that ip_hl >= 5 */
+#else
+#define	ICMP_ADVLEN(p)	(8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8)
+	/* N.B.: must separately check that header length >= 5 */
+#endif
+
+/* Definition of type and code fields. */
+#define	ICMP_ECHOREPLY		0		/* echo reply */
+#define	ICMP_UNREACH		3		/* dest unreachable, codes: */
+#define	ICMP_SOURCEQUENCH	4		/* packet lost, slow down */
+#define	ICMP_REDIRECT		5		/* shorter route, codes: */
+#define	ICMP_ECHO		8		/* echo service */
+#define	ICMP_ROUTERADVERT	9		/* router advertisement */
+#define	ICMP_ROUTERSOLICIT	10		/* router solicitation */
+#define	ICMP_TIMXCEED		11		/* time exceeded, code: */
+#define	ICMP_PARAMPROB		12		/* ip header bad */
+#define	ICMP_TSTAMP		13		/* timestamp request */
+#define	ICMP_TSTAMPREPLY	14		/* timestamp reply */
+#define	ICMP_IREQ		15		/* information request */
+#define	ICMP_IREQREPLY		16		/* information reply */
+#define	ICMP_MASKREQ		17		/* address mask request */
+#define	ICMP_MASKREPLY		18		/* address mask reply */
+
+#define	ICMP_MAXTYPE		18
+
+/* UNREACH codes */
+#define	ICMP_UNREACH_NET	        0	/* bad net */
+#define	ICMP_UNREACH_HOST	        1	/* bad host */
+#define	ICMP_UNREACH_PROTOCOL	        2	/* bad protocol */
+#define	ICMP_UNREACH_PORT	        3	/* bad port */
+#define	ICMP_UNREACH_NEEDFRAG	        4	/* IP_DF caused drop */
+#define	ICMP_UNREACH_SRCFAIL	        5	/* src route failed */
+#define	ICMP_UNREACH_NET_UNKNOWN        6	/* unknown net */
+#define	ICMP_UNREACH_HOST_UNKNOWN       7	/* unknown host */
+#define	ICMP_UNREACH_ISOLATED	        8	/* src host isolated */
+#define	ICMP_UNREACH_NET_PROHIB	        9	/* net denied */
+#define	ICMP_UNREACH_HOST_PROHIB        10	/* host denied */
+#define	ICMP_UNREACH_TOSNET	        11	/* bad tos for net */
+#define	ICMP_UNREACH_TOSHOST	        12	/* bad tos for host */
+#define	ICMP_UNREACH_FILTER_PROHIB      13	/* admin prohib */
+#define	ICMP_UNREACH_HOST_PRECEDENCE    14	/* host prec vio. */
+#define	ICMP_UNREACH_PRECEDENCE_CUTOFF  15	/* prec cutoff */
+
+/* REDIRECT codes */
+#define	ICMP_REDIRECT_NET	0		/* for network */
+#define	ICMP_REDIRECT_HOST	1		/* for host */
+#define	ICMP_REDIRECT_TOSNET	2		/* for tos and net */
+#define	ICMP_REDIRECT_TOSHOST	3		/* for tos and host */
+
+/* TIMEXCEED codes */
+#define	ICMP_TIMXCEED_INTRANS	0		/* ttl==0 in transit */
+#define	ICMP_TIMXCEED_REASS	1		/* ttl==0 in reass */
+
+/* PARAMPROB code */
+#define	ICMP_PARAMPROB_OPTABSENT 1		/* req. opt. absent */
+
+#define	ICMP_INFOTYPE(type) \
+	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+	(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+	(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+	(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+	(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+__END_DECLS
+
+#endif /* netinet/ip_icmp.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/tcp.h b/sysdeps/unix/sysv/linux/netinet/tcp.h
new file mode 100644
index 0000000000..b7bf0857b8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netinet/tcp.h
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 1982, 1986, 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 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.
+ *
+ *	@(#)tcp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H	1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#ifdef __FAVOR_BSD
+typedef	u_int32_t	tcp_seq;
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ */
+struct tcphdr {
+	u_int16_t	th_sport;		/* source port */
+	u_int16_t	th_dport;		/* destination port */
+	tcp_seq	th_seq;			/* sequence number */
+	tcp_seq	th_ack;			/* acknowledgement number */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	u_int8_t	th_x2:4,		/* (unused) */
+		th_off:4;		/* data offset */
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+	u_int8_t	th_off:4,		/* data offset */
+		th_x2:4;		/* (unused) */
+#endif
+	u_int8_t	th_flags;
+#define	TH_FIN	0x01
+#define	TH_SYN	0x02
+#define	TH_RST	0x04
+#define	TH_PUSH	0x08
+#define	TH_ACK	0x10
+#define	TH_URG	0x20
+	u_int16_t	th_win;			/* window */
+	u_int16_t	th_sum;			/* checksum */
+	u_int16_t	th_urp;			/* urgent pointer */
+};
+
+#else /* !__FAVOR_BSD */
+struct tcphdr {
+	u_int16_t	source;
+	u_int16_t	dest;
+	u_int32_t	seq;
+	u_int32_t	ack_seq;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	u_int16_t	res1:4,
+		doff:4,
+		fin:1,
+		syn:1,
+		rst:1,
+		psh:1,
+		ack:1,
+		urg:1,
+		res2:2;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+	u_int16_t	doff:4,
+		res1:4,
+		res2:2,
+		urg:1,
+		ack:1,
+		psh:1,
+		rst:1,
+		syn:1,
+		fin:1;
+#else
+#error	"Adjust your <bytesex.h> defines"
+#endif	
+	u_int16_t	window;
+	u_int16_t	check;
+	u_int16_t	urg_ptr;
+};
+#endif /* __FAVOR_BSD */
+
+enum {
+  TCP_ESTABLISHED = 1,
+  TCP_SYN_SENT,
+  TCP_SYN_RECV,
+  TCP_FIN_WAIT1,
+  TCP_FIN_WAIT2,
+  TCP_TIME_WAIT,
+  TCP_CLOSE,
+  TCP_CLOSE_WAIT,
+  TCP_LAST_ACK,
+  TCP_LISTEN,
+  TCP_CLOSING   /* now a valid state */
+};
+
+#define	TCPOPT_EOL		0
+#define	TCPOPT_NOP		1
+#define	TCPOPT_MAXSEG		2
+#define    TCPOLEN_MAXSEG		4
+#define TCPOPT_WINDOW		3
+#define    TCPOLEN_WINDOW		3
+#define TCPOPT_SACK_PERMITTED	4		/* Experimental */
+#define    TCPOLEN_SACK_PERMITTED	2
+#define TCPOPT_SACK		5		/* Experimental */
+#define TCPOPT_TIMESTAMP	8
+#define    TCPOLEN_TIMESTAMP		10
+#define    TCPOLEN_TSTAMP_APPA		(TCPOLEN_TIMESTAMP+2) /* appendix A */
+
+#define TCPOPT_TSTAMP_HDR	\
+    (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+
+/*
+ * Default maximum segment size for TCP.
+ * With an IP MSS of 576, this is 536,
+ * but 512 is probably more convenient.
+ * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
+ */
+#define	TCP_MSS	512
+
+#define	TCP_MAXWIN	65535	/* largest value for (unscaled) window */
+
+#define TCP_MAX_WINSHIFT	14	/* maximum window shift */
+
+/*
+ * User-settable options (used with setsockopt).
+ */
+#define	TCP_NODELAY	0x01	/* don't delay send to coalesce packets */
+#define	TCP_MAXSEG	0x02	/* set maximum segment size */
+
+#define SOL_TCP		6	/* TCP level */
+
+__END_DECLS
+
+#endif /* netinet/tcp.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/udp.h b/sysdeps/unix/sysv/linux/netinet/udp.h
index b088838ccb..9ee66f0fce 100644
--- a/sysdeps/unix/sysv/linux/netinet/udp.h
+++ b/sysdeps/unix/sysv/linux/netinet/udp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 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
@@ -16,20 +16,40 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _NETINET_UDP_H
-#define _NETINET_UDP_H	1
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
 
-#include <sys/types.h>
+#ifndef __NETINET_UDP_H
+#define __NETINET_UDP_H    1
 
-/* The Internet RFC 768 specifies this format for the UDP protocol.  */
-struct udphdr
-  {
-    u_short uh_sport;		/* Source port.  */
-    u_short uh_dport;		/* Destination port.  */
-    u_short uh_ulen;		/* UDP length.  */
-    u_short uh_sum;		/* UDP checksum.  */
-  };
+#include <sys/cdefs.h>
+#include <sys/types.h>
 
-#define SOL_UDP		17	/* UDP level.  */
+__BEGIN_DECLS
+
+/* UDP header as specified by RFC 768, August 1980. */
+#ifdef __FAVOR_BSD
+struct udphdr {
+         u_int16_t uh_sport;           /* source port */
+         u_int16_t uh_dport;           /* destination port */
+         u_int16_t uh_ulen;            /* udp length */
+         u_int16_t uh_sum;             /* udp checksum */
+};
+#else
+
+struct udphdr {
+  u_int16_t	source;
+  u_int16_t	dest;
+  u_int16_t	len;
+  u_int16_t	check;
+};
+#endif
+
+#define SOL_UDP            17      /* sockopt level for UDP */
+
+__END_DECLS
 
 #endif /* netinet/udp.h */