Print this page
7127  remove -Wno-missing-braces from Makefile.uts


13976 
13977         kstat_install(ksp);
13978         return (ksp);
13979 }
13980 
13981 static void
13982 ip_kstat2_fini(netstackid_t stackid, kstat_t *ksp)
13983 {
13984         if (ksp != NULL) {
13985                 ASSERT(stackid == (netstackid_t)(uintptr_t)ksp->ks_private);
13986                 kstat_delete_netstack(ksp, stackid);
13987         }
13988 }
13989 
13990 static void *
13991 ip_kstat_init(netstackid_t stackid, ip_stack_t *ipst)
13992 {
13993         kstat_t *ksp;
13994 
13995         ip_named_kstat_t template = {
13996                 { "forwarding",         KSTAT_DATA_UINT32, 0 },
13997                 { "defaultTTL",         KSTAT_DATA_UINT32, 0 },
13998                 { "inReceives",         KSTAT_DATA_UINT64, 0 },
13999                 { "inHdrErrors",        KSTAT_DATA_UINT32, 0 },
14000                 { "inAddrErrors",       KSTAT_DATA_UINT32, 0 },
14001                 { "forwDatagrams",      KSTAT_DATA_UINT64, 0 },
14002                 { "inUnknownProtos",    KSTAT_DATA_UINT32, 0 },
14003                 { "inDiscards",         KSTAT_DATA_UINT32, 0 },
14004                 { "inDelivers",         KSTAT_DATA_UINT64, 0 },
14005                 { "outRequests",        KSTAT_DATA_UINT64, 0 },
14006                 { "outDiscards",        KSTAT_DATA_UINT32, 0 },
14007                 { "outNoRoutes",        KSTAT_DATA_UINT32, 0 },
14008                 { "reasmTimeout",       KSTAT_DATA_UINT32, 0 },
14009                 { "reasmReqds",         KSTAT_DATA_UINT32, 0 },
14010                 { "reasmOKs",           KSTAT_DATA_UINT32, 0 },
14011                 { "reasmFails",         KSTAT_DATA_UINT32, 0 },
14012                 { "fragOKs",            KSTAT_DATA_UINT32, 0 },
14013                 { "fragFails",          KSTAT_DATA_UINT32, 0 },
14014                 { "fragCreates",        KSTAT_DATA_UINT32, 0 },
14015                 { "addrEntrySize",      KSTAT_DATA_INT32, 0 },
14016                 { "routeEntrySize",     KSTAT_DATA_INT32, 0 },
14017                 { "netToMediaEntrySize",        KSTAT_DATA_INT32, 0 },
14018                 { "routingDiscards",    KSTAT_DATA_UINT32, 0 },
14019                 { "inErrs",             KSTAT_DATA_UINT32, 0 },
14020                 { "noPorts",            KSTAT_DATA_UINT32, 0 },
14021                 { "inCksumErrs",        KSTAT_DATA_UINT32, 0 },
14022                 { "reasmDuplicates",    KSTAT_DATA_UINT32, 0 },
14023                 { "reasmPartDups",      KSTAT_DATA_UINT32, 0 },
14024                 { "forwProhibits",      KSTAT_DATA_UINT32, 0 },
14025                 { "udpInCksumErrs",     KSTAT_DATA_UINT32, 0 },
14026                 { "udpInOverflows",     KSTAT_DATA_UINT32, 0 },
14027                 { "rawipInOverflows",   KSTAT_DATA_UINT32, 0 },
14028                 { "ipsecInSucceeded",   KSTAT_DATA_UINT32, 0 },
14029                 { "ipsecInFailed",      KSTAT_DATA_INT32, 0 },
14030                 { "memberEntrySize",    KSTAT_DATA_INT32, 0 },
14031                 { "inIPv6",             KSTAT_DATA_UINT32, 0 },
14032                 { "outIPv6",            KSTAT_DATA_UINT32, 0 },
14033                 { "outSwitchIPv6",      KSTAT_DATA_UINT32, 0 },
14034         };
14035 
14036         ksp = kstat_create_netstack("ip", 0, "ip", "mib2", KSTAT_TYPE_NAMED,
14037             NUM_OF_FIELDS(ip_named_kstat_t), 0, stackid);
14038         if (ksp == NULL || ksp->ks_data == NULL)
14039                 return (NULL);
14040 
14041         template.forwarding.value.ui32 = WE_ARE_FORWARDING(ipst) ? 1:2;
14042         template.defaultTTL.value.ui32 = (uint32_t)ipst->ips_ip_def_ttl;
14043         template.reasmTimeout.value.ui32 = ipst->ips_ip_reassembly_timeout;
14044         template.addrEntrySize.value.i32 = sizeof (mib2_ipAddrEntry_t);
14045         template.routeEntrySize.value.i32 = sizeof (mib2_ipRouteEntry_t);
14046 
14047         template.netToMediaEntrySize.value.i32 =
14048             sizeof (mib2_ipNetToMediaEntry_t);
14049 
14050         template.memberEntrySize.value.i32 = sizeof (ipv6_member_t);
14051 
14052         bcopy(&template, ksp->ks_data, sizeof (template));
14053         ksp->ks_update = ip_kstat_update;




13976 
13977         kstat_install(ksp);
13978         return (ksp);
13979 }
13980 
13981 static void
13982 ip_kstat2_fini(netstackid_t stackid, kstat_t *ksp)
13983 {
13984         if (ksp != NULL) {
13985                 ASSERT(stackid == (netstackid_t)(uintptr_t)ksp->ks_private);
13986                 kstat_delete_netstack(ksp, stackid);
13987         }
13988 }
13989 
13990 static void *
13991 ip_kstat_init(netstackid_t stackid, ip_stack_t *ipst)
13992 {
13993         kstat_t *ksp;
13994 
13995         ip_named_kstat_t template = {
13996                 { "forwarding",         KSTAT_DATA_UINT32, {{ 0 }}},
13997                 { "defaultTTL",         KSTAT_DATA_UINT32, {{ 0 }}},
13998                 { "inReceives",         KSTAT_DATA_UINT64, {{ 0 }}},
13999                 { "inHdrErrors",        KSTAT_DATA_UINT32, {{ 0 }}},
14000                 { "inAddrErrors",       KSTAT_DATA_UINT32, {{ 0 }}},
14001                 { "forwDatagrams",      KSTAT_DATA_UINT64, {{ 0 }}},
14002                 { "inUnknownProtos",    KSTAT_DATA_UINT32, {{ 0 }}},
14003                 { "inDiscards",         KSTAT_DATA_UINT32, {{ 0 }}},
14004                 { "inDelivers",         KSTAT_DATA_UINT64, {{ 0 }}},
14005                 { "outRequests",        KSTAT_DATA_UINT64, {{ 0 }}},
14006                 { "outDiscards",        KSTAT_DATA_UINT32, {{ 0 }}},
14007                 { "outNoRoutes",        KSTAT_DATA_UINT32, {{ 0 }}},
14008                 { "reasmTimeout",       KSTAT_DATA_UINT32, {{ 0 }}},
14009                 { "reasmReqds",         KSTAT_DATA_UINT32, {{ 0 }}},
14010                 { "reasmOKs",           KSTAT_DATA_UINT32, {{ 0 }}},
14011                 { "reasmFails",         KSTAT_DATA_UINT32, {{ 0 }}},
14012                 { "fragOKs",            KSTAT_DATA_UINT32, {{ 0 }}},
14013                 { "fragFails",          KSTAT_DATA_UINT32, {{ 0 }}},
14014                 { "fragCreates",        KSTAT_DATA_UINT32, {{ 0 }}},
14015                 { "addrEntrySize",      KSTAT_DATA_INT32, {{ 0 }}},
14016                 { "routeEntrySize",     KSTAT_DATA_INT32, {{ 0 }}},
14017                 { "netToMediaEntrySize",        KSTAT_DATA_INT32, {{ 0 }}},
14018                 { "routingDiscards",    KSTAT_DATA_UINT32, {{ 0 }}},
14019                 { "inErrs",             KSTAT_DATA_UINT32, {{ 0 }}},
14020                 { "noPorts",            KSTAT_DATA_UINT32, {{ 0 }}},
14021                 { "inCksumErrs",        KSTAT_DATA_UINT32, {{ 0 }}},
14022                 { "reasmDuplicates",    KSTAT_DATA_UINT32, {{ 0 }}},
14023                 { "reasmPartDups",      KSTAT_DATA_UINT32, {{ 0 }}},
14024                 { "forwProhibits",      KSTAT_DATA_UINT32, {{ 0 }}},
14025                 { "udpInCksumErrs",     KSTAT_DATA_UINT32, {{ 0 }}},
14026                 { "udpInOverflows",     KSTAT_DATA_UINT32, {{ 0 }}},
14027                 { "rawipInOverflows",   KSTAT_DATA_UINT32, {{ 0 }}},
14028                 { "ipsecInSucceeded",   KSTAT_DATA_UINT32, {{ 0 }}},
14029                 { "ipsecInFailed",      KSTAT_DATA_INT32, {{ 0 }}},
14030                 { "memberEntrySize",    KSTAT_DATA_INT32, {{ 0 }}},
14031                 { "inIPv6",             KSTAT_DATA_UINT32, {{ 0 }}},
14032                 { "outIPv6",            KSTAT_DATA_UINT32, {{ 0 }}},
14033                 { "outSwitchIPv6",      KSTAT_DATA_UINT32, {{ 0 }}},
14034         };
14035 
14036         ksp = kstat_create_netstack("ip", 0, "ip", "mib2", KSTAT_TYPE_NAMED,
14037             NUM_OF_FIELDS(ip_named_kstat_t), 0, stackid);
14038         if (ksp == NULL || ksp->ks_data == NULL)
14039                 return (NULL);
14040 
14041         template.forwarding.value.ui32 = WE_ARE_FORWARDING(ipst) ? 1:2;
14042         template.defaultTTL.value.ui32 = (uint32_t)ipst->ips_ip_def_ttl;
14043         template.reasmTimeout.value.ui32 = ipst->ips_ip_reassembly_timeout;
14044         template.addrEntrySize.value.i32 = sizeof (mib2_ipAddrEntry_t);
14045         template.routeEntrySize.value.i32 = sizeof (mib2_ipRouteEntry_t);
14046 
14047         template.netToMediaEntrySize.value.i32 =
14048             sizeof (mib2_ipNetToMediaEntry_t);
14049 
14050         template.memberEntrySize.value.i32 = sizeof (ipv6_member_t);
14051 
14052         bcopy(&template, ksp->ks_data, sizeof (template));
14053         ksp->ks_update = ip_kstat_update;