BSD 4_4 release
[unix-history] / usr / src / sys / netiso / clnp_frag.c
index 35e862e..546a592 100644 (file)
@@ -1,3 +1,38 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ *     @(#)clnp_frag.c 8.1 (Berkeley) 6/10/93
+ */
+
 /***********************************************************
                Copyright IBM Corporation 1987
 
 /***********************************************************
                Copyright IBM Corporation 1987
 
@@ -26,28 +61,24 @@ SOFTWARE.
  */
 /* $Header: /var/src/sys/netiso/RCS/clnp_frag.c,v 5.1 89/02/09 16:20:26 hagens Exp $ */
 /* $Source: /var/src/sys/netiso/RCS/clnp_frag.c,v $ */
  */
 /* $Header: /var/src/sys/netiso/RCS/clnp_frag.c,v 5.1 89/02/09 16:20:26 hagens Exp $ */
 /* $Source: /var/src/sys/netiso/RCS/clnp_frag.c,v $ */
-/*     @(#)clnp_frag.c 7.10 (Berkeley) %G% */
-
-#ifndef lint
-static char *rcsid = "$Header: /var/src/sys/netiso/RCS/clnp_frag.c,v 5.1 89/02/09 16:20:26 hagens Exp $";
-#endif lint
 
 
-#include "param.h"
-#include "mbuf.h"
-#include "domain.h"
-#include "protosw.h"
-#include "socket.h"
-#include "socketvar.h"
-#include "errno.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/domain.h>
+#include <sys/protosw.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/errno.h>
 
 
-#include "../net/if.h"
-#include "../net/route.h"
+#include <net/if.h>
+#include <net/route.h>
 
 
-#include "iso.h"
-#include "iso_var.h"
-#include "clnp.h"
-#include "clnp_stat.h"
-#include "argo_debug.h"
+#include <netiso/iso.h>
+#include <netiso/iso_var.h>
+#include <netiso/clnp.h>
+#include <netiso/clnp_stat.h>
+#include <netiso/argo_debug.h>
 
 /* all fragments are hung off this list */
 struct clnp_fragl      *clnp_frags = NULL;
 
 /* all fragments are hung off this list */
 struct clnp_fragl      *clnp_frags = NULL;
@@ -85,7 +116,7 @@ struct rtentry *rt;                  /* route if direct ether */
 {
        struct clnp_fixed               *clnp = mtod(m, struct clnp_fixed *);
        int                                             hdr_len = (int)clnp->cnf_hdr_len;
 {
        struct clnp_fixed               *clnp = mtod(m, struct clnp_fixed *);
        int                                             hdr_len = (int)clnp->cnf_hdr_len;
-       int                                             frag_size = (ifp->if_mtu - hdr_len) & ~7;
+       int                                             frag_size = (SN_MTU(ifp, rt) - hdr_len) & ~7;
 
        total_len -= hdr_len;
        if ((clnp->cnf_type & CNF_SEG_OK) &&
 
        total_len -= hdr_len;
        if ((clnp->cnf_type & CNF_SEG_OK) &&
@@ -213,7 +244,7 @@ struct rtentry *rt;                 /* route if direct ether */
                        error = troll_output(ifp, frag_hdr, first_hop, rt);
 #else
                        error = (*ifp->if_output)(ifp, frag_hdr, first_hop, rt);
                        error = troll_output(ifp, frag_hdr, first_hop, rt);
 #else
                        error = (*ifp->if_output)(ifp, frag_hdr, first_hop, rt);
-#endif TROLL
+#endif /* TROLL */
 
                        /*
                         *      Tough situation: if the error occured on the last 
 
                        /*
                         *      Tough situation: if the error occured on the last 
@@ -252,7 +283,7 @@ struct rtentry *rt;                 /* route if direct ether */
                                        num_bytes *= troll_random();
                                frag_size -= num_bytes;
                        }
                                        num_bytes *= troll_random();
                                frag_size -= num_bytes;
                        }
-#endif TROLL
+#endif /* TROLL */
                        total_len -= frag_size;
                        if (!last_frag) {
                                frag_base += frag_size;
                        total_len -= frag_size;
                        if (!last_frag) {
                                frag_base += frag_size;
@@ -752,7 +783,7 @@ struct clnp_fragl   *cfh;           /* fragment header */
 }
 #ifdef TROLL
 static int troll_cnt;
 }
 #ifdef TROLL
 static int troll_cnt;
-#include "time.h"
+#include <sys/time.h>
 /*
  * FUNCTION:           troll_random
  *
 /*
  * FUNCTION:           troll_random
  *
@@ -825,4 +856,4 @@ struct rtentry *rt;
        }
 }
 
        }
 }
 
-#endif TROLL
+#endif /* TROLL */