--- sys/netinet/ip_mroute.c (revision 294669) +++ sys/netinet/ip_mroute.c (working copy) @@ -177,7 +177,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_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(viftable), sizeof(V_viftable), "S,vif[MAXVIFS]", @@ -208,7 +208,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) @@ -218,7 +218,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) @@ -2815,8 +2815,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, 1); callout_init(&V_bw_upcalls_ch, 1); callout_init(&V_bw_meter_ch, 1); @@ -2830,6 +2838,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; }