Hello, we used getifaddrs' ifi_ibytes on macOS10 to get traffic data from the utun network card,But the traffic read through ifi_ibytes on macOS11 and macOS12 is doubled. Does the system upgrade affect getifaddrs? I look forward to your reply. Thanks. SuperJohn
getifaddrs get ifi_ibytes on macOS11 and macOS12 is doubled
The ifi_ibytes
/ ifi_obytes
interface is one of those things that macOS inherited from its ancestor platforms that don’t really make much sense in the modern world. This is something I’ve discussed multiple times previously on here DevForums, for example this.
If you need accurate network interface statistics, I recommend that you file an enhancement request for a dedicated API for that. You could, for example, imagine it being a good fit for MetricKit.
Please post your bug number, just for the record.
In the meantime, if this legacy interface is not behaving as you expect, it’s fine to file a bug about that. However, you have to be realistic here. This interface isn’t something we generally recommend that folks use, and that means it’s going to be hard to get traction on your bug.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"