Sorry, I was incorrect I am getting packet_out's. Aaron
On Sat, Mar 5, 2011 at 10:50 PM, Aaron Rosen <[email protected]> wrote: > > > I've also tried this which yields the same results: > if packet.next.protocol == 0x4: > print "UNENCAPED1 " > packet.next = packet.next.next > self.send_openflow_packet(dpid, packet.arr,openflow.OFPP_FLOOD > , inport) > > self.send_openflow_packet(dpid, > packet.tostring(),openflow.OFPP_FLOOD , inport) > > On Sat, Mar 5, 2011 at 10:38 PM, Aaron Rosen <[email protected]> wrote: > >> Hey Guys I have one more question: >> >> I'm receiving IPIP packets and I want to unencapsulate them. I'm receiving >> these packets as packet_ins and I have the follow code to handle this: >> >> if packet.next.protocol == 0x4: >> print "UNENCAPED1 " >> packet.next = packet.next.next >> self.send_openflow_packet(dpid, packet.tostring(), >> openflow.OFPP_FLOOD) >> print "UNENCAPED2 " >> return CONTINUE >> >> >> In NOX I see: >> >> UNENCAPED1 >> UNENCAPED2 >> >> But in wireshark a packet_out event is never generated. >> >> Any idea whats going wrong here? (attached is one of the packet_in events >> that I'm receiving I'm not sure it will be helpful). I've also changed the >> follow code so that my controller receives the full packet from a packet_in >> event.) >> >> >> diff --git a/src/lib/openflow.cc b/src/lib/openflow.cc >> index e23cb20..9b5a023 100644 >> --- a/src/lib/openflow.cc >> +++ b/src/lib/openflow.cc >> @@ -598,7 +598,7 @@ int Openflow_connection::send_ >> switch_config() { >> osc.header.length = htons(sizeof osc); >> osc.header.xid = openflow_pack::get_xid(); >> osc.flags = 0; >> - osc.miss_send_len = htons(OFP_DEFAULT_MISS_SEND_LEN); >> + osc.miss_send_len = htons(UINT16_MAX); >> >> return send_openflow(&osc.header, false); >> >> >> Thanks, >> >> Aaron >> >> >> On Tue, Mar 1, 2011 at 7:50 PM, James "Murphy" McCauley >> <[email protected]>wrote: >> >>> You CAN change how much of the packet gets forwarded from a miss, but >>> this is done in the switch negotiation and there's no really clean way >>> to change it (it's a macro in one of the openflow headers). You're >>> better off installing a flow. >>> >>> In that case, if you're not manipulating the packets at all (it doesn't >>> seem like you are), you can also then generally send them back out by >>> buffer id, and not actually have to send the full packet both ways >>> to/from the controller. Also, if you just want to spy on traffic and >>> not alter it, you could set an action to flood the packet as well as the >>> action to send it to the controller. >>> >>> -- Murphy >>> >>> On Tue, 2011-03-01 at 19:36 -0500, Aaron Rosen wrote: >>> > These packets are from non-matches. So I guess I'm only getting >>> > 128Bytes of the packet from this? I guess I should install a rule that >>> > sends this packets to the controller if I want the full packet. >>> > >>> > Thanks, >>> > >>> > Aaron >>> > >>> > On Tue, Mar 1, 2011 at 7:28 PM, James "Murphy" McCauley >>> > <[email protected]> wrote: >>> > I didn't just add the "+ str(self.type)". I also switched it >>> > to a print >>> > from a call to self.msg() (which doesn't exist because the TCP >>> > option >>> > class isn't a subclass of the main packet class). You should >>> > do this. >>> > >>> > BUT... now I am suspicious. How are you getting these >>> > packets? Are >>> > they from non-matches, or did you install a flow with a >>> > send-to-controller action? In the former case, the packet is >>> > almost >>> > surely truncated because only 128 bytes of a packet from a >>> > miss are sent >>> > by default. In the latter, are you sure you specified a large >>> > enough >>> > size when installing the flow? >>> > >>> > -- Murphy >>> > >>> > >>> > On Tue, 2011-03-01 at 19:18 -0500, Aaron Rosen wrote: >>> > > If I pass packet.arr that still doesn't work. I don't get an >>> > Error >>> > > message but tcpdump says: >>> > > >>> > > 19:16:26.829891 IP truncated-ip - 730 bytes missing! >>> > > 130.127.39.173.58832 > 130.127.39.235.ssh: P >>> > > 2569410772:2569411564(792) ack 3106665167 win 12 >>> > <nop,nop,timestamp >>> > > 10172901 47037426> >>> > > >>> > > Also adding that +str(self.type) their doesn't seem to print >>> > out the >>> > > type at that point. >>> > > >>> > > >>> > > 00132|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 182, >>> > in packet_in_callback >>> > > self.forward(dpid, inport, packet, packet.arr, bufid) >>> > > File "./nox/coreapps/examples/aaronswitch.py", line 67, 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 78, in to_bytes >>> > > self.msg('(tcp_opt to_bytes) warning, unknown option') + >>> > str(self.type) >>> > > AttributeError: tcp_opt instance has no attribute 'msg' >>> > > >>> > > >>> > > >>> > > On Tue, Mar 1, 2011 at 6:48 PM, James "Murphy" McCauley >>> > <[email protected]> wrote: >>> > > > Yeah, that's a bug too. >>> > > > >>> > > > Change line 78 in tcp.py to like... >>> > > > print '(tcp_opt to_bytes) warning, unknown option type ' + >>> > > > str(self.type) >>> > > > >>> > > > .. I'd actually be interested in knowing which option it >>> > is, because >>> > > > maybe we should be handling it. >>> > > > >>> > > > You could also probably pass packet.arr instead of >>> > packet.tostring() >>> > > > which would get around the fact that the parsing library >>> > has not been >>> > > > extensively tested for packet assembly (mostly it's used >>> > for parsing). >>> > > > >>> > > > -- Murphy >>> > > > >>> > > > On Tue, 2011-03-01 at 18:21 -0500, Aaron Rosen wrote: >>> > > >> Oh Nox is also telling me this: >>> > > >> >>> > > >> 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 >>> > 182, in >>> > > >> packet_in_callback >>> > > >> self.forward(dpid, inport, packet, packet.arr, bufid) >>> > > >> File "./nox/coreapps/examples/aaronswitch.py", line 67, >>> > 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 78, in to_bytes >>> > > >> self.msg('(tcp_opt to_bytes) warning, unknown >>> > option') >>> > > >> AttributeError: tcp_opt instance has no attribute 'msg' >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> On Tue, Mar 1, 2011 at 6:18 PM, Aaron Rosen >>> > <[email protected]> >>> > > >> wrote: >>> > > >> Thanks Murphy that fixes the typeerror but I'm >>> > still not sure >>> > > >> if the packets are correct because I'm not able >>> > to make a >>> > > >> connection. In Wireshark for this ssh packet_in's >>> > it's saying >>> > > >> "This frame is a suspected retransmission" and in >>> > tcpdump at >>> > > >> the host that is getting these packets its >>> > saying: >>> > > >> >>> > > >> >>> > > >> 18:13:48.227362 IP truncated-ip - 730 bytes >>> > missing! >>> > > >> 130.127.39.173.59276 > 130.127.39.235.ssh: P >>> > 40:832(792) ack >>> > > >> 33 win 12 <nop,nop,timestamp 9797038 46103242> >>> > > >> >>> > > >> >>> > > >> Thanks, >>> > > >> >>> > > >> Aaron >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> On Tue, Mar 1, 2011 at 5:39 PM, James "Murphy" >>> > McCauley >>> > > >> <[email protected]> wrote: >>> > > >> 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 >>> > > >> > >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> -- >>> > > >> >>> > > >> Aaron O. Rosen >>> > > >> Masters Student - Network Communication >>> > > >> 306B Fluor Daniel >>> > > >> 843.425.9777 >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> -- >>> > > >> Aaron O. Rosen >>> > > >> Masters Student - Network Communication >>> > > >> 306B Fluor Daniel >>> > > >> 843.425.9777 >>> > > >> >>> > > > >>> > > > >>> > > > >>> > > >>> > > >>> > > >>> > >>> > >>> > >>> > >>> > >>> > >>> > -- >>> > Aaron O. Rosen >>> > Masters Student - Network Communication >>> > 306B Fluor Daniel >>> > 843.425.9777 >>> > >>> >>> >>> >> >> >> -- >> Aaron O. Rosen >> Masters Student - Network Communication >> 306B Fluor Daniel >> 843.425.9777 >> >> > > > -- > Aaron O. Rosen > Masters Student - Network Communication > 306B Fluor Daniel > 843.425.9777 > > -- 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
