Try fix MultipleTypeField: Add post_inits metric#1485
Try fix MultipleTypeField: Add post_inits metric#1485gpotter2 wants to merge 1 commit intosecdev:masterfrom gpotter2:socks-testfix
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1485 +/- ##
==========================================
+ Coverage 85.28% 85.36% +0.07%
==========================================
Files 177 177
Lines 40855 40879 +24
==========================================
+ Hits 34845 34896 +51
+ Misses 6010 5983 -27
|
| def i2m(self, pkt, x): | ||
| if x == b".": | ||
| return b"\x00" | ||
| elif isinstance(x, str): |
There was a problem hiding this comment.
I'm not sure when/if this can happen, as "internal" value should always be bytes.
|
Thanks for this work and your explanations, sorry it took me so long to understand what you wanted to do. Apart from my remark about |
|
I don't really like myself the extra layer of complexity that this PR adds :/ I really would have like a different fix. If you have time to look into it, it would be great |
| self.packetfields = [] | ||
| self.payload = NoPayload() | ||
| self.post_inits = [] | ||
| self.init_fields() |
There was a problem hiding this comment.
NOTE TO SELF: just order the fields following the fields_desc order during initialization. That will fix the problem way easier. (The arguments will be intianciated correctly. See example in #1484)
Use stg like
for f in fields_desc:
v = kwargs.get(v, None)
if v:
self.setfieldval.....
fixes #1484
Is certainly improvable, any ideas will be appreciated