Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osdp_phy_check_packet return value for incorrect PD #43

Closed
prxvm opened this issue Feb 1, 2021 · 2 comments
Closed

osdp_phy_check_packet return value for incorrect PD #43

prxvm opened this issue Feb 1, 2021 · 2 comments

Comments

@prxvm
Copy link

prxvm commented Feb 1, 2021

Return value of osdp_phy_check_packet in case a PD receives command poll command that is not intended it for i.e. meant for a different PD, shouldn't the following code block check for ISSET_FLAG(pd, PD_FLAG_PD_MODE) instead of !ISSET_FLAG(pd, PD_FLAG_PD_MODE) ?

  /* validate PD address */
  pd_addr = pkt->pd_address & 0x7F;
  if (pd_addr != pd->address && pd_addr != 0x7F) {
    /* not addressed to us and was not broadcasted */
    if (!ISSET_FLAG(pd, PD_FLAG_PD_MODE)) {
      OSDP_LOG_ERROR("Invalid pd address %d", pd_addr);
      return OSDP_ERR_PKT_FMT;
    }
    return OSDP_ERR_PKT_SKIP;
  }
@sidcha
Copy link
Member

sidcha commented Feb 1, 2021

In PD mode, in multi-drop channels, when a PD receives a command addressed to another PD, it should not process the command: ie, should skip it and hence returns OSDP_ERR_PKT_SKIP.

On the other hand, a CP receiving a response from another PD when the channel is locked to it is treated as an error. This can happen only if a faulty PD is responding when it shouldn't.

@prxvm
Copy link
Author

prxvm commented Feb 2, 2021

Thank you for the clarification!

@prxvm prxvm closed this as completed Feb 2, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants