Page MenuHomeFreeBSD

D34627.diff
No OneTemporary

D34627.diff

diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h
--- a/sys/netinet/ip_mroute.h
+++ b/sys/netinet/ip_mroute.h
@@ -265,6 +265,7 @@
u_long v_bytes_in; /* # bytes in on interface */
u_long v_bytes_out; /* # bytes out on interface */
#ifdef _KERNEL
+#define MROUTE_VIF_SYSCTL_LEN __offsetof(struct vif, v_spin)
struct mtx v_spin; /* Spin mutex for pkt stats */
char v_spin_name[32];
#endif
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -2727,18 +2727,23 @@
static int
sysctl_viflist(SYSCTL_HANDLER_ARGS)
{
- int error;
+ int error, i;
if (req->newptr)
return (EPERM);
if (V_viftable == NULL) /* XXX unlocked */
return (0);
- error = sysctl_wire_old_buffer(req, sizeof(*V_viftable) * MAXVIFS);
+ error = sysctl_wire_old_buffer(req, MROUTE_VIF_SYSCTL_LEN * MAXVIFS);
if (error)
return (error);
MRW_RLOCK();
- error = SYSCTL_OUT(req, V_viftable, sizeof(*V_viftable) * MAXVIFS);
+ /* Copy out user-visible portion of vif entry. */
+ for (i = 0; i < MAXVIFS; i++) {
+ error = SYSCTL_OUT(req, &V_viftable[i], MROUTE_VIF_SYSCTL_LEN);
+ if (error)
+ break;
+ }
MRW_RUNLOCK();
return (error);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 21, 6:15 AM (21 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14756096
Default Alt Text
D34627.diff (1 KB)

Event Timeline