Loading net/bluetooth/bnep/bnep.h +73 −73 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ #include <linux/crc32.h> #include <net/bluetooth/bluetooth.h> // Limits /* Limits */ #define BNEP_MAX_PROTO_FILTERS 5 #define BNEP_MAX_MULTICAST_FILTERS 20 // UUIDs /* UUIDs */ #define BNEP_BASE_UUID 0x0000000000001000800000805F9B34FB #define BNEP_UUID16 0x02 #define BNEP_UUID32 0x04 Loading @@ -37,14 +37,14 @@ #define BNEP_SVC_NAP 0x1116 #define BNEP_SVC_GN 0x1117 // Packet types /* Packet types */ #define BNEP_GENERAL 0x00 #define BNEP_CONTROL 0x01 #define BNEP_COMPRESSED 0x02 #define BNEP_COMPRESSED_SRC_ONLY 0x03 #define BNEP_COMPRESSED_DST_ONLY 0x04 // Control types /* Control types */ #define BNEP_CMD_NOT_UNDERSTOOD 0x00 #define BNEP_SETUP_CONN_REQ 0x01 #define BNEP_SETUP_CONN_RSP 0x02 Loading @@ -53,10 +53,10 @@ #define BNEP_FILTER_MULTI_ADDR_SET 0x05 #define BNEP_FILTER_MULTI_ADDR_RSP 0x06 // Extension types /* Extension types */ #define BNEP_EXT_CONTROL 0x00 // Response messages /* Response messages */ #define BNEP_SUCCESS 0x00 #define BNEP_CONN_INVALID_DST 0x01 Loading @@ -70,14 +70,14 @@ #define BNEP_FILTER_LIMIT_REACHED 0x03 #define BNEP_FILTER_DENIED_SECURITY 0x04 // L2CAP settings /* L2CAP settings */ #define BNEP_MTU 1691 #define BNEP_PSM 0x0f #define BNEP_FLUSH_TO 0xffff #define BNEP_CONNECT_TO 15 #define BNEP_FILTER_TO 15 // Headers /* Headers */ #define BNEP_TYPE_MASK 0x7f #define BNEP_EXT_HEADER 0x80 Loading Loading @@ -114,10 +114,10 @@ struct bnep_ext_hdr { #define BNEPGETCONNINFO _IOR('B', 211, int) struct bnep_connadd_req { int sock; // Connected socket int sock; /* Connected socket */ __u32 flags; __u16 role; char device[16]; // Name of the Ethernet device char device[16]; /* Name of the Ethernet device */ }; struct bnep_conndel_req { Loading Loading @@ -148,7 +148,7 @@ int bnep_del_connection(struct bnep_conndel_req *req); int bnep_get_connlist(struct bnep_connlist_req *req); int bnep_get_conninfo(struct bnep_conninfo *ci); // BNEP sessions /* BNEP sessions */ struct bnep_session { struct list_head list; Loading @@ -173,7 +173,7 @@ void bnep_sock_cleanup(void); static inline int bnep_mc_hash(__u8 *addr) { return (crc32_be(~0, addr, ETH_ALEN) >> 26); return crc32_be(~0, addr, ETH_ALEN) >> 26; } #endif net/bluetooth/bnep/core.c +21 −16 Original line number Diff line number Diff line Loading @@ -131,7 +131,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len return -EILSEQ; n = get_unaligned_be16(data); data++; len -= 2; data++; len -= 2; if (len < n) return -EILSEQ; Loading Loading @@ -176,7 +177,8 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) return -EILSEQ; n = get_unaligned_be16(data); data += 2; len -= 2; data += 2; len -= 2; if (len < n) return -EILSEQ; Loading @@ -198,8 +200,10 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) for (; n > 0; n--) { u8 a1[6], *a2; memcpy(a1, data, ETH_ALEN); data += ETH_ALEN; a2 = data; data += ETH_ALEN; memcpy(a1, data, ETH_ALEN); data += ETH_ALEN; a2 = data; data += ETH_ALEN; BT_DBG("mc filter %s -> %s", batostr((void *) a1), batostr((void *) a2)); Loading Loading @@ -231,7 +235,8 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len) u8 cmd = *(u8 *)data; int err = 0; data++; len--; data++; len--; switch (cmd) { case BNEP_CMD_NOT_UNDERSTOOD: Loading Loading @@ -315,7 +320,8 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) dev->stats.rx_bytes += skb->len; type = *(u8 *) skb->data; skb_pull(skb, 1); type = *(u8 *) skb->data; skb_pull(skb, 1); if ((type & BNEP_TYPE_MASK) >= sizeof(__bnep_rx_hlen)) goto badframe; Loading Loading @@ -481,7 +487,7 @@ static int bnep_session(void *arg) while (!atomic_read(&s->killed)) { set_current_state(TASK_INTERRUPTIBLE); // RX /* RX */ while ((skb = skb_dequeue(&sk->sk_receive_queue))) { skb_orphan(skb); bnep_rx_frame(s, skb); Loading @@ -490,7 +496,7 @@ static int bnep_session(void *arg) if (sk->sk_state != BT_CONNECTED) break; // TX /* TX */ while ((skb = skb_dequeue(&sk->sk_write_queue))) if (bnep_tx_frame(s, skb)) break; Loading Loading @@ -574,7 +580,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) s = netdev_priv(dev); /* This is rx header therefore addresses are swapped. * ie eh.h_dest is our local address. */ * ie. eh.h_dest is our local address. */ memcpy(s->eh.h_dest, &src, ETH_ALEN); memcpy(s->eh.h_source, &dst, ETH_ALEN); memcpy(dev->dev_addr, s->eh.h_dest, ETH_ALEN); Loading @@ -600,9 +606,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) SET_NETDEV_DEVTYPE(dev, &bnep_type); err = register_netdev(dev); if (err) { if (err) goto failed; } __bnep_link_session(s); Loading Loading
net/bluetooth/bnep/bnep.h +73 −73 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ #include <linux/crc32.h> #include <net/bluetooth/bluetooth.h> // Limits /* Limits */ #define BNEP_MAX_PROTO_FILTERS 5 #define BNEP_MAX_MULTICAST_FILTERS 20 // UUIDs /* UUIDs */ #define BNEP_BASE_UUID 0x0000000000001000800000805F9B34FB #define BNEP_UUID16 0x02 #define BNEP_UUID32 0x04 Loading @@ -37,14 +37,14 @@ #define BNEP_SVC_NAP 0x1116 #define BNEP_SVC_GN 0x1117 // Packet types /* Packet types */ #define BNEP_GENERAL 0x00 #define BNEP_CONTROL 0x01 #define BNEP_COMPRESSED 0x02 #define BNEP_COMPRESSED_SRC_ONLY 0x03 #define BNEP_COMPRESSED_DST_ONLY 0x04 // Control types /* Control types */ #define BNEP_CMD_NOT_UNDERSTOOD 0x00 #define BNEP_SETUP_CONN_REQ 0x01 #define BNEP_SETUP_CONN_RSP 0x02 Loading @@ -53,10 +53,10 @@ #define BNEP_FILTER_MULTI_ADDR_SET 0x05 #define BNEP_FILTER_MULTI_ADDR_RSP 0x06 // Extension types /* Extension types */ #define BNEP_EXT_CONTROL 0x00 // Response messages /* Response messages */ #define BNEP_SUCCESS 0x00 #define BNEP_CONN_INVALID_DST 0x01 Loading @@ -70,14 +70,14 @@ #define BNEP_FILTER_LIMIT_REACHED 0x03 #define BNEP_FILTER_DENIED_SECURITY 0x04 // L2CAP settings /* L2CAP settings */ #define BNEP_MTU 1691 #define BNEP_PSM 0x0f #define BNEP_FLUSH_TO 0xffff #define BNEP_CONNECT_TO 15 #define BNEP_FILTER_TO 15 // Headers /* Headers */ #define BNEP_TYPE_MASK 0x7f #define BNEP_EXT_HEADER 0x80 Loading Loading @@ -114,10 +114,10 @@ struct bnep_ext_hdr { #define BNEPGETCONNINFO _IOR('B', 211, int) struct bnep_connadd_req { int sock; // Connected socket int sock; /* Connected socket */ __u32 flags; __u16 role; char device[16]; // Name of the Ethernet device char device[16]; /* Name of the Ethernet device */ }; struct bnep_conndel_req { Loading Loading @@ -148,7 +148,7 @@ int bnep_del_connection(struct bnep_conndel_req *req); int bnep_get_connlist(struct bnep_connlist_req *req); int bnep_get_conninfo(struct bnep_conninfo *ci); // BNEP sessions /* BNEP sessions */ struct bnep_session { struct list_head list; Loading @@ -173,7 +173,7 @@ void bnep_sock_cleanup(void); static inline int bnep_mc_hash(__u8 *addr) { return (crc32_be(~0, addr, ETH_ALEN) >> 26); return crc32_be(~0, addr, ETH_ALEN) >> 26; } #endif
net/bluetooth/bnep/core.c +21 −16 Original line number Diff line number Diff line Loading @@ -131,7 +131,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len return -EILSEQ; n = get_unaligned_be16(data); data++; len -= 2; data++; len -= 2; if (len < n) return -EILSEQ; Loading Loading @@ -176,7 +177,8 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) return -EILSEQ; n = get_unaligned_be16(data); data += 2; len -= 2; data += 2; len -= 2; if (len < n) return -EILSEQ; Loading @@ -198,8 +200,10 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) for (; n > 0; n--) { u8 a1[6], *a2; memcpy(a1, data, ETH_ALEN); data += ETH_ALEN; a2 = data; data += ETH_ALEN; memcpy(a1, data, ETH_ALEN); data += ETH_ALEN; a2 = data; data += ETH_ALEN; BT_DBG("mc filter %s -> %s", batostr((void *) a1), batostr((void *) a2)); Loading Loading @@ -231,7 +235,8 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len) u8 cmd = *(u8 *)data; int err = 0; data++; len--; data++; len--; switch (cmd) { case BNEP_CMD_NOT_UNDERSTOOD: Loading Loading @@ -315,7 +320,8 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) dev->stats.rx_bytes += skb->len; type = *(u8 *) skb->data; skb_pull(skb, 1); type = *(u8 *) skb->data; skb_pull(skb, 1); if ((type & BNEP_TYPE_MASK) >= sizeof(__bnep_rx_hlen)) goto badframe; Loading Loading @@ -481,7 +487,7 @@ static int bnep_session(void *arg) while (!atomic_read(&s->killed)) { set_current_state(TASK_INTERRUPTIBLE); // RX /* RX */ while ((skb = skb_dequeue(&sk->sk_receive_queue))) { skb_orphan(skb); bnep_rx_frame(s, skb); Loading @@ -490,7 +496,7 @@ static int bnep_session(void *arg) if (sk->sk_state != BT_CONNECTED) break; // TX /* TX */ while ((skb = skb_dequeue(&sk->sk_write_queue))) if (bnep_tx_frame(s, skb)) break; Loading Loading @@ -574,7 +580,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) s = netdev_priv(dev); /* This is rx header therefore addresses are swapped. * ie eh.h_dest is our local address. */ * ie. eh.h_dest is our local address. */ memcpy(s->eh.h_dest, &src, ETH_ALEN); memcpy(s->eh.h_source, &dst, ETH_ALEN); memcpy(dev->dev_addr, s->eh.h_dest, ETH_ALEN); Loading @@ -600,9 +606,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) SET_NETDEV_DEVTYPE(dev, &bnep_type); err = register_netdev(dev); if (err) { if (err) goto failed; } __bnep_link_session(s); Loading