PcapPlusPlus icon indicating copy to clipboard operation
PcapPlusPlus copied to clipboard

GTPv2 Support

Open ArmanTulegenov opened this issue 3 years ago • 24 comments

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

ArmanTulegenov avatar Jul 18 '22 15:07 ArmanTulegenov

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

seladb avatar Jul 19 '22 08:07 seladb

Yes, I will try to add GTPv2 layer.

ArmanTulegenov avatar Jul 19 '22 11:07 ArmanTulegenov

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

seladb avatar Aug 24 '22 08:08 seladb

@ArmanTulegenov

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

mmanoj avatar Dec 23 '22 05:12 mmanoj

@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:

seladb avatar Dec 24 '22 22:12 seladb

@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 avatar Dec 25 '22 05:12 mmanoj

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.

mmanoj avatar Jan 10 '23 06:01 mmanoj

Sounds good @mmanoj , thanks for the update!

I am looking forward to seeing your PR.

cc @egecetin

seladb avatar Jan 10 '23 08:01 seladb

@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 avatar Jan 30 '23 08:01 mmanoj

GTPv1-01

mmanoj avatar Jan 30 '23 08:01 mmanoj

above from 3_reattach.zip

mmanoj avatar Jan 30 '23 08:01 mmanoj

@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

seladb avatar Jan 30 '23 09:01 seladb

@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 avatar Jan 30 '23 13:01 mmanoj

@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 😃

seladb avatar Jan 31 '23 08:01 seladb

@seladb

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

mmanoj avatar Jan 31 '23 14:01 mmanoj

Sure @mmanoj thank you! 🙏

You can always reach out to me at [email protected]

seladb avatar Jan 31 '23 16:01 seladb

@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?

mmanoj avatar May 22 '23 17:05 mmanoj

@mmanoj as mentioned in the comment below this line: https://github.com/seladb/PcapPlusPlus/blob/fb3a560482cbc3d5f12c2fa0b49e55cb3e0ab139/Examples/Tutorials/Tutorial-LiveTraffic/main.cpp#L181

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...

seladb avatar May 29 '23 02:05 seladb

@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.

mmanoj avatar May 30 '23 02:05 mmanoj

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

seladb avatar May 30 '23 06:05 seladb

@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 avatar Nov 16 '23 22:11 hpirlo

@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

seladb avatar Nov 17 '23 02:11 seladb

@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.

mmanoj avatar Nov 23 '23 13:11 mmanoj

@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.

hpirlo avatar Nov 23 '23 21:11 hpirlo