-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[enhancement] Enable clear_cache()
to spread upward in the packet tree
#4707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Successfully implemented in a Scapy wrapper. I'll provide a PR soon to propose the integration of it directly in Scapy implementation. |
In order to ensure both 1) improve performance, and 2) avoid breaking the API, we could add parameters to
|
alxroyer-thales
added a commit
to ThalesGroup/scapy
that referenced
this issue
Apr 18, 2025
…4706, secdev#4707) - secdev#4705: Performance issues with nested `PacketField`s: - Cache saved in `Packet.self_build()`. - `Packet`s marked as explicit systematically in `Packet.build()` to avoid a useless clone in `do_build()`. - `Packet.do_init_cached_fields()` optimized: - `init_fields` parameter added to `Packet.init_fields()` and `do_init_cached_fields()`. - Misc: `do_init_cached_fields()` fixed for list field copies. - `Packet.prepare_cached_fields()` optimized: - Default fields not copied anymore. - `Packet.copy()` and `clone_with()` optimized with `_fast_copy()`: - Avoid instantiating *ref fields* with default instantiation. - `Packet.copy_fields_dict()` optimized with new `use_fields_already_set` parameter and reworked as an inner method to work directly on the `clone` instance. - Misc: `_T` variable type at the module level made local and renamed as `_VarDictFieldType` in `_fast_copy()`. - `Packet.setfieldval()` optimized: - New value discarded if unchanged.: - `_PacketField.m2i()` optimized: - Avoid useless copies of fields with default instance. - Then `dissect()` is used on it. - secdev#4707: [enhancement] Enable clear_cache() to spread upward in the packet tree: - `Packet.clear_cache()` reworked. - secdev#4706: Force cache reset as soon as the payload or a packet field is modified: - `Packet.clear_cache()` (reworked as per secdev#4707) called in `setfieldval()`, `delfieldval()`, `add_payload()` and `remove_payload()`. - `Packet.raw_packet_cache_fields` now useless, thus removed. - Same for `Packet._raw_packet_cache_field_value()`. - `Packet.self_build()` simplified by the way. - `Packet.no_cache` flag added to avoid setting `raw_packet_cache` when specified, used in `Packet.self_build()` and `do_dissect()`.
alxroyer-thales
added a commit
to ThalesGroup/scapy
that referenced
this issue
Apr 18, 2025
- `upwards` (`False` by default) and `downwards` (`True` by default) parameters added to `clear_cache()`. - Set to `upwards=True` and `downwards=False` in `setfieldval()`, `delfieldval()`, `add_payload()` and `remove_payload()`. - Former implementation restored for `downwards=True`.
alxroyer-thales
added a commit
to ThalesGroup/scapy
that referenced
this issue
Apr 23, 2025
- Set step numbers.
alxroyer-thales
added a commit
to ThalesGroup/scapy
that referenced
this issue
Apr 23, 2025
…4706, secdev#4707) - secdev#4705: Performance issues with nested `PacketField`s: - Cache saved in `Packet.self_build()`. - `Packet`s marked as explicit systematically in `Packet.build()` to avoid a useless clone in `do_build()`. - `Packet.do_init_cached_fields()` optimized: - `init_fields` parameter added to `Packet.init_fields()` and `do_init_cached_fields()`. - Misc: `do_init_cached_fields()` fixed for list field copies. - `Packet.prepare_cached_fields()` optimized: - Default fields not copied anymore. - `Packet.copy()` and `clone_with()` optimized with `_fast_copy()`: - Avoid instantiating *ref fields* with default instantiation. - `Packet.copy_fields_dict()` optimized with new `use_fields_already_set` parameter and reworked as an inner method to work directly on the `clone` instance. - Misc: `_T` variable type at the module level made local and renamed as `_VarDictFieldType` in `_fast_copy()`. - `Packet.setfieldval()` optimized: - New value discarded if unchanged.: - `_PacketField.m2i()` optimized: - Avoid useless copies of fields with default instance. - Then `dissect()` is used on it. - secdev#4707: [enhancement] Enable clear_cache() to spread upward in the packet tree: - `Packet.clear_cache()` reworked. - secdev#4706: Force cache reset as soon as the payload or a packet field is modified: - `Packet.clear_cache()` (reworked as per secdev#4707) called in `setfieldval()`, `delfieldval()`, `add_payload()` and `remove_payload()`. - `Packet.raw_packet_cache_fields` now useless, thus removed. - Same for `Packet._raw_packet_cache_field_value()`. - `Packet.self_build()` simplified by the way. - `Packet.no_cache` flag added to avoid setting `raw_packet_cache` when specified, used in `Packet.self_build()` and `do_dissect()`.
alxroyer-thales
added a commit
to ThalesGroup/scapy
that referenced
this issue
Apr 23, 2025
- `upwards` (`False` by default) and `downwards` (`True` by default) parameters added to `clear_cache()`. - Set to `upwards=True` and `downwards=False` in `setfieldval()`, `delfieldval()`, `add_payload()` and `remove_payload()`. - Former implementation restored for `downwards=True`.
alxroyer-thales
added a commit
to ThalesGroup/scapy
that referenced
this issue
Apr 23, 2025
…ecdev#4707) - `Packet._ensure_parent_of()` added. - Called in `do_init_cached_fields()`.
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Enable
clear_cache()
to spread upward in the packet tree (underlayer and parent packets),and not downward as currently (fields and payload).
The text was updated successfully, but these errors were encountered: