check in torek's changes for sparc and sklower's workarounds on ifa problems
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Fri, 31 Jan 1992 03:25:55 +0000 (19:25 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Fri, 31 Jan 1992 03:25:55 +0000 (19:25 -0800)
SCCS-vsn: sys/net/if.h 7.14
SCCS-vsn: sys/net/route.c 7.27

usr/src/sys/net/if.h
usr/src/sys/net/route.c

index c03bdc0..7c8f5dd 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)if.h        7.13 (Berkeley) %G%
+ *     @(#)if.h        7.14 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -16,7 +16,7 @@
  * received from its medium.
  *
  * Output occurs when the routine if_output is called, with three parameters:
  * received from its medium.
  *
  * Output occurs when the routine if_output is called, with three parameters:
- *     (*ifp->if_output)(ifp, m, dst)
+ *     (*ifp->if_output)(ifp, m, dst, rt)
  * Here m is the mbuf chain to be sent and dst is the destination address.
  * The output routine encapsulates the supplied datagram if necessary,
  * and then transmits it on its medium.
  * Here m is the mbuf chain to be sent and dst is the destination address.
  * The output routine encapsulates the supplied datagram if necessary,
  * and then transmits it on its medium.
@@ -61,13 +61,21 @@ struct ifnet {
                int     ifq_drops;
        } if_snd;                       /* output queue */
 /* procedure handles */
                int     ifq_drops;
        } if_snd;                       /* output queue */
 /* procedure handles */
-       int     (*if_init)();           /* init routine */
-       int     (*if_output)();         /* output routine (enqueue) */
-       int     (*if_start)();          /* initiate output routine */
-       int     (*if_done)();           /* output complete routine */
-       int     (*if_ioctl)();          /* ioctl routine */
-       int     (*if_reset)();          /* bus reset routine */
-       int     (*if_watchdog)();       /* timer routine */
+       int     (*if_init)              /* init routine */
+               __P((int));
+       int     (*if_output)            /* output routine (enqueue) */
+               __P((struct ifnet *, struct mbuf *, struct sockaddr *,
+                    struct rtentry *));
+       int     (*if_start)             /* initiate output routine */
+               __P((struct ifnet *));
+       int     (*if_done)              /* output complete routine */
+               __P((struct ifnet *));  /* (XXX not used; fake prototype) */
+       int     (*if_ioctl)             /* ioctl routine */
+               __P((struct ifnet *, int, caddr_t));
+       int     (*if_reset)             /* XXX; Unibus reset routine for vax */
+               __P((int, int));        /* new autoconfig will permit removal */
+       int     (*if_watchdog)          /* timer routine */
+               __P((int));
 /* generic interface statistics */
        int     if_ipackets;            /* packets received on interface */
        int     if_ierrors;             /* input errors on interface */
 /* generic interface statistics */
        int     if_ipackets;            /* packets received on interface */
        int     if_ierrors;             /* input errors on interface */
@@ -166,7 +174,7 @@ struct ifaddr {
        int     (*ifa_rtrequest)();     /* check or clean routes (+ or -)'d */
        struct  rtentry *ifa_rt;        /* ??? for ROUTETOIF */
        u_short ifa_flags;              /* mostly rt_flags for cloning */
        int     (*ifa_rtrequest)();     /* check or clean routes (+ or -)'d */
        struct  rtentry *ifa_rt;        /* ??? for ROUTETOIF */
        u_short ifa_flags;              /* mostly rt_flags for cloning */
-       u_short ifa_refcnt;             /* extra to malloc for link info */
+       short   ifa_refcnt;             /* extra to malloc for link info */
 };
 #define IFA_ROUTE      RTF_UP          /* route installed */
 /*
 };
 #define IFA_ROUTE      RTF_UP          /* route installed */
 /*
@@ -219,7 +227,7 @@ struct      ifconf {
 
 #ifdef KERNEL
 #define        IFAFREE(ifa) \
 
 #ifdef KERNEL
 #define        IFAFREE(ifa) \
-       if ((ifa)->ifa_refcnt <= 1) \
+       if ((ifa)->ifa_refcnt <= 0) \
                ifafree(ifa); \
        else \
                (ifa)->ifa_refcnt--;
                ifafree(ifa); \
        else \
                (ifa)->ifa_refcnt--;
@@ -231,6 +239,7 @@ struct      ifaddr  *ifa_ifwithaddr __P((struct sockaddr *)),
                *ifa_ifwithnet __P((struct sockaddr *)),
                *ifa_ifwithdstaddr __P((struct sockaddr *));
 void   ifafree __P((struct ifaddr *));
                *ifa_ifwithnet __P((struct sockaddr *)),
                *ifa_ifwithdstaddr __P((struct sockaddr *));
 void   ifafree __P((struct ifaddr *));
+void   if_attach __P((struct ifnet *));
 #else KERNEL
 #include <net/if_arp.h>
 #endif KERNEL
 #else KERNEL
 #include <net/if_arp.h>
 #endif KERNEL
index 76fa21a..689b39a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)route.c     7.26 (Berkeley) %G%
+ *     @(#)route.c     7.27 (Berkeley) %G%
  */
 #include "param.h"
 #include "systm.h"
  */
 #include "param.h"
 #include "systm.h"
@@ -27,8 +27,6 @@
 #ifdef NS
 #include "../netns/ns.h"
 #endif
 #ifdef NS
 #include "../netns/ns.h"
 #endif
-#include "machine/mtpr.h"
-#include "netisr.h"
 
 #define        SA(p) ((struct sockaddr *)(p))
 
 
 #define        SA(p) ((struct sockaddr *)(p))
 
@@ -111,16 +109,23 @@ rtfree(rt)
                IFAFREE(ifa);
        }
 }
                IFAFREE(ifa);
        }
 }
-
+int ifafree_verbose;
 void
 ifafree(ifa)
        register struct ifaddr *ifa;
 {
        if (ifa == 0)
                panic("ifafree");
 void
 ifafree(ifa)
        register struct ifaddr *ifa;
 {
        if (ifa == 0)
                panic("ifafree");
+       /* for now . . . . */
+       if (ifafree_verbose) {
+           if (ifa->ifa_refcnt < 0)
+                   printf("ifafree: would panic\n");
+           if (ifa->ifa_refcnt == 0)
+                   printf("ifafree((caddr_t)ifa, M_IFADDR)\n");
+           if (ifa->ifa_flags & IFA_ROUTE)
+                   printf("ifafree: has route \n");
+       }
        ifa->ifa_refcnt--;
        ifa->ifa_refcnt--;
-       if (ifa->ifa_refcnt <= 0 && (ifa->ifa_flags & IFA_ROUTE) == 0)
-               free((caddr_t)ifa, M_IFADDR);
 }
 
 /*
 }
 
 /*