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

GUE dissection support #510

Closed
wants to merge 7 commits into from
Closed

Conversation

Wilm0r
Copy link

@Wilm0r Wilm0r commented Mar 18, 2016

Hello,

Here's a patch adding support for GUE (Generic UDP Encapsulation) to tcpdump. The spec can be found at: https://tools.ietf.org/html/draft-ietf-nvo3-gue-02 (header format in 2.2).

This is fairly basic but will show dissection of inner IPv4/IPv6 packets assuming GUE is indeed configured on the officially allocated port 6080. Sadly this is not going to be a firm standard (for example one may want to use a privileged <1024 port instead for security reasons), so I wonder whether, for example, using getservbyname() instead of hardcoded port numbers would be acceptable? There's no prior art for this in your code yet from what I can tell which is why I haven't done this yet.

Kind regards,

Wilmer van der Gaast.

Wilmer van der Gaast added 3 commits March 4, 2016 16:18
No interpretation of flags and other fields, they are not described in
detail in the I-D yet. Do dissect the inner packet which is the most
useful.
@Wilm0r
Copy link
Author

Wilm0r commented Apr 11, 2016

I've merged recent changes, this PR should apply cleanly against master now.

case 0:
gue_print_0(ndo, bp, len);
break;
default:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to add support for version 0x1?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll need some dumps to do so, I don't have any so far which makes writing (and testing) that a little bit hard. Will update this PR once that (and the other changes) are done.

@infrastation
Copy link
Member

Regarding the port numbers, getservbyname() use would not be a good idea because its return value generally may be (and practice will be) volatile and inconsistent across different hosts. tcpdump may be run on a host different from the one that did tunnel termination and the one that did the packet capture.

Section 5.6.2 of the Internet-Draft discusses a use of a magic number. That may be a more reliable means of telling the packets apart but the spec would need to have it as a normative statement rather than as a potential future approach. Maybe you would like to discuss this with the document authors as the root of the problem seems to be there. The magic number support in tcpdump should not be difficult per se.

@Wilm0r Wilm0r changed the title GUE dissection support GUE dissection suppor Jul 4, 2016
@Wilm0r
Copy link
Author

Wilm0r commented Jul 6, 2016

Regarding magic numbers, I'm told that's most likely going to get removed from the next draft version, so better not to add support for it.

So what I'll do is add support for version 1 and squash the commits back into one.

@Wilm0r Wilm0r changed the title GUE dissection suppor GUE dissection support Jul 6, 2016
@Wilm0r
Copy link
Author

Wilm0r commented Oct 5, 2016

Sorry for the long delay on this :-(

So magic numbers are going to get removed, I think it should be okay to not support those then?

And for GUEv1, I've tried to get example dumps but no response so far. One may be able to generate them using a very recent Linux kernel, but I'd rather not do this myself, not being all that familiar with GUEv1 in particular..

@infrastation
Copy link
Member

Thank you for the update. It would make it easier to review further with the new code rebased on the current master branch.

@Wilm0r
Copy link
Author

Wilm0r commented Oct 5, 2016

But of course, I was planning to do a merge but wanted to ask first how strongly you feel about the GUEv1 support.

Merged now. Not all tests pass, but the failing ones are not GUE and are failing in the parent branch as well. :-(

I'd squash this branch but I think Github can do that for you at merge time now?

@fxlb
Copy link
Member

fxlb commented Oct 6, 2016

Some warnings here: https://travis-ci.org/the-tcpdump-group/tcpdump/jobs/165389888

./print-gue.c: In function ‘gue_print_0’:
./print-gue.c:119:2: warning: C++ style comments are not allowed in ISO C90 [enabled by default]
./print-gue.c:119:2: warning: (this will be reported only once per input file) [enabled by default]
./print-gue.c:93:8: warning: unused variable ‘control’ [-Wunused-variable]

@Wilm0r
Copy link
Author

Wilm0r commented Oct 7, 2016

Oops, yeah those didn't appear during my local build. :-/ Fixed and the current build at https://travis-ci.org/the-tcpdump-group/tcpdump/jobs/165633760 looks clean now.

@Wilm0r
Copy link
Author

Wilm0r commented Jan 9, 2017

So is it okay to merge this one with just GUEv0, not v1? I've not been able to get dumps of GUEv1 traffic so far..

@infrastation
Copy link
Member

Could you rebase this on the current master branch?

@Wilm0r
Copy link
Author

Wilm0r commented Feb 20, 2018

Sorry for the delay - I'll try to do this in a few days when I get back into the office. (Been out for a while.)

@infrastation
Copy link
Member

Sure, take your time.

@guyharris
Copy link
Member

guyharris commented Mar 26, 2018

You need to update CMakeLists.txt to include print-gue.c as well.

@Wilm0r
Copy link
Author

Wilm0r commented Mar 27, 2018

Oh, thanks for the hint. I was still trying to update the range checking to use your ND_T(TEST|CHECK) macros as well but couldn't fully figure them out. :-( (CHECK vs TEST and also what to do for the check on length>=sizeof(struct ip))

@infrastation
Copy link
Member

@Wilm0r, if you wish to resume this work, please update this pull request within 14 days. Otherwise it will be closed.

@fxlb
Copy link
Member

fxlb commented Nov 2, 2021

FYI, this is an expired Internet-Draft.
draft-ietf-nvo3-gue-02 -> draft-ietf-intarea-gue-09
(https://datatracker.ietf.org/doc/draft-ietf-intarea-gue/)

@Wilm0r
Copy link
Author

Wilm0r commented Nov 2, 2021

Correct, there seem to be two versions now. I'll see whether I can get this PR back into decent shape, and how to deal with the versions/support both of them at all. Don't know which one's more common.

I think the two protocols aren't really compatible nor are they detectable easily except maybe with heuristics. Would the usual tcpdump solution be to just name them separately, for example gue0 and gue1 ?

@fxlb
Copy link
Member

fxlb commented Nov 2, 2021

I'll see whether I can get this PR back into decent shape

Is it useful for an expired draft?
If this specification is useful to you, why not find some people to revive it.

@fxlb
Copy link
Member

fxlb commented Nov 2, 2021

there seem to be two versions now.

Do you have specifications about these versions/variants?

@infrastation
Copy link
Member

@Wilm0r, in case you don't have the motivation to follow the developments of this protocol design closely, it is OK not to implement it, and to get something else done instead. Often it is better not to have a particular protocol support at all than to have out of date code and the cost of its maintenance.

@Wilm0r
Copy link
Author

Wilm0r commented Nov 19, 2021

Sorry for losing track of this again.

I agree, I don't want to contribute code that is prone to rot. What I will try to do is figure out the status of GUEv0 vs v1 and see what is wise here. AFAIK (and I should add that at work I'm not actually that close to this project/development (anymore)) GUE is definitely used more widely including by some hardware so support would be useful, but I'll need to figure out which of the two versions.

Feel free to close this PR if you've lost patience, I can reopen/open a new one if needed. I'll obviously need to deal with a pretty intense merge anyway.

BTW, my main worry for this one is that GUE can be on ~any port#. (We use a privileged <1024 port instead of the IANA-reserved one ourselves.) When I wrote this patch, tcpdump didn't really support "use this port#" arguments for decoders (while Wireshark does have "reinterpret this stream as protocol X" for example), possibly this has changed?

@infrastation
Copy link
Member

The traditional workaround to decode a protocol of interest on a non-standard UDP port would be along the lines of tcpdump -T gue udp port NNNN, which would obviously exclude decoding all other traffic, but would be better than nothing.

@infrastation
Copy link
Member

If in 14 days it is still not clear how to progress this matter in a constructive way, it will be better to close this request.

@infrastation
Copy link
Member

For reference, a potential alternative way to apply dissectors to non-standard ports was discussed in #495.

@infrastation
Copy link
Member

It is time.

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

Successfully merging this pull request may close these issues.

4 participants