Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTPv2 Support #917

Open
ArmanTulegenov opened this issue Jul 18, 2022 · 24 comments
Open

GTPv2 Support #917

ArmanTulegenov opened this issue Jul 18, 2022 · 24 comments

Comments

@ArmanTulegenov
Copy link

Would be great to add GTPv2 Support. Do you have some plans around it?

@seladb
Copy link
Owner

seladb commented Jul 19, 2022

That's a good idea! currently I don't have plans for that, but please feel free to contribute to this project and add this support. I can assist in guidance and code reviews

@ArmanTulegenov
Copy link
Author

Yes, I will try to add GTPv2 layer.

@seladb
Copy link
Owner

seladb commented Aug 24, 2022

@ArmanTulegenov do you know when you'll work on this?

@mmanoj
Copy link

mmanoj commented Dec 23, 2022

@ArmanTulegenov

Let ne know any help required,I also like to contribute to this patch. Pls share PCAP file with GTPv2

@seladb
Copy link
Owner

seladb commented Dec 24, 2022

@mmanoj please feel free to implement GTPv2, let me know if you need my help!

Here are a few pcap files with GTPv2 I found online:

@mmanoj
Copy link

mmanoj commented Dec 25, 2022

@seladb

Thanks for the quick reply and support,sure I will looking in to it and update you.Currently I'm working on Radius 3GPP dictionary attributes decoding.I will check is it possible to open source with pcpp.

@mmanoj
Copy link

mmanoj commented Jan 10, 2023

Hi @seladb

I'm working on initial work for GTPv2 message decoding, I will update you the progress,currently checking the core spec and protocol details.

@seladb
Copy link
Owner

seladb commented Jan 10, 2023

Sounds good @mmanoj , thanks for the update!

I am looking forward to seeing your PR.

cc @egecetin

@mmanoj
Copy link

mmanoj commented Jan 30, 2023

@seladb
Can you explain the below code, are you looking the bit pattern, I'm trying to relate with wireshark output for GTPv1 to plan the GTP2 code

bool GtpV1Layer::isGTPv1(const uint8_t* data, size_t dataSize)
{
if(data != NULL && dataSize >= sizeof(gtpv1_header) && (data[0] & 0xE0) == 0x20)
{
return true;
}

return false;

}

@mmanoj
Copy link

mmanoj commented Jan 30, 2023

GTPv1-01

@mmanoj
Copy link

mmanoj commented Jan 30, 2023

above from 3_reattach.zip

@seladb
Copy link
Owner

seladb commented Jan 30, 2023

@mmanoj the idea is to look at the first 3 bits of the Flags byte. In GTPv1 these bits will be set to 001:

image

And in GTPv2 they will be set to 010:

image

Please let me know if that makes sense

@mmanoj
Copy link

mmanoj commented Jan 30, 2023

@seladb
Can you check my calculation and understanding is correct?

GTPv1:
00110000
11100000 (0xE0) AND

00100000 = 20 in hex

GTPv2:
01001000
11100000 (0xE0) AND

01000000 =40 in Hex

bool GtpV2Layer::isGTPv2(const uint8_t* data, size_t dataSize)
{
if(data != NULL && dataSize >= sizeof(gtpv2_header) && (data[0] & 0xE0) == 0x40)
{
return true;
}

return false;
}

@seladb
Copy link
Owner

seladb commented Jan 31, 2023

@seladb Can you check my calculation and understanding is correct?

GTPv1: 00110000 11100000 (0xE0) AND

00100000 = 20 in hex

GTPv2: 01001000 11100000 (0xE0) AND

01000000 =40 in Hex

bool GtpV2Layer::isGTPv2(const uint8_t* data, size_t dataSize) { if(data != NULL && dataSize >= sizeof(gtpv2_header) && (data[0] & 0xE0) == 0x40) { return true; }

return false; }

@mmanoj I think this is correct. The best way to make sure is to test with a real GTPv2 packet 😃

@mmanoj
Copy link

mmanoj commented Jan 31, 2023

@seladb

Thanks for the feedback.I will check and update you.Please share your email if possible to easy communication.

@seladb
Copy link
Owner

seladb commented Jan 31, 2023

Sure @mmanoj thank you! 🙏

You can always reach out to me at pcapplusplus@gmail.com

@mmanoj
Copy link

mmanoj commented May 22, 2023

@seladb

can you advice, what will be the impact of below in example live capture app
// Capturing packets in a packet vector
pcpp::multiPlatformSleep(10)
As per my tests it will impact the capture performance/PPS

I observed low sleep leading to packet loss.Any idea?

@seladb
Copy link
Owner

seladb commented May 29, 2023

@mmanoj as mentioned in the comment below this line:

// sleep for 10 seconds in main thread, in the meantime packets are captured in the async thread

We sleep for 10 seconds in the main thread while the packet capture happens in another thread. Packet loss may happen if the capture thread cannot handle the volume of packets...

@mmanoj
Copy link

mmanoj commented May 30, 2023

@seladb

Thanks for the feedback, when I shifted to blocking mode it's seems drop rate reduce to 0.02% . The PPS we tested around 5000 PPS. I dont think it's big amount as per the framework bench marked results.

@seladb
Copy link
Owner

seladb commented May 30, 2023

it's hard to analyze the packet loss without diving deeper into the details. In general blocking mode might be a bit faster because the packet capture happens on the main thread, while in non-blocking mode the main thread is running in parallel to the capture thread. But it's hard to say for sure if this is causing the difference in packet loss

@hpirlo
Copy link

hpirlo commented Nov 16, 2023

@seladb

I want to start working on GTPv2. Would you please tell me what the current situation is with this issue?
Is there any progress, or should I start from scratch?

@seladb
Copy link
Owner

seladb commented Nov 17, 2023

@seladb

I want to start working on GTPv2. Would you please tell me what the current situation is with this issue? Is there any progress, or should I start from scratch?

@hpirlo I don't think anyone is working on it now, I'd really appreciate if you can work on it

@mmanoj
Copy link

mmanoj commented Nov 23, 2023

@seladb and @hpirlo

Sorry for late reply, not much work done after above due to other priority work.However I can help much as I can also I can share the initial work I done for the GTPv2.

@hpirlo
Copy link

hpirlo commented Nov 23, 2023

@mmanoj

I think it is good to create a branch and share what you've done in GTPv2 so that I can continue and complete it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants