TypeError: ord() expected string of length 1, but int found Error in Pox Controller

2k views Asked by At
  1. I ran pox using this command: /pox.py log.level openflow.of_01 forwarding.topo_proactive openflow.discovery
  2. Started mininet using a custom python script: sudo python3 proactive_p1.py

Up to this point, everything works fine until I ran this from the mininet prompt: h1 dhclient h1-eth0

The mininet prompt hangs for minutes and the following appears on the pox prompt:

INFO:core:POX 0.7.0 (gar) is up.
INFO:openflow.of_01:[00-00-00-00-00-01 2] connected
ERROR:core:Exception while handling OpenFlowNexus!PacketIn...
Traceback (most recent call last):
  File "/home/abdirahman/pox/pox/lib/revent/revent.py", line 242, in raiseEventNoErrors
    return self.raiseEvent(event, *args, **kw)
  File "/home/abdirahman/pox/pox/lib/revent/revent.py", line 295, in raiseEvent
    rv = event._invoke(handler, *args, **kw)
  File "/home/abdirahman/pox/pox/lib/revent/revent.py", line 168, in _invoke
    return handler(self, *args, **kw)
  File "/home/abdirahman/pox/pox/openflow/discovery.py", line 347, in _handle_openflow_PacketIn
    packet = event.parsed
  File "/home/abdirahman/pox/pox/openflow/__init__.py", line 193, in parsed
    return self.parse()
  File "/home/abdirahman/pox/pox/openflow/__init__.py", line 185, in parse
    self._parsed = ethernet(self.data)
  File "/home/abdirahman/pox/pox/lib/packet/ethernet.py", line 106, in __init__
    self.parse(raw)
  File "/home/abdirahman/pox/pox/lib/packet/ethernet.py", line 127, in parse
    self.next = ethernet.parse_next(self, self.type, raw, ethernet.MIN_LEN)
  File "/home/abdirahman/pox/pox/lib/packet/ethernet.py", line 134, in parse_next
    return parser(raw[offset:], prev)
  File "/home/abdirahman/pox/pox/lib/packet/ipv4.py", line 93, in __init__
    self.parse(raw)
  File "/home/abdirahman/pox/pox/lib/packet/ipv4.py", line 158, in parse
    self.next = udp(raw=raw[self.hl*4:length], prev=self)
  File "/home/abdirahman/pox/pox/lib/packet/udp.py", line 68, in __init__
    self.parse(raw)
  File "/home/abdirahman/pox/pox/lib/packet/udp.py", line 100, in parse
    self.next = dhcp(raw=raw[udp.MIN_LEN:],prev=self)
  File "/home/abdirahman/pox/pox/lib/packet/dhcp.py", line 142, in __init__
    self.parse(raw)
  File "/home/abdirahman/pox/pox/lib/packet/dhcp.py", line 215, in parse
    self.parseOptions()
  File "/home/abdirahman/pox/pox/lib/packet/dhcp.py", line 232, in parseOptions
    self.parseOptionSegment(self._raw_options)
  File "/home/abdirahman/pox/pox/lib/packet/dhcp.py", line 248, in parseOptionSegment
    opt = ord(barr[ofs])
TypeError: ord() expected string of length 1, but int found
1

There are 1 answers

0
Ruli On

This is known bug in pox, there is actually an open issue, few weeks old, might take a wile until it will be set. As this is not first question about this issue on SO I link it here, adding reply from thread that should solve it:

the workaround is to remove ord as described here in file dns.py but then new error will appear which will be solved by adding b for bytes (line 390):

def read_dns_name_from_index(cls, l, index):
    retlist = []
    next = cls._read_dns_name_from_index(l, index, retlist)
    return (next + 1,b".".join(retlist))

However this is quite complicated solution, so you can use the Python 2 version of POX in the fangtooth branch.