"man inet_pton" only says that it returns a negative value, zero or a postive value, and not specifically -1, 0, or 1, so even though we know that's what wsutil's inet_pton will return, we shouldn't test against those exact values.

svn path=/trunk/; revision=50670
This commit is contained in:
Chris Maynard 2013-07-16 16:23:31 +00:00
parent bb05898720
commit 91ecc2334f
9 changed files with 110 additions and 113 deletions

View File

@ -167,10 +167,10 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void))
addr_parts = g_strsplit(if_parts[4], ",", 0);
for (j = 0; addr_parts[j] != NULL; j++) {
if_addr = g_new0(if_addr_t,1);
if (inet_pton(AF_INET, addr_parts[j], &if_addr->addr.ip4_addr)) {
if (inet_pton(AF_INET, addr_parts[j], &if_addr->addr.ip4_addr) > 0) {
if_addr->ifat_type = IF_AT_IPv4;
} else if (inet_pton(AF_INET6, addr_parts[j],
&if_addr->addr.ip6_addr)) {
&if_addr->addr.ip6_addr) > 0) {
if_addr->ifat_type = IF_AT_IPv6;
} else {
g_free(if_addr);

View File

@ -1845,7 +1845,7 @@ cap_open_socket(char *pipename, pcap_options *pcap_opts, char *errmsg, int errms
strncpy(buf, sockname, len);
buf[len] = '\0';
if (!inet_pton(AF_INET, buf, &sa.sin_addr)) {
if (inet_pton(AF_INET, buf, &sa.sin_addr) <= 0) {
goto fail_invalid;
}

View File

@ -2046,14 +2046,14 @@ read_hosts_file (const char *hostspath)
continue; /* no tokens in the line */
ret = inet_pton(AF_INET6, cp, &host_addr);
if (ret == -1)
if (ret < 0)
continue; /* error parsing */
if (ret == 1) {
if (ret > 0) {
/* Valid IPv6 */
is_ipv6 = TRUE;
} else {
/* Not valid IPv6 - valid IPv4? */
if (inet_pton(AF_INET, cp, &host_addr) != 1)
if (inet_pton(AF_INET, cp, &host_addr) <= 0)
continue; /* no */
is_ipv6 = FALSE;
}
@ -2120,16 +2120,16 @@ add_ip_name_from_string (const char *addr, const char *name)
int ret;
ret = inet_pton(AF_INET6, addr, &ip6_addr);
if (ret == -1)
if (ret < 0)
/* Error parsing address */
return FALSE;
if (ret == 1) {
if (ret > 0) {
/* Valid IPv6 */
is_ipv6 = TRUE;
} else {
/* Not valid IPv6 - valid IPv4? */
if (inet_pton(AF_INET, addr, &host_addr) != 1)
if (inet_pton(AF_INET, addr, &host_addr) <= 0)
return FALSE; /* no */
is_ipv6 = FALSE;
}
@ -2193,7 +2193,7 @@ read_subnets_file (const char *subnetspath)
++cp2 ;
/* Check if this is a valid IPv4 address */
if (inet_pton(AF_INET, cp, &host_addr) != 1) {
if (inet_pton(AF_INET, cp, &host_addr) <= 0) {
continue; /* no */
}
@ -3332,7 +3332,7 @@ get_host_ipaddr6(const char *host, struct e_in6_addr *addrp)
struct hostent *hp;
#endif /* HAVE_C_ARES */
if (inet_pton(AF_INET6, host, addrp) == 1)
if (inet_pton(AF_INET6, host, addrp) > 0)
return TRUE;
/* It's not a valid dotted-quad IP address; is it a valid

View File

@ -2830,7 +2830,7 @@ prefs_6lowpan_apply(void)
for (i = 0; i < LOWPAN_CONTEXT_MAX; i++) {
if (!lowpan_context_prefs[i]) continue;
if (inet_pton(AF_INET6, lowpan_context_prefs[i], &prefix) != 1) continue;
if (inet_pton(AF_INET6, lowpan_context_prefs[i], &prefix) <= 0) continue;
/* Set the prefix */
lowpan_context_insert(i, IEEE802154_BCAST_PAN, 64, &prefix, 0);
} /* for */

View File

@ -451,7 +451,7 @@ proto_reg_handoff_fcoib(void)
SET_ADDRESS(&manual_addr[i], AT_IB, sizeof(guint16), manual_addr_data[i]);
}
} else { /* GID */
if (! inet_pton(AF_INET6, gPREF_ID[i], manual_addr_data[i]) ) {
if (inet_pton(AF_INET6, gPREF_ID[i], manual_addr_data[i]) <= 0) {
error_occured = TRUE;
} else {
SET_ADDRESS(&manual_addr[i], AT_IB, GID_SIZE, manual_addr_data[i]);

View File

@ -253,11 +253,11 @@ parse_port_pasv(const guchar *line, int linelen, guint32 *ftp_ip, guint16 *ftp_p
*/
*ftp_port = ((port[0] & 0xFF)<<8) | (port[1] & 0xFF);
*ftp_ip = g_htonl((ip_address[0] << 24) | (ip_address[1] <<16) | (ip_address[2] <<8) | ip_address[3]);
*pasv_offset = (guint32)(p - args);
*ftp_port_len = (port[0] < 10 ? 1 : (port[0] < 100 ? 2 : 3 )) + 1 +
*pasv_offset = (guint32)(p - args);
*ftp_port_len = (port[0] < 10 ? 1 : (port[0] < 100 ? 2 : 3 )) + 1 +
(port[1] < 10 ? 1 : (port[1] < 100 ? 2 : 3 ));
*ftp_ip_len = (ip_address[0] < 10 ? 1 : (ip_address[0] < 100 ? 2 : 3)) + 1 +
(ip_address[1] < 10 ? 1 : (ip_address[1] < 100 ? 2 : 3)) + 1 +
*ftp_ip_len = (ip_address[0] < 10 ? 1 : (ip_address[0] < 100 ? 2 : 3)) + 1 +
(ip_address[1] < 10 ? 1 : (ip_address[1] < 100 ? 2 : 3)) + 1 +
(ip_address[2] < 10 ? 1 : (ip_address[2] < 100 ? 2 : 3)) + 1 +
(ip_address[3] < 10 ? 1 : (ip_address[3] < 100 ? 2 : 3));
ret = TRUE;
@ -292,37 +292,37 @@ isvalid_rfc2428_delimiter(const guchar c)
/*
* RFC2428 states...
*
* AF Number Protocol
* --------- --------
* 1 Internet Protocol, Version 4
* 2 Internet Protocol, Version 6
*
* AF Number Address Format Example
* --------- -------------- -------
* 1 dotted decimal 132.235.1.2
* 2 IPv6 string 1080::8:800:200C:417A
* representations
* defined in
*
* The following are sample EPRT commands:
* EPRT |1|132.235.1.2|6275|
* AF Number Protocol
* --------- --------
* 1 Internet Protocol, Version 4
* 2 Internet Protocol, Version 6
*
* AF Number Address Format Example
* --------- -------------- -------
* 1 dotted decimal 132.235.1.2
* 2 IPv6 string 1080::8:800:200C:417A
* representations
* defined in
*
* The following are sample EPRT commands:
* EPRT |1|132.235.1.2|6275|
* EPRT |2|1080::8:800:200C:417A|5282|
*
* The first command specifies that the server should use IPv4 to open a
* data connection to the host "132.235.1.2" on TCP port 6275. The
* second command specifies that the server should use the IPv6 network
* protocol and the network address "1080::8:800:200C:417A" to open a
*
* The first command specifies that the server should use IPv4 to open a
* data connection to the host "132.235.1.2" on TCP port 6275. The
* second command specifies that the server should use the IPv6 network
* protocol and the network address "1080::8:800:200C:417A" to open a
* TCP data connection on port 5282.
*
* ... which means in fact that RFC2428 is capable to handle both,
*
* ... which means in fact that RFC2428 is capable to handle both,
* IPv4 and IPv6 so we have to care about the address family and properly
* act depending on it.
*
*
*/
static gboolean
parse_eprt_request(const guchar* line, gint linelen, guint32 *eprt_af,
guint32 *eprt_ip, guint16 *eprt_ipv6, guint16 *ftp_port,
guint32 *eprt_ip_len, guint32 *ftp_port_len)
parse_eprt_request(const guchar* line, gint linelen, guint32 *eprt_af,
guint32 *eprt_ip, guint16 *eprt_ipv6, guint16 *ftp_port,
guint32 *eprt_ip_len, guint32 *ftp_port_len)
{
gint delimiters_seen = 0;
gchar delimiter;
@ -344,7 +344,7 @@ parse_eprt_request(const guchar* line, gint linelen, guint32 *eprt_af,
/*
* RFC2428 sect. 2 states ...
*
*
* The EPRT command keyword MUST be followed by a single space (ASCII
* 32). Following the space, a delimiter character (<d>) MUST be
* specified.
@ -356,14 +356,14 @@ parse_eprt_request(const guchar* line, gint linelen, guint32 *eprt_af,
return FALSE; /* EPRT command does not follow a vaild delimiter;
* malformed EPRT command - immediate escape */
delimiter = *p;
delimiter = *p;
/* Validate that the delimiter occurs 4 times in the string */
for (n = 0; n < linelen; n++) {
if (*(p+n) == delimiter)
if (*(p+n) == delimiter)
delimiters_seen++;
}
if (delimiters_seen != 4)
return FALSE; /* delimiter doesn't occur 4 times
return FALSE; /* delimiter doesn't occur 4 times
* probably no EPRT request - immediate escape */
/* we know that the first character is a delimiter... */
@ -393,13 +393,13 @@ parse_eprt_request(const guchar* line, gint linelen, guint32 *eprt_af,
ip_str = ep_strndup(field, fieldlen);
if (*eprt_af == EPRT_AF_IPv4) {
if (inet_pton(AF_INET, ip_str, eprt_ip) == 1)
if (inet_pton(AF_INET, ip_str, eprt_ip) > 0)
ret = TRUE;
else
ret = FALSE;
}
else if (*eprt_af == EPRT_AF_IPv6) {
if (inet_pton(AF_INET6, ip_str, eprt_ipv6) == 1)
if (inet_pton(AF_INET6, ip_str, eprt_ipv6) > 0)
ret = TRUE;
else
ret = FALSE;
@ -426,24 +426,24 @@ parse_eprt_request(const guchar* line, gint linelen, guint32 *eprt_af,
/*
* RFC2428 states ....
*
* The first two fields contained in the parenthesis MUST be blank. The
* third field MUST be the string representation of the TCP port number
* on which the server is listening for a data connection.
*
* The first two fields contained in the parenthesis MUST be blank. The
* third field MUST be the string representation of the TCP port number
* on which the server is listening for a data connection.
*
* The network protocol used by the data connection will be the same network
* protocol used by the control connection. In addition, the network
* address used to establish the data connection will be the same
* protocol used by the control connection. In addition, the network
* address used to establish the data connection will be the same
* network address used for the control connection.
*
* An example response string follows:
*
*
* An example response string follows:
*
* Entering Extended Passive Mode (|||6446|)
*
*
* ... which in fact means that again both address families IPv4 and IPv6
* are supported. But gladly it's not necessary to parse because it doesn't
* occur in EPSV responses. We can leverage ftp_ip_address which is
* occur in EPSV responses. We can leverage ftp_ip_address which is
* protocol independent and already set.
*
*
*/
static gboolean
parse_extended_pasv_response(const guchar *line, gint linelen, guint16 *ftp_port,

View File

@ -551,7 +551,7 @@ proto_reg_handoff_ib_sdp(void)
SET_ADDRESS(&manual_addr[i], AT_IB, sizeof(guint16), manual_addr_data[i]);
}
} else { /* GID */
if (! inet_pton(AF_INET6, gPREF_ID[i], manual_addr_data[i]) ) {
if (inet_pton(AF_INET6, gPREF_ID[i], manual_addr_data[i]) <= 0) {
error_occured = TRUE;
} else {
SET_ADDRESS(&manual_addr[i], AT_IB, GID_SIZE, manual_addr_data[i]);

View File

@ -1120,7 +1120,7 @@ static gint find_sdp_media_attribute_names(tvbuff_t *tvb, int offset, guint len)
return -1;
}
static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto_item * ti, int length,
static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto_item * ti, int length,
transport_info_t *transport_info, disposable_media_info_t *media_info) {
proto_tree *sdp_media_attribute_tree, *parameter_item;
proto_item *fmtp_item, *media_format_item, *parameter_tree;
@ -1352,10 +1352,10 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
if (port_offset!= -1) {
/* Port ends with '/' */
port_end_offset = tvb_find_guint8(tvb, port_offset, -1, '/');
if (port_end_offset == -1) {
/* No "/" look for the ";" */
port_end_offset = tvb_find_guint8(tvb, port_offset, -1, ';');;
}
if (port_end_offset == -1) {
/* No "/" look for the ";" */
port_end_offset = tvb_find_guint8(tvb, port_offset, -1, ';');;
}
/* Attempt to convert address */
if (inet_pton(AF_INET,
(char*)tvb_get_ephemeral_string(tvb, address_offset, port_offset-address_offset),
@ -1421,10 +1421,10 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
/* We are at the first colon */
/* tag */
next_offset = tvb_find_guint8(tvb, offset, -1, ' ');
if(next_offset==-1){
/* XXX Add expert item? */
return;
}
if(next_offset==-1){
/* XXX Add expert item? */
return;
}
tokenlen = next_offset - offset;
proto_tree_add_uint(sdp_media_attribute_tree, hf_sdp_crypto_tag, tvb, offset, tokenlen,
atoi((char*)tvb_get_ephemeral_string(tvb, offset, tokenlen)));
@ -1432,10 +1432,10 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
/* crypto-suite */
next_offset = tvb_find_guint8(tvb, offset, -1, ' ');
if(next_offset==-1){
/* XXX Add expert item? */
return;
}
if(next_offset==-1){
/* XXX Add expert item? */
return;
}
tokenlen = next_offset - offset;
parameter_item = proto_tree_add_item(sdp_media_attribute_tree, hf_sdp_crypto_crypto_suite,
tvb, offset, tokenlen, ENC_ASCII|ENC_NA);
@ -1492,9 +1492,9 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
}
if (tvb_strncaseeql(tvb, offset, "inline", next_offset-offset) == 0) {
parameter_item = proto_tree_add_text(sdp_media_attribute_tree,
tvb, offset, param_end_offset-offset, "Key parameters");
parameter_tree = proto_item_add_subtree(parameter_item, ett_sdp_crypto_key_parameters);
parameter_item = proto_tree_add_text(sdp_media_attribute_tree,
tvb, offset, param_end_offset-offset, "Key parameters");
parameter_tree = proto_item_add_subtree(parameter_item, ett_sdp_crypto_key_parameters);
/* XXX only for SRTP? */
/* srtp-key-info = key-salt ["|" lifetime] ["|" mki] */
offset = next_offset +1;
@ -1537,11 +1537,11 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
*
* mki-value = 1*DIGIT
*/
if(offset>param_end_offset){
next_offset = -1;
}else{
next_offset = tvb_find_guint8(tvb, offset, -1, ':');
}
if(offset>param_end_offset){
next_offset = -1;
}else{
next_offset = tvb_find_guint8(tvb, offset, -1, ':');
}
if (next_offset != -1) {
tokenlen = next_offset - offset;
proto_tree_add_item(parameter_tree, hf_sdp_crypto_mki, tvb, offset, tokenlen, ENC_ASCII|ENC_NA);
@ -1560,7 +1560,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
}
offset = param_end_offset;
} else {
break;
break;
}
}
@ -1663,7 +1663,7 @@ convert_disposable_media(transport_info_t* transport_info, disposable_media_info
(media_info->connection_type != NULL)) {
if (strcmp(media_info->connection_type, "IP4") == 0) {
transport_info->src_addr[transport_index].data = se_alloc(4);
if (inet_pton(AF_INET, media_info->connection_address, (void*)transport_info->src_addr[transport_index].data) == 1) {
if (inet_pton(AF_INET, media_info->connection_address, (void*)transport_info->src_addr[transport_index].data) > 0) {
/* connection_address could be converted to a valid ipv4 address*/
transport_info->proto_bitmask[transport_index] |= SDP_IPv4;
transport_info->src_addr[transport_index].type = AT_IPv4;
@ -1671,7 +1671,7 @@ convert_disposable_media(transport_info_t* transport_info, disposable_media_info
}
} else if (strcmp(media_info->connection_type, "IP6") == 0) {
transport_info->src_addr[transport_index].data = se_alloc(16);
if (inet_pton(AF_INET6, media_info->connection_address, (void*)transport_info->src_addr[transport_index].data) == 1) {
if (inet_pton(AF_INET6, media_info->connection_address, (void*)transport_info->src_addr[transport_index].data) > 0) {
/* connection_address could be converted to a valid ipv6 address*/
transport_info->proto_bitmask[transport_index] |= SDP_IPv6;
transport_info->src_addr[transport_index].type = AT_IPv6;
@ -1741,7 +1741,7 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
se_tree_insert32(sdp_transport_rsps, pinfo->fd->num, (void *)transport_info);
/* Offer has already been answered or rejected and hash tables freed, so
* don't try to add to it
* don't try to add to it
* XXX - Need to support "modified offers" */
if ((transport_info->sdp_status == SDP_EXCHANGE_ANSWER_REJECT) ||
(transport_info->sdp_status == SDP_EXCHANGE_ANSWER_ACCEPT))
@ -1781,11 +1781,11 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
break;
case 'm':
hf = hf_media;
/* Increase the count of media channels, but don't walk off the end of the arrays. */
if (((transport_info->media_count < 0) && (in_media_description == FALSE)) || (transport_info->media_count < (SDP_MAX_RTP_CHANNELS-1)))
transport_info->media_count++;
if (in_media_description && (media_info.media_count < (SDP_MAX_RTP_CHANNELS-1)))
media_info.media_count++;
@ -1829,14 +1829,14 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
convert_disposable_media(transport_info, &media_info, start_transport_info_count);
/* We have a successful negotiation, apply data to their respective protocols */
if ((exchange_type == SDP_EXCHANGE_ANSWER_ACCEPT) &&
if ((exchange_type == SDP_EXCHANGE_ANSWER_ACCEPT) &&
(transport_info->sdp_status == SDP_EXCHANGE_OFFER)) {
for (n = 0; n <= transport_info->media_count; n++) {
guint32 current_rtp_port = 0;
/* Add (s)rtp and (s)rtcp conversation, if available (overrides t38 if conversation already set) */
if ((transport_info->media_port[n] != 0) &&
(transport_info->proto_bitmask[n] & (SDP_RTP_PROTO|SDP_SRTP_PROTO)) &&
if ((transport_info->media_port[n] != 0) &&
(transport_info->proto_bitmask[n] & (SDP_RTP_PROTO|SDP_SRTP_PROTO)) &&
(transport_info->proto_bitmask[n] & (SDP_IPv4|SDP_IPv6))) {
if (rtp_handle) {
if (transport_info->proto_bitmask[n] & SDP_SRTP_PROTO) {
@ -1870,7 +1870,7 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
}
/* add SPRT conversation */
if ((transport_info->proto_bitmask[n] & SDP_SPRT_PROTO) &&
if ((transport_info->proto_bitmask[n] & SDP_SPRT_PROTO) &&
(transport_info->proto_bitmask[n] & (SDP_IPv4|SDP_IPv6)) &&
(sprt_handle)) {
@ -1885,14 +1885,14 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
/* Add t38 conversation, if available and only if no rtp */
if ((transport_info->media_port[n] != 0) &&
!transport_info->media[n].set_rtp &&
(transport_info->proto_bitmask[n] & SDP_T38_PROTO) &&
(transport_info->proto_bitmask[n] & SDP_T38_PROTO) &&
(transport_info->proto_bitmask[n] & SDP_IPv4) &&
t38_handle) {
t38_add_address(pinfo, &transport_info->src_addr[n], transport_info->media_port[n], 0, "SDP", pinfo->fd->num);
}
/* Add MSRP conversation. Uses addresses discovered in attribute
rather than connection information of media session line
rather than connection information of media session line
(already handled in media conversion) */
if ((transport_info->proto_bitmask[n] & SDP_MSRP_PROTO) &&
(transport_info->proto_bitmask[n] & SDP_MSRP_IPv4) &&
@ -2112,7 +2112,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Increase the count of media channels, but don't walk off the end of the arrays. */
if (local_transport_info.media_count < (SDP_MAX_RTP_CHANNELS-1))
local_transport_info.media_count++;
if (in_media_description && (media_info.media_count < (SDP_MAX_RTP_CHANNELS-1)))
media_info.media_count++;
@ -2147,7 +2147,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
linelen - tokenoffset,
linelen - tokenoffset),
pinfo,
hf, sub_ti, linelen-tokenoffset,
hf, sub_ti, linelen-tokenoffset,
&local_transport_info, &media_info);
offset = next_offset;
@ -2177,8 +2177,8 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 current_rtp_port = 0;
if ((!pinfo->fd->flags.visited) && (transport_info == &local_transport_info) &&
(transport_info->media_port[n] != 0) &&
(transport_info->proto_bitmask[n] & (SDP_RTP_PROTO|SDP_SRTP_PROTO)) &&
(transport_info->media_port[n] != 0) &&
(transport_info->proto_bitmask[n] & (SDP_RTP_PROTO|SDP_SRTP_PROTO)) &&
(transport_info->proto_bitmask[n] & (SDP_IPv4|SDP_IPv6))) {
if (rtp_handle) {
if (transport_info->proto_bitmask[n] & SDP_SRTP_PROTO) {
@ -2213,7 +2213,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* add SPRT conversation */
/* XXX - more placeholder functionality */
if ((!pinfo->fd->flags.visited) && (transport_info == &local_transport_info) &&
(transport_info->proto_bitmask[n] & SDP_SPRT_PROTO) &&
(transport_info->proto_bitmask[n] & SDP_SPRT_PROTO) &&
(transport_info->proto_bitmask[n] & (SDP_IPv4|SDP_IPv6)) &&
(sprt_handle)) {
@ -2230,7 +2230,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if ((!pinfo->fd->flags.visited) && (transport_info == &local_transport_info) &&
(transport_info->media_port[n] != 0) &&
!transport_info->media[n].set_rtp &&
(transport_info->proto_bitmask[n] & SDP_T38_PROTO) &&
(transport_info->proto_bitmask[n] & SDP_T38_PROTO) &&
(transport_info->proto_bitmask[n] & SDP_IPv4) &&
t38_handle) {
t38_add_address(pinfo, &transport_info->src_addr[n], transport_info->media_port[n], 0, "SDP", pinfo->fd->num);
@ -2256,21 +2256,21 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if ((local_transport_info.media[n].pt[i] >= 96) && (local_transport_info.media[n].pt[i] <= 127)) {
encoding_name_and_rate_t *encoding_name_and_rate_pt =
(encoding_name_and_rate_t *)g_hash_table_lookup(
local_transport_info.media[n].rtp_dyn_payload,
&local_transport_info.media[n].pt[i]);
local_transport_info.media[n].rtp_dyn_payload,
&local_transport_info.media[n].pt[i]);
if (encoding_name_and_rate_pt) {
if (strlen(sdp_pi->summary_str))
if (strlen(sdp_pi->summary_str))
g_strlcat(sdp_pi->summary_str, " ", 50);
g_strlcat(sdp_pi->summary_str, encoding_name_and_rate_pt->encoding_name, 50);
} else {
char num_pt[10];
g_snprintf(num_pt, 10, "%u", local_transport_info.media[n].pt[i]);
if (strlen(sdp_pi->summary_str))
if (strlen(sdp_pi->summary_str))
g_strlcat(sdp_pi->summary_str, " ", 50);
g_strlcat(sdp_pi->summary_str, num_pt, 50);
}
} else {
if (strlen(sdp_pi->summary_str))
if (strlen(sdp_pi->summary_str))
g_strlcat(sdp_pi->summary_str, " ", 50);
g_strlcat(sdp_pi->summary_str,
val_to_str_ext(local_transport_info.media[n].pt[i], &rtp_payload_type_short_vals_ext, "%u"),
@ -2291,9 +2291,9 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Create the T38 summary str for the Voip Call analysis
* XXX - Currently this is based only on the current packet
*/
if ((local_transport_info.media_port[n] != 0) &&
if ((local_transport_info.media_port[n] != 0) &&
(local_transport_info.proto_bitmask[n] & SDP_T38_PROTO)) {
if (strlen(sdp_pi->summary_str))
if (strlen(sdp_pi->summary_str))
g_strlcat(sdp_pi->summary_str, " ", 50);
g_strlcat(sdp_pi->summary_str, "t38", 50);
}

View File

@ -488,19 +488,16 @@ void proto_reg_handoff_uasip(void)
use_proxy_ipaddr = FALSE;
memset(proxy_ipaddr, 0, sizeof(proxy_ipaddr));
if(uasip_enabled){
if(uasip_enabled){
dissector_add_string("media_type", "application/octet-stream", uasip_handle);
}else{
dissector_delete_string("media_type", "application/octet-stream", uasip_handle);
}
if (strcmp(pref_proxy_ipaddr_s, "") != 0) {
if (inet_pton(AF_INET, pref_proxy_ipaddr_s, proxy_ipaddr) == 1)
{
if (inet_pton(AF_INET, pref_proxy_ipaddr_s, proxy_ipaddr) > 0) {
use_proxy_ipaddr = TRUE;
}
else
{
} else {
g_warning("uasip: Invalid 'Proxy IP Address': \"%s\"", pref_proxy_ipaddr_s);
}
}