[quagga-users 13256] question regarding metric and distance in the rib

Bin Zhou binzhou at ruggedcom.com
Thu Apr 25 19:06:46 BST 2013


I have a question about the metric and distance defined in Zebra rib 
data structure.

struct rib
   /* Metric */
   u_int32_t metric;

   /* Distance. */
   u_char distance;

Both of them are used for route selection. But only metric is written to 
the RMA_PRIORITY field in Linux kernel. For protocols that only 
configure distance, the distance value does not pass to kernel. The 
RMA_PRIORITY field of this route will be 0 in this case, because the 
metric is zero. For example, static routes configured from zebra always 
end up with zero metric.

Some other protocols (outside of quagga) might depend on the metric of a 
route read from the RMA_PRIORITY field at kernel. We have a PIMD 
implementation, which reads such metric from kernel. It always read "0" 
for static routes. The static routes then become the least preferred 
routes. This causes wrong route calculation.

One workaround is proposed to write the distance value to the kernel if 
the metric is "0". It seems reasonable to me because the distance is the 
only metric used in route selection (at zebra). Will this cause any 
problem? Please correct me if you see any potential issue.

Thanks in advance for your response.

Bin Zhou

More information about the Quagga-users mailing list