You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unknown lease options don't appear to be dumped by dhcpcd. Microsoft Azure, for example, uses dhcp option 245 to announce its wireserver IP address to cloud instances. The ability to use dhcpcd --dumplease would be very helpful for use cases like this.
But I wrote some Python which demonstrates that this option is included in the lease:
#!/usr/bin/env python3importsysimportosdefiter_options(data: bytes, index: int):
"""options are variable length, and consist of the following format option number: 1 byte option length: 1 byte option data: variable length (see length field) """whilelen(data) >=index+2:
code=data[index]
length=data[1+index]
option=data[2+index : 2+index+length]
yieldcode, optionindex=2+length+indexlease_file=sys.argv[1]
print(f"parsing lease: {lease_file}")
withopen(lease_file, "rb") asf:
forcode, optioniniter_options(f.read(), 240):
print(f" found option {code}: {option}")
Which shows that option 245 is in the lease:
$ ./get_options.py /var/lib/dhcpcd/eth0.lease
parsing lease: /var/lib/dhcpcd/eth0.lease
found option 1: b'\xff\xff\xff\x00'
found option 3: b'\n\x00\x00\x01'
found option 6: b'\xa8?\x81\x10'
found option 15: b'ilo2tr0xng2exgucxg20yx0tjb.gx.internal.cloudapp.net'
found option 51: b'\xff\xff\xff\xff'
found option 53: b'\x05'
found option 54: b'\xa8?\x81\x10'
found option 58: b'\xff\xff\xff\xff'
found option 59: b'\xff\xff\xff\xff'
found option 245: b'\xa8?\x81\x10'
found option 121: b'\x00\n\x00\x00\x01 \xa8?\x81\x10\n\x00\x00\x01 \xa9\xfe\xa9\xfe\n\x00\x00\x01'
The isc-dhclient lease format shows the options as option unknown-245 a8:3f:81:10;:
Unknown lease options don't appear to be dumped by dhcpcd. Microsoft Azure, for example, uses dhcp option 245 to announce its wireserver IP address to cloud instances. The ability to use
dhcpcd --dumplease
would be very helpful for use cases like this.But I wrote some Python which demonstrates that this option is included in the lease:
Which shows that option 245 is in the lease:
The isc-dhclient lease format shows the options as
option unknown-245 a8:3f:81:10;
:The text was updated successfully, but these errors were encountered: