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

Incorrect classification in GTP #2

Closed
nhnghia opened this issue Feb 24, 2022 · 0 comments
Closed

Incorrect classification in GTP #2

nhnghia opened this issue Feb 24, 2022 · 0 comments

Comments

@nhnghia
Copy link
Contributor

nhnghia commented Feb 24, 2022

The 3 fields, sequence number (2 octets), n-pdu number (1 octet) and extension header (1 octet), are present if at least one of 3 bit fields, S, NP, E is present.

3GPP_TS_29_281

So the classification is incorrect:

int gtp_classify_next_proto(ipacket_t * ipacket, unsigned index) {

	int offset = get_packet_offset_at_index(ipacket, index);
	struct gtp_header_generic *gtp = (struct gtp_header_generic*)& ipacket->data[offset];
	int gtp_offset = sizeof (struct gtp_header_generic);
	if(gtp->sequence_number == 1){
		gtp_offset += 4;
	}
	if(gtp->ndpu_number == 1){
		gtp_offset += 2;
	}
	if(gtp->extension_header == 1){
		gtp_offset += 2;	
	}
	if (gtp->message_type == 0xff) {
		classified_proto_t retval;
		retval.proto_id = PROTO_IP;
		retval.offset = gtp_offset;
		retval.status = Classified;
		return set_classified_proto(ipacket, index + 1, retval);
	}
	return 0;
}
@nhnghia nhnghia mentioned this issue Mar 7, 2022
@nhnghia nhnghia closed this as completed in c8b7345 Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant