[prev in list] [next in list] [prev in thread] [next in thread]
List: dhcp-users
Subject: Re: Logging GI-Addr
From: Bill Shirley <bill () c3po ! polymerindustries ! biz>
Date: 2018-02-13 0:23:05
Message-ID: ed0c3520-a0f6-a9e8-02cf-82c1eb9dfa4a () c3po ! polymerindustries ! biz
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Yes, that is correct. Insert that line in with the rest of your logging.
on commit {
log (
info,
concat (
"Host:", pick-first-value(option fqdn.hostname, option host-name, \
"(none)"), "=>", pick-first-value(config-option server.ddns-hostname, "(none)")
...
," GIaddr:", pick-first-value(binary-to-ascii(10, 8, ".", \
packet(24,4)), "(none)") # ," Circuit:", \
pick-first-value(binary-to-ascii(10, 8, ":", option agent.circuit-id), "(none)") # \
," Remote:", pick-first-value(option agent.remote-id, "(none)")
," ReqOpt:", pick-first-value(binary-to-ascii(10, 8, ",", option \
dhcp-parameter-request-list), "(none)") )
);
}
Bill
On 2/12/2018 5:35 PM, Gregory Sloop wrote:
> Re: Logging GI-Addr
>
> " GIaddr:", pick-first-value(binary-to-ascii(10, 8, ".", packet(24,4)), "(none)")
>
>
>
> So, let me break this down, and see if I understand it correctly.
> Starting from the inside...
>
> Offset into the packet 24 bytes, and return 4 bytes [4 octets].
> ---
> I think this means that the OP, HType, HLen and HOPS, [4 bytes / 1 octet [each] *4]
> XID [4 octets / 4 bytes]
> SECs and FLAGs [4 bytes, 2 octets each*2]
> Then continue to offset past the CIADDR, YADDR & SIADDR (Four octets, 4 bytes each \
> in IPV4) to get to the GIAddr, at byte 24. Grab 4 bytes, 4 octets
>
> [The wikipedia page on dhcp is pretty handy here! \
> https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol]
> ---
>
> Convert from binary to ASCII from base 8 to base 10. Separate the items with "."
>
> Grab the first non-null output from that output of binary-to-ascii.
> If there's no GIAddr in this packet, return "(none)"
>
> Do I have that right?
>
> Thanks so much!
>
> -Greg
>
>
>
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users@lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
[Attachment #5 (text/html)]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-15">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Yes, that is correct. Insert that line in with the rest of your
logging.<br>
<br>
<font color="#993300"><tt>on commit {</tt><tt><br>
</tt><tt> log (</tt><tt><br>
</tt><tt> info,</tt><tt><br>
</tt><tt> concat (</tt><tt><br>
</tt><tt> "Host:", pick-first-value(option
fqdn.hostname, option host-name, "(none)"), "=>",
pick-first-value(config-option server.ddns-hostname, "(none)")</tt><tt><br>
</tt><tt>...</tt><tt><br>
</tt><tt> ," GIaddr:",
pick-first-value(binary-to-ascii(10, 8, ".", packet(24,4)),
"(none)")<br>
# ," Circuit:", pick-first-value(binary-to-ascii(10,
8, ":", option agent.circuit-id), "(none)")<br>
# ," Remote:", pick-first-value(option
agent.remote-id, "(none)")<br>
<br>
," ReqOpt:", pick-first-value(binary-to-ascii(10,
8, ",", option dhcp-parameter-request-list), "(none)")<br>
)<br>
</tt><tt></tt><tt> );</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt></font><br>
Bill<br>
<br>
<div class="moz-cite-prefix">On 2/12/2018 5:35 PM, Gregory Sloop
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:744637046.20180212143502@sloop.net">
<title>Re: Logging GI-Addr</title>
<table bgcolor="#ffffff">
<tbody>
<tr>
<td bgcolor="#0000ff" width="2"><br>
</td>
<td><span style=" font-family:'courier new'; font-size: 9pt;
color: #993300;">" GIaddr:",
pick-first-value(binary-to-ascii(10, 8, ".",
packet(24,4)), "(none)")</span></td>
</tr>
</tbody>
</table>
<br>
<br>
<span style=" font-family:'Courier New'; font-size: 9pt;">So, let
me break this down, and see if I understand it correctly.<br>
Starting from the inside...<br>
<br>
Offset into the packet 24 bytes, and return 4 bytes [4 octets].
<br>
---<br>
I think this means that the OP, HType, HLen and HOPS, [4 bytes
/ 1 octet [each] *4]<br>
XID [4 octets / 4 bytes]<br>
SECs and FLAGs [4 bytes, 2 octets each*2]<br>
Then continue to offset past the CIADDR, YADDR & SIADDR
(Four octets, 4 bytes each in IPV4) to get to the GIAddr, at
byte 24. <br>
Grab 4 bytes, 4 octets<br>
<br>
[The wikipedia page on dhcp is pretty handy here! </span><a
style=" font-family:'Courier New'; font-size: 9pt;"
href="https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol"
moz-do-not-send="true">https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol</a><span
style=" font-family:'Courier New'; font-size: 9pt;"> ]<br>
---<br>
<br>
Convert from binary to ASCII from base 8 to base 10. Separate
the items with "."<br>
<br>
Grab the first non-null output from that output of
binary-to-ascii.<br>
If there's no GIAddr in this packet, return "(none)"<br>
<br>
Do I have that right?<br>
<br>
Thanks so much!<br>
<br>
-Greg<br>
<br>
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
dhcp-users mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:dhcp-users@lists.isc.org">dhcp-users@lists.isc.org</a> <a \
class="moz-txt-link-freetext" \
href="https://lists.isc.org/mailman/listinfo/dhcp-users">https://lists.isc.org/mailman/listinfo/dhcp-users</a></pre>
</span></blockquote>
<br>
</body>
</html>
_______________________________________________
dhcp-users mailing list
dhcp-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/dhcp-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic