]> git.saurik.com Git - apple/network_cmds.git/blobdiff - netstat.tproj/mroute.c
network_cmds-307.1.1.tar.gz
[apple/network_cmds.git] / netstat.tproj / mroute.c
index 9e86ed6de7ea8e40a75fbccc202ad59813421fb8..ec1e2700a093b8b037a72f9102612dc32b53c29a 100644 (file)
@@ -3,20 +3,21 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
+ * Reserved.  This file contains Original Code and/or Modifications of
+ * Original Code as defined in and that are subject to the Apple Public
+ * Source License Version 1.0 (the 'License').  You may not use this file
+ * except in compliance with the License.  Please obtain a copy of the
+ * License at http://www.apple.com/publicsource and read it before using
+ * this file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
+ * License for the specific language governing rights and limitations
+ * under the License."
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
@@ -87,8 +88,8 @@ void
 mroutepr(void)
 {
        struct mfc **mfctable = 0;
 mroutepr(void)
 {
        struct mfc **mfctable = 0;
-       struct vif viftable[MAXVIFS];
-       struct mfc mfc, *m;
+       struct vif viftable[CONFIG_MAXVIFS];
+       struct mfc *m;
        register struct vif *v;
        register vifi_t vifi;
        register int i;
        register struct vif *v;
        register vifi_t vifi;
        register int i;
@@ -100,14 +101,14 @@ mroutepr(void)
        saved_nflag = nflag;
        nflag = 1;
 
        saved_nflag = nflag;
        nflag = 1;
 
-       len = MAXVIFS * sizeof(struct vif);
+       len = CONFIG_MAXVIFS * sizeof(struct vif);
        if (sysctlbyname("net.inet.ip.viftable", viftable, &len, 0, 0) == -1) {
                printf("No IPv4 multicast routing compiled into this system.\n");
                return;
        }
 
        banner_printed = 0;
        if (sysctlbyname("net.inet.ip.viftable", viftable, &len, 0, 0) == -1) {
                printf("No IPv4 multicast routing compiled into this system.\n");
                return;
        }
 
        banner_printed = 0;
-       for (vifi = 0, v = viftable; vifi < MAXVIFS; ++vifi, ++v) {
+       for (vifi = 0, v = viftable; vifi < CONFIG_MAXVIFS; ++vifi, ++v) {
                if (v->v_lcl_addr.s_addr == 0)
                        continue;
 
                if (v->v_lcl_addr.s_addr == 0)
                        continue;
 
@@ -143,7 +144,7 @@ mroutepr(void)
                return;
        }
        banner_printed = 0;
                return;
        }
        banner_printed = 0;
-       for (i = 0; i < MFCTBLSIZ; ++i) {
+       for (i = 0; i < CONFIG_MFCTBLSIZ; ++i) {
                m = mfctable[i];
                while(m) {
                        if (!banner_printed) {
                m = mfctable[i];
                while(m) {
                        if (!banner_printed) {
@@ -153,17 +154,17 @@ mroutepr(void)
                                banner_printed = 1;
                        }
 
                                banner_printed = 1;
                        }
 
-                       printf(" %-15.15s", routename(mfc.mfc_origin.s_addr));
-                       printf(" %-15.15s", routename(mfc.mfc_mcastgrp.s_addr));
-                       printf(" %9lu", mfc.mfc_pkt_cnt);
-                       printf("  %3d   ", mfc.mfc_parent);
+                       printf(" %-15.15s", routename(m->mfc_origin.s_addr));
+                       printf(" %-15.15s", routename(m->mfc_mcastgrp.s_addr));
+                       printf(" %9lu", m->mfc_pkt_cnt);
+                       printf("  %3d   ", m->mfc_parent);
                        for (vifi = 0; vifi <= maxvif; vifi++) {
                        for (vifi = 0; vifi <= maxvif; vifi++) {
-                               if (mfc.mfc_ttls[vifi] > 0)
+                               if (m->mfc_ttls[vifi] > 0)
                                        printf(" %u:%u", vifi, 
                                        printf(" %u:%u", vifi, 
-                                              mfc.mfc_ttls[vifi]);
+                                              m->mfc_ttls[vifi]);
                        }
                        printf("\n");
                        }
                        printf("\n");
-                       m = mfc.mfc_next;
+                       m = m->mfc_next;
                }
        }
        if (!banner_printed)
                }
        }
        if (!banner_printed)
@@ -188,30 +189,30 @@ mrt_stats()
        }
 
        printf("IPv4 multicast forwarding:\n");
        }
 
        printf("IPv4 multicast forwarding:\n");
-       printf(" %10lu multicast forwarding cache lookup%s\n",
+       printf(" %10u multicast forwarding cache lookup%s\n",
          mrtstat.mrts_mfc_lookups, plural(mrtstat.mrts_mfc_lookups));
          mrtstat.mrts_mfc_lookups, plural(mrtstat.mrts_mfc_lookups));
-       printf(" %10lu multicast forwarding cache miss%s\n",
+       printf(" %10u multicast forwarding cache miss%s\n",
          mrtstat.mrts_mfc_misses, plurales(mrtstat.mrts_mfc_misses));
          mrtstat.mrts_mfc_misses, plurales(mrtstat.mrts_mfc_misses));
-       printf(" %10lu upcall%s to mrouted\n",
+       printf(" %10u upcall%s to mrouted\n",
          mrtstat.mrts_upcalls, plural(mrtstat.mrts_upcalls));
          mrtstat.mrts_upcalls, plural(mrtstat.mrts_upcalls));
-       printf(" %10lu upcall queue overflow%s\n",
+       printf(" %10u upcall queue overflow%s\n",
          mrtstat.mrts_upq_ovflw, plural(mrtstat.mrts_upq_ovflw));
          mrtstat.mrts_upq_ovflw, plural(mrtstat.mrts_upq_ovflw));
-       printf(" %10lu upcall%s dropped due to full socket buffer\n",
+       printf(" %10u upcall%s dropped due to full socket buffer\n",
          mrtstat.mrts_upq_sockfull, plural(mrtstat.mrts_upq_sockfull));
          mrtstat.mrts_upq_sockfull, plural(mrtstat.mrts_upq_sockfull));
-       printf(" %10lu cache cleanup%s\n",
+       printf(" %10u cache cleanup%s\n",
          mrtstat.mrts_cache_cleanups, plural(mrtstat.mrts_cache_cleanups));
          mrtstat.mrts_cache_cleanups, plural(mrtstat.mrts_cache_cleanups));
-       printf(" %10lu datagram%s with no route for origin\n",
+       printf(" %10u datagram%s with no route for origin\n",
          mrtstat.mrts_no_route, plural(mrtstat.mrts_no_route));
          mrtstat.mrts_no_route, plural(mrtstat.mrts_no_route));
-       printf(" %10lu datagram%s arrived with bad tunneling\n",
+       printf(" %10u datagram%s arrived with bad tunneling\n",
          mrtstat.mrts_bad_tunnel, plural(mrtstat.mrts_bad_tunnel));
          mrtstat.mrts_bad_tunnel, plural(mrtstat.mrts_bad_tunnel));
-       printf(" %10lu datagram%s could not be tunneled\n",
+       printf(" %10u datagram%s could not be tunneled\n",
          mrtstat.mrts_cant_tunnel, plural(mrtstat.mrts_cant_tunnel));
          mrtstat.mrts_cant_tunnel, plural(mrtstat.mrts_cant_tunnel));
-       printf(" %10lu datagram%s arrived on wrong interface\n",
+       printf(" %10u datagram%s arrived on wrong interface\n",
          mrtstat.mrts_wrong_if, plural(mrtstat.mrts_wrong_if));
          mrtstat.mrts_wrong_if, plural(mrtstat.mrts_wrong_if));
-       printf(" %10lu datagram%s selectively dropped\n",
+       printf(" %10u datagram%s selectively dropped\n",
          mrtstat.mrts_drop_sel, plural(mrtstat.mrts_drop_sel));
          mrtstat.mrts_drop_sel, plural(mrtstat.mrts_drop_sel));
-       printf(" %10lu datagram%s dropped due to queue overflow\n",
+       printf(" %10u datagram%s dropped due to queue overflow\n",
          mrtstat.mrts_q_overflow, plural(mrtstat.mrts_q_overflow));
          mrtstat.mrts_q_overflow, plural(mrtstat.mrts_q_overflow));
-       printf(" %10lu datagram%s dropped for being too large\n",
+       printf(" %10u datagram%s dropped for being too large\n",
          mrtstat.mrts_pkt2large, plural(mrtstat.mrts_pkt2large));
 }
          mrtstat.mrts_pkt2large, plural(mrtstat.mrts_pkt2large));
 }