if (packet->flags & DNS_RESPONSE_FLAG == 0 || packet->questioncount != 1)
I'm not sure that it does what you want. if (packet->flags & DNS_RESPONSE_FLAG == 0 || packet->questioncount != 1)
I'm not sure that it does what you want. if ((packet->flags & (DNS_RESPONSE_FLAG == 0)) || (packet->questioncount != 1))
which at least does not read as intended.