aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@sony.com>2020-08-28 11:31:29 +0200
committerMikael Kanstrup <mikael.kanstrup@sony.com>2020-08-28 13:07:13 +0200
commit97ade16979592a756795d667de2ff217a5a44dd4 (patch)
tree8a98503b09039eb4f2c8241cb0b7b69805afd0a4 /tools
parent0e2cd329e3c25246d426f7f238714accdea13e2c (diff)
nl80211: Fix abbreviated field names for NAN
Python's lstrip apparently doesn't strip a prefix but instead strips all supplied characters from beginning of a string. Using lstrip in generate-nl80211-fields.py script to remove the 'nl80211_' prefix happened to work for everything but a few NAN related enums. Introduce a remove_prefix function and regenerate the nl80211 dissector code to fix the abbreviated field names for NAN.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/generate-nl80211-fields.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/generate-nl80211-fields.py b/tools/generate-nl80211-fields.py
index e2f47d59b8..38358b9fa8 100755
--- a/tools/generate-nl80211-fields.py
+++ b/tools/generate-nl80211-fields.py
@@ -163,6 +163,11 @@ def make_value_string(name, values, indent,):
code += ' VALUE_STRING_EXT_INIT(ws_%s_vals);\n' % name
return code
+def remove_prefix(prefix, text):
+ if text.startswith(prefix):
+ return text[len(prefix):]
+ return text
+
def make_hfi(name, indent):
(field_name, field_type, field_blurb) = EXPORT_ENUMS.get(name)
field_abbrev = name
@@ -182,7 +187,7 @@ def make_hfi(name, indent):
}
if rename_fields.get(name):
field_abbrev = rename_fields[name]
- field_abbrev = field_abbrev.lstrip('nl80211_')
+ field_abbrev = remove_prefix('nl80211_', field_abbrev)
code = 'static header_field_info hfi_%s NETLINK_NL80211_HFI_INIT =\n' % name
code += indent + '{ "%s", "nl80211.%s", %s, BASE_DEC | BASE_EXT_STRING,\n' % \