Fortinet white logo
Fortinet white logo

Script Reference Guide

IP:remote_port()

IP:remote_port()

Returns the remote port number. In the frontend, the remote port is the client port. In the backend, the remote port is the real server port.

Syntax

rp=IP:remote_port()

Arguments

N/A

Events

Applicable in the following events:

  • STREAM_CLIENT_INIT

  • STREAM_REQUEST_DATA

  • STREAM_RESPONSE_DATA

Example

when STREAM_RESPONSE_DATA { 
    local cip=IP:client_addr() 
    local lip=IP:local_addr() 
    local rip=IP:remote_addr() 
    local cp=IP:client_port() 
    local lp=IP:local_port() 
    local rp=IP:remote_port() 
    local cipv=IP:client_ip_ver() 
    
    local sip=IP:server_addr() 
    local sp=IP:server_port() 
    local sipv=IP:server_ip_ver() 

    debug("resp: remote %s:%s, client %s:%s, local %s:%s, cip version %s\n", rip, rp, cip, cp, lip, lp, cipv) 
    debug("resp: server %s:%s, sip version %s\n", sip, sp, sipv) 
    log("resp: remote %s:%s, client %s:%s, local %s:%s, cip version %s", rip, rp, cip, cp, lip, lp, cipv) 
    log("resp: server %s:%s, sip version %s", sip, sp, sipv) 
} 

Supported Version

FortiADC version 6.1.1 and later.

IP:remote_port()

IP:remote_port()

Returns the remote port number. In the frontend, the remote port is the client port. In the backend, the remote port is the real server port.

Syntax

rp=IP:remote_port()

Arguments

N/A

Events

Applicable in the following events:

  • STREAM_CLIENT_INIT

  • STREAM_REQUEST_DATA

  • STREAM_RESPONSE_DATA

Example

when STREAM_RESPONSE_DATA { 
    local cip=IP:client_addr() 
    local lip=IP:local_addr() 
    local rip=IP:remote_addr() 
    local cp=IP:client_port() 
    local lp=IP:local_port() 
    local rp=IP:remote_port() 
    local cipv=IP:client_ip_ver() 
    
    local sip=IP:server_addr() 
    local sp=IP:server_port() 
    local sipv=IP:server_ip_ver() 

    debug("resp: remote %s:%s, client %s:%s, local %s:%s, cip version %s\n", rip, rp, cip, cp, lip, lp, cipv) 
    debug("resp: server %s:%s, sip version %s\n", sip, sp, sipv) 
    log("resp: remote %s:%s, client %s:%s, local %s:%s, cip version %s", rip, rp, cip, cp, lip, lp, cipv) 
    log("resp: server %s:%s, sip version %s", sip, sp, sipv) 
} 

Supported Version

FortiADC version 6.1.1 and later.