mirror of
https://github.com/torvalds/linux
synced 2024-10-16 16:29:20 +00:00
9af41cc334
Adding GTP device through ip link creates the situation where there is no userspace daemon which would handle GTP messages (Echo Request for example). GTP-U instance which would not respond to echo requests would violate GTP specification. When GTP packet arrives with GTP_ECHO_REQ message type, GTP_ECHO_RSP is send to the sender. GTP_ECHO_RSP message should contain information element with GTPIE_RECOVERY tag and restart counter value. For GTPv1 restart counter is not used and should be equal to 0, for GTPv0 restart counter contains information provided from userspace(IFLA_GTP_RESTART_COUNT). Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com> Suggested-by: Harald Welte <laforge@gnumonks.org> Reviewed-by: Harald Welte <laforge@gnumonks.org> Tested-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
67 lines
1.2 KiB
C
67 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _GTP_H_
|
|
#define _GTP_H_
|
|
|
|
/* General GTP protocol related definitions. */
|
|
|
|
#define GTP0_PORT 3386
|
|
#define GTP1U_PORT 2152
|
|
|
|
/* GTP messages types */
|
|
#define GTP_ECHO_REQ 1 /* Echo Request */
|
|
#define GTP_ECHO_RSP 2 /* Echo Response */
|
|
#define GTP_TPDU 255
|
|
|
|
#define GTPIE_RECOVERY 14
|
|
|
|
struct gtp0_header { /* According to GSM TS 09.60. */
|
|
__u8 flags;
|
|
__u8 type;
|
|
__be16 length;
|
|
__be16 seq;
|
|
__be16 flow;
|
|
__u8 number;
|
|
__u8 spare[3];
|
|
__be64 tid;
|
|
} __attribute__ ((packed));
|
|
|
|
struct gtp1_header { /* According to 3GPP TS 29.060. */
|
|
__u8 flags;
|
|
__u8 type;
|
|
__be16 length;
|
|
__be32 tid;
|
|
} __attribute__ ((packed));
|
|
|
|
struct gtp1_header_long { /* According to 3GPP TS 29.060. */
|
|
__u8 flags;
|
|
__u8 type;
|
|
__be16 length;
|
|
__be32 tid;
|
|
__be16 seq;
|
|
__u8 npdu;
|
|
__u8 next;
|
|
} __packed;
|
|
|
|
/* GTP Information Element */
|
|
struct gtp_ie {
|
|
__u8 tag;
|
|
__u8 val;
|
|
} __packed;
|
|
|
|
struct gtp0_packet {
|
|
struct gtp0_header gtp0_h;
|
|
struct gtp_ie ie;
|
|
} __packed;
|
|
|
|
struct gtp1u_packet {
|
|
struct gtp1_header_long gtp1u_h;
|
|
struct gtp_ie ie;
|
|
} __packed;
|
|
|
|
#define GTP1_F_NPDU 0x01
|
|
#define GTP1_F_SEQ 0x02
|
|
#define GTP1_F_EXTHDR 0x04
|
|
#define GTP1_F_MASK 0x07
|
|
|
|
#endif
|