Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ifmcstat Remove !NetBSD code.



details:   https://anonhg.NetBSD.org/src/rev/399de9b0ef42
branches:  trunk
changeset: 329588:399de9b0ef42
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri May 30 02:28:07 2014 +0000

description:
Remove !NetBSD code.

diffstat:

 usr.sbin/ifmcstat/ifmcstat.c |  134 +------------------------------------------
 1 files changed, 2 insertions(+), 132 deletions(-)

diffs (263 lines):

diff -r 047a955f39c4 -r 399de9b0ef42 usr.sbin/ifmcstat/ifmcstat.c
--- a/usr.sbin/ifmcstat/ifmcstat.c      Fri May 30 02:27:29 2014 +0000
+++ b/usr.sbin/ifmcstat/ifmcstat.c      Fri May 30 02:28:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifmcstat.c,v 1.13 2014/05/30 01:44:21 rmind Exp $      */
+/*     $NetBSD: ifmcstat.c,v 1.14 2014/05/30 02:28:07 joerg Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -40,23 +40,10 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <net/if.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-# include <net/if_var.h>
-#endif
 #include <net/if_types.h>
 #include <net/if_dl.h>
 #include <netinet/in.h>
-#ifndef __NetBSD__
-# ifdef        __FreeBSD__
-#  define      KERNEL
-# endif
-# include <netinet/if_ether.h>
-# ifdef        __FreeBSD__
-#  undef       KERNEL
-# endif
-#else
-# include <net/if_ether.h>
-#endif
+#include <net/if_ether.h>
 #include <netinet/in_var.h>
 #include <arpa/inet.h>
 
@@ -67,10 +54,8 @@
 struct nlist nl[] = {
 #define        N_IFNET_LIST    0
        { "_ifnet_list", 0, 0, 0, 0 },
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
 #define N_IN6_MK 1
        { "_in6_mk", 0, 0, 0, 0 },
-#endif
        { "", 0, 0, 0, 0 },
 };
 
@@ -78,32 +63,19 @@
 int main __P((void));
 char *ifname __P((struct ifnet *));
 void kread __P((u_long, void *, int));
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
 void acmc __P((struct ether_multi *));
-#endif
 void if6_addrlist __P((struct ifaddr *));
 void in6_multilist __P((struct in6_multi *));
 struct in6_multi * in6_multientry __P((struct in6_multi *));
 
-#if !defined(__NetBSD__) && !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__)
-#ifdef __bsdi__
-struct ether_addr {
-       u_int8_t ether_addr_octet[6];
-};
-#endif
-static char *ether_ntoa __P((struct ether_addr *));
-#endif
-
 #define        KREAD(addr, buf, type) \
        kread((u_long)addr, (void *)buf, sizeof(type))
 
-#ifdef N_IN6_MK
 struct multi6_kludge {
        LIST_ENTRY(multi6_kludge) mk_entry;
        struct ifnet *mk_ifp;
        struct in6_multihead mk_head;
 };
-#endif
 
 const char *inet6_n2a(p)
        struct in6_addr *p;
@@ -129,9 +101,6 @@
 {
        char    buf[_POSIX2_LINE_MAX], ifnam[IFNAMSIZ];
        struct  ifnet   *ifp, *nifp, ifnet;
-#ifndef __NetBSD__
-       struct  arpcom  arpcom;
-#else
        struct ethercom ec;
        union {
                struct sockaddr_storage st;
@@ -139,7 +108,6 @@
        } su;
        struct sockaddr_dl *sdlp;
        sdlp = &su.sdl;
-#endif
 
        if ((kvmd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, buf)) == NULL) {
                perror("kvm_openfiles");
@@ -158,18 +126,9 @@
                KREAD(ifp, &ifnet, struct ifnet);
                printf("%s:\n", if_indextoname(ifnet.if_index, ifnam));
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
                if6_addrlist(ifnet.if_addrlist.tqh_first);
                nifp = ifnet.if_list.tqe_next;
-#elif defined(__FreeBSD__) && __FreeBSD__ >= 3
-               if6_addrlist(TAILQ_FIRST(&ifnet.if_addrhead));
-               nifp = ifnet.if_link.tqe_next;
-#else
-               if6_addrlist(ifnet.if_addrlist);
-               nifp = ifnet.if_next;
-#endif
 
-#ifdef __NetBSD__
                KREAD(ifnet.if_sadl, sdlp, struct sockaddr_dl);
                if (sdlp->sdl_type == IFT_ETHER) {
                        /* If we didn't get all of it, try again */
@@ -182,23 +141,6 @@
                        acmc(ec.ec_multiaddrs.lh_first);
                        printf("\n");
                }
-#elif defined(__FreeBSD__) && __FreeBSD__ >= 3
-               /* not supported */
-#else
-               if (ifnet.if_type == IFT_ETHER) {
-                       KREAD(ifp, &arpcom, struct arpcom);
-                       printf("\tenaddr %s",
-                           ether_ntoa((struct ether_addr *)arpcom.ac_enaddr));
-                       KREAD(ifp, &arpcom, struct arpcom);
-                       printf(" multicnt %d", arpcom.ac_multicnt);
-#ifdef __OpenBSD__
-                       acmc(arpcom.ac_multiaddrs.lh_first);
-#else
-                       acmc(arpcom.ac_multiaddrs);
-#endif
-                       printf("\n");
-               }
-#endif
 
                ifp = nifp;
        }
@@ -211,16 +153,10 @@
        struct ifnet *ifp;
 {
        static char buf[BUFSIZ];
-#if defined(__NetBSD__) || defined(__OpenBSD__)
        struct ifnet ifnet;
-#endif
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
        KREAD(ifp, &ifnet, struct ifnet);
        strncpy(buf, ifnet.if_xname, BUFSIZ);
-#else
-       KREAD(ifp->if_name, buf, IFNAMSIZ);
-#endif
        return buf;
 }
 
@@ -235,7 +171,6 @@
        }
 }
 
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
 void acmc(am)
        struct ether_multi *am;
 {
@@ -248,14 +183,9 @@
                printf("%s -- ", ether_ntoa((struct ether_addr *)em.enm_addrlo));
                printf("%s ", ether_ntoa((struct ether_addr *)&em.enm_addrhi));
                printf("%d", em.enm_refcount);
-#if !defined(__NetBSD__) && !defined(__OpenBSD__)
-               am = em.enm_next;
-#else
                am = em.enm_list.le_next;
-#endif
        }
 }
-#endif
 
 void
 if6_addrlist(ifap)
@@ -277,55 +207,12 @@
                        goto nextifap;
                KREAD(ifap, &if6a, struct in6_ifaddr);
                printf("\tinet6 %s\n", inet6_n2a(&if6a.ia_addr.sin6_addr));
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
                mc = mc ? mc : if6a.ia6_multiaddrs.lh_first;
-#endif
        nextifap:
-#if defined(__NetBSD__) || defined(__OpenBSD__)
                ifap = ifa.ifa_list.tqe_next;
-#elif defined(__FreeBSD__) && __FreeBSD__ >= 3
-               ifap = ifa.ifa_link.tqe_next;
-#else
-               ifap = ifa.ifa_next;
-#endif /* __FreeBSD__ >= 3 */
        }
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-       if (ifap0) {
-               struct ifnet ifnet;
-               struct ifmultiaddr ifm, *ifmp = 0;
-               struct sockaddr_in6 sin6;
-               struct in6_multi in6m;
-               struct sockaddr_dl sdl;
-               int in6_multilist_done = 0;
-
-               KREAD(ifap0, &ifa, struct ifaddr);
-               KREAD(ifa.ifa_ifp, &ifnet, struct ifnet);
-               if (ifnet.if_multiaddrs.lh_first)
-                       ifmp = ifnet.if_multiaddrs.lh_first;
-               while (ifmp) {
-                       KREAD(ifmp, &ifm, struct ifmultiaddr);
-                       if (ifm.ifma_addr == NULL)
-                               goto nextmulti;
-                       KREAD(ifm.ifma_addr, &sa, struct sockaddr);
-                       if (sa.sa_family != AF_INET6)
-                               goto nextmulti;
-                       (void)in6_multientry((struct in6_multi *)
-                                            ifm.ifma_protospec);
-                       if (ifm.ifma_lladdr == 0)
-                               goto nextmulti;
-                       KREAD(ifm.ifma_lladdr, &sdl, struct sockaddr_dl);
-                       printf("\t\t\tmcast-macaddr %s multicnt %d\n",
-                              ether_ntoa((struct ether_addr *)LLADDR(&sdl)),
-                              ifm.ifma_refcount);
-                   nextmulti:
-                       ifmp = ifm.ifma_link.le_next;
-               }
-       }
-#else
        if (mc)
                in6_multilist(mc);
-#endif
-#ifdef N_IN6_MK
        if (nl[N_IN6_MK].n_value != 0) {
                LIST_HEAD(in6_mktype, multi6_kludge) in6_mk;
                struct multi6_kludge *mkp, mk;
@@ -347,7 +234,6 @@
 
                free(nam);
        }
-#endif
 }
 
 struct in6_multi *
@@ -369,19 +255,3 @@
        while (mc)
                mc = in6_multientry(mc);
 }
-
-#if !defined(__NetBSD__) && !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__)
-static char *
-ether_ntoa(e)
-       struct ether_addr *e;
-{
-       static char buf[20];
-       u_char *p;
-
-       p = (u_char *)e;
-
-       snprintf(buf, sizeof(buf), "%02x:%02x:%02x:%02x:%02x:%02x",
-               p[0], p[1], p[2], p[3], p[4], p[5]);
-       return buf;
-}
-#endif



Home | Main Index | Thread Index | Old Index