dnp3 / opendnp3

DNP3 (IEEE-1815) protocol stack. Modern C++ with bindings for .NET and Java.
https://dnp3.github.io
Apache License 2.0
300 stars 231 forks source link

LinkContext does incorrectly report LinkStatus as UNRESET on link up #432

Closed petermartx closed 3 years ago

petermartx commented 3 years ago

On both OnLowerLayerUp and OnLowerLayerDown the listener is reported an UNRESET status. I think If the link is up a RESET status should be reported, as this patch suggest.

petermartx commented 3 years ago

0001-link-status-fix.txt

emgre commented 3 years ago

The UNRESET status when an link layer is brought up or down is the intended behaviour. UNRESET means the link-layer hasn't been synchronized with the other device, which is the default state at startup. Once a proper RESET_LINK_STATES will be received, than the link-layer will be RESET and synchronized , ready to receive confirmed user-data.

For more details, have a look at section 9.2.6.1 and Figure 9-8 of IEEE 1815-2012. Please also note that this UNRESET/RESET status is only useful when using confirmed link-layer user-data, which is not recommended (see section 10.2).