summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author李佳 <[email protected]>2020-08-26 21:44:03 +0800
committer李佳 <[email protected]>2020-08-26 21:44:03 +0800
commit69e7edf06a50136d04d59978b69a12d88f8be264 (patch)
treebe797fe549f0784ce341e68eba0a156ae1279d22
parent579c2e8cc475a0dbd526bcc7122d9c0f5a9327da (diff)
Fix v4.1 gtp hdr lenv4.1.2
-rw-r--r--src/dealpkt/deal_gprs_tunnel.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/dealpkt/deal_gprs_tunnel.c b/src/dealpkt/deal_gprs_tunnel.c
index f211286..24c5aad 100644
--- a/src/dealpkt/deal_gprs_tunnel.c
+++ b/src/dealpkt/deal_gprs_tunnel.c
@@ -139,7 +139,7 @@ int gtp_entry(struct streaminfo_private *pfstream_pr,void *this_layer_data,int t
gprsͷ�����ݱ�־λ�IJ�ͬ, ����Ҳ��ͬ, ����ֱ����sizeof(struct gtp_hdr)��ȡ����.
*/
-static int get_gprs_hdr_len(const struct gtp_hdr *gtph)
+static int get_gprs_hdr_len_v1(const struct gtp_hdr *gtph)
{
int base_len = sizeof(struct gtp_hdr);
@@ -179,16 +179,22 @@ static int identify_gtp(const struct streaminfo *pstream,const char *payload, un
if ((source == gtp_u) || (dest == gtp_u) || (source == gtp_c)
|| (dest == gtp_c) || (source == gtp_v0) || (dest == gtp_v0)) {
- struct gtp_hdr *gtp =
- (struct gtp_hdr *) payload;
+ struct gtp_hdr *gtp = (struct gtp_hdr *) payload;
unsigned short gtp_version = (gtp->flags & 0xE0) >> 5;
- if ((gtp_version == 0) || (gtp_version == 1) || (gtp_version == 2)) {
+ if(gtp_version == 0){
+ sapp_runtime_log(20, "GTP v0 is obsoleted, not support!\n");
+ return 0;
+ }else if(gtp_version == 1) {
unsigned short message_len = ntohs(gtp->len);
-
- if (message_len == (payload_len - get_gprs_hdr_len(gtp))) {
+ /* NOTE: gtp->len������gtpͷ���̶�����(8�ֽ�), ֻ������չͷ���͸��� */
+ if (message_len == (payload_len - sizeof(struct gtp_hdr))) {
return 1;
}
+ }else{
+ //TODO
+ sapp_runtime_log(20, "not support GTP v%d yet!\n", gtp_version);
+ return 0;
}
}
}