fix bug that can cause recursive .forward files to fail
[unix-history] / usr / src / sys / netinet / in_proto.c
index e00aff7..820e1f6 100644 (file)
@@ -1,60 +1,67 @@
 /*
 /*
- * Copyright (c) 1982 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1982, 1986, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- *     @(#)in_proto.c  6.12 (Berkeley) %G%
+ * %sccs.include.redist.c%
+ *
+ *     @(#)in_proto.c  8.1 (Berkeley) %G%
  */
 
  */
 
-#include "param.h"
-#include "socket.h"
-#include "protosw.h"
-#include "domain.h"
-#include "mbuf.h"
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/protosw.h>
+#include <sys/domain.h>
+#include <sys/mbuf.h>
 
 
-#include "in.h"
-#include "in_systm.h"
+#include <net/if.h>
+#include <net/radix.h>
+#include <net/route.h>
 
 
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_var.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/in_pcb.h>
+#include <netinet/igmp_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcp_fsm.h>
+#include <netinet/tcp_seq.h>
+#include <netinet/tcp_timer.h>
+#include <netinet/tcp_var.h>
+#include <netinet/tcpip.h>
+#include <netinet/tcp_debug.h>
+#include <netinet/udp.h>
+#include <netinet/udp_var.h>
 /*
  * TCP/IP protocol family: IP, ICMP, UDP, TCP.
  */
 /*
  * TCP/IP protocol family: IP, ICMP, UDP, TCP.
  */
-int    ip_output(),ip_ctloutput();
-int    ip_init(),ip_slowtimo(),ip_drain();
-int    icmp_input();
-int    udp_input(),udp_ctlinput();
-int    udp_usrreq();
-int    udp_init();
-int    tcp_input(),tcp_ctlinput();
-int    tcp_usrreq(),tcp_ctloutput();
-int    tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain();
-int    rip_input(),rip_output();
-extern int raw_usrreq();
-/*
- * IMP protocol family: raw interface.
- * Using the raw interface entry to get the timer routine
- * in is a kludge.
- */
-#include "imp.h"
-#if NIMP > 0
-int    rimp_output(), hostslowtimo();
-#endif
 
 #ifdef NSIP
 
 #ifdef NSIP
-int    idpip_input(), nsip_ctlinput();
+void   idpip_input(), nsip_ctlinput();
 #endif
 
 #endif
 
+#ifdef TPIP
+void   tpip_input(), tpip_ctlinput(), tp_ctloutput();
+int    tp_init(), tp_slowtimo(), tp_drain(), tp_usrreq();
+#endif
+
+#ifdef EON
+void   eoninput(), eonctlinput(), eonprotoinit();
+#endif /* EON */
+
 extern struct domain inetdomain;
 
 struct protosw inetsw[] = {
 { 0,           &inetdomain,    0,              0,
   0,           ip_output,      0,              0,
   0,
 extern struct domain inetdomain;
 
 struct protosw inetsw[] = {
 { 0,           &inetdomain,    0,              0,
   0,           ip_output,      0,              0,
   0,
-  ip_init,     0,              ip_slowtimo,    ip_drain,
+  ip_init,     0,              ip_slowtimo,    ip_drain,       ip_sysctl
 },
 { SOCK_DGRAM,  &inetdomain,    IPPROTO_UDP,    PR_ATOMIC|PR_ADDR,
   udp_input,   0,              udp_ctlinput,   ip_ctloutput,
   udp_usrreq,
 },
 { SOCK_DGRAM,  &inetdomain,    IPPROTO_UDP,    PR_ATOMIC|PR_ADDR,
   udp_input,   0,              udp_ctlinput,   ip_ctloutput,
   udp_usrreq,
-  udp_init,    0,              0,              0,
+  udp_init,    0,              0,              0,              udp_sysctl
 },
 { SOCK_STREAM, &inetdomain,    IPPROTO_TCP,    PR_CONNREQUIRED|PR_WANTRCVD,
   tcp_input,   0,              tcp_ctlinput,   tcp_ctloutput,
 },
 { SOCK_STREAM, &inetdomain,    IPPROTO_TCP,    PR_CONNREQUIRED|PR_WANTRCVD,
   tcp_input,   0,              tcp_ctlinput,   tcp_ctloutput,
@@ -62,41 +69,64 @@ struct protosw inetsw[] = {
   tcp_init,    tcp_fasttimo,   tcp_slowtimo,   tcp_drain,
 },
 { SOCK_RAW,    &inetdomain,    IPPROTO_RAW,    PR_ATOMIC|PR_ADDR,
   tcp_init,    tcp_fasttimo,   tcp_slowtimo,   tcp_drain,
 },
 { SOCK_RAW,    &inetdomain,    IPPROTO_RAW,    PR_ATOMIC|PR_ADDR,
-  rip_input,   rip_output,     0,              0,
-  raw_usrreq,
+  rip_input,   rip_output,     0,              rip_ctloutput,
+  rip_usrreq,
   0,           0,              0,              0,
 },
 { SOCK_RAW,    &inetdomain,    IPPROTO_ICMP,   PR_ATOMIC|PR_ADDR,
   0,           0,              0,              0,
 },
 { SOCK_RAW,    &inetdomain,    IPPROTO_ICMP,   PR_ATOMIC|PR_ADDR,
-  icmp_input,  rip_output,     0,              0,
-  raw_usrreq,
-  0,           0,              0,              0,
+  icmp_input,  rip_output,     0,              rip_ctloutput,
+  rip_usrreq,
+  0,           0,              0,              0,              icmp_sysctl
+},
+{ SOCK_RAW,    &inetdomain,    IPPROTO_IGMP,   PR_ATOMIC|PR_ADDR,
+  igmp_input,  rip_output,     0,              rip_ctloutput,
+  rip_usrreq,
+  igmp_init,   igmp_fasttimo,  0,              0,
+},
+#ifdef TPIP
+{ SOCK_SEQPACKET,&inetdomain,  IPPROTO_TP,     PR_CONNREQUIRED|PR_WANTRCVD,
+  tpip_input,  0,              tpip_ctlinput,  tp_ctloutput,
+  tp_usrreq,
+  tp_init,     0,              tp_slowtimo,    tp_drain,
+},
+#endif
+/* EON (ISO CLNL over IP) */
+#ifdef EON
+{ SOCK_RAW,    &inetdomain,    IPPROTO_EON,    0,
+  eoninput,    0,              eonctlinput,            0,
+  0,
+  eonprotoinit,        0,              0,              0,
 },
 },
+#endif
 #ifdef NSIP
 { SOCK_RAW,    &inetdomain,    IPPROTO_IDP,    PR_ATOMIC|PR_ADDR,
   idpip_input, rip_output,     nsip_ctlinput,  0,
 #ifdef NSIP
 { SOCK_RAW,    &inetdomain,    IPPROTO_IDP,    PR_ATOMIC|PR_ADDR,
   idpip_input, rip_output,     nsip_ctlinput,  0,
-  raw_usrreq,
+  rip_usrreq,
   0,           0,              0,              0,
 },
 #endif
        /* raw wildcard */
 { SOCK_RAW,    &inetdomain,    0,              PR_ATOMIC|PR_ADDR,
   0,           0,              0,              0,
 },
 #endif
        /* raw wildcard */
 { SOCK_RAW,    &inetdomain,    0,              PR_ATOMIC|PR_ADDR,
-  rip_input,   rip_output,     0,              0,
-  raw_usrreq,
-  0,           0,              0,              0,
+  rip_input,   rip_output,     0,              rip_ctloutput,
+  rip_usrreq,
+  rip_init,    0,              0,              0,
 },
 };
 
 struct domain inetdomain =
     { AF_INET, "internet", 0, 0, 0, 
 },
 };
 
 struct domain inetdomain =
     { AF_INET, "internet", 0, 0, 0, 
-      inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])] };
+      inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,
+      rn_inithead, 32, sizeof(struct sockaddr_in) };
 
 
+#include "imp.h"
 #if NIMP > 0
 extern struct domain impdomain;
 #if NIMP > 0
 extern struct domain impdomain;
+int    rimp_output(), hostslowtimo();
 
 struct protosw impsw[] = {
 { SOCK_RAW,    &impdomain,     0,              PR_ATOMIC|PR_ADDR,
   0,           rimp_output,    0,              0,
 
 struct protosw impsw[] = {
 { SOCK_RAW,    &impdomain,     0,              PR_ATOMIC|PR_ADDR,
   0,           rimp_output,    0,              0,
-  raw_usrreq,
+  rip_usrreq,
   0,           0,              hostslowtimo,   0,
 },
 };
   0,           0,              hostslowtimo,   0,
 },
 };
@@ -117,11 +147,11 @@ extern    struct domain hydomain;
 struct protosw hysw[] = {
 { SOCK_RAW,    &hydomain,      0,              PR_ATOMIC|PR_ADDR,
   0,           rhy_output,     0,              0,
 struct protosw hysw[] = {
 { SOCK_RAW,    &hydomain,      0,              PR_ATOMIC|PR_ADDR,
   0,           rhy_output,     0,              0,
-  raw_usrreq,
+  rip_usrreq,
   0,           0,              0,              0,
 },
 };
 
 struct domain hydomain =
   0,           0,              0,              0,
 },
 };
 
 struct domain hydomain =
-    { AF_HYLINK, "hy", hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] };
+    { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] };
 #endif
 #endif