This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/usr/src/uts/common/inet/ip/icmp.c b/usr/src/uts/common/inet/ip/icmp.c | |
index a4abdbd..68a8759 100644 | |
--- a/usr/src/uts/common/inet/ip/icmp.c | |
+++ b/usr/src/uts/common/inet/ip/icmp.c | |
@@ -22,6 +22,7 @@ | |
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. | |
* Copyright (c) 2013 by Delphix. All rights reserved. | |
* Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved. | |
+ * Copyright (c) 2018, Alasdair Lumsden. All rights reserved. | |
*/ | |
/* Copyright (c) 1990 Mentat Inc. */ | |
@@ -45,6 +46,7 @@ | |
#include <sys/priv.h> | |
#include <sys/ucred.h> | |
#include <sys/zone.h> | |
+#include <sys/kstat.h> | |
#include <sys/sockio.h> | |
#include <sys/socket.h> | |
@@ -5038,7 +5040,7 @@ rawip_kstat_init(netstackid_t stackid) { | |
{ "outErrors", KSTAT_DATA_UINT32, 0 }, | |
}; | |
- ksp = kstat_create_netstack("icmp", 0, "rawip", "mib2", | |
+ ksp = kstat_create_netstack("icmp", stackid, "rawip", "mib2", | |
KSTAT_TYPE_NAMED, | |
NUM_OF_FIELDS(rawip_named_kstat_t), | |
0, stackid); | |
@@ -5049,6 +5051,13 @@ rawip_kstat_init(netstackid_t stackid) { | |
ksp->ks_update = rawip_kstat_update; | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} | |
diff --git a/usr/src/uts/common/inet/ip/ip.c b/usr/src/uts/common/inet/ip/ip.c | |
index 215d09e..2bedbf1 100644 | |
--- a/usr/src/uts/common/inet/ip/ip.c | |
+++ b/usr/src/uts/common/inet/ip/ip.c | |
@@ -25,6 +25,7 @@ | |
* Copyright (c) 2017 OmniTI Computer Consulting, Inc. All rights reserved. | |
* Copyright (c) 2016 by Delphix. All rights reserved. | |
* Copyright (c) 2018 Joyent, Inc. All rights reserved. | |
+ * Copyright (c) 2018, Alasdair Lumsden. All rights reserved. | |
*/ | |
#include <sys/types.h> | |
@@ -49,6 +50,7 @@ | |
#include <sys/policy.h> | |
#include <sys/priv.h> | |
#include <sys/taskq.h> | |
+#include <sys/kstat.h> | |
#include <sys/systm.h> | |
#include <sys/param.h> | |
@@ -13962,7 +13964,7 @@ ip_kstat2_init(netstackid_t stackid, ip_stat_t *ip_statisticsp) | |
{ "conn_in_timestamp", KSTAT_DATA_UINT64 }, | |
}; | |
- ksp = kstat_create_netstack("ip", 0, "ipstat", "net", | |
+ ksp = kstat_create_netstack("ip", stackid, "ipstat", "net", | |
KSTAT_TYPE_NAMED, sizeof (template) / sizeof (kstat_named_t), | |
KSTAT_FLAG_VIRTUAL, stackid); | |
@@ -13973,6 +13975,13 @@ ip_kstat2_init(netstackid_t stackid, ip_stat_t *ip_statisticsp) | |
ksp->ks_data = (void *)ip_statisticsp; | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} | |
@@ -14032,7 +14041,7 @@ ip_kstat_init(netstackid_t stackid, ip_stack_t *ipst) | |
{ "outSwitchIPv6", KSTAT_DATA_UINT32, 0 }, | |
}; | |
- ksp = kstat_create_netstack("ip", 0, "ip", "mib2", KSTAT_TYPE_NAMED, | |
+ ksp = kstat_create_netstack("ip", stackid, "ip", "mib2", KSTAT_TYPE_NAMED, | |
NUM_OF_FIELDS(ip_named_kstat_t), 0, stackid); | |
if (ksp == NULL || ksp->ks_data == NULL) | |
return (NULL); | |
@@ -14052,6 +14061,13 @@ ip_kstat_init(netstackid_t stackid, ip_stack_t *ipst) | |
ksp->ks_update = ip_kstat_update; | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} | |
@@ -14182,7 +14198,7 @@ icmp_kstat_init(netstackid_t stackid) | |
{ "inBadRedirects", KSTAT_DATA_UINT32 }, | |
}; | |
- ksp = kstat_create_netstack("ip", 0, "icmp", "mib2", KSTAT_TYPE_NAMED, | |
+ ksp = kstat_create_netstack("ip", stackid, "icmp", "mib2", KSTAT_TYPE_NAMED, | |
NUM_OF_FIELDS(icmp_named_kstat_t), 0, stackid); | |
if (ksp == NULL || ksp->ks_data == NULL) | |
return (NULL); | |
@@ -14192,6 +14208,13 @@ icmp_kstat_init(netstackid_t stackid) | |
ksp->ks_update = icmp_kstat_update; | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} | |
diff --git a/usr/src/uts/common/inet/ip/ip6.c b/usr/src/uts/common/inet/ip/ip6.c | |
index 7f30aaa..cc3fa56 100644 | |
--- a/usr/src/uts/common/inet/ip/ip6.c | |
+++ b/usr/src/uts/common/inet/ip/ip6.c | |
@@ -22,6 +22,7 @@ | |
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. | |
* Copyright (c) 1990 Mentat Inc. | |
* Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved. | |
+ * Copyright (c) 2018, Alasdair Lumsden. All rights reserved. | |
*/ | |
#include <sys/types.h> | |
@@ -43,6 +44,7 @@ | |
#include <sys/zone.h> | |
#include <sys/neti.h> | |
#include <sys/hook.h> | |
+#include <sys/kstat.h> | |
#include <sys/kmem.h> | |
#include <sys/systm.h> | |
@@ -4845,7 +4847,7 @@ void | |
{ "ip6_udp_in_part_hw_cksum_err", KSTAT_DATA_UINT64 }, | |
{ "ip6_udp_in_sw_cksum_err", KSTAT_DATA_UINT64 }, | |
}; | |
- ksp = kstat_create_netstack("ip", 0, "ip6stat", "net", | |
+ ksp = kstat_create_netstack("ip", stackid, "ip6stat", "net", | |
KSTAT_TYPE_NAMED, sizeof (template) / sizeof (kstat_named_t), | |
KSTAT_FLAG_VIRTUAL, stackid); | |
@@ -4856,6 +4858,13 @@ void | |
ksp->ks_data = (void *)ip6_statisticsp; | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} | |
diff --git a/usr/src/uts/common/inet/sctp/sctp_snmp.c b/usr/src/uts/common/inet/sctp/sctp_snmp.c | |
index 303cc47..d73f0d0 100644 | |
--- a/usr/src/uts/common/inet/sctp/sctp_snmp.c | |
+++ b/usr/src/uts/common/inet/sctp/sctp_snmp.c | |
@@ -21,6 +21,7 @@ | |
/* | |
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. | |
+ * Copyright (c) 2018, Alasdair Lumsden. All rights reserved. | |
*/ | |
#include <sys/types.h> | |
@@ -31,6 +32,7 @@ | |
#include <sys/ddi.h> | |
#include <sys/sunddi.h> | |
#include <sys/tsol/tndb.h> | |
+#include <sys/kstat.h> | |
#include <netinet/in.h> | |
@@ -305,7 +307,7 @@ sctp_kstat_init(netstackid_t stackid) | |
{ "sctpInClosed", KSTAT_DATA_INT32, 0 } | |
}; | |
- ksp = kstat_create_netstack(SCTP_MOD_NAME, 0, "sctp", "mib2", | |
+ ksp = kstat_create_netstack(SCTP_MOD_NAME, stackid, "sctp", "mib2", | |
KSTAT_TYPE_NAMED, NUM_OF_FIELDS(sctp_named_kstat_t), 0, stackid); | |
if (ksp == NULL) | |
@@ -319,6 +321,13 @@ sctp_kstat_init(netstackid_t stackid) | |
ksp->ks_update = sctp_kstat_update; | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} | |
@@ -483,7 +492,7 @@ sctp_kstat2_init(netstackid_t stackid) | |
{ "sctp_listen_cnt_drop", KSTAT_DATA_UINT64 }, | |
}; | |
- ksp = kstat_create_netstack(SCTP_MOD_NAME, 0, "sctpstat", "net", | |
+ ksp = kstat_create_netstack(SCTP_MOD_NAME, stackid, "sctpstat", "net", | |
KSTAT_TYPE_NAMED, NUM_OF_FIELDS(template), 0, stackid); | |
if (ksp == NULL) | |
@@ -493,6 +502,13 @@ sctp_kstat2_init(netstackid_t stackid) | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
ksp->ks_update = sctp_kstat2_update; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} | |
diff --git a/usr/src/uts/common/inet/udp/udp_stats.c b/usr/src/uts/common/inet/udp/udp_stats.c | |
index 29f2718..679c1e7 100644 | |
--- a/usr/src/uts/common/inet/udp/udp_stats.c | |
+++ b/usr/src/uts/common/inet/udp/udp_stats.c | |
@@ -21,6 +21,7 @@ | |
/* | |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. | |
+ * Copyright (c) 2018, Alasdair Lumsden. All rights reserved. | |
*/ | |
#include <sys/types.h> | |
@@ -36,6 +37,7 @@ | |
#include <inet/snmpcom.h> | |
#include <inet/kstatcom.h> | |
#include <inet/udp_impl.h> | |
+#include <sys/kstat.h> | |
static int udp_kstat_update(kstat_t *, int); | |
static int udp_kstat2_update(kstat_t *, int); | |
@@ -407,7 +409,7 @@ udp_kstat2_init(netstackid_t stackid) | |
#endif | |
}; | |
- ksp = kstat_create_netstack(UDP_MOD_NAME, 0, "udpstat", "net", | |
+ ksp = kstat_create_netstack(UDP_MOD_NAME, stackid, "udpstat", "net", | |
KSTAT_TYPE_NAMED, sizeof (template) / sizeof (kstat_named_t), | |
0, stackid); | |
@@ -418,6 +420,13 @@ udp_kstat2_init(netstackid_t stackid) | |
ksp->ks_update = udp_kstat2_update; | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} | |
@@ -522,7 +531,7 @@ udp_kstat_init(netstackid_t stackid) | |
{ "outErrors", KSTAT_DATA_UINT32, 0 }, | |
}; | |
- ksp = kstat_create_netstack(UDP_MOD_NAME, 0, UDP_MOD_NAME, "mib2", | |
+ ksp = kstat_create_netstack(UDP_MOD_NAME, stackid, UDP_MOD_NAME, "mib2", | |
KSTAT_TYPE_NAMED, NUM_OF_FIELDS(udp_named_kstat_t), 0, stackid); | |
if (ksp == NULL) | |
@@ -535,6 +544,13 @@ udp_kstat_init(netstackid_t stackid) | |
ksp->ks_update = udp_kstat_update; | |
ksp->ks_private = (void *)(uintptr_t)stackid; | |
+ /* | |
+ * If this is an exclusive netstack for a local zone, the global zone | |
+ * should still be able to read the kstat. | |
+ */ | |
+ if (stackid != GLOBAL_NETSTACKID) | |
+ kstat_zone_add(ksp, GLOBAL_ZONEID); | |
+ | |
kstat_install(ksp); | |
return (ksp); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment