Page MenuHomeFreeBSD

sctp: fix heartbeat timer
ClosedPublic

Authored by tuexen on Mon, May 6, 8:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, May 14, 8:35 PM
Unknown Object (File)
Tue, May 14, 2:51 PM
Unknown Object (File)
Sat, May 11, 5:59 PM
Unknown Object (File)
Sat, May 11, 2:14 AM
Unknown Object (File)
Thu, May 9, 6:29 PM
Unknown Object (File)
Tue, May 7, 11:56 PM
Unknown Object (File)
Tue, May 7, 11:56 PM
Unknown Object (File)
Tue, May 7, 8:01 PM

Details

Reviewers
rrs
albin.hellqvist_ericsson.com
Group Reviewers
transport
Summary

Adding the +/-50%RTO jitter applies only to paths, which are not potentially failed and which are not unconfirmed and not idle.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

tuexen requested review of this revision.Mon, May 6, 8:49 PM
albin.hellqvist_ericsson.com added inline comments.
sys/netinet/sctputil.c
2292–2293

Should SCTP_ADDR_REACHABLE be checked here?

This might be enough?

if ((net->dest_state & (SCTP_ADDR_UNCONFIRMED | SCTP_ADDR_PF)) == 0) {

In that way, we don't add the jitter and heartbeat interval if the path is unconfirmed or potentially failed.

2295–2304

I might be mistaken, but before we had (assuming that RTO > 1):
to_ticks == [RTO/2, 3*RTO/2]
or
to_ticks == [RTO/2, 3*RTO/2] + HB-interval

And now we have (assuming that RTO > 1):
to_ticks == RTO
or
to_ticks == [RTO/2, RTO] + HB-interval

And I think that we would want this (assuming that RTO > 1)?
to_ticks == RTO
or
to_ticks == [RTO/2, 3*RTO/2] + HB-interval

I think the switch case could be easier to understand with a new variable called rto, like in this example:

uint32_t to_ticks;
uint32_t rto, rndval, jitter;

...

if (net->RTO == 0) {
	rto = stcb->asoc.initial_rto;
} else {
	rto = net->RTO;
}

// to_ticks == RTO
to_ticks = rto;

if ((net->dest_state & (SCTP_ADDR_UNCONFIRMED | SCTP_ADDR_PF)) == 0) {
	if (rto > 1) {
		rndval = sctp_select_initial_TSN(&inp->sctp_ep);
		
		// jitter == [0, RTO]
		jitter = rndval % rto;		

		// to_ticks == RTO/2
		to_ticks >>= 1;
		
		// Haven't calculated how this if statement could end up.
		if (jitter < (UINT32_MAX - to_ticks)) {
			// to_ticks == [RTO/2, 3*RTO/2]
			to_ticks += jitter;
		} else {
			to_ticks = UINT32_MAX;
		}
	}
	
	// Haven't calculated how this if statement could end up.
	if (net->heart_beat_delay < (UINT32_MAX - to_ticks)) {
		to_ticks += net->heart_beat_delay;
	} else {
		to_ticks = UINT32_MAX;
	}
}

...
This revision now requires changes to proceed.Thu, May 9, 4:36 PM
tuexen marked an inline comment as done.

Fix computation of jitter.

sys/netinet/sctputil.c
2292–2293

Path Verification contains:

In each RTO, a probe MAY be sent on an active UNCONFIRMED path in
an attempt to move it to the CONFIRMED state. If during this probing the
path becomes inactive, this rate is lowered to the normal HEARTBEAT rate.

I think this is captured exactly with:

if (!((net->dest_state & SCTP_ADDR_UNCONFIRMED) &&
      (net->dest_state & SCTP_ADDR_REACHABLE)) &&
    ((net->dest_state & SCTP_ADDR_PF) == 0)) {
2295–2304

You are correct. Fixed in the latest patch.

tuexen marked an inline comment as done and an inline comment as not done.Fri, May 10, 10:06 AM
This revision is now accepted and ready to land.Fri, May 10, 8:16 PM