diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index ede7cb8713..c32834ffbd 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -2933,12 +2933,18 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data return 0; } + /* RFCs 2661 and 3931 say that L2TPv2 and v3 use a TFTP-like method + * of each side choosing their own port and only using the L2TP port + * to establish the connection. In common practice, both parties use + * the assigned L2TP port the entire time, due to NAT, firewalls, etc. + * We support both methods by using conversations with no second port. + */ conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst, ENDPOINT_UDP, pinfo->srcport, pinfo->destport, NO_PORT_B); - if (conv == NULL) { - conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst, ENDPOINT_UDP, - pinfo->srcport, pinfo->destport, 0); + if (conv == NULL || (conversation_get_dissector(conv, pinfo->num) != l2tp_udp_handle)) { + conv = find_conversation(pinfo->num, &pinfo->dst, &pinfo->src, ENDPOINT_UDP, + pinfo->destport, pinfo->srcport, NO_PORT_B); } if ((conv == NULL) || (conversation_get_dissector(conv, pinfo->num) != l2tp_udp_handle)) {