forked from osmocom/wireshark
6lowpan: Create ifcid from AT_ETHER
This will reassemble source and destination addresses from Bluetooth and Bluetooth LE. Change-Id: I563ef7b411488a2ba99fe2284eca0445208cf7e1 Reviewed-on: https://code.wireshark.org/review/23618 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
0d869dae1e
commit
253fcfa221
|
@ -607,6 +607,7 @@ static gboolean lowpan_dlsrc_to_ifcid (packet_info *pinfo, guint8 *ifcid);
|
|||
static gboolean lowpan_dldst_to_ifcid (packet_info *pinfo, guint8 *ifcid);
|
||||
static void lowpan_addr16_to_ifcid (guint16 addr, guint8 *ifcid);
|
||||
static void lowpan_addr16_with_panid_to_ifcid(guint16 panid, guint16 addr, guint8 *ifcid);
|
||||
static void lowpan_addr48_to_ifcid (guint8 *addr, guint8 *ifcid);
|
||||
static tvbuff_t * lowpan_reassemble_ipv6 (tvbuff_t *tvb, packet_info *pinfo, struct ws_ip6_hdr *ipv6, struct lowpan_nhdr *nhdr_list);
|
||||
static guint8 lowpan_parse_nhc_proto (tvbuff_t *tvb, gint offset);
|
||||
|
||||
|
@ -838,6 +839,39 @@ lowpan_addr16_with_panid_to_ifcid(guint16 panid, guint16 addr, guint8 *ifcid)
|
|||
ifcid[7] = (addr >> 0) & 0xff;
|
||||
} /* lowpan_addr16_with_panid_to_ifcid */
|
||||
|
||||
/*FUNCTION:------------------------------------------------------
|
||||
* NAME
|
||||
* lowpan_addr48_to_ifcid
|
||||
* DESCRIPTION
|
||||
* Converts an IEEE 48-bit MAC identifier to an interface
|
||||
* identifier as per RFC 4291 Appendix A.
|
||||
* PARAMETERS
|
||||
* addr ; 48-bit MAC identifier.
|
||||
* ifcid ; interface identifier (output).
|
||||
* RETURNS
|
||||
* void ;
|
||||
*---------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
lowpan_addr48_to_ifcid(guint8 *addr, guint8 *ifcid)
|
||||
{
|
||||
static const guint8 unknown_addr[] = { 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
/* Don't convert unknown addresses */
|
||||
if (memcmp (addr, unknown_addr, sizeof(unknown_addr)) != 0) {
|
||||
ifcid[0] = addr[0] | 0x02; /* Set the U/L bit. */
|
||||
ifcid[1] = addr[1];
|
||||
ifcid[2] = addr[2];
|
||||
ifcid[3] = 0xff;
|
||||
ifcid[4] = 0xfe;
|
||||
ifcid[5] = addr[3];
|
||||
ifcid[6] = addr[4];
|
||||
ifcid[7] = addr[5];
|
||||
} else {
|
||||
memset(ifcid, 0, LOWPAN_IFC_ID_LEN);
|
||||
}
|
||||
} /* lowpan_ether_to_ifcid */
|
||||
|
||||
/*FUNCTION:------------------------------------------------------
|
||||
* NAME
|
||||
* lowpan_dlsrc_to_ifcid
|
||||
|
@ -863,6 +897,9 @@ lowpan_dlsrc_to_ifcid(packet_info *pinfo, guint8 *ifcid)
|
|||
/* RFC2464: Invert the U/L bit when using an EUI64 address. */
|
||||
ifcid[0] ^= 0x02;
|
||||
return TRUE;
|
||||
} else if (pinfo->dl_src.type == AT_ETHER) {
|
||||
lowpan_addr48_to_ifcid((guint8 *)pinfo->dl_src.data, ifcid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Lookup the IEEE 802.15.4 addressing hints. */
|
||||
|
@ -910,6 +947,9 @@ lowpan_dldst_to_ifcid(packet_info *pinfo, guint8 *ifcid)
|
|||
/* RFC2464: Invert the U/L bit when using an EUI64 address. */
|
||||
ifcid[0] ^= 0x02;
|
||||
return TRUE;
|
||||
} else if (pinfo->dl_dst.type == AT_ETHER) {
|
||||
lowpan_addr48_to_ifcid((guint8 *)pinfo->dl_dst.data, ifcid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Lookup the IEEE 802.15.4 addressing hints. */
|
||||
|
|
Loading…
Reference in New Issue