|
|
I've been beating my head against this for days. I've tried all kinds of
variants, but I just can't make it work. What my real end goal i is to
give a special config and boot image to some Polycom phones, ,so this is
all a means to an end. The phones use an option-125 that has Polycom in
it at the beginning (verified with tshark), but no matter what I try in
the config, I can't get the right match. So, I tried adding log
statements for debugging using various offsets, but the log statements
never output anything at all.
Here's an excerpt:
option option125 code 125 = string;
log (debug, concat("hw: ", binary-to-ascii(16,8,":", hardware)));
log (debug, concat("client-id: ",
binary-to-ascii(16,8,":",substring(dhcp-client
-identifier,16,1))));
log (debug, concat("opt-125: ", substring(option125,1,7)));
log (debug, "check option125");
The only lines that output anything are the 'hw' line at the beginning
and the plain old option125 at the end. The other 2 lines output
nothing, not even the plain text.. I wish there was extra levels of
debugging that I could turn on to see raw options processing.
Any hints?
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
|
|
Doug Hughes < [hidden email]> wrote:
> option option125 code 125 = string;
>
> log (debug, concat("hw: ", binary-to-ascii(16,8,":", hardware)));
> log (debug, concat("client-id: ", binary-to-ascii(16,8,":",substring(dhcp-client
> -identifier,16,1))));
> log (debug, concat("opt-125: ", substring(option125,1,7)));
> log (debug, "check option125");
>
> The only lines that output anything are the 'hw' line at the beginning and the plain old option125 at the end. The other 2 lines output nothing, not even the plain text.. I wish there was extra levels of debugging that I could turn on to see raw options processing.
Try changing "substring(option125,1,7)" to "pick-first-value(substring(option125,1,7),"")" and see what happens (check the man page to make sure I've got that right). Ditto for client-id.
With concat, if any element is null, then the whole result is null, and so log won't log anything.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
|
|
Thanks, Simon
I now have the prefix string printed.. So that's good, but no matter
what I seem to put for the substring offset, there's nothing further
printed. I'm scratching my head because I can see the text in the
package and I just wish there was an easier way to extract it.
Here's the raw:
0110 00 00 00 00 00 00 63 82 53 63 35 01 01 39 02 02
......c.Sc5..9..
0120 4e 37 0a 01 1c a0 42 03 04 2a 02 06 0f 33 04 00
N7....B..*...3..
0130 00 a8 c0 3c 76 00 00 36 3d 71 01 07 50 6f 6c 79
...<v..6=q..Poly
0140 63 6f 6d 02 15 53 6f 75 6e 64 50 6f 69 6e 74 49
com..SoundPointI
0150 50 2d 53 50 49 50 5f 33 33 30 03 10 32 33 34 35
P-SPIP_330..2345
0160 2d 31 32 32 30 30 2d 30 30 31 2c 31 04 1e 53 49
-12200-001,1..SI
0170 50 2f 33 2e 32 2e 34 2e 30 32 36 37 2f 33 31 2d
P/3.2.4.0267/31-
0180 4a 61 6e 2d 31 31 20 31 36 3a 34 33 05 1d 42 52 Jan-11
16:43..BR
0190 2f 34 2e 32 2e 33 2e 30 30 30 33 2f 30 37 2d 4a
/4.2.3.0003/07-J
01a0 61 6e 2d 31 31 20 30 39 3a 32 36 7d 76 00 00 36 an-11
09:26}v..6
01b0 3d 71 01 07 50 6f 6c 79 63 6f 6d 02 15 53 6f 75
=q..Polycom..Sou
01c0 6e 64 50 6f 69 6e 74 49 50 2d 53 50 49 50 5f 33
ndPointIP-SPIP_3
01d0 33 30 03 10 32 33 34 35 2d 31 32 32 30 30 2d 30
30..2345-12200-0
01e0 30 31 2c 31 04 1e 53 49 50 2f 33 2e 32 2e 34 2e
01,1..SIP/3.2.4.
01f0 30 32 36 37 2f 33 31 2d 4a 61 6e 2d 31 31 20 31
0267/31-Jan-11 1
0200 36 3a 34 33 05 1d 42 52 2f 34 2e 32 2e 33 2e 30
6:43..BR/4.2.3.0
0210 30 30 33 2f 30 37 2d 4a 61 6e 2d 31 31 20 30 39
003/07-Jan-11 09
0220 3a 32 36 ff 00 00 00 00 00 00 00 00 00 00 00 00
:26.............
0230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Here it is in wireshark:(snip)
I've tried substring(8,7) which seems like it should work, but many
other possibilitie as well.
maybe I should build up a custom option with 2 32 bit ints in the
front to try to force it with a suboption? It doesn't seem like it
should be this difficult.
On 4/12/2016 2:53 AM, Simon Hobson
wrote:
Doug Hughes [hidden email] wrote:
option option125 code 125 = string;
log (debug, concat("hw: ", binary-to-ascii(16,8,":", hardware)));
log (debug, concat("client-id: ", binary-to-ascii(16,8,":",substring(dhcp-client
-identifier,16,1))));
log (debug, concat("opt-125: ", substring(option125,1,7)));
log (debug, "check option125");
The only lines that output anything are the 'hw' line at the beginning and the plain old option125 at the end. The other 2 lines output nothing, not even the plain text.. I wish there was extra levels of debugging that I could turn on to see raw options processing.
Try changing "substring(option125,1,7)" to "pick-first-value(substring(option125,1,7),"")" and see what happens (check the man page to make sure I've got that right). Ditto for client-id.
With concat, if any element is null, then the whole result is null, and so log won't log anything.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
|
|
With what you are doing you need to tag the option125 as an option. You will also need to adjust the starting point of your substring as that option has other stuff in it. From the packet dump the string would appear to start at byte 8. log (debug, concat("opt-125: ", substring(option option125,8,7)));
However what you really want to do is to create an option space for Polycon to properly encode / decode the vendor string. The following appears to get the name properly from a modified version of the option.
option space polycon; option polycon.name code 1 = text; option vendor.polycon code 13885 = encapsulate polycon;
if (exists polycon.name) { log (info, concat("polycon:", option polycon.name));
}
Adding additional sub-options is left as an exercise to the reader.
Shawn
Thanks, Simon
I now have the prefix string printed.. So that's good, but no matter
what I seem to put for the substring offset, there's nothing further
printed. I'm scratching my head because I can see the text in the
package and I just wish there was an easier way to extract it.
Here's the raw:
0110 00 00 00 00 00 00 63 82 53 63 35 01 01 39 02 02
......c.Sc5..9..
0120 4e 37 0a 01 1c a0 42 03 04 2a 02 06 0f 33 04 00
N7....B..*...3..
0130 00 a8 c0 3c 76 00 00 36 3d 71 01 07 50 6f 6c 79
...<v..6=q..Poly
0140 63 6f 6d 02 15 53 6f 75 6e 64 50 6f 69 6e 74 49
com..SoundPointI
0150 50 2d 53 50 49 50 5f 33 33 30 03 10 32 33 34 35
P-SPIP_330..2345
0160 2d 31 32 32 30 30 2d 30 30 31 2c 31 04 1e 53 49
-12200-001,1..SI
0170 50 2f 33 2e 32 2e 34 2e 30 32 36 37 2f 33 31 2d
P/3.2.4.0267/31-
0180 4a 61 6e 2d 31 31 20 31 36 3a 34 33 05 1d 42 52 Jan-11
16:43..BR
0190 2f 34 2e 32 2e 33 2e 30 30 30 33 2f 30 37 2d 4a
/4.2.3.0003/07-J
01a0 61 6e 2d 31 31 20 30 39 3a 32 36 7d 76 00 00 36 an-11
09:26}v..6
01b0 3d 71 01 07 50 6f 6c 79 63 6f 6d 02 15 53 6f 75
=q..Polycom..Sou
01c0 6e 64 50 6f 69 6e 74 49 50 2d 53 50 49 50 5f 33
ndPointIP-SPIP_3
01d0 33 30 03 10 32 33 34 35 2d 31 32 32 30 30 2d 30
30..2345-12200-0
01e0 30 31 2c 31 04 1e 53 49 50 2f 33 2e 32 2e 34 2e
01,1..SIP/3.2.4.
01f0 30 32 36 37 2f 33 31 2d 4a 61 6e 2d 31 31 20 31
0267/31-Jan-11 1
0200 36 3a 34 33 05 1d 42 52 2f 34 2e 32 2e 33 2e 30
6:43..BR/4.2.3.0
0210 30 30 33 2f 30 37 2d 4a 61 6e 2d 31 31 20 30 39
003/07-Jan-11 09
0220 3a 32 36 ff 00 00 00 00 00 00 00 00 00 00 00 00
:26.............
0230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Here it is in wireshark:(snip)
I've tried substring(8,7) which seems like it should work, but many
other possibilitie as well.
maybe I should build up a custom option with 2 32 bit ints in the
front to try to force it with a suboption? It doesn't seem like it
should be this difficult.
<gjiefggc.png>
On 4/12/2016 2:53 AM, Simon Hobson
wrote:
Doug Hughes [hidden email] wrote:
option option125 code 125 = string;
log (debug, concat("hw: ", binary-to-ascii(16,8,":", hardware)));
log (debug, concat("client-id: ", binary-to-ascii(16,8,":",substring(dhcp-client
-identifier,16,1))));
log (debug, concat("opt-125: ", substring(option125,1,7)));
log (debug, "check option125");
The only lines that output anything are the 'hw' line at the beginning and the plain old option125 at the end. The other 2 lines output nothing, not even the plain text.. I wish there was extra levels of debugging that I could turn on to see raw options processing.
Try changing "substring(option125,1,7)" to "pick-first-value(substring(option125,1,7),"")" and see what happens (check the man page to make sure I've got that right). Ditto for client-id.
With concat, if any element is null, then the whole result is null, and so log won't log anything.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________ dhcp-users mailing list [hidden email]https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
|
|
I figured out the trick, though it took me a while..
First and foremost, I had to use 'option option125' or it would fail silently.
match if substring(option option125, 7, 7) = "Polycom";
That works.
Thanks for the help. I'm not sure what I could suggest except to make the documentation a little bit clearer about using the keyword option when doing the substring match or it won't do what you are expecting.
-----Original Message-----
From: [hidden email] [mailto: [hidden email]] On Behalf Of Simon Hobson
Sent: Tuesday, April 12, 2016 2:53 AM
To: Users of ISC DHCP
Subject: Re: log statement doesn't
Doug Hughes < [hidden email]> wrote:
> option option125 code 125 = string;
>
> log (debug, concat("hw: ", binary-to-ascii(16,8,":", hardware)));
> log (debug, concat("client-id: ", binary-to-ascii(16,8,":",substring(dhcp-client
> -identifier,16,1))));
> log (debug, concat("opt-125: ", substring(option125,1,7)));
> log (debug, "check option125");
>
> The only lines that output anything are the 'hw' line at the beginning and the plain old option125 at the end. The other 2 lines output nothing, not even the plain text.. I wish there was extra levels of debugging that I could turn on to see raw options processing.
Try changing "substring(option125,1,7)" to "pick-first-value(substring(option125,1,7),"")" and see what happens (check the man page to make sure I've got that right). Ditto for client-id.
With concat, if any element is null, then the whole result is null, and so log won't log anything.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
|
|
"Hughes, Doug" < [hidden email]> wrote:
> First and foremost, I had to use 'option option125' or it would fail silently.
Ah yes, that gotcha.
If I understand the nuances correctly ...
It would fail silently because "substr(foo...)" is a valid expression - but since foo will itself be unset (null value), the result is simply a null value.
In this case, it uses the server variable called foo - which may be a server set option IIRC.
In the version you need to use, "substr(option foo...)", the "option" keyword means to use the value of the option foo rather than a server variable.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
|
|