• Pablo Neira Ayuso's avatar
    gtp: properly parse extension headers · b6fc0956
    Pablo Neira Ayuso authored
    Currently GTP packets are dropped if the next extension field is set to
    non-zero value, but this are valid GTP packets.
    
    TS 29.281 provides a longer header format, which is defined as struct
    gtp1_header_long. Such long header format is used if any of the S, PN, E
    flags is set.
    
    This long header is 4 bytes longer than struct gtp1_header, plus
    variable length (optional) extension headers. The next extension header
    field is zero is no extension header is provided.
    
    The extension header is composed of a length field which includes total
    number of 4 byte words including the extension header itself (1 byte),
    payload (variable length) and next type (1 byte). The extension header
    size and its payload is aligned to 4 bytes.
    
    A GTP packet might come with a chain extensions headers, which makes it
    slightly cumbersome to parse because the extension next header field
    comes at the end of the extension header, and there is a need to check
    if this field becomes zero to stop the extension header parser.
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    b6fc0956
gtp.h 1.51 KB