Add (and document) host.reason and host.reason_ttl

This commit is contained in:
jay 2014-08-10 06:28:58 +00:00
parent fc5cc15b2c
commit 4d5950cb42
2 changed files with 26 additions and 0 deletions

View file

@ -1783,6 +1783,29 @@ host.os = {
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>host.reason</option>
</term>
<listitem>
<para>
Contains a string representation of the reason why the target host is in
its current state. The reason is given by the type of the packet that
determined the state. For example, an <literal>echo-reply</literal> from
an alive host.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>host.reason_ttl</option>
</term>
<listitem>
<para>
Contains the TTL value of the response packet, that was used to determine
the status of the target host, when it arrived. This response packet is the
packet that is also used to set <literal>host.reason</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>host.directly_connected</option>
</term>

View file

@ -151,6 +151,9 @@ void set_hostinfo(lua_State *L, Target *currenths) {
nseU_setsfield(L, -1, "ip", currenths->targetipstr());
nseU_setsfield(L, -1, "name", currenths->HostName());
nseU_setsfield(L, -1, "targetname", currenths->TargetName());
nseU_setsfield(L, -1, "reason", reason_str(currenths->reason.reason_id, SINGULAR));
nseU_setnfield(L, -1, "reason_ttl", currenths->reason.ttl);
if (currenths->directlyConnectedOrUnset() != -1)
nseU_setbfield(L, -1, "directly_connected", currenths->directlyConnected());
if (currenths->MACAddress())