In the future the L2CAP layer will have full support for fixed channels
and right now it already can export the channel assignment, but for the
functions bind() and connect() the usage of only CID 0 is allowed. This
allows an easy detection if the kernel supports fixed channels or not,
because otherwise it would impossible for application to tell.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
len = min_t(unsigned int, sizeof(la), alen);
memcpy(&la, addr, len);
+ if (la.l2_cid)
+ return -EINVAL;
+
lock_sock(sk);
if (sk->sk_state != BT_OPEN) {
struct sockaddr_l2 la;
int len, err = 0;
- lock_sock(sk);
-
BT_DBG("sk %p", sk);
- if (!addr || addr->sa_family != AF_BLUETOOTH) {
- err = -EINVAL;
- goto done;
- }
+ if (!addr || addr->sa_family != AF_BLUETOOTH)
+ return -EINVAL;
memset(&la, 0, sizeof(la));
len = min_t(unsigned int, sizeof(la), alen);
memcpy(&la, addr, len);
+ if (la.l2_cid)
+ return -EINVAL;
+
+ lock_sock(sk);
+
if (sk->sk_type == SOCK_SEQPACKET && !la.l2_psm) {
err = -EINVAL;
goto done;