I've been working with ryu.lib.packet.dhcp and I believe hlen is being
calculated incorrectly.

If I create a dhcp() object without passing hlen, it attempts to set
this to len(chaddr) - but this gets the length of the string (17 chars
for a MAC address) instead of measuring the 6 octets.

The code should be changed from this (ryu/lib/packet/dhcp.py line 156-157)

if hlen == 0:
  self.hlen = len(chaddr)

to this

if hlen == 0:
  self.hlen = len(addrconv.mac.bin_to_text(chaddr))

This does involve doubling up on the bin_to_text operation, which
makes me wonder whether it's best to leave hlen as 0 until the end of
the dhcp._parser() function where chaddr is converted to hex.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to