forked from osmocom/wireshark
The lack of _WITH_PHDR in WTAP_ENCAP_BLUETOOTH_H4 means there's no
pseudo-header, and hence there's no direction indication. Don't set pinfo->p2p_dir for it. Use WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR, not WTAP_ENCAP_BLUETOOTH_H4, for capture files where we have the direction. Don't assume pinfo->p2p_dir is either P2P_DIR_SENT or P2P_DIR_RECV when setting the info column in various Bluetooth dissectors; it might be unknown. In the HCI H4 dissector, put the direction into the info column regardless of whether we have a type match or not; the dissectors for HCI packet types appear to assume it's been set (as they put a blank at the beginning of the stuff they append to the direction). svn path=/trunk/; revision=35933
This commit is contained in:
parent
b83634d5a9
commit
a595f69ce4
|
@ -389,7 +389,25 @@ static void dissect_btamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
guint16 cmd_length;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMP");
|
||||
col_set_str(pinfo->cinfo, COL_INFO, pinfo->p2p_dir == P2P_DIR_SENT ? "Sent " : "Rcvd ");
|
||||
switch (pinfo->p2p_dir) {
|
||||
|
||||
case P2P_DIR_SENT:
|
||||
col_add_str(pinfo->cinfo, COL_INFO, "Sent ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_RECV:
|
||||
col_add_str(pinfo->cinfo, COL_INFO, "Rcvd ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_UNKNOWN:
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
break;
|
||||
|
||||
default:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ",
|
||||
pinfo->p2p_dir);
|
||||
break;
|
||||
}
|
||||
|
||||
if(tree){
|
||||
ti=proto_tree_add_item(tree, proto_btamp, tvb, offset, -1, FALSE);
|
||||
|
|
|
@ -1095,7 +1095,25 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
void* pd_save;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2CAP");
|
||||
col_set_str(pinfo->cinfo, COL_INFO, pinfo->p2p_dir == P2P_DIR_SENT ? "Sent " : "Rcvd ");
|
||||
switch (pinfo->p2p_dir) {
|
||||
|
||||
case P2P_DIR_SENT:
|
||||
col_add_str(pinfo->cinfo, COL_INFO, "Sent ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_RECV:
|
||||
col_add_str(pinfo->cinfo, COL_INFO, "Rcvd ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_UNKNOWN:
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
break;
|
||||
|
||||
default:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ",
|
||||
pinfo->p2p_dir);
|
||||
break;
|
||||
}
|
||||
|
||||
if(tree){
|
||||
ti=proto_tree_add_item(tree, proto_btl2cap, tvb, offset, -1, FALSE);
|
||||
|
|
|
@ -490,8 +490,26 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
code = tvb_get_guint8(next_tvb, offset) & BTOBEX_CODE_VALS_MASK;
|
||||
final_flag = tvb_get_guint8(next_tvb, offset) & 0x80;
|
||||
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
|
||||
pinfo->p2p_dir==P2P_DIR_SENT?"Sent":"Rcvd",
|
||||
switch (pinfo->p2p_dir) {
|
||||
|
||||
case P2P_DIR_SENT:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Sent ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_RECV:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Rcvd ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_UNKNOWN:
|
||||
break;
|
||||
|
||||
default:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ",
|
||||
pinfo->p2p_dir);
|
||||
break;
|
||||
}
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
|
||||
val_to_str(code, code_vals, "Unknown"));
|
||||
|
||||
if( (code < BTOBEX_CODE_VALS_CONTINUE) || (code == BTOBEX_CODE_VALS_ABORT)) {
|
||||
|
|
|
@ -512,8 +512,24 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
rfcomm_tree = proto_item_add_subtree(ti, ett_btrfcomm);
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RFCOMM");
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
col_set_str(pinfo->cinfo, COL_INFO, pinfo->p2p_dir == P2P_DIR_SENT ? "Sent " : "Rcvd ");
|
||||
switch (pinfo->p2p_dir) {
|
||||
|
||||
case P2P_DIR_SENT:
|
||||
col_add_str(pinfo->cinfo, COL_INFO, "Sent ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_RECV:
|
||||
col_add_str(pinfo->cinfo, COL_INFO, "Rcvd ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_UNKNOWN:
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
break;
|
||||
|
||||
default:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ",
|
||||
pinfo->p2p_dir);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
|
|||
case WTAP_ENCAP_CHDLC_WITH_PHDR:
|
||||
case WTAP_ENCAP_PPP_WITH_PHDR:
|
||||
case WTAP_ENCAP_SDLC:
|
||||
case WTAP_ENCAP_BLUETOOTH_H4:
|
||||
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
|
||||
pinfo->p2p_dir = pinfo->pseudo_header->p2p.sent ?
|
||||
P2P_DIR_SENT : P2P_DIR_RECV;
|
||||
|
|
|
@ -69,7 +69,24 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree *hci_h4_tree=NULL;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI H4");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
switch (pinfo->p2p_dir) {
|
||||
|
||||
case P2P_DIR_SENT:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Sent ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_RECV:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Rcvd ");
|
||||
break;
|
||||
|
||||
case P2P_DIR_UNKNOWN:
|
||||
break;
|
||||
|
||||
default:
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ",
|
||||
pinfo->p2p_dir);
|
||||
break;
|
||||
}
|
||||
|
||||
type = tvb_get_guint8(tvb, 0);
|
||||
|
||||
|
@ -83,13 +100,11 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
proto_tree_add_item(hci_h4_tree, hf_hci_h4_type,
|
||||
tvb, 0, 1, TRUE);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
|
||||
val_to_str(type, hci_h4_type_vals, "Unknown HCI packet type 0x%02x"));
|
||||
|
||||
next_tvb = tvb_new_subset_remaining(tvb, 1);
|
||||
if(!dissector_try_uint(hci_h4_table, type, next_tvb, pinfo, tree)) {
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
|
||||
pinfo->p2p_dir==P2P_DIR_SENT ? "Sent" : "Rcvd",
|
||||
val_to_str(type, hci_h4_type_vals, "Unknown HCI packet type 0x%02x"));
|
||||
|
||||
call_dissector(data_handle, next_tvb, pinfo, tree);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ int btsnoop_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
*err_info = g_strdup_printf("btsnoop: H5 capture logs unsupported");
|
||||
return -1;
|
||||
case KHciLoggerDatalinkTypeH4:
|
||||
file_encap=WTAP_ENCAP_BLUETOOTH_H4;
|
||||
file_encap=WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR;
|
||||
break;
|
||||
default:
|
||||
*err = WTAP_ERR_UNSUPPORTED;
|
||||
|
@ -209,7 +209,7 @@ static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info,
|
|||
wth->phdr.ts.nsecs = (guint)((ts % 1000000) * 1000);
|
||||
wth->phdr.caplen = packet_size;
|
||||
wth->phdr.len = orig_size;
|
||||
if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_H4)
|
||||
if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR)
|
||||
{
|
||||
wth->pseudo_header.p2p.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE;
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off,
|
|||
if (!snoop_read_rec_data(wth->random_fh, pd, length, err))
|
||||
return FALSE; /* failed */
|
||||
|
||||
if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_H4)
|
||||
if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR)
|
||||
{
|
||||
pseudo_header->p2p.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ int hcidump_open(wtap *wth, int *err, gchar **err_info _U_)
|
|||
return -1;
|
||||
|
||||
wth->file_type = WTAP_FILE_HCIDUMP;
|
||||
wth->file_encap = WTAP_ENCAP_BLUETOOTH_H4;
|
||||
wth->file_encap = WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR;
|
||||
wth->snapshot_length = 0;
|
||||
|
||||
wth->subtype_read = hcidump_read;
|
||||
|
|
Loading…
Reference in New Issue