EDNS0 Packet Format

The enterprise policy ID (CF_POLICY_ID) from PCRF helps to create the Device ID. The SMF sends the device ID to the UPF. Adding the Device ID to the DNS packet helps in creating the EDNS0 packet. The format of EDNS0 packets is specified by RFC2671. The following are few specifics:

  • Following is the structure for the fixed part of an OPT RR:

    Field Name   Field Type     Description
    ------------------------------------------------------
    NAME         domain name    empty (root domain)
    TYPE           u_int16_t          OPT
    CLASS          u_int16_t          sender's UDP payload size
    TTL            u_int32_t          extended RCODE and flags
    RDLEN          u_int16_t          describes RDATA
    RDATA          octet stream       {attribute, value} pairs
    
  • Following is the variable part of an OPT RR encoded in its RDATA:

          +0 (MSB)                            +1 (LSB)
         +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
      0: |                       OPTION-CODE                             |
         +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
      2: |                       OPTION-LENGTH                           |
         +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
      4: |                                                               |
         /                       OPTION-DATA                             /
         /                                                               /
         +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
    
    • OPTION-CODE: Assigned by IANA

    • OPTION-LENGTH: Size (in octets) of OPTION-DATA

    • OPTION-DATA- Varies per OPTION-CODE

Example: If received policy-id from PCF/PCRF is “1234” and static prefix configured on UPF is “5678”.

64-bits Device-ID will be “0000162e000004d2”.

  • 0000162e -- 5678 (Decimal)

  • 000004d2 -- 1234 (Decimal)

RDATA 69 42 00 0f 4f 70 65 6e 44 4e 53 00 00 16 2e 00 00 04 d2

  • 6942 -- option-code

  • 000f -- option-length

  • 4f70656e444e53 -- OpenDNS (String)

  • 0000162e -- 5678 (MSB)

  • 000004d2 -- 1234 (LSB)