forked from osmocom/wireshark
conversation: fix indent (use tabs)
Change-Id: I256c364954e1b9edd479e5f25a1d742cc216ffff Reviewed-on: https://code.wireshark.org/review/9809 Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
e4f418ce7c
commit
e482786ae8
|
@ -103,83 +103,83 @@ typedef struct _conv_proto_data {
|
||||||
static conversation_t *
|
static conversation_t *
|
||||||
conversation_create_from_template(conversation_t *conversation, const address *addr2, const guint32 port2)
|
conversation_create_from_template(conversation_t *conversation, const address *addr2, const guint32 port2)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Add a new conversation and keep the conversation template only if the
|
* Add a new conversation and keep the conversation template only if the
|
||||||
* CONVERSATION_TEMPLATE bit is set for a connection oriented protocol.
|
* CONVERSATION_TEMPLATE bit is set for a connection oriented protocol.
|
||||||
*/
|
*/
|
||||||
if(conversation->options & CONVERSATION_TEMPLATE &&
|
if(conversation->options & CONVERSATION_TEMPLATE &&
|
||||||
conversation->key_ptr->ptype != PT_UDP)
|
conversation->key_ptr->ptype != PT_UDP)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Set up a new options mask where the conversation template bit and the
|
* Set up a new options mask where the conversation template bit and the
|
||||||
* bits for absence of a second address and port pair have been removed.
|
* bits for absence of a second address and port pair have been removed.
|
||||||
*/
|
*/
|
||||||
conversation_t *new_conversation_from_template;
|
conversation_t *new_conversation_from_template;
|
||||||
guint options = conversation->options & ~(CONVERSATION_TEMPLATE | NO_ADDR2 | NO_PORT2);
|
guint options = conversation->options & ~(CONVERSATION_TEMPLATE | NO_ADDR2 | NO_PORT2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Are both the NO_ADDR2 and NO_PORT2 wildcards set in the options mask?
|
* Are both the NO_ADDR2 and NO_PORT2 wildcards set in the options mask?
|
||||||
*/
|
*/
|
||||||
if(conversation->options & NO_ADDR2 &&
|
if(conversation->options & NO_ADDR2 &&
|
||||||
conversation->options & NO_PORT2)
|
conversation->options & NO_PORT2)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The conversation template was created without knowledge of both
|
* The conversation template was created without knowledge of both
|
||||||
* the second address as well as the second port. Create a new
|
* the second address as well as the second port. Create a new
|
||||||
* conversation with new 2nd address and 2nd port.
|
* conversation with new 2nd address and 2nd port.
|
||||||
*/
|
*/
|
||||||
new_conversation_from_template =
|
new_conversation_from_template =
|
||||||
conversation_new(conversation->setup_frame,
|
conversation_new(conversation->setup_frame,
|
||||||
&conversation->key_ptr->addr1, addr2,
|
&conversation->key_ptr->addr1, addr2,
|
||||||
conversation->key_ptr->ptype, conversation->key_ptr->port1,
|
conversation->key_ptr->ptype, conversation->key_ptr->port1,
|
||||||
port2, options);
|
port2, options);
|
||||||
}
|
}
|
||||||
else if(conversation->options & NO_PORT2)
|
else if(conversation->options & NO_PORT2)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The conversation template was created without knowledge of port 2
|
* The conversation template was created without knowledge of port 2
|
||||||
* only. Create a new conversation with new 2nd port.
|
* only. Create a new conversation with new 2nd port.
|
||||||
*/
|
*/
|
||||||
new_conversation_from_template =
|
new_conversation_from_template =
|
||||||
conversation_new(conversation->setup_frame,
|
conversation_new(conversation->setup_frame,
|
||||||
&conversation->key_ptr->addr1, &conversation->key_ptr->addr2,
|
&conversation->key_ptr->addr1, &conversation->key_ptr->addr2,
|
||||||
conversation->key_ptr->ptype, conversation->key_ptr->port1,
|
conversation->key_ptr->ptype, conversation->key_ptr->port1,
|
||||||
port2, options);
|
port2, options);
|
||||||
}
|
}
|
||||||
else if(conversation->options & NO_ADDR2)
|
else if(conversation->options & NO_ADDR2)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The conversation template was created without knowledge of address
|
* The conversation template was created without knowledge of address
|
||||||
* 2. Create a new conversation with new 2nd address.
|
* 2. Create a new conversation with new 2nd address.
|
||||||
*/
|
*/
|
||||||
new_conversation_from_template =
|
new_conversation_from_template =
|
||||||
conversation_new(conversation->setup_frame,
|
conversation_new(conversation->setup_frame,
|
||||||
&conversation->key_ptr->addr1, addr2,
|
&conversation->key_ptr->addr1, addr2,
|
||||||
conversation->key_ptr->ptype, conversation->key_ptr->port1,
|
conversation->key_ptr->ptype, conversation->key_ptr->port1,
|
||||||
conversation->key_ptr->port2, options);
|
conversation->key_ptr->port2, options);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The CONVERSATION_TEMPLATE bit was set, but no other bit that the
|
* The CONVERSATION_TEMPLATE bit was set, but no other bit that the
|
||||||
* CONVERSATION_TEMPLATE bit controls is active. Just return the old
|
* CONVERSATION_TEMPLATE bit controls is active. Just return the old
|
||||||
* conversation.
|
* conversation.
|
||||||
*/
|
*/
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the protocol dissector used for the template conversation as
|
* Set the protocol dissector used for the template conversation as
|
||||||
* the handler of the new conversation as well.
|
* the handler of the new conversation as well.
|
||||||
*/
|
*/
|
||||||
new_conversation_from_template->dissector_handle = conversation->dissector_handle;
|
new_conversation_from_template->dissector_handle = conversation->dissector_handle;
|
||||||
|
|
||||||
return new_conversation_from_template;
|
return new_conversation_from_template;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -840,8 +840,8 @@ conversation_lookup_hashtable(GHashTable *hashtable, const guint32 frame_num, co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match)
|
if (match)
|
||||||
chain_head->latest_found = match;
|
chain_head->latest_found = match;
|
||||||
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
@ -887,330 +887,330 @@ conversation_t *
|
||||||
find_conversation(const guint32 frame_num, const address *addr_a, const address *addr_b, const port_type ptype,
|
find_conversation(const guint32 frame_num, const address *addr_a, const address *addr_b, const port_type ptype,
|
||||||
const guint32 port_a, const guint32 port_b, const guint options)
|
const guint32 port_a, const guint32 port_b, const guint options)
|
||||||
{
|
{
|
||||||
conversation_t *conversation;
|
conversation_t *conversation;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First try an exact match, if we have two addresses and ports.
|
* First try an exact match, if we have two addresses and ports.
|
||||||
*/
|
*/
|
||||||
if (!(options & (NO_ADDR_B|NO_PORT_B))) {
|
if (!(options & (NO_ADDR_B|NO_PORT_B))) {
|
||||||
/*
|
/*
|
||||||
* Neither search address B nor search port B are wildcarded,
|
* Neither search address B nor search port B are wildcarded,
|
||||||
* start out with an exact match.
|
* start out with an exact match.
|
||||||
*/
|
*/
|
||||||
DPRINT(("trying exact match"));
|
DPRINT(("trying exact match"));
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_exact,
|
conversation_lookup_hashtable(conversation_hashtable_exact,
|
||||||
frame_num, addr_a, addr_b, ptype,
|
frame_num, addr_a, addr_b, ptype,
|
||||||
port_a, port_b);
|
port_a, port_b);
|
||||||
/* Didn't work, try the other direction */
|
/* Didn't work, try the other direction */
|
||||||
if (conversation == NULL) {
|
if (conversation == NULL) {
|
||||||
DPRINT(("trying opposite direction"));
|
DPRINT(("trying opposite direction"));
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_exact,
|
conversation_lookup_hashtable(conversation_hashtable_exact,
|
||||||
frame_num, addr_b, addr_a, ptype,
|
frame_num, addr_b, addr_a, ptype,
|
||||||
port_b, port_a);
|
port_b, port_a);
|
||||||
}
|
}
|
||||||
if ((conversation == NULL) && (addr_a->type == AT_FC)) {
|
if ((conversation == NULL) && (addr_a->type == AT_FC)) {
|
||||||
/* In Fibre channel, OXID & RXID are never swapped as
|
/* In Fibre channel, OXID & RXID are never swapped as
|
||||||
* TCP/UDP ports are in TCP/IP.
|
* TCP/UDP ports are in TCP/IP.
|
||||||
*/
|
*/
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_exact,
|
conversation_lookup_hashtable(conversation_hashtable_exact,
|
||||||
frame_num, addr_b, addr_a, ptype,
|
frame_num, addr_b, addr_a, ptype,
|
||||||
port_a, port_b);
|
port_a, port_b);
|
||||||
}
|
}
|
||||||
DPRINT(("exact match %sfound",conversation?"":"not "));
|
DPRINT(("exact match %sfound",conversation?"":"not "));
|
||||||
if (conversation != NULL)
|
if (conversation != NULL)
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Well, that didn't find anything. Try matches that wildcard
|
* Well, that didn't find anything. Try matches that wildcard
|
||||||
* one of the addresses, if we have two ports.
|
* one of the addresses, if we have two ports.
|
||||||
*/
|
*/
|
||||||
if (!(options & NO_PORT_B)) {
|
if (!(options & NO_PORT_B)) {
|
||||||
/*
|
/*
|
||||||
* Search port B isn't wildcarded.
|
* Search port B isn't wildcarded.
|
||||||
*
|
*
|
||||||
* First try looking for a conversation with the specified
|
* First try looking for a conversation with the specified
|
||||||
* address A and port A as the first address and port, and
|
* address A and port A as the first address and port, and
|
||||||
* with any address and the specified port B as the second
|
* with any address and the specified port B as the second
|
||||||
* address and port.
|
* address and port.
|
||||||
* ("addr_b" doesn't take part in this lookup.)
|
* ("addr_b" doesn't take part in this lookup.)
|
||||||
*/
|
*/
|
||||||
DPRINT(("trying wildcarded dest address"));
|
DPRINT(("trying wildcarded dest address"));
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_addr2,
|
conversation_lookup_hashtable(conversation_hashtable_no_addr2,
|
||||||
frame_num, addr_a, addr_b, ptype, port_a, port_b);
|
frame_num, addr_a, addr_b, ptype, port_a, port_b);
|
||||||
if ((conversation == NULL) && (addr_a->type == AT_FC)) {
|
if ((conversation == NULL) && (addr_a->type == AT_FC)) {
|
||||||
/* In Fibre channel, OXID & RXID are never swapped as
|
/* In Fibre channel, OXID & RXID are never swapped as
|
||||||
* TCP/UDP ports are in TCP/IP.
|
* TCP/UDP ports are in TCP/IP.
|
||||||
*/
|
*/
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_addr2,
|
conversation_lookup_hashtable(conversation_hashtable_no_addr2,
|
||||||
frame_num, addr_b, addr_a, ptype,
|
frame_num, addr_b, addr_a, ptype,
|
||||||
port_a, port_b);
|
port_a, port_b);
|
||||||
}
|
}
|
||||||
if (conversation != NULL) {
|
if (conversation != NULL) {
|
||||||
/*
|
/*
|
||||||
* If search address B isn't wildcarded, and this is for a
|
* If search address B isn't wildcarded, and this is for a
|
||||||
* connection-oriented protocol, set the second address for this
|
* connection-oriented protocol, set the second address for this
|
||||||
* conversation to address B, as that's the address that matched the
|
* conversation to address B, as that's the address that matched the
|
||||||
* wildcarded second address for this conversation.
|
* wildcarded second address for this conversation.
|
||||||
*
|
*
|
||||||
* (This assumes that, for all connection oriented protocols, the
|
* (This assumes that, for all connection oriented protocols, the
|
||||||
* endpoints of a connection have only one address each, i.e. you
|
* endpoints of a connection have only one address each, i.e. you
|
||||||
* don't get packets in a given direction coming from more than one
|
* don't get packets in a given direction coming from more than one
|
||||||
* address, unless the CONVERSATION_TEMPLATE option is set.)
|
* address, unless the CONVERSATION_TEMPLATE option is set.)
|
||||||
*/
|
*/
|
||||||
DPRINT(("wildcarded dest address match found"));
|
DPRINT(("wildcarded dest address match found"));
|
||||||
if (!(conversation->options & NO_ADDR_B) && ptype != PT_UDP)
|
if (!(conversation->options & NO_ADDR_B) && ptype != PT_UDP)
|
||||||
{
|
{
|
||||||
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
||||||
{
|
{
|
||||||
conversation_set_addr2(conversation, addr_b);
|
conversation_set_addr2(conversation, addr_b);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
conversation =
|
conversation =
|
||||||
conversation_create_from_template(conversation, addr_b, 0);
|
conversation_create_from_template(conversation, addr_b, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Well, that didn't find anything.
|
* Well, that didn't find anything.
|
||||||
* If search address B was specified, try looking for a
|
* If search address B was specified, try looking for a
|
||||||
* conversation with the specified address B and port B as
|
* conversation with the specified address B and port B as
|
||||||
* the first address and port, and with any address and the
|
* the first address and port, and with any address and the
|
||||||
* specified port A as the second address and port (this
|
* specified port A as the second address and port (this
|
||||||
* packet may be going in the opposite direction from the
|
* packet may be going in the opposite direction from the
|
||||||
* first packet in the conversation).
|
* first packet in the conversation).
|
||||||
* ("addr_a" doesn't take part in this lookup.)
|
* ("addr_a" doesn't take part in this lookup.)
|
||||||
*/
|
*/
|
||||||
if (!(options & NO_ADDR_B)) {
|
if (!(options & NO_ADDR_B)) {
|
||||||
DPRINT(("trying dest addr:port as source addr:port with wildcarded dest addr"));
|
DPRINT(("trying dest addr:port as source addr:port with wildcarded dest addr"));
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_addr2,
|
conversation_lookup_hashtable(conversation_hashtable_no_addr2,
|
||||||
frame_num, addr_b, addr_a, ptype, port_b, port_a);
|
frame_num, addr_b, addr_a, ptype, port_b, port_a);
|
||||||
if (conversation != NULL) {
|
if (conversation != NULL) {
|
||||||
/*
|
/*
|
||||||
* If this is for a connection-oriented
|
* If this is for a connection-oriented
|
||||||
* protocol, set the second address for
|
* protocol, set the second address for
|
||||||
* this conversation to address A, as
|
* this conversation to address A, as
|
||||||
* that's the address that matched the
|
* that's the address that matched the
|
||||||
* wildcarded second address for this
|
* wildcarded second address for this
|
||||||
* conversation.
|
* conversation.
|
||||||
*/
|
*/
|
||||||
DPRINT(("match found"));
|
DPRINT(("match found"));
|
||||||
if (ptype != PT_UDP) {
|
if (ptype != PT_UDP) {
|
||||||
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
||||||
{
|
{
|
||||||
conversation_set_addr2(conversation, addr_a);
|
conversation_set_addr2(conversation, addr_a);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
conversation =
|
conversation =
|
||||||
conversation_create_from_template(conversation, addr_a, 0);
|
conversation_create_from_template(conversation, addr_a, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Well, that didn't find anything. Try matches that wildcard
|
* Well, that didn't find anything. Try matches that wildcard
|
||||||
* one of the ports, if we have two addresses.
|
* one of the ports, if we have two addresses.
|
||||||
*/
|
*/
|
||||||
if (!(options & NO_ADDR_B)) {
|
if (!(options & NO_ADDR_B)) {
|
||||||
/*
|
/*
|
||||||
* Search address B isn't wildcarded.
|
* Search address B isn't wildcarded.
|
||||||
*
|
*
|
||||||
* First try looking for a conversation with the specified
|
* First try looking for a conversation with the specified
|
||||||
* address A and port A as the first address and port, and
|
* address A and port A as the first address and port, and
|
||||||
* with the specified address B and any port as the second
|
* with the specified address B and any port as the second
|
||||||
* address and port.
|
* address and port.
|
||||||
* ("port_b" doesn't take part in this lookup.)
|
* ("port_b" doesn't take part in this lookup.)
|
||||||
*/
|
*/
|
||||||
DPRINT(("trying wildcarded dest port"));
|
DPRINT(("trying wildcarded dest port"));
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_port2,
|
conversation_lookup_hashtable(conversation_hashtable_no_port2,
|
||||||
frame_num, addr_a, addr_b, ptype, port_a, port_b);
|
frame_num, addr_a, addr_b, ptype, port_a, port_b);
|
||||||
if ((conversation == NULL) && (addr_a->type == AT_FC)) {
|
if ((conversation == NULL) && (addr_a->type == AT_FC)) {
|
||||||
/* In Fibre channel, OXID & RXID are never swapped as
|
/* In Fibre channel, OXID & RXID are never swapped as
|
||||||
* TCP/UDP ports are in TCP/IP
|
* TCP/UDP ports are in TCP/IP
|
||||||
*/
|
*/
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_port2,
|
conversation_lookup_hashtable(conversation_hashtable_no_port2,
|
||||||
frame_num, addr_b, addr_a, ptype, port_a, port_b);
|
frame_num, addr_b, addr_a, ptype, port_a, port_b);
|
||||||
}
|
}
|
||||||
if (conversation != NULL) {
|
if (conversation != NULL) {
|
||||||
/*
|
/*
|
||||||
* If search port B isn't wildcarded, and this is for a connection-
|
* If search port B isn't wildcarded, and this is for a connection-
|
||||||
* oriented protocol, set the second port for this conversation to
|
* oriented protocol, set the second port for this conversation to
|
||||||
* port B, as that's the port that matched the wildcarded second port
|
* port B, as that's the port that matched the wildcarded second port
|
||||||
* for this conversation.
|
* for this conversation.
|
||||||
*
|
*
|
||||||
* (This assumes that, for all connection oriented protocols, the
|
* (This assumes that, for all connection oriented protocols, the
|
||||||
* endpoints of a connection have only one port each, i.e. you don't
|
* endpoints of a connection have only one port each, i.e. you don't
|
||||||
* get packets in a given direction coming from more than one port,
|
* get packets in a given direction coming from more than one port,
|
||||||
* unless the CONVERSATION_TEMPLATE option is set.)
|
* unless the CONVERSATION_TEMPLATE option is set.)
|
||||||
*/
|
*/
|
||||||
DPRINT(("match found"));
|
DPRINT(("match found"));
|
||||||
if (!(conversation->options & NO_PORT_B) && ptype != PT_UDP)
|
if (!(conversation->options & NO_PORT_B) && ptype != PT_UDP)
|
||||||
{
|
{
|
||||||
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
||||||
{
|
{
|
||||||
conversation_set_port2(conversation, port_b);
|
conversation_set_port2(conversation, port_b);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
conversation =
|
conversation =
|
||||||
conversation_create_from_template(conversation, 0, port_b);
|
conversation_create_from_template(conversation, 0, port_b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Well, that didn't find anything.
|
* Well, that didn't find anything.
|
||||||
* If search port B was specified, try looking for a
|
* If search port B was specified, try looking for a
|
||||||
* conversation with the specified address B and port B
|
* conversation with the specified address B and port B
|
||||||
* as the first address and port, and with the specified
|
* as the first address and port, and with the specified
|
||||||
* address A and any port as the second address and port
|
* address A and any port as the second address and port
|
||||||
* (this packet may be going in the opposite direction
|
* (this packet may be going in the opposite direction
|
||||||
* from the first packet in the conversation).
|
* from the first packet in the conversation).
|
||||||
* ("port_a" doesn't take part in this lookup.)
|
* ("port_a" doesn't take part in this lookup.)
|
||||||
*/
|
*/
|
||||||
if (!(options & NO_PORT_B)) {
|
if (!(options & NO_PORT_B)) {
|
||||||
DPRINT(("trying dest addr:port as source addr:port and wildcarded dest port"));
|
DPRINT(("trying dest addr:port as source addr:port and wildcarded dest port"));
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_port2,
|
conversation_lookup_hashtable(conversation_hashtable_no_port2,
|
||||||
frame_num, addr_b, addr_a, ptype, port_b, port_a);
|
frame_num, addr_b, addr_a, ptype, port_b, port_a);
|
||||||
if (conversation != NULL) {
|
if (conversation != NULL) {
|
||||||
/*
|
/*
|
||||||
* If this is for a connection-oriented
|
* If this is for a connection-oriented
|
||||||
* protocol, set the second port for
|
* protocol, set the second port for
|
||||||
* this conversation to port A, as
|
* this conversation to port A, as
|
||||||
* that's the address that matched the
|
* that's the address that matched the
|
||||||
* wildcarded second address for this
|
* wildcarded second address for this
|
||||||
* conversation.
|
* conversation.
|
||||||
*/
|
*/
|
||||||
DPRINT(("match found"));
|
DPRINT(("match found"));
|
||||||
if (ptype != PT_UDP)
|
if (ptype != PT_UDP)
|
||||||
{
|
{
|
||||||
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
||||||
{
|
{
|
||||||
conversation_set_port2(conversation, port_a);
|
conversation_set_port2(conversation, port_a);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
conversation =
|
conversation =
|
||||||
conversation_create_from_template(conversation, 0, port_a);
|
conversation_create_from_template(conversation, 0, port_a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Well, that didn't find anything. Try matches that wildcard
|
* Well, that didn't find anything. Try matches that wildcard
|
||||||
* one address/port pair.
|
* one address/port pair.
|
||||||
*
|
*
|
||||||
* First try looking for a conversation with the specified address A
|
* First try looking for a conversation with the specified address A
|
||||||
* and port A as the first address and port.
|
* and port A as the first address and port.
|
||||||
* (Neither "addr_b" nor "port_b" take part in this lookup.)
|
* (Neither "addr_b" nor "port_b" take part in this lookup.)
|
||||||
*/
|
*/
|
||||||
DPRINT(("trying wildcarding dest addr:port"));
|
DPRINT(("trying wildcarding dest addr:port"));
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_addr2_or_port2,
|
conversation_lookup_hashtable(conversation_hashtable_no_addr2_or_port2,
|
||||||
frame_num, addr_a, addr_b, ptype, port_a, port_b);
|
frame_num, addr_a, addr_b, ptype, port_a, port_b);
|
||||||
if (conversation != NULL) {
|
if (conversation != NULL) {
|
||||||
/*
|
/*
|
||||||
* If this is for a connection-oriented protocol:
|
* If this is for a connection-oriented protocol:
|
||||||
*
|
*
|
||||||
* if search address B isn't wildcarded, set the
|
* if search address B isn't wildcarded, set the
|
||||||
* second address for this conversation to address
|
* second address for this conversation to address
|
||||||
* B, as that's the address that matched the
|
* B, as that's the address that matched the
|
||||||
* wildcarded second address for this conversation;
|
* wildcarded second address for this conversation;
|
||||||
*
|
*
|
||||||
* if search port B isn't wildcarded, set the
|
* if search port B isn't wildcarded, set the
|
||||||
* second port for this conversation to port B,
|
* second port for this conversation to port B,
|
||||||
* as that's the port that matched the wildcarded
|
* as that's the port that matched the wildcarded
|
||||||
* second port for this conversation.
|
* second port for this conversation.
|
||||||
*/
|
*/
|
||||||
DPRINT(("match found"));
|
DPRINT(("match found"));
|
||||||
if (ptype != PT_UDP)
|
if (ptype != PT_UDP)
|
||||||
{
|
{
|
||||||
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
||||||
{
|
{
|
||||||
if (!(conversation->options & NO_ADDR_B))
|
if (!(conversation->options & NO_ADDR_B))
|
||||||
conversation_set_addr2(conversation, addr_b);
|
conversation_set_addr2(conversation, addr_b);
|
||||||
if (!(conversation->options & NO_PORT_B))
|
if (!(conversation->options & NO_PORT_B))
|
||||||
conversation_set_port2(conversation, port_b);
|
conversation_set_port2(conversation, port_b);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
conversation =
|
conversation =
|
||||||
conversation_create_from_template(conversation, addr_b, port_b);
|
conversation_create_from_template(conversation, addr_b, port_b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Well, that didn't find anything.
|
* Well, that didn't find anything.
|
||||||
* If search address and port B were specified, try looking for a
|
* If search address and port B were specified, try looking for a
|
||||||
* conversation with the specified address B and port B as the
|
* conversation with the specified address B and port B as the
|
||||||
* first address and port, and with any second address and port
|
* first address and port, and with any second address and port
|
||||||
* (this packet may be going in the opposite direction from the
|
* (this packet may be going in the opposite direction from the
|
||||||
* first packet in the conversation).
|
* first packet in the conversation).
|
||||||
* (Neither "addr_a" nor "port_a" take part in this lookup.)
|
* (Neither "addr_a" nor "port_a" take part in this lookup.)
|
||||||
*/
|
*/
|
||||||
DPRINT(("trying dest addr:port as source addr:port and wildcarding dest addr:port"));
|
DPRINT(("trying dest addr:port as source addr:port and wildcarding dest addr:port"));
|
||||||
if (addr_a->type == AT_FC)
|
if (addr_a->type == AT_FC)
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_addr2_or_port2,
|
conversation_lookup_hashtable(conversation_hashtable_no_addr2_or_port2,
|
||||||
frame_num, addr_b, addr_a, ptype, port_a, port_b);
|
frame_num, addr_b, addr_a, ptype, port_a, port_b);
|
||||||
else
|
else
|
||||||
conversation =
|
conversation =
|
||||||
conversation_lookup_hashtable(conversation_hashtable_no_addr2_or_port2,
|
conversation_lookup_hashtable(conversation_hashtable_no_addr2_or_port2,
|
||||||
frame_num, addr_b, addr_a, ptype, port_b, port_a);
|
frame_num, addr_b, addr_a, ptype, port_b, port_a);
|
||||||
if (conversation != NULL) {
|
if (conversation != NULL) {
|
||||||
/*
|
/*
|
||||||
* If this is for a connection-oriented protocol, set the
|
* If this is for a connection-oriented protocol, set the
|
||||||
* second address for this conversation to address A, as
|
* second address for this conversation to address A, as
|
||||||
* that's the address that matched the wildcarded second
|
* that's the address that matched the wildcarded second
|
||||||
* address for this conversation, and set the second port
|
* address for this conversation, and set the second port
|
||||||
* for this conversation to port A, as that's the port
|
* for this conversation to port A, as that's the port
|
||||||
* that matched the wildcarded second port for this
|
* that matched the wildcarded second port for this
|
||||||
* conversation.
|
* conversation.
|
||||||
*/
|
*/
|
||||||
DPRINT(("match found"));
|
DPRINT(("match found"));
|
||||||
if (ptype != PT_UDP)
|
if (ptype != PT_UDP)
|
||||||
{
|
{
|
||||||
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
if(!(conversation->options & CONVERSATION_TEMPLATE))
|
||||||
{
|
{
|
||||||
conversation_set_addr2(conversation, addr_a);
|
conversation_set_addr2(conversation, addr_a);
|
||||||
conversation_set_port2(conversation, port_a);
|
conversation_set_port2(conversation, port_a);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
conversation = conversation_create_from_template(conversation, addr_a, port_a);
|
conversation = conversation_create_from_template(conversation, addr_a, port_a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT(("no matches found"));
|
DPRINT(("no matches found"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We found no conversation.
|
* We found no conversation.
|
||||||
*/
|
*/
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
|
Loading…
Reference in New Issue