ltm rule command DATAGRAM dnsΒΆ

iRule(1)					  BIG-IP TMSH Manual					     iRule(1)

DATAGRAM::dns
       Returns DNS header information.

SYNOPSIS
       DATAGRAM::dns (id | qr | opcode | qdcount | ancount | nscount | arcount)

DESCRIPTION
       This iRules command returns DNS header information.
	 Note: L4 protocol of the packet must be either TCP or UDP for this command
	       to work. Also, the L4 port must be equal to the dns port (typically port 53).

       DATAGRAM::dns id

	    * Returns DNS header 16-bit XidentificationX field as an integer value.

       DATAGRAM::dns qr

	    * Returns DNS header Xquery/responseX as a boolean value.
	      0 indicates a XqueryX and 1 indicates a XresponseX.

       DATAGRAM::dns opcode

	    * Returns DNS header XopcodeX as a string.
	      Values include XQueryX, XIQueryX, XStatusX, XNotifyX, XUpdateX and XUnassignedX.

       DATAGRAM::dns qdcount

	    * Returns DNS header field Xquestion countX as an integer value.

       DATAGRAM::dns ancount

	    * Returns DNS header field Xanswer countX as an integer value.

       DATAGRAM::dns nscount

	    * Returns DNS header field Xauthority record countX as an integer value.

       DATAGRAM::dns qdcount

	    * Returns DNS header field Xadditional record countX as an integer value.

RETURN VALUE
VALID DURING
       FLOW_INIT, CLIENT_DATA

EXAMPLES
	when FLOW_INIT {
	  if { [IP::protocol] == 6 } {
	    log local0. "TCP Payload Length = [DATAGRAM::tcp payload_length] Payload: [DATAGRAM::tcp payload 100]"
	    log local0. "DNS Header fields ID: [DATAGRAM::dns id] QR: [DATAGRAM::dns qr] OPCODE: [DATAGRAM::dns opcode] QDCOUNT: [DATAGRAM::dns qdcount]"
	  }
	  if { [IP::protocol] == 17 } {
	    log local0. "UDP Payload Length = [DATAGRAM::udp payload_length] Payload: [DATAGRAM::udp payload 100]"
	    log local0. "DNS Header fields ID: [DATAGRAM::dns id] QR: [DATAGRAM::dns qr] OPCODE: [DATAGRAM::dns opcode] QDCOUNT: [DATAGRAM::dns qdcount]"
	  }
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-12.0.0 --First introduced the command.

BIG-IP						      2020-06-23					     iRule(1)