ChargePoint / wireshark-v2g

Dissector for the V2G Protocols
Other
43 stars 18 forks source link

Update V2G Lua Dissector to support SDP with EMSP, put TLS/TCP connection in info field, and some bug fixes #58

Closed JeremyWhaling closed 4 months ago

JeremyWhaling commented 6 months ago

I've made the following modifications to the existing dissector: 1) Fixed bug related to payload length bytes not being able to be selected in Wireshark - subtree for payload_length did not have buffer or append text. 2) Fixed bug related to response_secc_port not being able to selected in Wireshark - subtree add only specified port, not buffer(24,2) 3) Added support for including "(Secure)" or "(Not Secure)" to info field for regular SDP messages. This allows at-a-glance determination of TLS or TCP request or response when going through PCAPs. Also changed info from "SECC Discovery Protocol Request" to "SDP Request", as well as "SECC Discovery Protocol Response" to "SDP Response" - this saves screen space when info column is small. 3) Added support for SDP with EMSP Request/Response. This allows decoding of new ISO 15118-2 ED2 SDP messages where EMSP IDs are included in the request and response messages. The info field becomes "SDP with EMSP Request" or "SDP with EMSP Response" as applicable. Note: I encourage testing of this with such messages to ensure this feature works as expected. I created some packets as defined in ISO 15118-2 ED2, but could use a few more eyes (or packets!) on this.

JeremyWhaling commented 6 months ago

Ah, I just realized I forgot to include MAC and Port in the SDP with EMSP response, please add these lines after "local subtree = tree:add(v2gtp_protocol, buffer(), "SDP EMSP Response")": subtree:add(SDP["response_secc_ip_addr"], buffer(8,16)) subtree:add(SDP["response_secc_port"], buffer(24,2))

jhart-cpi commented 5 months ago

Ah, I just realized I forgot to include MAC and Port in the SDP with EMSP response, please add these lines after "local subtree = tree:add(v2gtp_protocol, buffer(), "SDP EMSP Response")": subtree:add(SDP["response_secc_ip_addr"], buffer(8,16)) subtree:add(SDP["response_secc_port"], buffer(24,2))

If you include this and the byte range fix from https://github.com/ChargePoint/wireshark-v2g/issues/59 we're happy to merge.

JeremyWhaling commented 5 months ago

Ah, I see, I accidentally used tabs instead of four spaces, and the tabs appear to default to 8 spaces in github. Currently cleaning it all up now.

jhart-cpi commented 4 months ago

Please squash your commits to a single commit before merge.

JeremyWhaling commented 4 months ago

Please squash your commits to a single commit before merge.

Done. Note I did not resolve the 0x8001 reserved message "issue". The logic right now should take care of this, you have "if set_contains(types, type) then return types[type] end" which should be returning 0x8001 as "EXI ENCODED" here as the rest of the code will not run in that case, 0x8001 is covered in the types table. However, I would like to fix this in next version by adding more items (those -20 message types) to the table and could maybe simplify the rest of that code to be if type >= 0xA000 and type <= 0xFFFF then type_name = "MFG SPECIFIC" elseif type_name = "RESERVED".