expand parameters to functions; READDIR drops eofflag;
[unix-history] / usr / src / sys / netiso / esis.c
index e748cb8..9e5f6c1 100644 (file)
@@ -1,3 +1,12 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ *
+ *     @(#)esis.c      7.21 (Berkeley) %G%
+ */
+
 /***********************************************************
                Copyright IBM Corporation 1987
 
 /***********************************************************
                Copyright IBM Corporation 1987
 
@@ -24,10 +33,6 @@ SOFTWARE.
 /*
  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
  */
 /*
  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
  */
-/*     @(#)esis.c      7.15 (Berkeley) %G% */
-#ifndef lint
-static char *rcsid = "$Header: esis.c,v 4.10 88/09/15 18:57:03 hagens Exp $";
-#endif
 
 #ifdef ISO
 
 
 #ifdef ISO
 
@@ -37,11 +42,9 @@ static char *rcsid = "$Header: esis.c,v 4.10 88/09/15 18:57:03 hagens Exp $";
 #include "mbuf.h"
 #include "domain.h"
 #include "protosw.h"
 #include "mbuf.h"
 #include "domain.h"
 #include "protosw.h"
-#include "user.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "errno.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "errno.h"
-#include "kernel.h"
 
 #include "../net/if.h"
 #include "../net/if_dl.h"
 
 #include "../net/if.h"
 #include "../net/if_dl.h"
@@ -57,6 +60,7 @@ static char *rcsid = "$Header: esis.c,v 4.10 88/09/15 18:57:03 hagens Exp $";
 #include "clnp_stat.h"
 #include "esis.h"
 #include "argo_debug.h"
 #include "clnp_stat.h"
 #include "esis.h"
 #include "argo_debug.h"
+#include "kernel.h"
 
 /*
  *     Global variables to esis implementation
 
 /*
  *     Global variables to esis implementation
@@ -68,6 +72,7 @@ static char *rcsid = "$Header: esis.c,v 4.10 88/09/15 18:57:03 hagens Exp $";
  *
  */
 struct rawcb   esis_pcb;
  *
  */
 struct rawcb   esis_pcb;
+int                            esis_config(), snpac_age();
 int                            esis_sendspace = 2048;
 int                            esis_recvspace = 2048;
 short                  esis_holding_time = ESIS_HT;
 int                            esis_sendspace = 2048;
 int                            esis_recvspace = 2048;
 short                  esis_holding_time = ESIS_HT;
@@ -101,7 +106,6 @@ esis_init()
 {
        extern struct clnl_protosw clnl_protox[256];
        int     esis_input(), isis_input();
 {
        extern struct clnl_protosw clnl_protox[256];
        int     esis_input(), isis_input();
-       int     esis_config(), snpac_age();
 #ifdef ISO_X25ESIS
        int     x25esis_input();
 #endif ISO_X25ESIS
 #ifdef ISO_X25ESIS
        int     x25esis_input();
 #endif ISO_X25ESIS
@@ -140,7 +144,7 @@ struct mbuf         *control;       /* optional control */
        struct rawcb *rp = sotorawcb(so);
        int error = 0;
 
        struct rawcb *rp = sotorawcb(so);
        int error = 0;
 
-       if (suser(u.u_cred, &u.u_acflag)) {
+       if ((so->so_state & SS_PRIV) == 0) {
                error = EACCES;
                goto release;
        }
                error = EACCES;
                goto release;
        }
@@ -413,7 +417,7 @@ struct rtentry              *rt;                    /* snpa cache info regarding next hop of
        siso.siso_nlen = 6 + 1; /* should be taken from snpa_hdr */
                                                                                /* +1 is for AFI */
        bcopy(inbound_shp->snh_shost, siso.siso_data + 1, 6);
        siso.siso_nlen = 6 + 1; /* should be taken from snpa_hdr */
                                                                                /* +1 is for AFI */
        bcopy(inbound_shp->snh_shost, siso.siso_data + 1, 6);
-       (ifp->if_output)(ifp, m0, &siso, 0);
+       (ifp->if_output)(ifp, m0, (struct sockaddr *)&siso, 0);
 }
 
 /*
 }
 
 /*
@@ -722,13 +726,18 @@ esis_config()
        /* 
         *      Report configuration for each interface that 
         *      - is UP
        /* 
         *      Report configuration for each interface that 
         *      - is UP
-        *      - is not loopback
+        *      - has BROADCAST capability
         *      - has an ISO address
         */
         *      - has an ISO address
         */
+       /* Todo: a better way would be to construct the esh or ish
+        * once and copy it out for all devices, possibly calling
+        * a method in the iso_ifaddr structure to encapsulate and
+        * transmit it.  This could work to advantage for non-broadcast media
+        */
        
        for (ifp = ifnet; ifp; ifp = ifp->if_next) {
                if ((ifp->if_flags & IFF_UP) &&
        
        for (ifp = ifnet; ifp; ifp = ifp->if_next) {
                if ((ifp->if_flags & IFF_UP) &&
-                       ((ifp->if_flags & IFF_LOOPBACK) == 0)) {
+                   (ifp->if_flags & IFF_BROADCAST)) {
                        /* search for an ISO address family */
                        struct ifaddr   *ia;
 
                        /* search for an ISO address family */
                        struct ifaddr   *ia;
 
@@ -885,7 +894,7 @@ struct      iso_addr *isoa;
        siso.siso_data[0] = AFI_SNA;
        siso.siso_nlen = sn_len + 1;
        bcopy(sn_addr, siso.siso_data + 1, (unsigned)sn_len);
        siso.siso_data[0] = AFI_SNA;
        siso.siso_nlen = sn_len + 1;
        bcopy(sn_addr, siso.siso_data + 1, (unsigned)sn_len);
-       (ifp->if_output)(ifp, m0, &siso, 0);
+       (ifp->if_output)(ifp, m0, (struct sockaddr *)&siso, 0);
 }
 
 /*
 }
 
 /*
@@ -931,9 +940,9 @@ struct snpa_hdr     *shp;   /* subnetwork header */
                }
                if (mm = m_copy(m0, 0, M_COPYALL)) { /*can't block at interrupt level */
                        if (sbappendaddr(&rp->rcb_socket->so_rcv,
                }
                if (mm = m_copy(m0, 0, M_COPYALL)) { /*can't block at interrupt level */
                        if (sbappendaddr(&rp->rcb_socket->so_rcv,
-                                                         &esis_dl, mm, (struct mbuf *)0) != 0)
+                                                         &esis_dl, mm, (struct mbuf *)0) != 0) {
                                sorwakeup(rp->rcb_socket);
                                sorwakeup(rp->rcb_socket);
-                       else {
+                        } else {
                                IFDEBUG(D_ISISINPUT)
                                        printf("Error in sbappenaddr, mm = 0x%x\n", mm);
                                ENDDEBUG
                                IFDEBUG(D_ISISINPUT)
                                        printf("Error in sbappenaddr, mm = 0x%x\n", mm);
                                ENDDEBUG
@@ -959,7 +968,7 @@ struct mbuf *m;
        int error = 0;
        unsigned sn_len;
 
        int error = 0;
        unsigned sn_len;
 
-       ifa = ifa_ifwithnet(sdl);       /* extract ifp from sockaddr_dl */
+       ifa = ifa_ifwithnet((struct sockaddr *)sdl);    /* get ifp from sdl */
        if (ifa == 0) {
                IFDEBUG(D_ISISOUTPUT)
                        printf("isis_output: interface not found\n");
        if (ifa == 0) {
                IFDEBUG(D_ISISOUTPUT)
                        printf("isis_output: interface not found\n");
@@ -968,7 +977,7 @@ struct mbuf *m;
                goto release;
        }
        ifp = ifa->ifa_ifp;
                goto release;
        }
        ifp = ifa->ifa_ifp;
-       sn_len = ifp->if_addrlen;
+       sn_len = sdl->sdl_alen;
        IFDEBUG(D_ISISOUTPUT)
                u_char *cp = (u_char *)LLADDR(sdl), *cplim = cp + sn_len;
                printf("isis_output: ifp 0x%x (%s%d), to: ",
        IFDEBUG(D_ISISOUTPUT)
                u_char *cp = (u_char *)LLADDR(sdl), *cplim = cp + sn_len;
                printf("isis_output: ifp 0x%x (%s%d), to: ",