From 558f2ca7c0edee10deae529a0a399e17a7813bd7 Mon Sep 17 00:00:00 2001 From: Peter Hessler Date: Sat, 3 Sep 2016 22:51:16 +0000 Subject: handle the remaining bits of the packet we are sent --- sys/net/bfd.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'sys') diff --git a/sys/net/bfd.c b/sys/net/bfd.c index c334a393d2f..1548334eaeb 100644 --- a/sys/net/bfd.c +++ b/sys/net/bfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bfd.c,v 1.14 2016/09/03 22:24:43 phessler Exp $ */ +/* $OpenBSD: bfd.c,v 1.15 2016/09/03 22:51:15 phessler Exp $ */ /* * Copyright (c) 2016 Peter Hessler @@ -751,21 +751,29 @@ printf("%s: peer your discr 0x%x != local 0x%x\n", goto discard; sc->sc_peer->RemoteSessionState = state; - sc->sc_peer->RemoteMinRxInterval = ntohl(peer->bfd_required_min_rx_interval); + sc->sc_peer->RemoteMinRxInterval = + ntohl(peer->bfd_required_min_rx_interval); /* Local change to the algorithm, we don't accept below 10ms */ - if (sc->sc_peer->RemoteMinRxInterval < BFD_MINIMUM) + if (sc->sc_peer->RequiredMinRxInterval < BFD_MINIMUM) goto discard; - /* * Local change to the algorithm, we can't use larger than signed * 32bits for a timeout. * That is Too Long(tm) anyways. */ - if (sc->sc_peer->RemoteMinRxInterval > INT32_MAX) + if (sc->sc_peer->RequiredMinRxInterval > INT32_MAX) goto discard; - sc->minrx = sc->sc_peer->RequiredMinRxInterval; + + sc->sc_peer->DesiredMinTxInterval = + htonl(peer->bfd_desired_min_tx_interval); + if (sc->sc_peer->SessionState != BFD_STATE_UP) + sc->sc_peer->DesiredMinTxInterval = BFD_SECOND; + + sc->sc_peer->RequiredMinRxInterval = + ntohl(peer->bfd_required_min_rx_interval); + /* rfc5880 6.8.7 */ sc->mintx = max(sc->sc_peer->RemoteMinRxInterval, sc->sc_peer->DesiredMinTxInterval); -- cgit v1.2.3