I’ve been working on a ePDG for VoWiFi access to my IMS core.
This has led to a bit of a deep dive into GTP (easy enough) and GTPv2 (Bit harder).
The Fully Qualified Tunnel Endpoint Identifier includes an information element for the Interface Type, identified by a two digit number.
In the end I found the answer in 3GPP TS 29.274, but thought I’d share it here.
0 | S1-U eNodeB GTP-U interface |
1 | S1-U SGW GTP-U interface |
2 | S12 RNC GTP-U interface |
3 | S12 SGW GTP-U interface |
4 | S5/S8 SGW GTP-U interface |
5 | S5/S8 PGW GTP-U interface |
6 | S5/S8 SGW GTP-C interface |
7 | S5/S8 PGW GTP-C interface |
8 | S5/S8 SGW PMIPv6 interface (the 32 bit GRE key is encoded in 32 bit TEID field and since alternate CoA is not used the control plane and user plane addresses are the same for PMIPv6) |
9 | S5/S8 PGW PMIPv6 interface (the 32 bit GRE key is encoded in 32 bit TEID field and the control plane and user plane addresses are the same for PMIPv6) |
10 | S11 MME GTP-C interface |
11 | S11/S4 SGW GTP-C interface |
12 | S10 MME GTP-C interface |
13 | S3 MME GTP-C interface |
14 | S3 SGSN GTP-C interface |
15 | S4 SGSN GTP-U interface |
16 | S4 SGW GTP-U interface |
17 | S4 SGSN GTP-C interface |
18 | S16 SGSN GTP-C interface |
19 | eNodeB GTP-U interface for DL data forwarding |
20 | eNodeB GTP-U interface for UL data forwarding |
21 | RNC GTP-U interface for data forwarding |
22 | SGSN GTP-U interface for data forwarding |
23 | SGW GTP-U interface for DL data forwarding |
24 | Sm MBMS GW GTP-C interface |
25 | Sn MBMS GW GTP-C interface |
26 | Sm MME GTP-C interface |
27 | Sn SGSN GTP-C interface |
28 | SGW GTP-U interface for UL data forwarding |
29 | Sn SGSN GTP-U interface |
30 | S2b ePDG GTP-C interface |
31 | S2b-U ePDG GTP-U interface |
32 | S2b PGW GTP-C interface |
33 | S2b-U PGW GTP-U interface |
I also found how this data is encoded on the wire is a bit strange,
In the example above the Interface Type is 7,
This is encoded in binary which give us 111.
This is then padded to 6 bits to give us 000111.
This is prefixed by two additional bits the first denotes if IPv4 address is present, the second bit is for if IPv6 address is present.
Bit 1 | Bit 2 | Bit 3-6 |
IPv4 Address Present | IPv4 Address Present | Interface Type |
1 | 1 | 000111 |
This is then encoded to hex to give us 87
Here’s my Python example;
interface_type = int(7)
interface_type = "{0:b}".format(interface_type).zfill(6) #Produce binary bits
ipv4ipv6 = "10" #IPv4 only
interface_type = ipv4ipv6 + interface_type #concatenate the two
interface_type = format(int(str(interface_type), 2),"x") #convert to hex