BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / netiso / clnp_subr.c
index 12865d7..e214817 100644 (file)
@@ -1,3 +1,38 @@
+/*-
+ * Copyright (c) 1991 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_subr.c 7.13 (Berkeley) 5/6/91
+ */
+
 /***********************************************************
                Copyright IBM Corporation 1987
 
 /***********************************************************
                Copyright IBM Corporation 1987
 
@@ -26,11 +61,6 @@ SOFTWARE.
  */
 /* $Header: /var/src/sys/netiso/RCS/clnp_subr.c,v 5.1 89/02/09 16:20:46 hagens Exp $ */
 /* $Source: /var/src/sys/netiso/RCS/clnp_subr.c,v $ */
  */
 /* $Header: /var/src/sys/netiso/RCS/clnp_subr.c,v 5.1 89/02/09 16:20:46 hagens Exp $ */
 /* $Source: /var/src/sys/netiso/RCS/clnp_subr.c,v $ */
-/*     @(#)clnp_subr.c 7.11 (Berkeley) %G% */
-
-#ifndef lint
-static char *rcsid = "$Header: /var/src/sys/netiso/RCS/clnp_subr.c,v 5.1 89/02/09 16:20:46 hagens Exp $";
-#endif lint
 
 #ifdef ISO
 
 
 #ifdef ISO
 
@@ -101,7 +131,7 @@ int                                         length; /* length (in bytes) of packet */
        return mhead;
 }
 
        return mhead;
 }
 
-#ifdef ndef
+#ifdef notdef
 /*
  * FUNCTION:           clnp_extract_addr
  *
 /*
  * FUNCTION:           clnp_extract_addr
  *
@@ -155,7 +185,7 @@ register struct iso_addr    *destp;         /* ptr to destination address buffer */
        else
                return (caddr_t) 0;
 }
        else
                return (caddr_t) 0;
 }
-#endif ndef
+#endif notdef
 
 /*
  * FUNCTION:           clnp_ours
 
 /*
  * FUNCTION:           clnp_ours
@@ -339,7 +369,7 @@ struct snpa_hdr             *inbound_shp;   /* subnetwork header of inbound packet */
        /*
         *      Dispatch the datagram if it is small enough, otherwise fragment
         */
        /*
         *      Dispatch the datagram if it is small enough, otherwise fragment
         */
-       if (len <= SN_MTU(ifp)) {
+       if (len <= SN_MTU(ifp, route.ro_rt)) {
                iso_gen_csum(m, CLNP_CKSUM_OFF, (int)clnp->cnf_hdr_len);
                (void) (*ifp->if_output)(ifp, m, next_hop, route.ro_rt);
        } else {
                iso_gen_csum(m, CLNP_CKSUM_OFF, (int)clnp->cnf_hdr_len);
                (void) (*ifp->if_output)(ifp, m, next_hop, route.ro_rt);
        } else {
@@ -355,7 +385,7 @@ done:
        }
 }
 
        }
 }
 
-#ifdef ndef
+#ifdef notdef
 /*
  * FUNCTION:           clnp_insert_addr
  *
 /*
  * FUNCTION:           clnp_insert_addr
  *
@@ -384,7 +414,7 @@ register struct iso_addr    *dstp;  /* ptr to dst addr */
        return bufp;
 }
 
        return bufp;
 }
 
-#endif ndef
+#endif notdef
 
 /*
  * FUNCTION:           clnp_route
 
 /*
  * FUNCTION:           clnp_route
@@ -547,6 +577,30 @@ struct iso_addr            *final_dst;             /* final destination */
        return error;
 }
 
        return error;
 }
 
+/*
+ * FUNCTION:           clnp_badmtu
+ *
+ * PURPOSE:                    print notice of route with mtu not initialized.
+ *
+ * RETURNS:                    mtu of ifp.
+ *
+ * SIDE EFFECTS:       prints notice, slows down system.
+ */
+clnp_badmtu(ifp, rt, line, file)
+struct ifnet *ifp;     /* outgoing interface */
+struct rtentry *rt; /* dst route */
+int line;                      /* where the dirty deed occured */
+char *file;                    /* where the dirty deed occured */
+{
+       printf("sending on route %x with no mtu, line %s of file %s\n",
+               rt, line, file);
+#ifdef ARGO_DEBUG
+       printf("route dst is");
+       dump_isoaddr(rt_key(rt));
+#endif
+       return ifp->if_mtu;
+}
+
 /*
  * FUNCTION:           clnp_ypocb - backwards bcopy
  *
 /*
  * FUNCTION:           clnp_ypocb - backwards bcopy
  *
@@ -566,29 +620,4 @@ u_int      len;            /* number of bytes */
        while (len--)
                *(to + len) = *(from + len);
 }
        while (len--)
                *(to + len) = *(from + len);
 }
-
-/*
- * FUNCTION:           clnp_hdrsize
- *
- * PURPOSE:                    Return the size of a typical clnp hdr.
- *
- * RETURNS:                    Size of hdr in bytes.
- *
- * SIDE EFFECTS:       
- *
- * NOTES:                      Assumes segmenting subset. If addrlen is
- *                                     zero, default to largest nsap address size.
- */
-clnp_hdrsize(addrlen)
-u_char addrlen;                /* length of nsap address */
-{
-       if (addrlen == 0)
-               addrlen = 20;
-       
-       addrlen++;                      /* length of address byte */
-       addrlen *= 2;           /* src and dst addresses */
-       addrlen += sizeof(struct clnp_fixed) + sizeof(struct clnp_segment);
-
-       return(addrlen);
-}
 #endif ISO
 #endif ISO