# File ../../auditor/lib/kasp_auditor/auditor.rb, line 504
    def check_nsec_next(rr, last_next)
      # Keep last_nsec_next.
      if (!@last_nsec)
        @last_nsec = rr
        return
      end

      compare_val = (last_next <=> rr.name)
      if (compare_val > 0)
        # last was greater than we expected - we missed an NSEC
        # Was the NSEC in the unknown_nsecs list?
        if (n = @unknown_nsecs[last_next.to_s+"."])
          # We missed one because the type was unknown.
          # So - fix up the list. We need to check that the unknown NSEC points to rr.name
          if (rr.type == "NSEC3")
            if (n == (rr.name.labels()[0].to_s))
              @last_nsec = rr
              return
            end
          else
            if (n == (rr.name.to_s + "."))
              @last_nsec = rr
              return
            end
          end
        end
        # print an error
        log(LOG_ERR, "Can't follow #{rr.type} loop from #{@last_nsec.name} to #{last_next}")
      elsif (compare_val < 0)
        # last was less than we expected - we have an extra nsec
        # print an error
        log(LOG_ERR, "NSEC record left after folowing closed loop : #{rr.name}. Was expecting #{last_next}")
      else
        # All OK
      end
      @last_nsec = rr

    end