codedua

my technote


SOMEIP packet dissection


Background

Before consumer sending the first SOMEIP message to call provider’s method, consumer and provider must “handshake” to detect each other.
Handshake is steps conducted by SOMEIP Service Discovery sending broadcast message to find out existence services over the network.
That broadcast message is called SOMEIP SD message.

Both SOMEIP and SOMEIP SD packet are encapsulated as TCP/UDP payload.

SOMEIP Message

SOME/IP messages shall be sent over UDP or TCP.
SOMEIP message consist of a header and a payload as illustrative figure below:

The structure of header layout shall consist of

  • Message ID (Service ID/Method ID) [32 bit]:
  • Length [32 bit]
  • Request ID (Client ID/Session ID) [32 bit]
  • Protocol Version [8 bit]:
  • Interface Version [8 bit]:
  • Message Type [8 bit]:
  • Return Code [8 bit]:

Payload

Payload bring parameters of function call.

SOMEIP SD Message

SOME/IP-SD messages shall be sent over UDP only.
SOMEIP SD message consists of a header only

SOMEIP SD header starts with the SOMEIP header, but several fields take fixed value

  • Message ID (Service ID/Method ID) [32 bit]: 0xFFFF 8100
  • Length [32 bit]
  • Request ID (Client ID/Session ID) [32 bit]: (Client ID is set to 0x0000 because only a single SOME/IP-SD instance exists)
  • Protocol Version [8 bit]: 0x01
  • Interface Version [8 bit]: 0x01
  • Message Type [8 bit]: 0x02
  • Return Code [8 bit]: 0x00 and extened with some new fields
  • Flags [8 bit]
  • Reserved [24 bit]
  • Length of Entries Array [32 bit]
  • Entries Array [variable size]
  • Length of Options Array [32 bit]
  • Options Array [variable size]

Message ID
32 bits, bit 1 to 16 represent the serviceID. if the 17th bit is 0 then bit 18 to 32 represent methodID, otherwise, they represent the eventID

Request ID
allows a server and client to differentiate multiple parallel uses of the same method, getter or setter.
32 bits. bit 1 to 16 represent clientID, bit 17 to 32 represent sessionID
clientID is ID of “application” you set in your vsomeip configuration file (*.json).
in below example, clientID is 0x2222

"application" :
[
    {
        "name" : "ClientA",
        "id" : "0x2222"
    }
],

sessionID starts from 0 to 0xFFFF before resetting to 0

Message Type

Return code

for details, refer official specification:
see 5.1.2 SOME/IP-SD Message Format:
https://www.autosar.org/fileadmin/standards/foundation/22-11/AUTOSAR_PRS_SOMEIPServiceDiscoveryProtocol.pdf
see 4.1 Specification of SOME/IP Message Format (Serialization)
https://www.autosar.org/fileadmin/standards/foundation/22-11/AUTOSAR_PRS_SOMEIPProtocol.pdf

Example

Example capture packet using Wireshark


consumer service on the host 172.17.0.6 found out the expected provider service 2021.1234 on the host 172.17.0.7