Go back to having only one SocketCAN LINKTYPE_ value.

Libpcap just backed out the "host-endian" SocketCAN LINKTYPE_ value; we
don't need it any more.

Change-Id: I33a7dc21207a0009e20b4abaefe1119eb649c39a
Reviewed-on: https://code.wireshark.org/review/17327
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-08-25 14:14:11 -07:00
parent ce9a4b212e
commit c8157aa6b4
4 changed files with 5 additions and 48 deletions

View File

@ -285,12 +285,10 @@ proto_reg_handoff_socketcan(void)
socketcan_bigendian_handle = create_dissector_handle(dissect_socketcan_bigendian,
proto_can);
dissector_add_uint("wtap_encap", WTAP_ENCAP_SOCKETCAN_BIGENDIAN,
dissector_add_uint("wtap_encap", WTAP_ENCAP_SOCKETCAN,
socketcan_bigendian_handle);
socketcan_hostendian_handle = create_dissector_handle(dissect_socketcan_hostendian,
proto_can);
dissector_add_uint("wtap_encap", WTAP_ENCAP_SOCKETCAN_HOSTENDIAN,
socketcan_hostendian_handle);
dissector_add_uint("sll.ltype", LINUX_SLL_P_CAN,
socketcan_hostendian_handle);
}

View File

@ -1123,8 +1123,7 @@
["SITA"] = 100,
["SLIP"] = 3,
["SLL"] = 25,
["SOCKETCAN_BIGENDIAN"] = 125,
["SOCKETCAN_HOSTENDIAN"] = 182,
["SOCKETCAN"] = 125,
["STANAG_4607"] = 156,
["STANAG_5066_D_PDU"] = 157,
["SYMANTEC"] = 61,

View File

@ -378,8 +378,8 @@ static const struct {
{ 225, WTAP_ENCAP_FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS },
/* Solaris IPNET */
{ 226, WTAP_ENCAP_IPNET },
/* SocketCAN frame, with CAN ID in big-endian byte order */
{ 227, WTAP_ENCAP_SOCKETCAN_BIGENDIAN },
/* SocketCAN frame */
{ 227, WTAP_ENCAP_SOCKETCAN },
/* Raw IPv4 */
{ 228, WTAP_ENCAP_RAW_IP4 },
/* Raw IPv6 */
@ -437,9 +437,6 @@ static const struct {
/* ISO14443 contactless smartcard standards */
{ 264, WTAP_ENCAP_ISO14443 },
/* SocketCAN frame, with CAN ID in host-endian byte order */
{ 265, WTAP_ENCAP_SOCKETCAN_HOSTENDIAN },
/*
* To repeat:
*
@ -1387,37 +1384,6 @@ pcap_byteswap_nflog_pseudoheader(struct wtap_pkthdr *phdr, guint8 *pd)
}
}
static void
pcap_byteswap_can_socketcan_pseudoheader(struct wtap_pkthdr *phdr, guint8 *pd)
{
guint packet_size;
struct can_socketcan_hdr *can_socketcan_phdr;
/*
* Minimum of captured and actual length (just in case the
* actual length < the captured length, which Should Never
* Happen).
*/
packet_size = phdr->caplen;
if (packet_size > phdr->len)
packet_size = phdr->len;
/*
* Greasy hack, but we never directly dereference any of
* the fields in *can_socketcan_phdr, we just get offsets
* of and addresses of its members and byte-swap it with a
* byte-at-a-time macro, so it's alignment-safe.
*/
can_socketcan_phdr = (struct can_socketcan_hdr *)(void *)pd;
if (packet_size < sizeof(can_socketcan_phdr->can_id)) {
/* Not enough data to have the full CAN ID */
return;
}
PBSWAP32((guint8 *)&can_socketcan_phdr->can_id);
}
/*
* Pseudo-header at the beginning of DLT_BLUETOOTH_HCI_H4_WITH_PHDR frames.
* Values in network byte order.
@ -2000,11 +1966,6 @@ pcap_read_post_process(int file_type, int wtap_encap,
phdr->caplen = MIN(phdr->len, phdr->caplen);
break;
case WTAP_ENCAP_SOCKETCAN_HOSTENDIAN:
if (bytes_swapped)
pcap_byteswap_can_socketcan_pseudoheader(phdr, pd);
break;
default:
break;
}

View File

@ -212,7 +212,7 @@ extern "C" {
#define WTAP_ENCAP_FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS 122
#define WTAP_ENCAP_JPEG_JFIF 123 /* obsoleted by WTAP_ENCAP_MIME*/
#define WTAP_ENCAP_IPNET 124
#define WTAP_ENCAP_SOCKETCAN_BIGENDIAN 125
#define WTAP_ENCAP_SOCKETCAN 125
#define WTAP_ENCAP_IEEE_802_11_NETMON 126
#define WTAP_ENCAP_IEEE802_15_4_NOFCS 127
#define WTAP_ENCAP_RAW_IPFIX 128
@ -269,7 +269,6 @@ extern "C" {
#define WTAP_ENCAP_GFP_F 179
#define WTAP_ENCAP_IP_OVER_IB_PCAP 180
#define WTAP_ENCAP_JUNIPER_VN 181
#define WTAP_ENCAP_SOCKETCAN_HOSTENDIAN 182
/* After adding new item here, please also add new item to encap_table_base array */
#define WTAP_NUM_ENCAP_TYPES wtap_get_num_encap_types()