Repository: secdev/scapy

Issue:
Wrong message type for SOME/IP transport protocol responses
<!--
Things to consider

1.  Please check that you are using the latest scapy version, e.g. installed via:

    `pip install --upgrade git+git://github.com/secdev/scapy`

2.  If you are here to ask a question - please check previous issues and online resources, and consider using gitter instead: <https://gitter.im/secdev/scapy>

3.  Please understand that **this is not a forum** but an issue tracker. The following article explains why you should limit questions asked on Github issues: <https://medium.com/@methane/why-you-must-not-ask-questions-on-github-issues-51d741d83fde>
-->

#### Brief description

Scapy automotive uses wrong message type for SOME/IP transport protocol responses and error messages.

<!-- describe the main issue in one sentence -->
<!-- if possible, describe what components / protocols could be affected by the issue (e.g. wrpcap() + IPv6, it is likely this also affects XXX) -->

#### Environment

-   Scapy version: `2.4.4`
-   Python version: ` 3.8`
-   Operating System: `Win 10`

I'm trying to receive a SOME/IP transport protocol response. My simulated ECU (using vsomeip) sends the response with a message type of `0xa0`. This is according to the SOME/IP spec correct ([SOME/IP classic transport protocol spec](https://www.autosar.org/fileadmin/user_upload/standards/classic/19-11/AUTOSAR_SWS_SOMEIPTransportProtocol.pdf), [SOME/IP foundation spec](https://www.autosar.org/fileadmin/user_upload/standards/foundation/19-11/AUTOSAR_PRS_SOMEIPProtocol.pdf)).

<img width="456" alt="scapy_bug_spec" src="https://user-images.githubusercontent.com/7139633/101769331-1b037580-3ae7-11eb-9642-e9f60384a809.PNG">


The problem seems to be in the [SOMEIP](https://github.com/secdev/scapy/blob/master/scapy/contrib/automotive/someip.py) class. The [TYPE_TP_RESPONSE](https://github.com/secdev/scapy/blob/ee21931bbbbe94f801a6e44031cb117eba141e16/scapy/contrib/automotive/someip.py#L67) is wrong (set to `0x23`). It should be `0xa0` instead.

Same thing for the [TYPE_TP_ERROR ](https://github.com/secdev/scapy/blob/ee21931bbbbe94f801a6e44031cb117eba141e16/scapy/contrib/automotive/someip.py#L68). It is set to `0x24`. This variable should be (according to SOME/IP transport protocol spec) set to `0xa1`.
 
<!-- if needed - further information to get a picture of your setup (e.g. a sketch of your network setup) -->

#### How to reproduce

<!-- step-by-step explanation or a short script, may reference section 'Related resources' -->
Send a SOME/IP RPC call to a transport protocol enabled service and wait for the response. The response needs to be above the max payload size for SOME/IP messages.

#### Actual result

<!-- dump results that outline the issue, please format your code -->
Transport protocol response are not recognized correctly. Therefore the receiving part is not working.
The defined [conditional fields](https://github.com/secdev/scapy/blob/ee21931bbbbe94f801a6e44031cb117eba141e16/scapy/contrib/automotive/someip.py#L127) are always `None`

```
        ConditionalField(BitField("offset", 0, 28),
                         lambda pkt: SOMEIP._is_tp(pkt)),
        ConditionalField(BitField("res", 0, 3),
                         lambda pkt: SOMEIP._is_tp(pkt)),
        ConditionalField(BitField("more_seg", 0, 1),
                         lambda pkt: SOMEIP._is_tp(pkt))
```

Debugging the code, the static `_is_tp()` method inside the `SOMEIP` class returns always `False` for transport protocol responses.

#### Expected result

<!-- describe the expected result and outline the difference to the actual one, could also be a screen shot (e.g. wireshark) -->

The `_is_tp()` method inside the `SOMEIP` class  should return `True` for transport protocol responses.

<img width="829" alt="scapy_bug_wire" src="https://user-images.githubusercontent.com/7139633/101769536-67e74c00-3ae7-11eb-8984-1745da1eb5da.PNG">




Discussion:

Resolving patch:
diff --git a/scapy/contrib/automotive/someip.py b/scapy/contrib/automotive/someip.py
--- a/scapy/contrib/automotive/someip.py
+++ b/scapy/contrib/automotive/someip.py
@@ -64,8 +64,8 @@ class SOMEIP(Packet):
     TYPE_TP_REQUEST = 0x20
     TYPE_TP_REQUEST_NO_RET = 0x21
     TYPE_TP_NOTIFICATION = 0x22
-    TYPE_TP_RESPONSE = 0x23
-    TYPE_TP_ERROR = 0x24
+    TYPE_TP_RESPONSE = 0xa0
+    TYPE_TP_ERROR = 0xa1
     RET_E_OK = 0x00
     RET_E_NOT_OK = 0x01
     RET_E_UNKNOWN_SERVICE = 0x02


Test patch: