This change is required for passing below PTS testcase: 1. BNEP/CTRL/BV-01-C PTS sends an Unknown Control Message with only two bytes, which is considered incorrect data. Therefore, add responses to error control commands. Signed-off-by: Shuai Zhang <quic_shuaz@xxxxxxxxxxx> --- profiles/network/bnep.c | 6 ++++++ profiles/network/bnep.h | 2 ++ profiles/network/server.c | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c index 54b950058..8d4786d45 100644 --- a/profiles/network/bnep.c +++ b/profiles/network/bnep.c @@ -726,3 +726,9 @@ void bnep_server_delete(char *bridge, char *iface, const bdaddr_t *addr) bnep_if_down(iface); bnep_conndel(addr); } + +int bnep_send_unkown_rsp(int sk, uint16_t resp) +{ + return bnep_send_ctrl_rsp(sk, BNEP_CMD_NOT_UNDERSTOOD, + resp); +} diff --git a/profiles/network/bnep.h b/profiles/network/bnep.h index 493a2b036..61971ae0b 100644 --- a/profiles/network/bnep.h +++ b/profiles/network/bnep.h @@ -27,3 +27,5 @@ void bnep_disconnect(struct bnep *session); int bnep_server_add(int sk, char *bridge, char *iface, const bdaddr_t *addr, uint8_t *setup_data, int len); void bnep_server_delete(char *bridge, char *iface, const bdaddr_t *addr); +int bnep_send_unkown_rsp(int sk, uint16_t resp); + diff --git a/profiles/network/server.c b/profiles/network/server.c index 96738f26c..7d84b6a1a 100644 --- a/profiles/network/server.c +++ b/profiles/network/server.c @@ -331,6 +331,17 @@ static gboolean bnep_setup(GIOChannel *chan, * 1 byte of BNEP Control Type + 1 byte of BNEP services UUID size. */ if (n < 3) { + + /* Added a response to the error control command + * This packet reply to any control message received, + * which contains an unknown BNEP control type value. + */ + if (req->ctrl == BNEP_CONTROL) { + if (bnep_send_unkown_rsp(sk, req->ctrl) < 0) + error("send not understood ctrl rsp error: %s (%d)", + strerror(errno), errno); + } + error("To few setup connection request data received"); return FALSE; } -- 2.25.1