add parse option 82
case 82: {
var len = msg.readUInt8(offset++);
var vlan = msg.readInt16BE(offset + 4);
var port = msg.readUInt8(offset + 7);
var mac = "";
for(var i = 0; i < 6; i++){
if (mac != "") { mac = mac + ":" }
mac = mac + msg.readUInt8(offset + 12 + i).toString(16);
}
p.options.option82 = {
mac: mac,
vlan: vlan,
port: port
};
offset += len;
break;
}
DHCP option 82 is much more complicated -- it is basically a variable length encoding of a number of sub-options that each have their own format. Can you provide a hex dump of the option 82 packet you are seeing so that I can see what sub-options you care about?
21:17:15.366156 IP (tos 0x0, ttl 255, id 31678, offset 0, flags [none], proto UDP (17), length 316)
gw.home-nadym.ru.bootps > 91-221-49-48.home-nadym.ru.bootps: [udp sum ok] BOOTP/DHCP, Request from d4:ca:6d:88:f4:00 (oui Unknown), length 288, hops 1, xid 0x19d8a7f9, secs 53, Flags [none] (0x0000)
Gateway-IP gw.home-nadym.ru
Client-Ethernet-Address d4:ca:6d:88:f4:00 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Parameter-Request Option 55, length 7:
Subnet-Mask, Classless-Static-Route, Default-Gateway, Static-Route
Domain-Name-Server, NTP, Option 138
Hostname Option 12, length 4: "nas1"
Client-ID Option 61, length 7: ether d4:ca:6d:88:f4:00
Agent-Information Option 82, length 18:
Circuit-ID SubOption 1, length 6: ^@^D^M^E^E^A
Remote-ID SubOption 2, length 8: ^@^F^@M-P^DM-MT^@
END Option 255, length 0
21:17:16.772383 IP (tos 0x0, ttl 255, id 31685, offset 0, flags [none], proto UDP (17), length 316)
Please test the branch in #14 to make sure it parses your packet correctly and let me know.
May be agentCircuitId and agentRemoteId must be inside object relayAgentInformation?

I updated the branch -- it should fix the location of the options to be inside relayAgentInformation. Please try.