diff --git a/docs/scripting.xml b/docs/scripting.xml
index 58848674c..8146e8d16 100644
--- a/docs/scripting.xml
+++ b/docs/scripting.xml
@@ -1938,6 +1938,32 @@ host.os = {
+
+
+
+
+
+ Contains a string representation of the reason why the target port is in
+ its current state (given by port.state). The reason is
+ given by the type of the packet that determined the state. For example, a
+ RST packet from a closed port or
+ SYN-ACK from an open port.
+
+
+
+
+
+
+
+
+
+ Contains the TTL value of the response packet, that was used to determine
+ the status of the target port, when it arrived. This response packet is the
+ packet that is also used to set port.reason.
+
+
+
+
diff --git a/nse_nmaplib.cc b/nse_nmaplib.cc
index 6020c43d6..187cb8438 100644
--- a/nse_nmaplib.cc
+++ b/nse_nmaplib.cc
@@ -70,6 +70,7 @@ void set_portinfo (lua_State *L, const Target *target, const Port *port)
nseU_setsfield(L, -1, "protocol", IPPROTO2STR(port->proto));
nseU_setsfield(L, -1, "state", statenum2str(port->state));
nseU_setsfield(L, -1, "reason", reason_str(port->reason.reason_id, 1));
+ nseU_setnfield(L, -1, "reason_ttl", port->reason.ttl);
lua_newtable(L);
set_version(L, &sd);
lua_setfield(L, -2, "version");