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

  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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 23

Commits related to this issue

Most upvoted comments

I’d forgotten about this issue, but have made a bunch of fixes to DNS (including the problem above) in this branch of my fork: https://github.com/MurphyMc/pox/tree/gar-wip3

… that stuff should probably eventually all get upstreamed.

I added b in join and it worked . “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))”

I don’t have a lot of time to work on this right now. The basic issue is a Python2/Python3 conversion problem that didn’t get caught yet. Here are some options:

  • Use the Python 2 version of POX. The fangtooth branch of my fork is the most up to date for Python 2.
  • Fix it yourself. For hints, you could look through other recent commits which are marked as Python 3 conversion stuff relating to str/bytes. If you do this, it’d be great if you’d make your fix available so it can be incorporated into POX.
  • Wait for me or someone else to fix it. You could facilitate this by:
    1. If there’s a traceback instead of just the “sequence item 0” error message, post the full traceback.
    2. Posting a pcap capture that includes the DNS packet which causes the problem.

I had to both add that “b” in read_dns_name_from_index and remove the ord’s in _read_dns_name_from_index to get rid of the problem

The problem still persists

Why not just upgrade to the halosaur branch, where this was fixed almost two years ago?

The Selecting a Branch / Version section of the manual hasn’t been updated for a while, but describes the POX versioning scheme and the procedure to select them.