forked from osmocom/wireshark
IP: Use pinfo for session IP addresses
The pinfo structure is sufficent for providing the src/dst address. The pinfo address data is strictly the same as the tap data, even for IP over IP. Besides the trivial code simplification we prioritize the use of pinfo over a tap, for increased type-safety and on the presumption of having a more stable implementation (in the mutability sense). Change-Id: Idcfc8c762f9af934e4612522b7472b35a01042ca Reviewed-on: https://code.wireshark.org/review/29238 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
ca355b8905
commit
bb25d64a2a
|
@ -506,12 +506,11 @@ static const char* ip_conv_get_filter_type(conv_item_t* conv, conv_filter_type_e
|
|||
static ct_dissector_info_t ip_ct_dissector_info = {&ip_conv_get_filter_type};
|
||||
|
||||
static int
|
||||
ip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
|
||||
ip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_)
|
||||
{
|
||||
conv_hash_t *hash = (conv_hash_t*) pct;
|
||||
const ws_ip4 *iph=(const ws_ip4 *)vip;
|
||||
|
||||
add_conversation_table_data(hash, &iph->ip_src, &iph->ip_dst, 0, 0, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->abs_ts, &ip_ct_dissector_info, ENDPOINT_NONE);
|
||||
add_conversation_table_data(hash, &pinfo->src, &pinfo->dst, 0, 0, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->abs_ts, &ip_ct_dissector_info, ENDPOINT_NONE);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -527,16 +526,15 @@ static const char* ip_host_get_filter_type(hostlist_talker_t* host, conv_filter_
|
|||
static hostlist_dissector_info_t ip_host_dissector_info = {&ip_host_get_filter_type};
|
||||
|
||||
static int
|
||||
ip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
|
||||
ip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_)
|
||||
{
|
||||
conv_hash_t *hash = (conv_hash_t*) pit;
|
||||
const ws_ip4 *iph=(const ws_ip4 *)vip;
|
||||
|
||||
/* Take two "add" passes per packet, adding for each direction, ensures that all
|
||||
packets are counted properly (even if address is sending to itself)
|
||||
XXX - this could probably be done more efficiently inside hostlist_table */
|
||||
add_hostlist_table_data(hash, &iph->ip_src, 0, TRUE, 1, pinfo->fd->pkt_len, &ip_host_dissector_info, ENDPOINT_NONE);
|
||||
add_hostlist_table_data(hash, &iph->ip_dst, 0, FALSE, 1, pinfo->fd->pkt_len, &ip_host_dissector_info, ENDPOINT_NONE);
|
||||
add_hostlist_table_data(hash, &pinfo->src, 0, TRUE, 1, pinfo->fd->pkt_len, &ip_host_dissector_info, ENDPOINT_NONE);
|
||||
add_hostlist_table_data(hash, &pinfo->dst, 0, FALSE, 1, pinfo->fd->pkt_len, &ip_host_dissector_info, ENDPOINT_NONE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -427,12 +427,11 @@ static const char* ipv6_conv_get_filter_type(conv_item_t* conv, conv_filter_type
|
|||
static ct_dissector_info_t ipv6_ct_dissector_info = {&ipv6_conv_get_filter_type};
|
||||
|
||||
static int
|
||||
ipv6_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
|
||||
ipv6_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_)
|
||||
{
|
||||
conv_hash_t *hash = (conv_hash_t*) pct;
|
||||
const ipv6_tap_info_t *ip6 = (const ipv6_tap_info_t *)vip;
|
||||
|
||||
add_conversation_table_data(hash, &ip6->ip6_src, &ip6->ip6_dst, 0, 0, 1,
|
||||
add_conversation_table_data(hash, &pinfo->src, &pinfo->dst, 0, 0, 1,
|
||||
pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->abs_ts,
|
||||
&ipv6_ct_dissector_info, ENDPOINT_NONE);
|
||||
|
||||
|
@ -450,14 +449,13 @@ static const char* ipv6_host_get_filter_type(hostlist_talker_t* host, conv_filte
|
|||
static hostlist_dissector_info_t ipv6_host_dissector_info = {&ipv6_host_get_filter_type};
|
||||
|
||||
static int
|
||||
ipv6_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
|
||||
ipv6_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_)
|
||||
{
|
||||
conv_hash_t *hash = (conv_hash_t*) pit;
|
||||
const ipv6_tap_info_t *ip6 = (const ipv6_tap_info_t *)vip;
|
||||
|
||||
add_hostlist_table_data(hash, &ip6->ip6_src, 0, TRUE, 1,
|
||||
add_hostlist_table_data(hash, &pinfo->src, 0, TRUE, 1,
|
||||
pinfo->fd->pkt_len, &ipv6_host_dissector_info, ENDPOINT_NONE);
|
||||
add_hostlist_table_data(hash, &ip6->ip6_dst, 0, FALSE, 1,
|
||||
add_hostlist_table_data(hash, &pinfo->dst, 0, FALSE, 1,
|
||||
pinfo->fd->pkt_len, &ipv6_host_dissector_info, ENDPOINT_NONE);
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue