pfSense Support Subscription

Author Topic: USD$50 - DHCP Option 82 on status_dhcp_leases.php page  (Read 3472 times)

0 Members and 1 Guest are viewing this topic.

Offline djzort

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +2/-0
    • View Profile
USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« on: January 19, 2014, 05:51:56 pm »
We configure our switches to do DHCP Snooping and add option 82 information. WiFi access points can also be configured to inject values, as can a variety of equipment.

This information, if included in the dhcp packets, is already saved in /var/dhcpd/var/db/dhcpd.leases

Quote
lease 192.168.1.53 {
  starts 0 2014/01/19 23:44:58;
  ends 1 2014/01/20 01:44:58;
  cltt 0 2014/01/19 23:44:58;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet aa:08:19:0c:9c:ff;
  uid "\001\000\010\031\014\234\307";
  option agent.circuit-id 0:1:0:e;
  option agent.remote-id 64:66:b3:a3:e9:80;
  client-hostname "samoa";
}



This bounty is merely to display this information on the status_dhcp_leases.php page. The Hex values should be decoded back to ascii.


Offline bryan.paradis

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +4/-10
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #1 on: January 23, 2014, 01:58:17 am »
We configure our switches to do DHCP Snooping and add option 82 information. WiFi access points can also be configured to inject values, as can a variety of equipment.

This information, if included in the dhcp packets, is already saved in /var/dhcpd/var/db/dhcpd.leases

Quote
lease 192.168.1.53 {
  starts 0 2014/01/19 23:44:58;
  ends 1 2014/01/20 01:44:58;
  cltt 0 2014/01/19 23:44:58;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet aa:08:19:0c:9c:ff;
  uid "\001\000\010\031\014\234\307";
  option agent.circuit-id 0:1:0:e;
  option agent.remote-id 64:66:b3:a3:e9:80;
  client-hostname "samoa";
}



This bounty is merely to display this information on the status_dhcp_leases.php page. The Hex values should be decoded back to ascii.

Could you be more clear. I have it already displaying the values I need to understand which ones and in what format.
« Last Edit: January 23, 2014, 09:15:57 pm by bryan.paradis »

Offline djzort

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +2/-0
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #2 on: January 23, 2014, 07:17:56 pm »
agent.circuit-id is the "port" that the dhcp client is attached to. the hover-over tip should explain that. it would probably be most useful to convert from hex to int and display with slashes or dashes or something. so in this case 0:1:0:e becomes 0/1/0/14

agent.remote-id is a mac address or the device that the dhcp client is connected to. the hover-over tip should explain that too. i guess not much to decode for this really. maybe link it to dhcp leases?


Offline bryan.paradis

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +4/-10
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #3 on: January 23, 2014, 09:14:57 pm »
agent.circuit-id is the "port" that the dhcp client is attached to. the hover-over tip should explain that.

agent.remote-id is a mac address or the device that the dhcp client is connected to. the hover-over tip should explain that too.

Added tooltips to each row and to column title. Let me know if you want just column title tooltips.

It would probably be most useful to convert from hex to int and display with slashes or dashes or something. so in this case 0:1:0:e becomes 0/1/0/14

Did the conversion of client-id. Remote-id resting as is.

Code: [Select]
client-id: hex:hex:hex:hex -> dec/dec/dec/dec
remote-id: hex:hex:hex:hex:hex:hex

status_dhcp_leases.php with agent.circuit-id & agent.-remote-id

Offline djzort

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +2/-0
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #4 on: January 27, 2014, 08:04:36 pm »
dont forget to add yourself to the credits at the top?

Offline bryan.paradis

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +4/-10
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #5 on: January 27, 2014, 08:17:02 pm »
dont forget to add yourself to the credits at the top?

So has this work forfilled your bounty requirements? Have you tried it out yet? Simply backup your status_dhcp_leases.php file and place the one posted above.
« Last Edit: January 28, 2014, 12:19:50 am by bryan.paradis »

Offline djzort

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +2/-0
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #6 on: January 29, 2014, 10:46:01 pm »
yup looks good.

please submit for inclusion in pfsense and pm me your paypal details

Offline bryan.paradis

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +4/-10
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #7 on: March 05, 2014, 07:57:08 pm »
yup looks good.

please submit for inclusion in pfsense and pm me your paypal details

Behavoir before merge. Because it is an odd ball thing what do you think about having a option somewhere to enable it or make it show the information if it is exists? I have a feeling that just having it always show up as another column may come up as a problem with the devs on merge.

Offline Klaws

  • Full Member
  • ***
  • Posts: 253
  • Karma: +14/-3
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #8 on: March 17, 2014, 10:24:51 am »
Yes.

I'd suggest to use the System Patches package to add this feature to a specific installation.

Offline bryan.paradis

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +4/-10
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #9 on: March 17, 2014, 07:22:53 pm »
Yes.

I'd suggest to use the System Patches package to add this feature to a specific installation.

Yeah probably but then again we may see it get broken. maybe a setting to turn off or on somewhere

Offline Petru

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #10 on: April 03, 2017, 09:35:16 am »
This is an old thread, but posting here anyway for future reference :)

agent.circuit-id is the "port" that the dhcp client is attached to. the hover-over tip should explain that. it would probably be most useful to convert from hex to int and display with slashes or dashes or something. so in this case 0:1:0:e becomes 0/1/0/14

agent.remote-id is a mac address or the device that the dhcp client is connected to. the hover-over tip should explain that too. i guess not much to decode for this really. maybe link it to dhcp leases?

Please see RFC 3046:
 - Agent Circuit ID Sub-option: https://tools.ietf.org/html/rfc3046#section-3.1
 - Agent Remote ID Sub-option: https://tools.ietf.org/html/rfc3046#section-3.2

Both are supposed to be opaque:
    "The Circuit ID SHOULD be considered an opaque value, with policies based on exact string match only; that is, the Circuit ID SHOULD NOT be internally parsed by the server."
    "The option [NB: Remote ID] SHOULD be considered an opaque value, with policies based on exact string match only; that is, the option SHOULD NOT be internally parsed by the server."

In addition, the meaning of both are left to the specific implementations of each particular DHCP Relay Agents:
    Circuit ID:
       - Router interface number
       - Switching Hub port number
       - Remote Access Server port number
       - Frame Relay DLCI
       - ATM virtual circuit number
       - Cable Data virtual circuit number
    Remote ID:
       -- a "caller ID" telephone number for dial-up connection
       -- a "user name" prompted for by a Remote Access Server
       -- a remote caller ATM address
       -- a "modem ID" of a cable data modem
       -- the remote IP address of a point-to-point link
       -- a remote X.25 address for X.25 connections

IMHO, each switch/router/ras manufacturer/model would have its own implementation that would invalidate the code below (or above depending on sorting :) )

If one would be to implement such a feature, maybe an optional input box with some modifiable regex that would be applied on the raw strings might be more future-proof ?
« Last Edit: April 21, 2017, 05:53:39 pm by Petru »

Offline hermandalig

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: USD$50 - DHCP Option 82 on status_dhcp_leases.php page
« Reply #11 on: May 11, 2017, 01:26:30 pm »
Could you be more clear. I have it already displaying the values I need to understand which ones and in what format.