listen

Description

Sets up a related ephemeral listener to allow an incoming related connection to be established. The source address and/or port of the related connection is unknown but the destination address and port are known.

Syntax

listen {
    proto <ip_protocol>
    timeout <seconds>
    bind <vlan> <addr> <port>
    server <addr> <port>
    allow <addr> [<port>]
}

listen { proto <ip_protocol> timeout <seconds> bind <vlan> <addr> <port> server <addr> <port> allow <addr> [<port>] }

  • Sets up a related ephemeral listener to allow an incoming related connection to be established.
  • Where:

parameter options description
proto ip_protocol The IP protocol number used in the connection. See /etc/protocols. Usually 6 (TCP) or 17 (UDP). See also IP::protocol
timeout seconds The number of seconds to hold the listener open waiting on a connection.
bind vlan, addr, port The vlan number of the vlan to listen on. See also LINK::vlan_id
server addr, port The address and port to connect the listening connection to. See also LB::server
allow addr, optional port The address and optional port to restrict the incoming connection to. See also IP::client_addr

Examples

# Note, this example is not quite working yet...
# connect to virtual and send something like "L 4444" to listen on port 4444.
rule rl_listen {

   when RULE_INIT {
      set my_port ""
   }
   when CLIENT_ACCEPTED {
      TCP::collect 6
   }
   when CLIENT_DATA {
      set my_port [getfield [TCP::payload 6] " " 2]
   }
   when LB_SELECTED {
      listen {
         proto [IP::protocol]
         timeout 30
         bind [LINK::vlan_id] [IP::local_addr] $my_port
         server [LB::server addr] 7
         allow [IP::client_addr]
      }
   }
}