]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
DNS: better handle TX' with lost replies
authorVictor Julien <victor@inliniac.net>
Tue, 2 Jul 2013 12:44:41 +0000 (14:44 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 4 Jul 2013 11:52:13 +0000 (13:52 +0200)
src/app-layer-dns-common.c
src/app-layer-dns-common.h

index 1c3f164518e0c565045dbe8a845b2d1d5cea1bdd..bccad58638594214427d08a15470cefec410c897 100644 (file)
@@ -88,7 +88,7 @@ uint64_t DNSGetTxCnt(void *alstate) {
 
 int DNSGetAlstateProgress(void *tx, uint8_t direction) {
     DNSTransaction *dns_tx = (DNSTransaction *)tx;
-    return dns_tx->replied;
+    return dns_tx->replied|dns_tx->reply_lost;
 }
 
 /* value for tx->replied value */
@@ -293,6 +293,9 @@ bad_data:
 void DNSStoreQueryInState(DNSState *dns_state, const uint8_t *fqdn, const uint16_t fqdn_len,
         const uint16_t type, const uint16_t class, const uint16_t tx_id)
 {
+    if (dns_state->curr != NULL && dns_state->curr->replied == 0)
+        dns_state->curr->reply_lost = 1;
+
     DNSTransaction *tx = DNSTransactionFindByTxId(dns_state, tx_id);
     if (tx == NULL) {
         tx = DNSTransactionAlloc(tx_id);
index 7a7e99d34c897d1f0bf2bb2eafaa95c84c632d9f..1782188bb193c54226f3aeec0ff45aed88b2a66b 100644 (file)
@@ -124,9 +124,10 @@ typedef struct DNSAnswerEntry_ {
 typedef struct DNSTransaction_ {
     uint16_t tx_num;                                /**< internal: id */
     uint16_t tx_id;                                 /**< transaction id */
-    uint16_t replied;                               /**< bool indicating request is
+    uint8_t replied;                                /**< bool indicating request is
                                                          replied to. */
-    uint16_t no_such_name;                          /**< server said "no such name" */
+    uint8_t reply_lost;
+    uint8_t no_such_name;                           /**< server said "no such name" */
 
     TAILQ_HEAD(, DNSQueryEntry_) query_list;        /**< list for query/queries */
     TAILQ_HEAD(, DNSAnswerEntry_) answer_list;      /**< list for answers */