Fortinet white logo
Fortinet white logo

Script Reference Guide

IP:client_port()

IP:client_port()

Returns the local port number. In the frontend, the local port is the virtual server port. In the backend, the local port is the port of the gateway used to connect.

Syntax

cp=IP:client_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:client_port()

IP:client_port()

Returns the local port number. In the frontend, the local port is the virtual server port. In the backend, the local port is the port of the gateway used to connect.

Syntax

cp=IP:client_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.