Guest User

Untitled

a guest
Feb 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. diff --git a/src/app-layer-dns-udp.c b/src/app-layer-dns-udp.c
  2. index 9f1ec9d09..747b441b3 100644
  3. --- a/src/app-layer-dns-udp.c
  4. +++ b/src/app-layer-dns-udp.c
  5. @@ -387,6 +387,35 @@ static void DNSUDPConfigure(void)
  6. DNSConfigSetGlobalMemcap(global_memcap);
  7. }
  8.  
  9. +static void *DNSUDPGetTxIterator(const uint8_t ipproto, const AppProto alproto,
  10. + void *alstate, uint64_t min_tx_id, uint64_t max_tx_id,
  11. + uint64_t *ret_tx_id, AppLayerGetTxIterState *istate)
  12. +{
  13. + DNSState *dns_state = alstate;
  14. + DNSTransaction *tx = NULL;
  15. +
  16. + /* If we have istate, set tx to the next transaction. Otherwise
  17. + * set it to the the first transaction in the list. */
  18. + if (istate != NULL && istate->un.ptr != NULL) {
  19. + tx = TAILQ_NEXT(((DNSTransaction *)istate->un.ptr), next);
  20. + } else {
  21. + tx = TAILQ_FIRST(&dns_state->tx_list);
  22. + }
  23. +
  24. + while (tx != NULL) {
  25. + if (tx->tx_num > max_tx_id) {
  26. + break;
  27. + }
  28. + if (tx->tx_num >= min_tx_id) {
  29. + *ret_tx_id = tx->tx_num + 1;
  30. + return tx;
  31. + }
  32. + tx = TAILQ_NEXT(tx, next);
  33. + }
  34. +
  35. + return NULL;
  36. +}
  37. +
  38. void RegisterDNSUDPParsers(void)
  39. {
  40. const char *proto_name = "dns";
  41. @@ -461,6 +490,9 @@ void RegisterDNSUDPParsers(void)
  42.  
  43. DNSAppLayerRegisterGetEventInfo(IPPROTO_UDP, ALPROTO_DNS);
  44.  
  45. + AppLayerParserRegisterGetTxIterator(IPPROTO_UDP, ALPROTO_DNS,
  46. + DNSUDPGetTxIterator);
  47. +
  48. DNSUDPConfigure();
  49. } else {
  50. SCLogInfo("Parsed disabled for %s protocol. Protocol detection"
Add Comment
Please, Sign In to add comment