jacobschaer / python-doipclient

Pure Python ISO 13400 Client
MIT License
158 stars 51 forks source link

Server responds with different ids #54

Open d84812 opened 3 weeks ago

d84812 commented 3 weeks ago

Today I faced with a weird behavior with doipclient + udsoncan library, after connection is established, my app sends data identifier requests, but receives replies to the other ones. This is related to the only one DOIP server.

Seems like some garbage on rx buffer. I managed this by deleting Ethernet adapter and reinstalling it. But after 5-10 minutes it happened again. No antivirus SW on that PC.

Example: requested f186, but received db94, etc.

What is going on there? Any ideas?

2024-10-14 13:21:25 [INFO] UdsClient: ReadDataByIdentifier<0x22> - Reading data identifier : 0xf186 (ActiveDiagnosticSessionDataIdentifier)
2024-10-14 13:21:25 [DEBUG] Connection: Sending 3 bytes : [22f186]
2024-10-14 13:21:25 [DEBUG] Connection: Received 7 bytes : [62db9441400000]
2024-10-14 13:21:25 [INFO] UdsClient: Received positive response for service ReadDataByIdentifier (0x22) from server.
2024-10-14 13:21:25 [ERROR] UdsClient: [UnexpectedResponseException] : ReadDataByIdentifier service execution returned a valid response but unexpected. Details : Server returned values for data identifier 0xdb94 that was not requested and no Codec was defined for it. Parsing must be stopped. 
2024-10-14 13:21:25 [INFO] UdsClient: TesterPresent<0x3e> - Sending TesterPresent request
2024-10-14 13:21:25 [DEBUG] Connection: Sending 2 bytes : [3e80]
2024-10-14 13:21:25 [INFO] UdsClient: ReadDataByIdentifier<0x22> - Reading data identifier : 0xf186 (ActiveDiagnosticSessionDataIdentifier)
2024-10-14 13:21:25 [DEBUG] Connection: Sending 3 bytes : [22f186]
2024-10-14 13:21:25 [DEBUG] Connection: Received 7 bytes : [62dba000000000]
2024-10-14 13:21:25 [INFO] UdsClient: Received positive response for service ReadDataByIdentifier (0x22) from server.
2024-10-14 13:21:25 [ERROR] UdsClient: [UnexpectedResponseException] : ReadDataByIdentifier service execution returned a valid response but unexpected. Details : Server returned values for data identifier 0xdba0 that was not requested and no Codec was defined for it. Parsing must be stopped. 
2024-10-14 13:21:25 [INFO] UdsClient: TesterPresent<0x3e> - Sending TesterPresent request
2024-10-14 13:21:25 [DEBUG] Connection: Sending 2 bytes : [3e80]
2024-10-14 13:21:26 [INFO] UdsClient: ReadDataByIdentifier<0x22> - Reading data identifier : 0xf186 (ActiveDiagnosticSessionDataIdentifier)
2024-10-14 13:21:26 [DEBUG] Connection: Sending 3 bytes : [22f186]
2024-10-14 13:21:26 [DEBUG] Connection: Received 4 bytes : [62f18601]
2024-10-14 13:21:26 [INFO] UdsClient: Received positive response for service ReadDataByIdentifier (0x22) from server.
2024-10-14 13:21:26 [INFO] UdsClient: TesterPresent<0x3e> - Sending TesterPresent request
2024-10-14 13:21:26 [DEBUG] Connection: Sending 2 bytes : [3e80]
2024-10-14 13:21:26 [INFO] UdsClient: ReadDataByIdentifier<0x22> - Reading data identifier : 0xf106 (IdentificationOptionVehicleManufacturerSpecificDataIdentifier)
2024-10-14 13:21:26 [DEBUG] Connection: Sending 3 bytes : [22f106]
2024-10-14 13:21:26 [DEBUG] Connection: Received 7 bytes : [62db9441400000]
jacobschaer commented 3 weeks ago

Do you do UDS resets or otherwise reset the socket? Seems suspicious of the ECU though if you're getting the wrong DID but not the wrong service. I'd be more inclined to think your DID codec is wrong size or the ECU is not following the spec. This is at the UDS layer though, I don't see any evidence to implicate the DOIP layer.