summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-12-10 08:53:19 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-12-10 08:53:19 +0000
commitf09d6503a5c3a093911f3cf7088e94f293dbd631 (patch)
treebf980755633250216b25c8a2eb480884cdfc1728
parentccedba7f4e30cdaf3c9a85bc25afb27c3fada95f (diff)
Add RCS tags, remove unused header files and code, remove a few
unnecessary ifdefs...
-rw-r--r--sys/netinet6/debug.h215
-rw-r--r--sys/netinet6/debug_inet6.c121
-rw-r--r--sys/netinet6/debug_inet6.h25
-rw-r--r--sys/netinet6/icmpv6.h2
-rw-r--r--sys/netinet6/icmpv6_var.h2
-rw-r--r--sys/netinet6/in6.c1
-rw-r--r--sys/netinet6/in6.h1
-rw-r--r--sys/netinet6/in6_cksum.c2
-rw-r--r--sys/netinet6/in6_pcb.c2
-rw-r--r--sys/netinet6/in6_proto.c2
-rw-r--r--sys/netinet6/in6_var.h2
-rw-r--r--sys/netinet6/nd6_protocol.h2
-rw-r--r--sys/netinet6/osdep.h148
-rw-r--r--sys/netinet6/raw_ipv6.c317
-rw-r--r--sys/netinet6/tcpipv6.h2
15 files changed, 35 insertions, 809 deletions
diff --git a/sys/netinet6/debug.h b/sys/netinet6/debug.h
deleted file mode 100644
index a27b9fb427b..00000000000
--- a/sys/netinet6/debug.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
-%%% portions-copyright-nrl-95
-Portions of this software are Copyright 1995-1998 by Randall Atkinson,
-Ronald Lee, Daniel McDonald, Bao Phan, and Chris Winters. All Rights
-Reserved. All rights under this copyright have been assigned to the US
-Naval Research Laboratory (NRL). The NRL Copyright Notice and License
-Agreement Version 1.1 (January 17, 1995) applies to these portions of the
-software.
-You should have received a copy of the license with this software. If you
-didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
-
-*/
-
-#ifndef _SYS_DEBUG_H
-#define _SYS_DEBUG_H 1
-
-#ifdef DEBUG_NRL
-#include <sys/osdep.h>
-#else /* DEBUG_NRL */
-#if __OpenBSD__
-#include <netinet6/osdep.h>
-#else /* __OpenBSD__ */
-#include <sys/osdep.h>
-#endif /* __OpenBSD__ */
-#endif /* DEBUG_NRL */
-
-/* Non-ANSI compilers don't stand a chance. You PROBABLY need GNU C. */
-#ifndef __STDC__
-#error An ANSI C compiler is required here.
-#endif /* __STDC__ */
-
-#ifndef _KERN_DEBUG_GENERIC_C
-extern int debug_level;
-#endif /* _KERN_DEBUG_GENERIC_DEBUG_C */
-
-/* Debugging levels */
-
-#define __DEBUG_LEVEL_ALL (INT_MAX-1) /* Report all messages. */
-#define __DEBUG_LEVEL_NONE 0 /* Report no messages. */
-
-#define __DEBUG_LEVEL_CRITICAL 3
-#define __DEBUG_LEVEL_ERROR 7
-#define __DEBUG_LEVEL_MAJOREVENT 10
-#define __DEBUG_LEVEL_EVENT 15
-#define __DEBUG_LEVEL_GROSSEVENT 20
-#define __DEBUG_LEVEL_FINISHED 1000
-
-/* Compatibility macros */
-
-#define __DEBUG_LEVEL_MAJOR_EVENT __DEBUG_LEVEL_MAJOREVENT
-#define __DEBUG_LEVEL_GROSS_EVENT __DEBUG_LEVEL_GROSSEVENT
-#define __DEBUG_LEVEL_IDL_CRITICAL __DEBUG_LEVEL_CRITICAL
-#define __DEBUG_LEVEL_IDL_ERROR __DEBUG_LEVEL_ERROR
-#define __DEBUG_LEVEL_IDL_MAJOR_EVENT __DEBUG_LEVEL_MAJOREVENT
-#define __DEBUG_LEVEL_IDL_EVENT __DEBUG_LEVEL_EVENT
-#define __DEBUG_LEVEL_IDL_GROSS_EVENT __DEBUG_LEVEL_GROSSEVENT
-#define __DEBUG_LEVEL_IDL_FINISHED __DEBUG_LEVEL_FINISHED
-
-/* Unless you have optimization turned off and your compiler is drain bamaged,
- this will turn in to a syntactically inert no-op - cmetz */
-#define __DEBUG_NOP do { } while (0)
-
-#ifdef DEBUG_NRL
-/*
- * Make sure argument for DPRINTF is in parentheses.
- *
- * For both DPRINTF and DDO, and attempt was made to make both macros
- * be usable as normal C statments. There is a small amount of compiler
- * trickery (if-else clauses with effectively null statements), which may
- * cause a few compilers to complain.
- */
-
-#ifndef __GENERIC_DEBUG_LEVEL
-#define __GENERIC_DEBUG_LEVEL debug_level
-#endif /* __GENERIC_DEBUG_LEVEL */
-
-/*
- * DPRINTF() is a general printf statement. The "arg" is literally what
- * would follow the function name printf, which means it has to be in
- * parenthesis. Unlimited arguments can be used this way.
- *
- * EXAMPLE:
- * DPRINTF(IDL_MAJOR_EVENT,("Hello, world. IP version %d.\n",vers));
- */
-#undef DPRINTF
-#define DPRINTF(lev,arg) \
- if (__DEBUG_LEVEL_ ## lev <= __GENERIC_DEBUG_LEVEL) { \
- printf arg; \
- } else \
- __DEBUG_NOP
-
-/*
- * DDO() executes a series of statements at a certain debug level. The
- * "stmt" argument is a statement in the sense of a "statement list" in a
- * C grammar. "stmt" does not have to end with a semicolon.
- *
- * EXAMPLE:
- * DDO(IDL_CRITICAL,dump_ipv6(header), dump_inpcb(inp));
- */
-#undef DDO
-#define DDO(lev,stmt) \
- if (__DEBUG_LEVEL_ ## lev <= __GENERIC_DEBUG_LEVEL) { \
- stmt ; \
- } else \
- __DEBUG_NOP
-
-/*
- * DP() is a shortcut for DPRINTF(). Basically:
- *
- * DP(lev, var, fmt) == DPRINTF(IDL_lev, ("var = %fmt\n", var))
- *
- * It is handy for printing single variables without a lot of typing.
- *
- * EXAMPLE:
- *
- * DP(CRITICAL,length,d);
- * same as DPRINTF(IDL_CRITICAL, ("length = %d\n", length))
- */
-#undef DP
-#define DP(lev, var, fmt) \
- DPRINTF(lev, (#var " = %" #fmt "\n", var))
-
-#undef DEBUG_STATUS
-#if defined(__GNUC__) && (__GNUC__ >= 2)
-#define DEBUG_STATUS debug_status(__FILE__ ":" __FUNCTION__, __LINE__, __builtin_return_address(0))
-#else /* defined(__GNUC__) && (__GNUC__ >= 2) */
-#define DEBUG_STATUS debug_status(__FILE__, __LINE__, (void *)0)
-#endif /* defined(__GNUC__) && (__GNUC__ >= 2) */
-
-/* Call as:
-
- DS();
-*/
-#undef DS
-#define DS() DPRINTF(IDL_CRITICAL, ("%s\n", DEBUG_STATUS))
-#else /* DEBUG_NRL */
-#undef DPRINTF
-#define DPRINTF(lev,arg) __DEBUG_NOP
-#undef DDO
-#define DDO(lev, stmt) __DEBUG_NOP
-#undef DP
-#define DP(x, y, z) __DEBUG_NOP
-#undef DS
-#define DS() __DEBUG_NOP
-#endif /* DEBUG_NRL */
-
-#ifdef DEBUG_MALLOC
-void *debug_malloc_malloc(unsigned int n, char *creator);
-void debug_malloc_free(void *p);
-void debug_malloc_dump(void);
-void debug_malloc_flush(void);
-#endif /* DEBUG_MALLOC */
-
-#ifdef DEBUG_NRL
-char *debug_status(char *filefunction, unsigned int line, void *returnaddress);
-void dump_buf_small(void *, int);
-void debug_dump_buf(void *, int);
-void dump_packet(void *buf, int len);
-
-struct dump_flags {
- int val;
- char *name;
-};
-void dump_flags(struct dump_flags *, int);
-
-struct sockaddr;
-void dump_sockaddr(struct sockaddr *);
-void dump_smart_sockaddr(void *);
-
-#ifdef __linux__
-struct sk_buff;
-void dump_skb(struct sk_buff *);
-#endif /* __linux__ */
-
-#ifdef OSDEP_BSD
-struct sockaddr_dl;
-void dump_sockaddr_dl(struct sockaddr_dl *);
-struct mbuf;
-void dump_mbuf_flags(struct mbuf *);
-void dump_mbuf_hdr(struct mbuf *);
-void dump_mbuf(struct mbuf *);
-void dump_mchain_hdr(struct mbuf *);
-void dump_mchain(struct mbuf *);
-void dump_mbuf_tcpdump(struct mbuf *);
-struct ifaddr;
-void dump_ifa(struct ifaddr *);
-struct ifnet;
-void dump_ifp(struct ifnet *);
-struct route;
-void dump_route(struct route *);
-struct rtentry;
-void dump_rtentry(struct rtentry *);
-struct inpcb;
-void dump_inpcb(struct inpcb *);
-#if __NetBSD__ || __OpenBSD__
-struct inpcbtable;
-void dump_inpcbs(struct inpcbtable *);
-#else /* __NetBSD__ || __OpenBSD__ */
-void dump_inpcbs(struct inpcb *);
-#endif /* __NetBSD__ || __OpenBSD__ */
-#endif /* OSDEP_BSD */
-
-#ifdef INET
-struct in_addr;
-void dump_in_addr(struct in_addr *);
-struct sockaddr_in;
-void dump_sockaddr_in(struct sockaddr_in *);
-#endif /* INET */
-
-#ifdef INET6
-#include <netinet6/debug_inet6.h>
-#endif /* INET6 */
-#endif /* DEBUG_NRL */
-
-#endif /* _SYS_DEBUG_H */
diff --git a/sys/netinet6/debug_inet6.c b/sys/netinet6/debug_inet6.c
deleted file mode 100644
index e90b090c50d..00000000000
--- a/sys/netinet6/debug_inet6.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-%%% copyright-nrl-95
-This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
-Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
-rights under this copyright have been assigned to the US Naval Research
-Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
-1.1 (January 17, 1995) applies to this software.
-You should have received a copy of the license with this software. If you
-didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
-
-*/
-
-#include <sys/osdep.h>
-
-#ifdef OSDEP_BSD
-#include <netinet6/ipv6.h>
-#include <netinet6/ipv6_icmp.h>
-#endif /* OSDEP_BSD */
-
-#include <sys/debug.h>
-
-/*
- * Globals
- */
-
-/*----------------------------------------------------------------------
- * Dump an IPv6 address. Don't compress 0's out because of debugging.
- ----------------------------------------------------------------------*/
-void dump_in6_addr(struct in6_addr *in6_addr)
-{
- uint16_t *p = (uint16_t *)in6_addr;
- int i = 0;
-
- if (!in6_addr) {
- printf("Dereference a NULL in6_addr? I don't think so.\n");
- return;
- }
-
- while (i++ < 7)
- printf("%04x:", ntohs(*(p++)));
- printf("%04x\n", ntohs(*p));
-}
-
-/*----------------------------------------------------------------------
- * Dump an IPv6 socket address.
- ----------------------------------------------------------------------*/
-void dump_sockaddr_in6(struct sockaddr_in6 *sin6)
-{
- printf("sockaddr_in6 at %08x: ", OSDEP_PCAST(sin6));
- if (!sin6)
- goto ret;
-
-#if OSDEP_SALEN
- printf("len=%d, ", sin6->sin6_len);
-#endif /* OSDEP_SALEN */
- printf("family=%d, port=%d, flowinfo=%lx, addr=", sin6->sin6_family, ntohs(sin6->sin6_port), (unsigned long)ntohl(sin6->sin6_flowinfo));
- dump_in6_addr(&sin6->sin6_addr);
-
-ret:
- printf("\n");
-};
-
-#ifdef OSDEP_BSD
-/*----------------------------------------------------------------------
- * Dump an IPv6 header.
- ----------------------------------------------------------------------*/
-void dump_ipv6(struct ipv6 *ipv6)
-{
- if (!ipv6) {
- printf("Dereference a NULL ipv6? I don't think so.\n");
- return;
- }
-
- printf("Vers & flow label (conv to host order) 0x%x\n",
- (unsigned int)htonl(ipv6->ipv6_versfl));
- printf("Length (conv) = %d, nexthdr = %d, hoplimit = %d.\n",
- htons(ipv6->ipv6_length),ipv6->ipv6_nexthdr,ipv6->ipv6_hoplimit);
- printf("Src: ");
- dump_in6_addr(&ipv6->ipv6_src);
- printf("Dst: ");
- dump_in6_addr(&ipv6->ipv6_dst);
-}
-
-/*----------------------------------------------------------------------
- * Dump an ICMPv6 header. This function is not very smart beyond the
- * type, code, and checksum.
- ----------------------------------------------------------------------*/
-void dump_ipv6_icmp(struct ipv6_icmp *icp)
-{
- if (!icp) {
- printf("Dereference a NULL ipv6_icmp? I don't think so.\n");
- return;
- }
-
- printf("type %d, code %d, cksum (conv) = 0x%x\n",icp->icmp_type,
- icp->icmp_code,htons(icp->icmp_cksum));
- printf("First four bytes: 0x%x", (unsigned int)htonl(icp->icmp_unused));
- printf("Next four bytes: 0x");
- debug_dump_buf((void *)icp->icmp_echodata, 4);
- printf("\n");
-}
-
-#ifdef KERNEL
-/*----------------------------------------------------------------------
- * Dump an IPv6 discovery queue structure.
- ----------------------------------------------------------------------*/
-void dump_discq(struct discq *dq)
-{
- if (!dq) {
- printf("Dereference a NULL discq? I don't think so.\n");
- return;
- }
-
- printf("dq_next = 0x%lx, dq_prev = 0x%lx, dq_rt = 0x%lx,\n", (unsigned long)dq->dq_next,
- (unsigned long)dq->dq_prev, (unsigned long)dq->dq_rt);
- printf("dq_queue = 0x%lx.\n", (unsigned long)dq->dq_queue);
- /* Dump first mbuf chain? */
- /*printf("dq_expire = %d (0x%x).\n",dq->dq_expire,dq->dq_expire);*/
-}
-#endif /* KERNEL */
-#endif /* OSDEP_BSD */
diff --git a/sys/netinet6/debug_inet6.h b/sys/netinet6/debug_inet6.h
deleted file mode 100644
index b443db4ef70..00000000000
--- a/sys/netinet6/debug_inet6.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-%%% copyright-nrl-95
-This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
-Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
-rights under this copyright have been assigned to the US Naval Research
-Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
-1.1 (January 17, 1995) applies to this software.
-You should have received a copy of the license with this software. If you
-didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
-
-*/
-#ifndef _NETINET6_DEBUG_INET6_H
-#define _NETINET6_DEBUG_INET6_H 1
-
-struct in6_addr;
-void dump_in6_addr(struct in6_addr *);
-struct sockaddr_in6;
-void dump_sockaddr_in6(struct sockaddr_in6 *);
-struct ipv6;
-void dump_ipv6(struct ipv6 *ipv6);
-struct ipv6_icmp;
-void dump_ipv6_icmp(struct ipv6_icmp *icp);
-struct discq;
-void dump_discq(struct discq *dq);
-#endif /* _NETINET6_DEBUG_INET6_H */
diff --git a/sys/netinet6/icmpv6.h b/sys/netinet6/icmpv6.h
index 31ac045a677..11a337f3809 100644
--- a/sys/netinet6/icmpv6.h
+++ b/sys/netinet6/icmpv6.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: icmpv6.h,v 1.2 1999/12/10 08:53:17 angelos Exp $ */
+
/*
%%% portions-copyright-nrl-97
Portions of this software are Copyright 1997-1998 by Randall Atkinson,
diff --git a/sys/netinet6/icmpv6_var.h b/sys/netinet6/icmpv6_var.h
index d92bd7bb120..ad468c848c7 100644
--- a/sys/netinet6/icmpv6_var.h
+++ b/sys/netinet6/icmpv6_var.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: icmpv6_var.h,v 1.5 1999/12/10 08:53:17 angelos Exp $ */
+
/*
%%% copyright-nrl-95
This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 02f3da2447f..f8c50848539 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: in6.c,v 1.8 1999/12/10 08:53:17 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 8bafafe7bb9..4043de425f6 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: in6.h,v 1.9 1999/12/10 08:53:17 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
diff --git a/sys/netinet6/in6_cksum.c b/sys/netinet6/in6_cksum.c
index 16bb1ea124a..a8775312bce 100644
--- a/sys/netinet6/in6_cksum.c
+++ b/sys/netinet6/in6_cksum.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: in6_cksum.c,v 1.3 1999/12/10 08:53:17 angelos Exp $ */
+
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 22322457a00..02191ec6d24 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: in6_pcb.c,v 1.8 1999/12/10 08:53:17 angelos Exp $ */
+
/*
%%% copyright-nrl-95
This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c
index e9903a4f54e..599e0af4a37 100644
--- a/sys/netinet6/in6_proto.c
+++ b/sys/netinet6/in6_proto.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: in6_proto.c,v 1.5 1999/12/10 08:53:17 angelos Exp $ */
+
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 9db4753fbd2..31ff8983a6e 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: in6_var.h,v 1.5 1999/12/10 08:53:17 angelos Exp $ */
+
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
diff --git a/sys/netinet6/nd6_protocol.h b/sys/netinet6/nd6_protocol.h
index 58e813bf547..0121a7390b6 100644
--- a/sys/netinet6/nd6_protocol.h
+++ b/sys/netinet6/nd6_protocol.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: nd6_protocol.h,v 1.3 1999/12/10 08:53:17 angelos Exp $ */
+
/*
%%% portions-copyright-nrl-97
Portions of this software are Copyright 1997-1998 by Randall Atkinson,
diff --git a/sys/netinet6/osdep.h b/sys/netinet6/osdep.h
index 3e3f2a93f7a..6501a3f17b7 100644
--- a/sys/netinet6/osdep.h
+++ b/sys/netinet6/osdep.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: osdep.h,v 1.3 1999/12/10 08:53:18 angelos Exp $ */
/*
%%% copyright-nrl-97
This software is Copyright 1997-1998 by Randall Atkinson, Ronald Lee,
@@ -18,137 +19,8 @@ you didn't get a copy, you may request one from <license@inner.net>.
#ifndef __OSDEP_H
#define __OSDEP_H 1
-#if __linux__
-#ifdef __KERNEL__
-#define KERNEL 1
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/socket.h>
-#include <net/sock.h>
-#include <linux/random.h>
-#include <asm/uaccess.h>
-#include <linux/malloc.h>
-
-#define printf printk
-
-/* XXX */
-#define OSDEP_CRITICALDCL unsigned long flags;
-#define OSDEP_CRITICALSTART save_flags(flags); cli()
-#define OSDEP_CRITICALEND restore_flags(flags)
-
-#define OSDEP_TIMESECONDS (xtime.tv_sec)
-
-#define OSDEP_PROCESS struct task_struct
-#define OSDEP_PROCESSCURRENT (current)
-#define OSDEP_PROCESSPARENT(x) ((x)->p_pptr)
-#define OSDEP_PROCESSPID(x) ((x)->pid)
-
-#define OSDEP_PCAST(x) ((unsigned int)(x) & 0xffffffff)
-#define OSDEP_SOCKET struct sock
-#define OSDEP_PACKET struct sk_buff
-struct sk_buff;
-
-#define OSDEP_REAL_MALLOC(n) kmalloc(n, GFP_ATOMIC)
-#define OSDEP_REAL_FREE(p) kfree(p)
-
-#define OSDEP_SOCKETFAMILY(socket) (socket->family)
-#define OSDEP_SOCKETPRIVELEGED(socket) (suser())
-
-static inline uint32_t __osdep_pseudorandom(void)
-{
- static uint32_t seed=152;
- seed=seed*69069+1;
- return seed^jiffies;
-};
-#define OSDEP_PSEUDORANDOM __osdep_pseudorandom()
-
-static inline int __osdep_datatopacket(void *data, int len, OSDEP_PACKET **packet)
-{
- if (!(*packet = alloc_skb(len, GFP_ATOMIC)))
- return -ENOMEM;
-
- memcpy((*packet)->h.raw = skb_put(*packet, len), data, len);
-
- return 0;
-};
-#define OSDEP_DATATOPACKET(data, len, packet) __osdep_datatopacket(data, len, packet)
-#define OSDEP_ZEROPACKET(packet) memset(packet->head, 0, packet->end - packet->head)
-#define OSDEP_FREEPACKET(packet) kfree_skb(packet)
-
-#define OSDEP_COPYFROMUSER(dst, src, len) \
- (copy_from_user(dst, src, len) ? -EFAULT : 0)
-
-#define OSDEP_COPYTOUSER(dst, src, len) \
- (copy_to_user(dst, src, len) ? -EFAULT : 0)
-
-#define __P(x) x
-#else /* __KERNEL__ */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <errno.h>
-#endif /* __KERNEL__ */
-
-#define OSDEP_SALEN 0
-#define OSDEP_ERROR(x) (-(x))
-
-#ifndef IN6_IS_ADDR_UNSPECIFIED
-#define IN6_IS_ADDR_UNSPECIFIED(a) \
- ((((uint32_t *)(a))[0] == 0) && (((uint32_t *)(a))[1] == 0) && \
- (((uint32_t *)(a))[2] == 0) && (((uint32_t *)(a))[3] == 0))
-#endif /* IN6_IS_ADDR_UNSPECIFIED */
-
-/* Stupid C trick: We can define the structures that are members of union
- sockaddr_union as empty and later redefine them as non-empty. We CAN'T,
- however, define them as non-empty and later redefine them as empty. So
- the empty declarations must be wrapped to ensure that we don't do that.
-
- WARNING: gcc < 2.8 generates incorrect debugging information for this;
- the symptom is that gdb thinks that all struct sockaddr_*'s are empty
- structures. gcc >= 2.8 correctly figures out what's going on. - cmetz
-*/
-
-#ifdef KERNEL
-#ifndef _NETINET_IN_H_
-/* struct sockaddr_in {}; */
-#endif /* _NETINET_IN_H_ */
-#ifndef _NETINET6_IN6_H
-/* struct sockaddr_in6 {}; */
-#endif /* _NETINET6_IN6_H */
-#ifndef _SYS_UN_H_
-struct sockaddr_un {};
-#endif /* _SYS_UN_H_ */
-
-union sockaddr_union {
- struct sockaddr sa;
- struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
- struct sockaddr_un sun;
- char __maxsize[128]; /* should probably be MHLEN on BSD */
-};
-
-static inline uint8_t __osdep_sa_len(struct sockaddr *sockaddr)
-{
- switch(sockaddr->sa_family) {
- case AF_INET:
- return 16; /* sizeof(struct sockaddr_in); */
- case AF_INET6:
- return 24; /* sizeof(struct sockaddr_in6); */
- default:
- return 0;
- };
-};
-#define SA_LEN(sockaddr) __osdep_sa_len(sockaddr)
-#endif /* KERNEL */
-#endif /* __linux__ */
-
-#if __NetBSD__ || __bsdi__ || __OpenBSD__ || __FreeBSD__
#define OSDEP_BSD 1
-#if __OpenBSD__ || __NetBSD__
-#define KERNEL 1
-#endif /* __OpenBSD__ || __NetBSD__ */
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -179,20 +51,9 @@ struct route6;
#define OSDEP_CRITICALDCL int __s;
#define OSDEP_CRITICALSTART __s = splnet()
#define OSDEP_CRITICALEND splx(__s)
-
-#ifdef __FreeBSD__
-#define OSDEP_TIMESECONDS (time_second)
-#else /* __FreeBSD__ */
#define OSDEP_TIMESECONDS (time.tv_sec)
-#endif /* __FreeBSD__ */
-
#define OSDEP_PROCESS struct proc
-#if !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802)
#define OSDEP_PROCESSCURRENT (curproc)
-#else /* !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802) */
-#include <machine/pcpu.h>
-#define OSDEP_PROCESSCURRENT (PCPU(curproc))
-#endif /* !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802) */
#define OSDEP_PROCESSPARENT(x) ((x)->p_pptr)
#define OSDEP_PROCESSPID(x) ((x)->p_pid)
@@ -212,10 +73,8 @@ struct mbuf;
#define OSDEP_FAMILY(socket) (socket->so_proto->pr_domain->dom_family)
#define OSDEP_PSEUDORANDOM (uint32_t)random()
-#if !__FreeBSD__
struct ifnet;
struct mbuf *m_devget(char *, int, int, struct ifnet *, void (*)(const void *, void *, size_t));
-#endif /* !__FreeBSD__ */
static __inline__ int __osdep_datatopacket(void *data, int len, OSDEP_PACKET **packet)
{
@@ -238,14 +97,9 @@ static __inline__ int __osdep_datatopacket(void *data, int len, OSDEP_PACKET **p
#define OSDEP_COPYFROMUSER(dst, src, len) copyin(src, dst, len)
#define OSDEP_COPYTOUSER(dst, src, len) copyout(src, dst, len)
-#if __FreeBSD__
-#define M_SOCKET M_TEMP
-#define MT_SOOPTS MT_DATA
-#endif /* __FreeBSD__ */
#endif /* KERNEL */
#define OSDEP_SALEN 1
#define OSDEP_ERROR(x) (x)
-#endif /* __NetBSD__ || __bsdi__ || __OpenBSD__ || __FreeBSD__ */
#define ENETSECURITYPOLICY -ECOMM
diff --git a/sys/netinet6/raw_ipv6.c b/sys/netinet6/raw_ipv6.c
index a32e501f699..3adf99b2002 100644
--- a/sys/netinet6/raw_ipv6.c
+++ b/sys/netinet6/raw_ipv6.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: raw_ipv6.c,v 1.6 1999/12/10 08:53:18 angelos Exp $ */
/*
%%% copyright-nrl-95
This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
@@ -42,7 +43,7 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
* SUCH DAMAGE.
*
* @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
- * $Id: raw_ipv6.c,v 1.5 1999/12/08 06:50:23 itojun Exp $
+ * $Id: raw_ipv6.c,v 1.6 1999/12/10 08:53:18 angelos Exp $
*/
#include <sys/param.h>
@@ -56,13 +57,6 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/kernel.h>
-#if __NetBSD__ || __FreeBSD__
-#include <sys/proc.h>
-#endif /* __NetBSD__ || __FreeBSD__ */
-#if __FreeBSD__
-#include <vm/vm_zone.h>
-#endif /* __FreeBSD__ */
-
#include <net/if.h>
#include <net/route.h>
@@ -79,36 +73,13 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
#if __OpenBSD__
#undef IPSEC
-#ifdef NRL_IPSEC
-#define IPSEC 1
-#endif /* NRL_IPSEC */
-#endif /* __OpenBSD__ */
-
-#ifdef IPSEC
-#include <sys/osdep.h>
-#include <net/netproc.h>
-#include <net/netproc_var.h>
-#endif /* IPSEC */
-
-#ifdef DEBUG_NRL
-#include <sys/debug.h>
-#else /* DEBUG_NRL */
-#if __OpenBSD__
-#include <netinet6/debug.h>
-#else /* __OpenBSD__ */
-#include <sys/debug.h>
#endif /* __OpenBSD__ */
-#endif /* DEBUG_NRL */
/*
* Globals
*/
-#if __NetBSD__ || __OpenBSD__
struct inpcbtable rawin6pcbtable;
-#else /* __NetBSD__ || __OpenBSD__ */
-struct inpcb rawin6pcb;
-#endif /* __NetBSD__ || __OpenBSD__ */
struct sockaddr_in6 rip6src = { sizeof(struct sockaddr_in6), AF_INET6 };
/*
@@ -117,6 +88,7 @@ struct sockaddr_in6 rip6src = { sizeof(struct sockaddr_in6), AF_INET6 };
#define RIPV6SNDQ 8192
#define RIPV6RCVQ 8192
+
#if 0
u_long rip6_sendspace = RIPV6SNDQ;
u_long rip6_recvspace = RIPV6RCVQ;
@@ -128,24 +100,11 @@ extern u_long rip6_recvspace;
/*
* External globals
*/
-#if __FreeBSD__
-static struct inpcbhead ri6pcb;
-static struct inpcbinfo ri6pcbinfo;
-#endif /* __FreeBSD__ */
#if 0
extern struct ip6_hdrstat ipv6stat;
#endif
-#define RETURN_ERROR(x) { \
- DPRINTF(EVENT, ("%s: returning %s\n", DEBUG_STATUS, #x)); \
- return x; \
-}
-#define RETURN_VALUE(x) { \
- DPRINTF(EVENT, ("%s: returning %d\n", DEBUG_STATUS, x)); \
- return x; \
-}
-
/*----------------------------------------------------------------------
* Raw IPv6 PCB initialization.
----------------------------------------------------------------------*/
@@ -153,29 +112,7 @@ extern struct ip6_hdrstat ipv6stat;
void
rip6_init()
{
-#if __FreeBSD__
- LIST_INIT(&ri6pcb);
- ri6pcbinfo.listhead = &ri6pcb;
- /*
- * XXX We don't use the hash list for raw IP, but it's easier
- * to allocate a one entry hash list than it is to check all
- * over the place for hashbase == NULL.
- */
- ri6pcbinfo.hashbase = hashinit(1, M_PCB, M_WAITOK, &ri6pcbinfo.hashmask);
- ri6pcbinfo.porthashbase = hashinit(1, M_PCB, M_WAITOK, &ri6pcbinfo.porthashmask);
- ri6pcbinfo.ipi_zone = zinit("ri6pcb", sizeof(struct inpcb),
- nmbclusters / 4, ZONE_INTERRUPT, 0);
-#else /* __FreeBSD__ */
-#if __NetBSD__
- in_pcbinit(&rawin6pcbtable, 1, 1);
-#else /* __NetBSD__ */
-#if __OpenBSD__
in_pcbinit(&rawin6pcbtable, 1);
-#else /* __OpenBSD__ */
- rawin6pcb.inp_next = rawin6pcb.inp_prev = &rawin6pcb;
-#endif /* __OpenBSD__ */
-#endif /* __NetBSD__ */
-#endif /* __FreeBSD__ */
}
/* At the point where this function gets called, we don't know the nexthdr of
@@ -277,15 +214,6 @@ rip6_input(mp, offp, proto)
#endif /* IPSEC */
int extra = *offp;
- DPRINTF(FINISHED, ("rip6_input(m=%08x, extra=%d)\n", OSDEP_PCAST(m), extra));
- DP(FINISHED, m->m_pkthdr.len, d);
- DDO(FINISHED,printf("In rip6_input(), header is:\n");dump_mchain(m));
- DPRINTF(EVENT, ("In rip6_input()\n"));
- DPRINTF(EVENT, ("Header is: "));
-#if 0
- DDO(GROSSEVENT, dump_ipv6(ipv6));
-#endif
-
bzero(&srcsa, sizeof(struct sockaddr_in6));
srcsa.sin6_family = AF_INET6;
srcsa.sin6_len = sizeof(struct sockaddr_in6);
@@ -317,19 +245,14 @@ rip6_input(mp, offp, proto)
}
#endif /* 0 */
- if ((nexthdr = ipv6_findnexthdr(m, extra)) < 0) {
- DPRINTF(ERROR, ("rip6_input: ipv6_findnexthdr failed\n"));
+ if ((nexthdr = ipv6_findnexthdr(m, extra)) < 0)
goto ret;
- }
-
- DP(FINISHED, nexthdr, d);
if (nexthdr == IPPROTO_ICMPV6) {
if (m->m_len < extra + sizeof(struct icmp6_hdr)) {
- if (!(m = m_pullup2(m, extra + sizeof(struct icmp6_hdr)))) {
- DPRINTF(ERROR, ("rip6_input: m_pullup2 failed\n"));
+ if (!(m = m_pullup2(m, extra + sizeof(struct icmp6_hdr))))
goto ret;
- }
+
ip6 = mtod(m, struct ip6_hdr *);
}
icmp6type = ((struct icmp6_hdr *)(mtod(m, caddr_t) + extra))->icmp6_type;
@@ -339,17 +262,9 @@ rip6_input(mp, offp, proto)
/*
* Locate raw PCB for incoming datagram.
*/
-#if __FreeBSD__
- for (inp = ri6pcb.lh_first; inp != NULL; inp = inp->inp_list.le_next) {
-#else /* __FreeBSD__ */
-#if __NetBSD__ || __OpenBSD__
for (inp = rawin6pcbtable.inpt_queue.cqh_first;
inp != (struct inpcb *)&rawin6pcbtable.inpt_queue;
inp = inp->inp_queue.cqe_next)
-#else /* __NetBSD__ || __OpenBSD__ */
- for (inp = rawin6pcb.inp_next; inp != &rawin6pcb; inp = inp->inp_next)
-#endif /* __NetBSD__ || __OpenBSD__ */
-#endif /* __FreeBSD__ */
{
if (inp->inp_ipv6.ip6_nxt && inp->inp_ipv6.ip6_nxt != nexthdr)
continue;
@@ -363,7 +278,6 @@ rip6_input(mp, offp, proto)
ICMP6_FILTER_WILLBLOCK(icmp6type, inp->inp_icmp6filt))
continue;
- DPRINTF(IDL_EVENT, ("Found a raw pcb (>1)\n"));
foundone = 1;
#ifdef IPSEC
@@ -377,13 +291,12 @@ rip6_input(mp, offp, proto)
(struct sockaddr *)&dstsa, nexthdr, m, NULL, NULL))
#endif /* IPSEC */
- DP(FINISHED, m->m_pkthdr.len, d);
/* Note the inefficiency here; this is a consequence of the interfaces of
the functions being used. The raw code is not performance critical
enough to require an immediate fix. - cmetz */
if ((m2 = m_copym(m, 0, (int)M_COPYALL, M_DONTWAIT))) {
m_adj(m2, extra);
- DP(FINISHED, m2->m_pkthdr.len, d);
+
if (inp->inp_flags & IN6P_CONTROLOPTS)
ip6_savecontrol(inp, &opts, ip6, m);
else
@@ -412,7 +325,6 @@ ret:
if (m)
m_freem(m);
- DPRINTF(FINISHED, ("rip6_input\n"));
return IPPROTO_DONE;
}
@@ -421,16 +333,7 @@ ret:
* ipv6_icmp_usrreq().
----------------------------------------------------------------------*/
-#if __OpenBSD__
int rip6_output(struct mbuf *m, ...)
-#else /* __OpenBSD__ */
-int
-rip6_output(m, so, dst, control)
- struct mbuf *m;
- struct socket *so;
- struct in6_addr *dst;
- struct mbuf *control;
-#endif /* __OpenBSD__ */
{
register struct ip6_hdr *ip6;
register struct inpcb *inp;
@@ -441,7 +344,7 @@ rip6_output(m, so, dst, control)
#endif
struct ip6_pktopts opt, *optp = NULL;
struct ifnet *oifp = NULL;
-#if __OpenBSD__
+
va_list ap;
struct socket *so;
struct sockaddr_in6 *dst;
@@ -452,7 +355,6 @@ rip6_output(m, so, dst, control)
dst = va_arg(ap, struct sockaddr_in6 *);
control = va_arg(ap, struct mbuf *);
va_end(ap);
-#endif /* __OpenBSD__ */
inp = sotoinpcb(so);
flags = (so->so_options & SO_DONTROUTE);
@@ -548,7 +450,6 @@ rip6_output(m, so, dst, control)
uint16_t *csum;
if (!(m = m_pullup2(m, payload + inp->inp_csumoffset))) {
- DPRINTF(IDL_ERROR, ("rip6_output: m_pullup2(m, %d) failed\n", payload + inp->inp_csumoffset));
m_freem(m);
return ENOBUFS;
};
@@ -572,32 +473,6 @@ bad:
* Handles [gs]etsockopt() calls.
----------------------------------------------------------------------*/
-#if __FreeBSD__
-int rip6_ctloutput(struct socket *so, struct sockopt *sopt)
-{
- register struct inpcb *inp = sotoinpcb(so);
- int op;
- int level;
- int optname;
- int optval;
-
- DPRINTF(FINISHED, ("rip6_ctloutput(so=%08x, sopt=%08x)\n",
- OSDEP_PCAST(so), OSDEP_PCAST(sopt)));
-
- switch(sopt->sopt_dir) {
- case SOPT_GET:
- op = PRCO_GETOPT;
- break;
- case SOPT_SET:
- op = PRCO_SETOPT;
- break;
- default:
- RETURN_ERROR(EINVAL);
- };
-
- level = sopt->sopt_level;
- optname = sopt->sopt_name;
-#else /* __FreeBSD__ */
int
rip6_ctloutput (op, so, level, optname, m)
int op;
@@ -607,35 +482,17 @@ rip6_ctloutput (op, so, level, optname, m)
{
register struct inpcb *inp = sotoinpcb(so);
- DPRINTF(FINISHED, ("rip6_ctloutput(op=%x,so,level=%x,optname=%x,m)\n", op, level, optname));
-#endif /* __FreeBSD__ */
-
if ((level != IPPROTO_IP) && (level != IPPROTO_IPV6) && (level != IPPROTO_ICMPV6)) {
-#if !__FreeBSD__
if (op == PRCO_SETOPT && *m)
(void)m_free(*m);
-#endif /* !__FreeBSD__ */
- RETURN_ERROR(EINVAL);
+ return(EINVAL);
}
switch (optname) {
case IPV6_CHECKSUM:
if (op == PRCO_SETOPT || op == PRCO_GETOPT) {
-#if __FreeBSD__
- if (!sopt->sopt_val || (sopt->sopt_valsize != sizeof(int)))
- RETURN_ERROR(EINVAL);
- if (op == PRCO_SETOPT) {
- int error = sooptcopyin(sopt, &optval, sizeof(int), sizeof(int));
- if (error)
- RETURN_VALUE(error);
- inp->inp_csumoffset = optval;
-
- return 0;
- } else
- return sooptcopyout(sopt, &inp->inp_csumoffset, sizeof(int));
-#else /* __FreeBSD__ */
if (!m || !*m || (*m)->m_len != sizeof(int))
- RETURN_ERROR(EINVAL);
+ return(EINVAL);
if (op == PRCO_SETOPT) {
inp->inp_csumoffset = *(mtod(*m, int *));
m_freem(*m);
@@ -643,32 +500,13 @@ rip6_ctloutput (op, so, level, optname, m)
(*m)->m_len = sizeof(int);
*(mtod(*m, int *)) = inp->inp_csumoffset;
};
-#endif /* __FreeBSD__ */
return 0;
};
break;
case ICMP6_FILTER:
if (op == PRCO_SETOPT || op == PRCO_GETOPT) {
-#if __FreeBSD__
- if (!sopt->sopt_val || (sopt->sopt_valsize !=
- sizeof(struct icmp6_filter)))
- RETURN_ERROR(EINVAL);
- if (op == PRCO_SETOPT) {
- struct icmp6_filter icmp6_filter;
- int error = sooptcopyin(sopt, &icmp6_filter,
- sizeof(struct icmp6_filter), sizeof(struct icmp6_filter));
- if (error)
- return error;
-
- bcopy(&icmp6_filter, inp->inp_icmp6filt, sizeof(icmp6_filter));
-
- return 0;
- } else
- return sooptcopyout(sopt, inp->inp_icmp6filt,
- sizeof(struct icmp6_filter));
-#else /* __FreeBSD__ */
if (!m || !*m || (*m)->m_len != sizeof(struct icmp6_filter))
- RETURN_ERROR(EINVAL);
+ return(EINVAL);
if (op == PRCO_SETOPT) {
bcopy(mtod(*m, struct icmp6_filter *), inp->inp_icmp6filt,
sizeof(struct icmp6_filter));
@@ -678,7 +516,6 @@ rip6_ctloutput (op, so, level, optname, m)
*mtod(*m, struct icmp6_filter *) = *inp->inp_icmp6filt;
};
return 0;
-#endif /* __FreeBSD__ */
};
break;
@@ -686,27 +523,8 @@ rip6_ctloutput (op, so, level, optname, m)
case IP_HDRINCL:
if (op == PRCO_SETOPT || op == PRCO_GETOPT)
{
-#if __FreeBSD__
- if (!sopt->sopt_val || (sopt->sopt_valsize != sizeof(int)))
- RETURN_ERROR(EINVAL);
- if (op == PRCO_SETOPT) {
- int error = sooptcopyin(sopt, &optval, sizeof(int), sizeof(int));
- if (error)
- return error;
-
- if (optval)
- inp->inp_flags |= INP_HDRINCL;
- else
- inp->inp_flags &= ~INP_HDRINCL;
-
- return 0;
- } else {
- optval = (inp->inp_flags & INP_HDRINCL) ? 1 : 0;
- return sooptcopyout(sopt, &optval, sizeof(int));
- };
-#else /* __FreeBSD__ */
if (m == 0 || *m == 0 || (*m)->m_len != sizeof(int))
- RETURN_ERROR(EINVAL);
+ return(EINVAL);
if (op == PRCO_SETOPT)
{
if (*mtod(*m, int *))
@@ -720,7 +538,6 @@ rip6_ctloutput (op, so, level, optname, m)
*(mtod(*m, int *)) = (inp->inp_flags & INP_HDRINCL) ? 1 : 0;
}
return 0;
-#endif /* __FreeBSD__ */
}
break;
@@ -748,21 +565,16 @@ rip6_ctloutput (op, so, level, optname, m)
}
else error = EINVAL;
return (error);*/
- RETURN_ERROR(EOPNOTSUPP);
+ return(EOPNOTSUPP);
#else /* MROUTING */
-#if !__FreeBSD__
if (op == PRCO_SETOPT && *m)
(void)m_free(*m);
-#endif /* !__FreeBSD__ */
- RETURN_ERROR(EOPNOTSUPP);
+ return(EOPNOTSUPP);
#endif /* MROUTING */
};
}
-#if __FreeBSD__
- return ip6_ctloutput(so, sopt);
-#else /* __FreeBSD__ */
+
return ip6_ctloutput(op, so, level, optname, m);
-#endif /* __FreeBSD__ */
}
#if __GNUC__ && __GNUC__ >= 2 && __OPTIMIZE__ && !__FreeBSD__
@@ -773,12 +585,7 @@ rip6_ctloutput (op, so, level, optname, m)
#define MAYBEINLINE
#endif /* __GNUC__ && __GNUC__ >= 2 && __OPTIMIZE__ && !__FreeBSD__ */
-#if __NetBSD__ || __FreeBSD__
-MAYBESTATIC MAYBEINLINE int rip6_usrreq_attach(struct socket *so, int proto,
- struct proc *p)
-#else /* __NetBSD__ || __FreeBSD__ */
MAYBESTATIC MAYBEINLINE int rip6_usrreq_attach(struct socket *so, int proto)
-#endif /* __NetBSD__ || __FreeBSD__ */
{
register struct inpcb *inp = sotoinpcb(so);
register int error = 0;
@@ -786,26 +593,13 @@ MAYBESTATIC MAYBEINLINE int rip6_usrreq_attach(struct socket *so, int proto)
if (inp)
panic("rip6_attach - Already got PCB");
-#if __NetBSD__ || __FreeBSD__
- if (p == 0 || (error = suser(p->p_ucred, &p->p_acflag)))
-#else /* __NetBSD__ || __FreeBSD__ */
if ((so->so_state & SS_PRIV) == 0)
-#endif /* __NetBSD__ || __FreeBSD__ */
{
error = EACCES;
return error;
}
if ((error = soreserve(so, rip6_sendspace, rip6_recvspace)) ||
-
-#if __FreeBSD__
- (error = in_pcballoc(so, &ri6pcbinfo, p)))
-#else /* __FreeBSD__ */
-#if __NetBSD__ || __OpenBSD__
- (error = in_pcballoc(so, &rawin6pcbtable)))
-#else /* __NetBSD__ || __OpenBSD__ */
- (error = in_pcballoc(so, &rawin6pcb)))
-#endif /* __NetBSD__ || __OpenBSD__ */
-#endif /* __FreeBSD__ */
+ (error = in_pcballoc(so, &rawin6pcbtable)))
return error;
@@ -855,23 +649,14 @@ static MAYBEINLINE int rip6_usrreq_disconnect(struct socket *so)
return rip6_usrreq_abort(so);
}
-#if __NetBSD__ || __FreeBSD__
-MAYBESTATIC MAYBEINLINE int rip6_usrreq_bind(struct socket *so,
- struct sockaddr *nam, struct proc *p)
-#else /* __NetBSD__ || __FreeBSD__ */
MAYBESTATIC MAYBEINLINE int rip6_usrreq_bind(struct socket *so,
struct sockaddr *nam)
-#endif /* __NetBSD__ || __FreeBSD__ */
{
register struct inpcb *inp = sotoinpcb(so);
register struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam;
/* 'ifnet' is declared in one of the net/ header files. */
-#if __NetBSD__ || __OpenBSD__ || __FreeBSD__
if ((ifnet.tqh_first == 0) ||
-#else /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ */
- if ((ifnet == 0) ||
-#endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ */
(addr->sin6_family != AF_INET6) || /* I only allow AF_INET6 */
(!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr) &&
ifa_ifwithaddr((struct sockaddr *)addr) == 0 ) )
@@ -882,13 +667,8 @@ MAYBESTATIC MAYBEINLINE int rip6_usrreq_bind(struct socket *so,
return 0;
}
-#if __NetBSD__ || __FreeBSD__
-MAYBESTATIC MAYBEINLINE int rip6_usrreq_connect(struct socket *so,
- struct sockaddr *nam, struct proc *p)
-#else /* __NetBSD__ || __FreeBSD__ */
MAYBESTATIC MAYBEINLINE int rip6_usrreq_connect(struct socket *so,
struct sockaddr *nam)
-#endif /* __NetBSD__ || __FreeBSD__ */
{
register struct inpcb *inp = sotoinpcb(so);
register struct sockaddr_in6 *addr = (struct sockaddr_in6 *) nam;
@@ -923,18 +703,8 @@ MAYBESTATIC MAYBEINLINE int rip6_usrreq_shutdown(struct socket *so)
static int rip6_usrreq_send __P((struct socket *so, int flags, struct mbuf *m,
struct sockaddr *addr, struct mbuf *control));
-#if __NetBSD__ || __FreeBSD__
-/*
- * Note that flags and p are not used, but required by protosw in
- * FreeBSD.
- */
-static int rip6_usrreq_send(struct socket *so, int flags, struct mbuf *m,
- struct sockaddr *addr, struct mbuf *control,
- struct proc *p)
-#else /* __NetBSD__ || __FreeBSD__ */
static int rip6_usrreq_send(struct socket *so, int flags, struct mbuf *m,
struct sockaddr *addr, struct mbuf *control)
-#endif /* __NetBSD__ || __FreeBSD__ */
{
register struct inpcb *inp = sotoinpcb(so);
register int error = 0;
@@ -973,21 +743,12 @@ static int rip6_usrreq_send(struct socket *so, int flags, struct mbuf *m,
return error;
}
-#if __NetBSD__ || __FreeBSD__
-MAYBESTATIC MAYBEINLINE int rip6_usrreq_control(struct socket *so, u_long cmd,
- caddr_t data, struct ifnet *ifp, struct proc *p)
-#else /* __NetBSD__ || __FreeBSD__ */
MAYBESTATIC MAYBEINLINE int rip6_usrreq_control(struct socket *so, int cmd,
caddr_t data, struct ifnet *ifp)
-#endif /* __NetBSD__ || __FreeBSD__ */
{
/* Notice that IPv4 raw sockets don't pass PRU_CONTROL. I wonder
if they panic as well? */
-#if __NetBSD__ || __FreeBSD__
- return in6_control(so, cmd, data, ifp, 0, p);
-#else /* __NetBSD__ || __FreeBSD__ */
return in6_control(so, cmd, data, ifp, 0);
-#endif /* __NetBSD__ || __FreeBSD__ */
}
MAYBESTATIC MAYBEINLINE int rip6_usrreq_sense(struct socket *so,
@@ -997,45 +758,23 @@ MAYBESTATIC MAYBEINLINE int rip6_usrreq_sense(struct socket *so,
return 0;
}
-#if __FreeBSD__
-MAYBESTATIC MAYBEINLINE int rip6_usrreq_sockaddr(struct socket *so,
- struct sockaddr **nam)
-#else /* __FreeBSD__ */
MAYBESTATIC MAYBEINLINE int rip6_usrreq_sockaddr(struct socket *so,
struct mbuf *nam)
-#endif /* __FreeBSD__ */
{
register struct inpcb *inp = sotoinpcb(so);
return in6_setsockaddr(inp, nam);
}
-#if __FreeBSD__
-MAYBESTATIC MAYBEINLINE int rip6_usrreq_peeraddr(struct socket *so,
- struct sockaddr **nam)
-#else /* __FreeBSD__ */
MAYBESTATIC MAYBEINLINE int rip6_usrreq_peeraddr(struct socket *so,
struct mbuf *nam)
-#endif /* __FreeBSD__ */
{
register struct inpcb *inp = sotoinpcb(so);
return in6_setpeeraddr(inp, nam);
}
-#if __FreeBSD__
-struct pr_usrreqs rip6_usrreqs = {
- rip6_usrreq_abort, pru_accept_notsupp, rip6_usrreq_attach,
- rip6_usrreq_bind, rip6_usrreq_connect, pru_connect2_notsupp,
- rip6_usrreq_control, rip6_usrreq_detach, rip6_usrreq_detach,
- pru_listen_notsupp, rip6_usrreq_peeraddr, pru_rcvd_notsupp,
- pru_rcvoob_notsupp, rip6_usrreq_send, rip6_usrreq_sense,
- rip6_usrreq_shutdown, rip6_usrreq_sockaddr, sosend, soreceive, sopoll
-};
-#endif /* __FreeBSD__ */
-
/*----------------------------------------------------------------------
* Handles PRU_* for raw IPv6 sockets.
----------------------------------------------------------------------*/
-#if !__FreeBSD__
int
rip6_usrreq(so, req, m, nam, control, p)
struct socket *so;
@@ -1045,8 +784,6 @@ rip6_usrreq(so, req, m, nam, control, p)
{
register int error = 0;
- DPRINTF(IDL_EVENT, ("rip6_usrreq(so, req, m, nam, control)\n"));
-
#ifdef MROUTING
/*
* Ummm, like, multicast routing stuff goes here, huh huh huh.
@@ -1060,11 +797,7 @@ rip6_usrreq(so, req, m, nam, control, p)
switch (req)
{
case PRU_ATTACH:
-#if __NetBSD__
- error = rip6_usrreq_attach(so, (long)nam, p);
-#else /* __NetBSD__ */
error = rip6_usrreq_attach(so, (long)nam);
-#endif /* __NetBSD__ */
break;
case PRU_DISCONNECT:
error = rip6_usrreq_disconnect(so);
@@ -1085,11 +818,7 @@ rip6_usrreq(so, req, m, nam, control, p)
/*
* Be strict regarding sockaddr_in6 fields.
*/
-#if __NetBSD__
- error = rip6_usrreq_bind(so, mtod(nam, struct sockaddr *), p);
-#else /* __NetBSD__ */
error = rip6_usrreq_bind(so, mtod(nam, struct sockaddr *));
-#endif /* __NetBSD__ */
break;
case PRU_CONNECT:
/*
@@ -1097,11 +826,7 @@ rip6_usrreq(so, req, m, nam, control, p)
*/
if (nam->m_len != sizeof(struct sockaddr_in6))
return EINVAL;
-#if __NetBSD__
- error = rip6_usrreq_connect(so, mtod(nam, struct sockaddr *), p);
-#else /* __NetBSD__ */
error = rip6_usrreq_connect(so, mtod(nam, struct sockaddr *));
-#endif /* __NetBSD__ */
break;
case PRU_SHUTDOWN:
error = rip6_usrreq_shutdown(so);
@@ -1112,21 +837,12 @@ rip6_usrreq(so, req, m, nam, control, p)
*/
if (nam->m_len != sizeof(struct sockaddr_in6))
return EINVAL;
-#if __NetBSD__
- error = rip6_usrreq_send(so, 0, m, mtod(nam, struct sockaddr *), control, p);
-#else /* __NetBSD__ */
error = rip6_usrreq_send(so, 0, m, mtod(nam, struct sockaddr *), control);
-#endif /* __NetBSD__ */
m = NULL;
break;
case PRU_CONTROL:
-#if __NetBSD__
- return rip6_usrreq_control(so, (u_long)m, (caddr_t) nam,
- (struct ifnet *) control, p);
-#else /* __NetBSD__ */
return rip6_usrreq_control(so, (int)m, (caddr_t) nam,
(struct ifnet *) control);
-#endif /* __NetBSD__ */
case PRU_SENSE:
return rip6_usrreq_sense(so, NULL); /* XXX */
case PRU_CONNECT2:
@@ -1150,4 +866,3 @@ rip6_usrreq(so, req, m, nam, control, p)
m_freem(m);
return error;
}
-#endif /* !__FreeBSD__ */
diff --git a/sys/netinet6/tcpipv6.h b/sys/netinet6/tcpipv6.h
index 27aec0a1864..37ab052e990 100644
--- a/sys/netinet6/tcpipv6.h
+++ b/sys/netinet6/tcpipv6.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: tcpipv6.h,v 1.4 1999/12/10 08:53:18 angelos Exp $ */
+
/*
%%% copyright-nrl-95
This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,