FRRouting / frr

The FRRouting Protocol Suite
https://frrouting.org/
Other
3.29k stars 1.25k forks source link

ospf: When the transmit-delay is set to more than 901, the interface continuously retransmits packets. #16944

Open Shbinging opened 1 week ago

Shbinging commented 1 week ago

Description

When the transmit-delay is set to more than 901, the interface continuously retransmits information, that is, the linkStateRetransmissionListCounter > 1

Version

10.1

How to reproduce

Given the network below Router A

Router B

Router A's conf

interface r1-eth0
    ip address 182.128.70.217/18
    ip ospf transmit-delay 1000

router ospf
    ospf router-id 0.0.0.2
    network 182.128.70.217/32 area 0.0.0.0

Router B's conf

debug ospf packet all detail
interface r2-eth2
    ip address 182.128.70.216/18
    ip ospf transmit-delay 1000
    ip ospf area 0.0.0.0

router ospf
    ospf router-id 0.0.0.3

Expected behavior

When we use show ip ospf neighbor, the linkStateRetransmissionListCounter=0 after some time

Actual behavior

When we use show ip ospf neighbor, the linkStateRetransmissionListCounter keeps to be 1 or 2

Additional context

No response

Checklist

Shbinging commented 6 days ago

We set the transmit delay greater than OSPF_LSA_MAXAGE(900) such as 1000. The interface will add delay to the LSAs in lsa update packet. In retransmit list, the age is still 0. (ospf_packet.c:3318)

        /* Set LS age. */
        /* each hop must increment an lsa_age by transmit_delay
           of OSPF interface */
        ls_age = ls_age_increment(lsa,
                      OSPF_IF_PARAM(oi, transmit_delay));
        lsah->ls_age = htons(ls_age);

After receiving the packet, the receiver will send lsa ack packet, the age of lsa is the same as lsa in the update packet, which is 1000.However, the age of lsa in the retransmit list (same in LSDB) is not added by the transmit delay, which is 0.

The age of lsa in link state ack packet exceeds OSPF_LSA_MAXAGE_DIFF(900) compared to the age of lsa in retransmit list. This makes the reply LSA considered different from the LSA in the retransmission list, so the lsa in retransmit list can never be cleared.(ospf_packet.c:2127)

        lsr = ospf_ls_retransmit_lookup(nbr, lsa);

        if (lsr != NULL && ospf_lsa_more_recent(lsr, lsa) == 0) {//LSAs are same
            ospf_ls_retransmit_delete(nbr, lsr); //remove LSA from retransmit list
            ospf_check_and_gen_init_seq_lsa(oi, lsa);
        }
Shbinging commented 6 days ago

PR:https://github.com/FRRouting/frr/pull/16956

aceelindem commented 4 days ago

I'm not really a fan of this fxi. If the configured transmit delay is anywhere close to the actual transmit delay, the LSA will be aged locally as well both during the time of LSA transmit AND the time of the LS Ack transmit (which would also be a problem). Hence, the root problem is that transmit delay is configured incorrectly.