aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph
diff options
context:
space:
mode:
authorTakanori Watanabe <takawata@FreeBSD.org>2017-04-27 15:03:24 +0000
committerTakanori Watanabe <takawata@FreeBSD.org>2017-04-27 15:03:24 +0000
commit4aa92fe2f385fa66a86878dd38e29cde6c28ece7 (patch)
tree118a668c3443572267cfcc3b5b43a326489a5a7b /sys/netgraph
parent791c9d7848b38e9ef3f8f1b78d0e00a2fbafa542 (diff)
Notes
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/bluetooth/hci/ng_hci_evnt.c32
-rw-r--r--sys/netgraph/bluetooth/hci/ng_hci_main.c21
-rw-r--r--sys/netgraph/bluetooth/hci/ng_hci_var.h3
-rw-r--r--sys/netgraph/bluetooth/include/ng_bluetooth.h4
-rw-r--r--sys/netgraph/bluetooth/include/ng_btsocket.h4
-rw-r--r--sys/netgraph/bluetooth/include/ng_hci.h4
6 files changed, 53 insertions, 15 deletions
diff --git a/sys/netgraph/bluetooth/hci/ng_hci_evnt.c b/sys/netgraph/bluetooth/hci/ng_hci_evnt.c
index 1c1aeee3b6b2..647bfccabaa5 100644
--- a/sys/netgraph/bluetooth/hci/ng_hci_evnt.c
+++ b/sys/netgraph/bluetooth/hci/ng_hci_evnt.c
@@ -417,7 +417,6 @@ le_advertizing_report(ng_hci_unit_p unit, struct mbuf *event)
} else
getmicrotime(&n->updated);
-#if 0
{
/*
* TODO: Make these information
@@ -425,21 +424,36 @@ le_advertizing_report(ng_hci_unit_p unit, struct mbuf *event)
*/
u_int8_t length_data;
- char *rssi;
-
- NG_HCI_M_PULLUP(event, sizeof(u_int8_t));
+ event = m_pullup(event, sizeof(u_int8_t));
+ if(event == NULL){
+ NG_HCI_WARN("%s: Event datasize Pullup Failed\n", __func__);
+ goto out;
+ }
length_data = *mtod(event, u_int8_t *);
m_adj(event, sizeof(u_int8_t));
+ n->extinq_size = (length_data < NG_HCI_EXTINQ_MAX)?
+ length_data : NG_HCI_EXTINQ_MAX;
+
/*Advertizement data*/
- NG_HCI_M_PULLUP(event, length_data);
- m_adj(event, length_data);
- NG_HCI_M_PULLUP(event, sizeof(char ));
+ event = m_pullup(event, n->extinq_size);
+ if(event == NULL){
+ NG_HCI_WARN("%s: Event data pullup Failed\n", __func__);
+ goto out;
+ }
+ m_copydata(event, 0, n->extinq_size, n->extinq_data);
+ m_adj(event, n->extinq_size);
+ event = m_pullup(event, sizeof(char ));
/*Get RSSI*/
- rssi = mtod(event, char *);
+ if(event == NULL){
+ NG_HCI_WARN("%s: Event rssi pull up Failed\n", __func__);
+
+ goto out;
+ }
+ n->page_scan_mode = *mtod(event, char *);
m_adj(event, sizeof(u_int8_t));
}
-#endif
}
+ out:
NG_FREE_M(event);
return (error);
diff --git a/sys/netgraph/bluetooth/hci/ng_hci_main.c b/sys/netgraph/bluetooth/hci/ng_hci_main.c
index 9abe595c9774..ae00ea6d18e8 100644
--- a/sys/netgraph/bluetooth/hci/ng_hci_main.c
+++ b/sys/netgraph/bluetooth/hci/ng_hci_main.c
@@ -93,7 +93,22 @@ NETGRAPH_INIT(hci, &typestruct);
MODULE_VERSION(ng_hci, NG_BLUETOOTH_VERSION);
MODULE_DEPEND(ng_hci, ng_bluetooth, NG_BLUETOOTH_VERSION,
NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION);
+static int ng_hci_linktype_to_addrtype(int linktype);
+static int ng_hci_linktype_to_addrtype(int linktype)
+{
+ switch(linktype){
+ case NG_HCI_LINK_LE_PUBLIC:
+ return BDADDR_LE_PUBLIC;
+ case NG_HCI_LINK_LE_RANDOM:
+ return BDADDR_LE_RANDOM;
+ case NG_HCI_LINK_ACL:
+ /*FALLTHROUGH*/
+ default:
+ return BDADDR_BREDR;
+ }
+ return BDADDR_BREDR;
+}
/*****************************************************************************
*****************************************************************************
** Netgraph methods implementation
@@ -481,11 +496,15 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook)
e2->page_scan_rep_mode = n->page_scan_rep_mode;
e2->page_scan_mode = n->page_scan_mode;
e2->clock_offset = n->clock_offset;
+ e2->addrtype =
+ ng_hci_linktype_to_addrtype(n->addrtype);
+ e2->extinq_size = n->extinq_size;
bcopy(&n->bdaddr, &e2->bdaddr,
sizeof(e2->bdaddr));
bcopy(&n->features, &e2->features,
sizeof(e2->features));
-
+ bcopy(&n->extinq_data, &e2->extinq_data,
+ n->extinq_size);
e2 ++;
if (--s <= 0)
break;
diff --git a/sys/netgraph/bluetooth/hci/ng_hci_var.h b/sys/netgraph/bluetooth/hci/ng_hci_var.h
index 171c437c13fe..7909ce6299b2 100644
--- a/sys/netgraph/bluetooth/hci/ng_hci_var.h
+++ b/sys/netgraph/bluetooth/hci/ng_hci_var.h
@@ -210,7 +210,8 @@ typedef struct ng_hci_neighbor {
u_int8_t page_scan_rep_mode; /* PS rep. mode */
u_int8_t page_scan_mode; /* page scan mode */
u_int16_t clock_offset; /* clock offset */
-
+ uint8_t extinq_size;
+ uint8_t extinq_data[NG_HCI_EXTINQ_MAX];
LIST_ENTRY(ng_hci_neighbor) next;
} ng_hci_neighbor_t;
typedef ng_hci_neighbor_t * ng_hci_neighbor_p;
diff --git a/sys/netgraph/bluetooth/include/ng_bluetooth.h b/sys/netgraph/bluetooth/include/ng_bluetooth.h
index 2b85facad51f..3015b9f1b9bb 100644
--- a/sys/netgraph/bluetooth/include/ng_bluetooth.h
+++ b/sys/netgraph/bluetooth/include/ng_bluetooth.h
@@ -224,5 +224,9 @@ u_int32_t bluetooth_l2cap_rtx_timeout (void);
u_int32_t bluetooth_l2cap_ertx_timeout (void);
u_int32_t bluetooth_sco_rtx_timeout (void);
+#define BDADDR_BREDR 0
+#define BDADDR_LE_PUBLIC 1
+#define BDADDR_LE_RANDOM 2
+
#endif /* _NETGRAPH_BLUETOOTH_H_ */
diff --git a/sys/netgraph/bluetooth/include/ng_btsocket.h b/sys/netgraph/bluetooth/include/ng_btsocket.h
index 4815e4373b3d..515770b3cdc0 100644
--- a/sys/netgraph/bluetooth/include/ng_btsocket.h
+++ b/sys/netgraph/bluetooth/include/ng_btsocket.h
@@ -228,10 +228,6 @@ struct sockaddr_l2cap_compat {
bdaddr_t l2cap_bdaddr; /* address */
};
-#define BDADDR_BREDR 0
-#define BDADDR_LE_PUBLIC 1
-#define BDADDR_LE_RANDOM 2
-
struct sockaddr_l2cap {
u_char l2cap_len; /* total length */
u_char l2cap_family; /* address family */
diff --git a/sys/netgraph/bluetooth/include/ng_hci.h b/sys/netgraph/bluetooth/include/ng_hci.h
index 7fe1dc7a6f0b..34cd1a68f221 100644
--- a/sys/netgraph/bluetooth/include/ng_hci.h
+++ b/sys/netgraph/bluetooth/include/ng_hci.h
@@ -80,6 +80,7 @@
#define NG_HCI_FEATURES_SIZE 8 /* LMP features */
#define NG_HCI_UNIT_NAME_SIZE 248 /* unit name size */
#define NG_HCI_COMMANDS_SIZE 64 /*Command list BMP size*/
+#define NG_HCI_EXTINQ_MAX 240 /**/
/* HCI specification */
#define NG_HCI_SPEC_V10 0x00 /* v1.0 */
#define NG_HCI_SPEC_V11 0x01 /* v1.1 */
@@ -561,6 +562,9 @@ typedef struct {
u_int16_t clock_offset; /* clock offset */
bdaddr_t bdaddr; /* bdaddr */
u_int8_t features[NG_HCI_FEATURES_SIZE]; /* features */
+ uint8_t addrtype;
+ uint8_t extinq_size; /* MAX 240*/
+ uint8_t extinq_data[NG_HCI_EXTINQ_MAX];
} ng_hci_node_neighbor_cache_entry_ep;
#define NG_HCI_MAX_NEIGHBOR_NUM \