Repository: secdev/scapy

Issue:
Add missing SOME/IP-SD FLAG 'EXPLICIT_INITIAL_DATA_CONTROL' in SD class
### Brief description

Hello Scapy team,

Firstly, I want to thank you for your incredible work on Scapy. It's an invaluable tool that I use often.

I'm writing to bring your attention to what seems to be a missing flag in the `SD` class for SOME/IP-SD. In the latest version, the `FLAGSDEF` dictionary is defined as follows:

```.py
FLAGSDEF = {
    "REBOOT": _sdFlag(mask=0x80, offset=7),
    "UNICAST": _sdFlag(mask=0x40, offset=6)
}

```

However, it appears to be missing the Explicit Initial Data Control Flag. According to the SOME/IP-SD protocol, the correct `FLAGSDEF` should be:

```python
FLAGSDEF = {
    "REBOOT": _sdFlag(mask=0x80, offset=7),
    "UNICAST": _sdFlag(mask=0x40, offset=6),
    "EXPLICIT_INITIAL_DATA_CONTROL": _sdFlag(mask=0x20, offset=5),
}

```

If this is indeed an oversight, I think it would be beneficial to add this flag to the class to fully comply with the SOME/IP-SD protocol.

Please let me know if there's any additional information needed, or if there is a reason that this flag was intentionally left out.

Thank you for your attention to this matter.

Best regards,

Masafumi Harada

### Scapy version

2.5.0

### Python version

3.8

### Operating system

macOS 13.3.1

### Additional environment information

_No response_

### How to reproduce

You can see the current configuration of the `FLAGSDEF` by simply inspecting the `SD` class in Scapy library. Here are the steps:

1. Open a Python interpreter in your terminal.
2. Import the `SD` class from Scapy. You can do this by entering the following command:

```python
from scapy.contrib.automotive.someip import SD
```

1. Print the `FLAGSDEF` dictionary of the `SD` class to see its current structure:

```python
print(SD.FLAGSDEF)

```

### Actual result

The output will be:

```python
{
    "REBOOT": _sdFlag(mask=0x80, offset=7),
    "UNICAST": _sdFlag(mask=0x40, offset=6)
}

```

As you can see, the "EXPLICIT_INITIAL_DATA_CONTROL" flag is missing from this dictionary. 

### Expected result

The expected output is:

```python
FLAGSDEF = {
    "REBOOT": _sdFlag(mask=0x80, offset=7),
    "UNICAST": _sdFlag(mask=0x40, offset=6),
    "EXPLICIT_INITIAL_DATA_CONTROL": _sdFlag(mask=0x20, offset=5),
}

```

According to the SOME/IP-SD protocol, this flag should also be included with a mask of 0x20 and an offset of 5.

### Related resources

Please see `[PRS_SOMEIPSD_00700]` in [SOME/IP Service Discovery Protocol Specification](https://www.autosar.org/fileadmin/standards/R1-5-0/FO/AUTOSAR_PRS_SOMEIPServiceDiscoveryProtocol.pdf).



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
@@ -432,7 +432,8 @@ class SD(_SDPacketBase):
     _sdFlag = collections.namedtuple('Flag', 'mask offset')
     FLAGSDEF = {
         "REBOOT": _sdFlag(mask=0x80, offset=7),
-        "UNICAST": _sdFlag(mask=0x40, offset=6)
+        "UNICAST": _sdFlag(mask=0x40, offset=6),
+        "EXPLICIT_INITIAL_DATA_CONTROL": _sdFlag(mask=0x20, offset=5),
     }
 
     name = "SD"


Test patch:
diff --git a/test/contrib/automotive/someip.uts b/test/contrib/automotive/someip.uts
--- a/test/contrib/automotive/someip.uts
+++ b/test/contrib/automotive/someip.uts
@@ -208,9 +208,16 @@ assert p.flags == 0x40
 p.set_flag("UNICAST", 0)
 assert p.flags == 0x00
 
+p.set_flag("EXPLICIT_INITIAL_DATA_CONTROL", 1)
+assert p.flags == 0x20
+
+p.set_flag("EXPLICIT_INITIAL_DATA_CONTROL", 0)
+assert p.flags == 0x00
+
 p.set_flag("REBOOT", 1)
 p.set_flag("UNICAST", 1)
-assert p.flags == 0xc0
+p.set_flag("EXPLICIT_INITIAL_DATA_CONTROL", 1)
+assert p.flags == 0xe0
 
 + SD Get SOME/IP Packet