Do not mask protocols on both directions with only first packet
For instance :
When the first packet is no valid DNS but on port 53 (a junk request)
second packet (error response from server) does not get checked for DNS
as first packet bit masked away DNS for both directions
Ticket: #2757
} else {
/* first try the destination port */
pp_port_dp = AppLayerProtoDetectGetProbingParsers(alpd_ctx.ctx_pp, ipproto, dp);
- alproto_masks = &f->probing_parser_toclient_alproto_masks;
+ if (dir == idir) {
+ // do not update alproto_masks to let a chance to second packet
+ // for instance when sending a junk packet to a DNS server
+ alproto_masks = &f->probing_parser_toclient_alproto_masks;
+ }
if (pp_port_dp != NULL) {
SCLogDebug("toclient - Probing parser found for destination port %"PRIu16, dp);