Fortinet white logo
Fortinet white logo

Script Reference Guide

IP:local_addr()

IP:local_addr()

For the frontend, this returns the IP address of the virtual server that the client is connected to. For the backend, this returns the incoming interface IP address of the return packet.

Syntax

sip=IP:local_addr()

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:local_addr()

IP:local_addr()

For the frontend, this returns the IP address of the virtual server that the client is connected to. For the backend, this returns the incoming interface IP address of the return packet.

Syntax

sip=IP:local_addr()

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.