Diff between 5014920870d92ac6f616a4eb9ba757bbf538fb22 and d280c9346cf0e3f563174433b3aca997d8d88978

Changed Files

File Additions Deletions Status
profiles/network/bnep.c +6 -0 modified
profiles/network/bnep.h +2 -0 modified
profiles/network/server.c +8 -0 modified

Full Patch

diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 54b9500..8d4786d 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 493a2b0..61971ae 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 96738f2..36a1136 100644
--- a/profiles/network/server.c
+++ b/profiles/network/server.c
@@ -331,6 +331,14 @@ 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)
+			bnep_send_unkown_rsp(sk, req->ctrl);
+
 		error("To few setup connection request data received");
 		return FALSE;
 	}