--- sys/netinet/ip_mroute.c (revision 294659) +++ sys/netinet/ip_mroute.c (working copy) @@ -176,7 +176,7 @@ static VNET_DEFINE(vifi_t, numvifs); #define V_numvifs VNET(numvifs) -static VNET_DEFINE(struct vif, viftable[MAXVIFS]); +static VNET_DEFINE(struct vif *, viftable); #define V_viftable VNET(viftable) SYSCTL_VNET_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_RD, &VNET_NAME(viftable), sizeof(V_viftable), "S,vif[MAXVIFS]", @@ -207,7 +207,7 @@ * expiration time. Periodically, the entries are analysed and processed. */ #define BW_METER_BUCKETS 1024 -static VNET_DEFINE(struct bw_meter*, bw_meter_timers[BW_METER_BUCKETS]); +static VNET_DEFINE(struct bw_meter **, bw_meter_timers); #define V_bw_meter_timers VNET(bw_meter_timers) static VNET_DEFINE(struct callout, bw_meter_ch); #define V_bw_meter_ch VNET(bw_meter_ch) @@ -217,7 +217,7 @@ * Pending upcalls are stored in a vector which is flushed when * full, or periodically */ -static VNET_DEFINE(struct bw_upcall, bw_upcalls[BW_UPCALLS_MAX]); +static VNET_DEFINE(struct bw_upcall *, bw_upcalls); #define V_bw_upcalls VNET(bw_upcalls) static VNET_DEFINE(u_int, bw_upcalls_n); /* # of pending upcalls */ #define V_bw_upcalls_n VNET(bw_upcalls_n) @@ -2805,8 +2805,16 @@ vnet_mroute_init(const void *unused __unused) { - MALLOC(V_nexpire, u_char *, mfchashsize, M_MRTABLE, M_WAITOK|M_ZERO); - bzero(V_bw_meter_timers, sizeof(V_bw_meter_timers)); + MALLOC(V_nexpire, u_char *, sizeof(*V_nexpire) * mfchashsize, + M_MRTABLE, M_WAITOK|M_ZERO); + MALLOC(V_viftable, struct vif *, sizeof(*V_viftable) * MAXVIFS, + M_MRTABLE, M_WAITOK|M_ZERO); + MALLOC(V_bw_meter_timers, struct bw_meter **, + sizeof(*V_bw_meter_timers) * BW_METER_BUCKETS, + M_MRTABLE, M_WAITOK|M_ZERO); + MALLOC(V_bw_upcalls, struct bw_upcall *, + sizeof(*V_bw_upcalls) * BW_UPCALLS_MAX, + M_MRTABLE, M_WAITOK|M_ZERO); callout_init(&V_expire_upcalls_ch, CALLOUT_MPSAFE); callout_init(&V_bw_upcalls_ch, CALLOUT_MPSAFE); callout_init(&V_bw_meter_ch, CALLOUT_MPSAFE); @@ -2820,6 +2828,9 @@ { FREE(V_nexpire, M_MRTABLE); + FREE(V_viftable, M_MRTABLE); + FREE(V_bw_meter_timers, M_MRTABLE); + FREE(V_bw_upcalls, M_MRTABLE); V_nexpire = NULL; }