Subject: Between schedule transmissions

From: [email-masked]
Date: Wed, 23 Feb 2005 00:10:55 -0000

The base draft states that "A single BFD Control packet SHOULD be transmitted between normally scheduled transmissions when the contents of that packet would differ from those in the previously transmitted packet in order to more rapidly communicate a change in state."

In the case of state transitions from 'Down to Up or Init', and from 'Up to Failing' it is obvious that a BFD packet should be sent immediately (rather than waiting for the next scheduled transmission) because the IHY variable changes. However, what about state changes form 'Init to Up' and 'Failing to Down' where the IHY doesn't change? Do these result in BFD packets being sent immediately, or does the system wait until the next scheduled transmission? The answer to this question may be dependant on the bfd.LocalDiag field, the draft states that bfd.LocalDiag MUST be initialised to zero, and describes when it should be changed to reflect failure conditions. However, there is no information (or at least I can't find any) regarding when bfd.LocalDiag should be reset to 0.

The main reason behind asking this question is that following restoration of a unidirectional failure, if a BFD packet is not sent immediately following a state change from Failing to Down, then it would appear to me that it would be possible that a BFD session may never come back up and instead each side would loop through the Failing, Init, Down states. To use an example, lets say that at T=0 seconds, the unidirectional fault (A->B) is repaired, at this point node A is in the Down state and Node B is in the Failing state (to keep things simple, in this example one way delay = 100ms and processing time is not included) -

[A: Down, B: Failing]
T=0:   Connectivity in the direction A->B is restored
T=0.1: B reaches its next scheduled BFD transmission slot and sends a BFD packet to A
T=0.2: A receives the BFD packet from A with IHY set to 0 and changes from Down to Init
[A: Init, B: Failing]
T=0.2: A sends a BFD packet to B straight away
T=0.3: B receives the BFD packet from A with IHY set to 1 and ignores the packet (waits for IHY = 0)
T=0.5: A reaches its next scheduled BFD transmission slot and sends a BFD packet to B
T=0.6: B receives the BFD packet from A with IHY set to 1 and ignores the packet (waits for IHY = 0)
T=1.1: B reaches its next scheduled BFD transmission slot and sends a BFD packet to A
T=1.2: A receives the BFD packet from B with IHY set to 0 and drops the packet (waits for IHY = 1)
T=1.5: A reaches its next scheduled BFD transmission slot and sends a BFD packet to B
T=1.6: B receives the BFD packet from A with IHY set to 1 and ignores the packet (waits for IHY = 0)
T=2.1: B reaches its next scheduled BFD transmission slot and sends a BFD packet to A
T=2.2: A receives the BFD packet from B with IHY set to 0 and drops the packet (waits for IHY = 1)
T=2.5: A reaches its next scheduled BFD transmission slot and sends a BFD packet to B
T=2.6: B receives the BFD packet from A with IHY set to 1 and ignores the packet (waits for IHY = 0)
T=3.1: B reaches its next scheduled BFD transmission slot and sends a BFD packet to A
T=3.2: A receives the BFD packet from B with IHY set to 0, drops the packet, and changes from Init to Failing due to detection timeout
[A: Failing, B: Failing]
T=3.2: A sends a BFD packet to B straight away
T=3.3: B receives the BFD packet from A with IHY set to 0 and changes from Failing to Down
[A: Failing, B: Down]
T=3.5: A reaches its next scheduled BFD transmission slot and sends a BFD packet to B
T=3.6: B receives the BFD packet from A with IHY set to 0 and changes from Down to Init
[A: Failing, B: Init]
T=3.6: B sends a BFD packet to A straight away
T=3.7: A receives the BFD packet from B with IHY set to 1 and ignores the packet (waits for IHY = 0)
T=4.1: B reaches its next scheduled BFD transmission slot and sends a BFD packet to A
T=4.2: A receives the BFD packet from B with IHY set to 1 and ignores the packet (waits for IHY = 0)
T=4.5: A reaches its next scheduled BFD transmission slot and sends a BFD packet to B
T=4.6: B receives the BFD packet from A with IHY set to 0 and drops the packet (waits for IHY = 1)
T=5.1: B reaches its next scheduled BFD transmission slot and sends a BFD packet to A
T=5.2: A receives the BFD packet from B with IHY set to 1 and ignores the packet (waits for IHY = 0)
T=5.5: A reaches its next scheduled BFD transmission slot and sends a BFD packet to B
T=5.6: B receives the BFD packet from A with IHY set to 0 and drops the packet (waits for IHY = 1)
T=6.1: B reaches its next scheduled BFD transmission slot and sends a BFD packet to A
T=6.2: A receives the BFD packet from B with IHY set to 1 and ignores the packet (waits for IHY = 0)
T=6.5: A reaches its next scheduled BFD transmission slot and sends a BFD packet to B
T=6.6: B receives the BFD packet from A with IHY set to 0, drops the packet, and changes from Init to Failing due to detection timeout
[A: Failing, B: Failing]
T=6.6: B sends a BFD packet to A straight away
T=6.7: A receives the BFD packet from B with IHY set to 0 and changes from Failing to Down
[A: Down, B: Failing]

This loop would continue indefinitely, however, the loop would be avoided if a BFD packet was sent immediately following a state transition from Failing to Down, i.e. -

T=3.3: B receives the BFD packet from A with IHY set to 0 and changes from Failing to Down
[A: Failing, B: Down]
T=3.3: B sends a BFD packet to A straight away
T=3.4: A receives the BFD packet from B with IHY set to 0 and changes from Failing to Down
[A: Down, B: Down]
T=3.4: A sends a BFD packet to A straight away
T=3.5: B receives the BFD packet from A with IHY set to 0 and changes from Down to Init
[A: Down, B: Init]
T=3.5: B sends a BFD packet to A straight away
T=3.6: A receives the BFD packet from B with IHY set to 1 and changes from Down to Up
[A: Up, B: Init]
T=3.6: A sends a BFD packet to A straight away
T=3.7: B receives the BFD packet from A with IHY set to 1 and changes from Init to Up
[A: Up, B: Up]

Perhaps I have missed something or there is a mistake in the scenario I describe above. However, if not then it would appear to me that if BFD packets are sent between scheduled transmissions for 'Down to Up or Init', and 'Up to Failing' state transitions, then they must also be sent following a state transition from 'Failing to Down' to avoid a loop occurring. 

Confirmation either way would be greatly appreciated.

Thanks,
Richard

---

From: Dave Katz <[email-masked]>
Date: Thu, 24 Feb 2005 02:33:59 -0700

The loop is persistent only if you can guarantee that one system will 
always send two packets prior to receiving one from the other guy.  
This guarantee is hard to make unless the implementation always 
explicitly sends two packets back-to-back (and if an implementation 
does this, your suggestion will not change the outcome.)

Everything after that is probabilistic.  If this situation occurs, one 
side will time out of Init state and try again.  Then the dice are 
rolled once more.

The change you suggest may reduce the odds of this occurring somewhat, 
although it is worth noting that it is the "extra" packet that causes 
the problem in the first place, and additional "extra" packets may 
exacerbate the situation instead.  Note also that as the latency on the 
link increases, your change is less likely to work, as it is predicated 
on the opposite case, namely that exactly one packet is guaranteed to 
be sent, and one sent in return (a round trip time), prior to the 
second packet being sent.

The sedate rate at which packets are sent when the session isn't Up 
helps improve the odds as well.

I think there is no way out of this conundrum, particularly if the 
packet transmit rates are different on each side (getting rid of the 
"extra" packets entirely wouldn't even help.)  Distributed state 
establishment is a sloppy business.

One thing you point out is that the text is not clear as to when the 
state variables are to be initialized;  the answer is that they are 
initialized once when the session is created, and never again (the 
protocol machinery will tinker with the state as necessary as the 
session goes up and down.)  I'll add a little text to that effect.

--Dave

On Feb 22, 2005, at 5:10 PM, [email-masked] wrote:

> In the case of state transitions from 'Down to Up or Init', and from 
> 'Up to Failing' it is obvious that a BFD packet should be sent 
> immediately (rather than waiting for the next scheduled transmission) 
> because the IHY variable changes. However, what about state changes 
> form 'Init to Up' and 'Failing to Down' where the IHY doesn't change? 
> Do these result in BFD packets being sent immediately, or does the 
> system wait until the next scheduled transmission? The answer to this 
> question may be dependant on the bfd.LocalDiag field, the draft states 
> that bfd.LocalDiag MUST be initialised to zero, and describes when it 
> should be changed to reflect failure conditions. However, there is no 
> information (or at least I can't find any) regarding when 
> bfd.LocalDiag should be reset to 0.