- if_copy_traffic_class(ifp, &if_tc);
-
- error = SYSCTL_OUT(req, &if_tc, sizeof(struct if_traffic_class));
+ if ((ifmd_supp = _MALLOC(sizeof(*ifmd_supp), M_TEMP,
+ M_NOWAIT | M_ZERO)) == NULL) {
+ error = ENOMEM;
+ break;
+ }
+
+ if_copy_traffic_class(ifp, &ifmd_supp->ifmd_traffic_class);
+ if_copy_data_extended(ifp, &ifmd_supp->ifmd_data_extended);
+ if_copy_packet_stats(ifp, &ifmd_supp->ifmd_packet_stats);
+ if_copy_rxpoll_stats(ifp, &ifmd_supp->ifmd_rxpoll_stats);
+ if_copy_netif_stats(ifp, &ifmd_supp->ifmd_netif_stats);
+
+ if (req->oldptr == USER_ADDR_NULL) {
+ req->oldlen = sizeof(*ifmd_supp);
+ }
+
+ error = SYSCTL_OUT(req, ifmd_supp, MIN(sizeof(*ifmd_supp),
+ req->oldlen));
+
+ _FREE(ifmd_supp, M_TEMP);