Looks like the problem is in the parsing. Here's a patch:
--- a/src/nox/lib/packet/tcp.py
+++ b/src/nox/lib/packet/tcp.py
@@ -150,7 +150,7 @@ class tcp(packet_base):
elif arr[i] == tcp_opt.MSS:
if arr[i+1] != 4:
raise Exception()
- val = struct.unpack('!H',arr[i+2:i+4])
+ val = struct.unpack('!H',arr[i+2:i+4])[0]
self.options.append(tcp_opt(tcp_opt.MSS,val))
elif arr[i] == tcp_opt.WSOPT:
if arr[i+1] != 3:
-- Murphy
On Tue, 2011-03-01 at 17:29 -0500, Aaron Rosen wrote:
> Hi Murphy,
>
> I'm just trying to connect to a computer using ssh so when I do ssh
> 130.127.39.235 I see these typeerror messages. I do not to anything
> with the packet when it gets to the controller except tell it to
> flood.
>
> The MSS of these packets are 1460 in the packet_in event.
>
> Any idea?
>
> Thanks,
>
> Aaron
>
>
> On Tue, Mar 1, 2011 at 3:51 PM, James "Murphy" McCauley
> <[email protected]> wrote:
> You're not doing anything wrong here. You seem to be doing
> something
> wrong elsewhere. Specifically, you seem to have constructed
> an MSS TCP
> option with a tuple as its value, when the value should be
> some sort of
> integer.
>
> -- Murphy
>
>
> On Tue, 2011-03-01 at 15:22 -0500, Aaron Rosen wrote:
> > Hello I was wondering if someone could explain where I'm
> going wrong
> > here:
> > I'm receiving a packet and then trying to send it back out
> with
> >
> > self.send_openflow_packet(dpid,
> > packet.tostring(),openflow.OFPP_FLOOD , inport)
> >
> > When I do this I'm getting the following exception:
> >
> > 00290|pyrt|ERR:unable to invoke a Python event handler:
> > Traceback (most recent call last):
> > File "./nox/lib/util.py", line 113, in f
> > event.total_len, buffer_id, packet)
> > File "./nox/coreapps/examples/aaronswitch.py", line 177,
> in
> > packet_in_callback
> > self.forward(dpid, inport, packet, packet.arr, bufid)
> > File "./nox/coreapps/examples/aaronswitch.py", line 96, in
> forward
> > self.send_openflow_packet(dpid,
> > packet.tostring(),openflow.OFPP_FLOOD , inport)
> > File "./nox/lib/packet/packet_base.py", line 114, in
> tostring
> > return ''.join((buf, self.next.tostring()))
> > File "./nox/lib/packet/packet_base.py", line 114, in
> tostring
> > return ''.join((buf, self.next.tostring()))
> > File "./nox/lib/packet/packet_base.py", line 109, in
> tostring
> > buf = self.hdr()
> > File "./nox/lib/packet/tcp.py", line 215, in hdr
> > packet += option.to_bytes()
> > File "./nox/lib/packet/tcp.py", line 70, in to_bytes
> > return struct.pack('!BBH',self.type,4,self.val)
> > TypeError: unsupported operand type(s) for &: 'tuple' and
> 'long'
> >
> > Thanks,
> >
> > Aaron
> >
> >
> > --
> > Aaron O. Rosen
> > Masters Student - Network Communication
> > 306B Fluor Daniel
> > 843.425.9777
> >
>
> > _______________________________________________
> > nox-dev mailing list
> > [email protected]
> > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
>
>
>
>
>
> --
> Aaron O. Rosen
> Masters Student - Network Communication
> 306B Fluor Daniel
> 843.425.9777
>
_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org