Fix asn2wrs.py: always add BASE_VAL64_STRING

In some cases (e.g. when a field has a user defined dissection function)
the type reported for this field is a 'virtual' one and the latter is not
contained in selt.type. Consequently, BASE_VAL64_STRING is not set.

Function eth_get_type_attr should return all the attributes of a type and
it seems resonable to expect it to return the BASE_VAL64_STRING. This
will solve the above mentioned error and may solve any possible issue in
other parts that call this function.

Change-Id: Iaee9ce5bd30f2a768cfcecf628df23bf1ed54e55
Reviewed-on: https://code.wireshark.org/review/31287
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Christophe GUERBER 2019-01-01 14:53:41 +01:00 committed by Michael Mann
parent a05ba5be69
commit b9473c46f7
1 changed files with 2 additions and 6 deletions

View File

@ -707,6 +707,8 @@ class EthCtx:
else:
attr.update(self.type[t]['attr'])
attr.update(self.eth_type[self.type[t]['ethname']]['attr'])
if attr['STRINGS'].startswith('VALS64('):
attr['DISPLAY'] += '|BASE_VAL64_STRING'
#print " ", attr
return attr
@ -1320,12 +1322,6 @@ class EthCtx:
use_vals_ext = self.eth_type[ethtype].get('vals_ext')
if (use_vals_ext):
attr['DISPLAY'] += '|BASE_EXT_STRING'
if ethtype in self.type \
and self.type[ethtype]['attr'].get('STRINGS') == '$$' \
and self.eth_type[ethtype]['val'].type == 'IntegerType' \
and self.eth_type[ethtype]['val'].HasConstraint() \
and self.eth_type[ethtype]['val'].constr.Needs64b(self):
attr['DISPLAY'] += '|BASE_VAL64_STRING'
self.eth_hf[nm] = {'fullname' : fullname, 'pdu' : self.field[f]['pdu'],
'ethtype' : ethtype, 'modified' : self.field[f]['modified'],
'attr' : attr.copy(),