Forum Discussion
cjun
Nimbostratus
Jul 05, 2008Extracting info for DHCP option
The iRule here is to find out value for DHCP option 82 for further processing. It can be used
for extracting info for other kind of packet as long as packet format is known.
Few ...
Nicola_DT
Nimbostratus
May 11, 2011Hi heroes,
I have used this irule to be able to parse the udp packet and find the option 82, all works well but when I try then to make a decision on the field I see on option 82 I get in troubles.
I have just set an easy test to be sent to 2 different dhcp servers:
binary scan $dhcp_option_payload x[expr { $option_82_6_offset + 2 } ]a[expr { $option_82_6_length * 2 } ] agent_remote_id
log local0. "Agent Remote ID: $agent_remote_id" ** That one is correctly parsed**
binary scan [UDP::payload] x028H12 dhcp_client_mac_address ** That mac address is correctly parsed **
**This is the test that gives me issues: easily in some cases the 2 strings match and then I have to send the dhcp request to a pool of DHCP, else send to another pool of DHCP's**
if { $agent_remote_id == $dhcp_client_mac_address } {
log local0. "Using DHCP pool dhcp main" ** worls well, data is correct **
pool dhcp-ut-group_main ** this is the line that gives me the error, see down **
This test is performed but then instead of sending packet to the right pool I see a tcl error (and packet is sent to the default virtual server pool).
This is what I see on ltm logs:
May 11 11:05:42 local/tmm info tmm[6916]: Rule dhcp-extended-rule-2 : (Subscriber ID: 30304130424332354430464340756e636f6d6d697373696f6e6564)
May 11 11:05:42 local/tmm info tmm[6916]: Rule dhcp-extended-rule-2 : NSP: 756e636f6d6d697373696f6e6564
May 11 11:05:42 local/tmm info tmm[6916]: Rule dhcp-extended-rule-2 : (Option 82.6 offset: 108)
May 11 11:05:42 local/tmm info tmm[6916]: Rule dhcp-extended-rule-2 : (Option 82.6 length: 06)
May 11 11:05:42 local/tmm info tmm[6916]: Rule dhcp-extended-rule-2 : Agent Remote ID: 00a0bc25d0fc
May 11 11:05:42 local/tmm info tmm[6916]: Rule dhcp-extended-rule-2 : Client MAC Address 00a0bc25d0fc
May 11 11:05:42 local/tmm info tmm[6916]: Rule dhcp-extended-rule-2 : Using DHCP pool dhcp main
May 11 11:05:42 local/tmm err tmm[6916]: 01220001:3: TCL error: dhcp-extended-rule-2 - Address in use (line 47) invoked from within "pool dhcp-ut-group_main"
Can anyone help me with that "Address in use" error ?
How can I use the right pool without the error ?
PS
if I change the evento to client_accepted it seems to work, without giving the "Address in use" error, but it happens that many DHCP requests are not triggering the irule, maybe because we're in UDP and not in TCP...
I am stuck :/
Thanx a lot for any tips,
Nicola.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
