Apply some of the patches from:

http://wiki.wireshark.org/Development/Optimization

svn path=/trunk/; revision=28364
This commit is contained in:
Anders Broman 2009-05-14 20:04:28 +00:00
parent 4ec2c4ff47
commit 64a33ad7af
5 changed files with 14 additions and 20 deletions

View File

@ -1232,7 +1232,7 @@ static gboolean snmp_usm_auth_sha1(snmp_usm_params_t* p _U_, guint8** calc_auth_
return ( memcmp(auth,calc_auth,12) != 0 ) ? FALSE : TRUE;
}
static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar const** error _U_) {
static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData , gchar const** error _U_) {
#ifdef HAVE_LIBGCRYPT
gcry_error_t err;
gcry_cipher_hd_t hd = NULL;
@ -1290,7 +1290,7 @@ static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encrypted
gcry_cipher_close(hd);
clear_tvb = tvb_new_real_data(cleartext, cryptgrm_len, cryptgrm_len);
clear_tvb = tvb_new_child_real_data(encryptedData, cleartext, cryptgrm_len, cryptgrm_len);
return clear_tvb;
@ -1304,7 +1304,7 @@ on_gcry_error:
#endif
}
static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar const** error _U_) {
static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData , gchar const** error _U_) {
#ifdef HAVE_LIBGCRYPT
gcry_error_t err;
gcry_cipher_hd_t hd = NULL;
@ -1353,7 +1353,7 @@ static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encrypted
gcry_cipher_close(hd);
clear_tvb = tvb_new_real_data(cleartext, cryptgrm_len, cryptgrm_len);
clear_tvb = tvb_new_child_real_data(encryptedData, cleartext, cryptgrm_len, cryptgrm_len);
return clear_tvb;

View File

@ -141,7 +141,6 @@ gint pdu_type=-1;
add_new_data_source(actx->pinfo, cleartext_tvb, "Decrypted ScopedPDU");
tvb_set_child_real_data_tvbuff(tvb, cleartext_tvb);
decrypted_item = proto_tree_add_item(encryptedpdu_tree, hf_snmp_decryptedPDU,cleartext_tvb,0,-1,FALSE);
decrypted_tree = proto_item_add_subtree(decrypted_item,ett_decrypted);

View File

@ -1,7 +1,7 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-snmp.c */
/* ../../tools/asn2wrs.py -b -p snmp -c ./snmp.cnf -s ./packet-snmp-template -D . snmp.asn */
/* ../../tools/asn2wrs.py -b -p snmp -c snmp.cnf -s packet-snmp-template snmp.asn */
/* Input file: packet-snmp-template.c */
@ -1334,7 +1334,7 @@ static gboolean snmp_usm_auth_sha1(snmp_usm_params_t* p _U_, guint8** calc_auth_
return ( memcmp(auth,calc_auth,12) != 0 ) ? FALSE : TRUE;
}
static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar const** error _U_) {
static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData , gchar const** error _U_) {
#ifdef HAVE_LIBGCRYPT
gcry_error_t err;
gcry_cipher_hd_t hd = NULL;
@ -1392,7 +1392,7 @@ static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encrypted
gcry_cipher_close(hd);
clear_tvb = tvb_new_real_data(cleartext, cryptgrm_len, cryptgrm_len);
clear_tvb = tvb_new_child_real_data(encryptedData, cleartext, cryptgrm_len, cryptgrm_len);
return clear_tvb;
@ -1406,7 +1406,7 @@ on_gcry_error:
#endif
}
static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar const** error _U_) {
static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData , gchar const** error _U_) {
#ifdef HAVE_LIBGCRYPT
gcry_error_t err;
gcry_cipher_hd_t hd = NULL;
@ -1455,7 +1455,7 @@ static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encrypted
gcry_cipher_close(hd);
clear_tvb = tvb_new_real_data(cleartext, cryptgrm_len, cryptgrm_len);
clear_tvb = tvb_new_child_real_data(encryptedData, cleartext, cryptgrm_len, cryptgrm_len);
return clear_tvb;
@ -2088,7 +2088,7 @@ dissect_snmp_INTEGER_484_2147483647(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
static int
dissect_snmp_T_msgFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 213 "snmp.cnf"
#line 212 "snmp.cnf"
tvbuff_t *parameter_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@ -2143,7 +2143,7 @@ dissect_snmp_HeaderData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_snmp_T_msgSecurityParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 156 "snmp.cnf"
#line 155 "snmp.cnf"
switch(MsgSecurityModel){
case SNMP_SEC_USM: /* 3 */
@ -2227,7 +2227,6 @@ dissect_snmp_T_encryptedPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
add_new_data_source(actx->pinfo, cleartext_tvb, "Decrypted ScopedPDU");
tvb_set_child_real_data_tvbuff(tvb, cleartext_tvb);
decrypted_item = proto_tree_add_item(encryptedpdu_tree, hf_snmp_decryptedPDU,cleartext_tvb,0,-1,FALSE);
decrypted_tree = proto_item_add_subtree(decrypted_item,ett_decrypted);
@ -2279,7 +2278,7 @@ dissect_snmp_SNMPv3Message(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
SNMPv3Message_sequence, hf_index, ett_snmp_SNMPv3Message);
#line 171 "snmp.cnf"
#line 170 "snmp.cnf"
if( usm_p.authenticated
&& usm_p.user_assoc

View File

@ -147,14 +147,12 @@ dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static gboolean
dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
char sync[TALI_SYNC_LENGTH]; /* TALI sync */
char opcode[TALI_OPCODE_LENGTH]; /* TALI opcode */
if (tvb_reported_length(tvb) < TALI_HEADER_LENGTH) /* Mandatory header */
return FALSE;
tvb_memcpy(tvb, (guint8*)sync, 0, TALI_SYNC_LENGTH);
if (strncmp(sync, TALI_SYNC, TALI_SYNC_LENGTH) != 0)
if (tvb_strneql(tvb, 0, TALI_SYNC, TALI_SYNC_LENGTH) != 0)
return FALSE;
tvb_memcpy(tvb, (guint8*)opcode, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH);

View File

@ -1628,11 +1628,9 @@ again:
int old_len;
/* create a new TVB structure for desegmented data */
next_tvb = tvb_new_real_data(ipfd_head->data,
next_tvb = tvb_new_child_real_data(tvb, ipfd_head->data,
ipfd_head->datalen, ipfd_head->datalen);
/* add this tvb as a child to the original one */
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
/* add desegmented data to the data source list */
add_new_data_source(pinfo, next_tvb, "Reassembled TCP");