Kernel static routes redistribution via OSPFv3 using FRRouting SW

Posted on

Dear all,
 
I have a question regarding redistribution of kernel static routes via OSPFv3 using FRRouting SW.
I have the following setup:
Red Hat machine running FRRouting SW configured as OSPFv3 neighbor:
Red Hat version:

Operating System: Red Hat Enterprise Linux 8.5 (Ootpa)
     CPE OS Name: cpe:/o:redhat:enterprise_linux:8::baseos
          Kernel: Linux 4.18.0-348.7.1.el8_5.x86_64
    Architecture: x86-64

FRRouting version:

Name        : frr
Version     : 7.5
Release     : 4.el8
Architecture: x86_64

which is connected to another non-RHEL OSPFv3 neighbor (not relevant).

FRRouting configuration (OSPF6 router):

router ospf6
 ospf6 router-id 199.199.199.199
 redistribute kernel
 interface ens192 area 0
!

The goal of the setup is to redistribute IPv6 kernel static routes via OSPFv3 AND preserve configured metric.
In the setup I have unspecified number of kernel static routes divided into pre-defined groups. Assignment to the group is done by setting specific metric.

Example with 4 static routes divide into 3 groups (metrics 100, 200 and 300):

ip -6 route
fca0:ffff::4 via 10:99:30:0:be54:cae6:ef59:e113 dev ens192 metric 100 pref medium
fca0:ffff::5 via 10:99:30:0:be54:cae6:ef59:e113 dev ens192 metric 200 pref medium
fca0:ffff::6 via 10:99:30:0:be54:cae6:ef59:e113 dev ens192 metric 200 pref medium
fca0:ffff::7 via 10:99:30:0:be54:cae6:ef59:e113 dev ens192 metric 300 pref medium

Note: Number of static routes per group is unknown but number of groups and metric assignment is pre-defined and static.

FRRouting:

show ipv6 route
K>* fca0:ffff::4/128 [0/100] via 10:99:30:0:be54:cae6:ef59:e113, ens192, 00:01:56
K>* fca0:ffff::5/128 [0/200] via 10:99:30:0:be54:cae6:ef59:e113, ens192, 00:01:51
K>* fca0:ffff::6/128 [0/200] via 10:99:30:0:be54:cae6:ef59:e113, ens192, 00:01:45
K>* fca0:ffff::7/128 [0/300] via 10:99:30:0:be54:cae6:ef59:e113, ens192, 00:01:38

Note: metrics are visible also in FRRouting routing table

OSPFv3 redistribution of the first route:

Age:   35 Type: AS-External
Link State ID: 0.0.0.15
Advertising Router: 199.199.199.199
LS Sequence Number: 0x80000001
CheckSum: 0x1ca0 Length: 44
Duration: 00:00:34
     Bits: ---
     Metric:     0
     Prefix Options: xxx
     Referenced LSType: 0
     Prefix: fca0:ffff::4/128

Question: Is it expected that kernel static route metric is ignored and the routes are redistributed with default metric 0 instead?

I also tried to set metrics using route-maps the following way:

router ospf6
 ospf6 router-id 199.199.199.199
 redistribute kernel route-map KERNEL
 interface ens192 area 0
!
route-map KERNEL permit 1
 match metric 100
 set metric 100
!
route-map KERNEL permit 2
 match metric 200
 set metric 200
!
route-map KERNEL permit 3
 match metric 300
 set metric 300
!

The problem is that "match metric" doesn't match kernel static route metric and static routes are redistributed with OSPF metric 100.

Question: Is there a way to match kernel static route metric and why "match metric 100" matches all the routes?

Thank you in advance for your help.

Best regards,
Peter