winapiroutesmetricwindows-networkingplatform-sdk

MIB_IPFORWARDROW metric(s) vs. ROUTE's


In the Windows command line, the 'ROUTE PRINT' command yields a tabular list of entries, with a single column labeled 'Metric'.

In the Windows Platform SDK, you can fetch the same values (more or less) via the API, through the structure MIB_IPFORWARDROW. I can correlate most of the fields in MIB_IPFORWARDROW to the one's in ROUTE PRINT's but when it comes to Metrics, MIB_IPFORWARDROW has 5 (five!) metric fields. Which one of them is ROUTE PRINT's Metric?


Solution

  • Oops... I missed that part in the documentation that says:

    A number of members of the MIB_IPFORWARDROW structure are not currently used by IPv4 routing. These members include dwForwardPolicy, dwForwardNextHopAS, dwForwardMetric2, dwForwardMetric3, dwForwardMetric4, and dwForwardMetric5.

    So, answering myself: In IPv4, ROUTE PRINT's Metric is dwForwardMetric1 in MIB_IPFORWARDROW.