On Wed, 06 Mar 2019 23:56:06 +0900, Daniel Gomes wrote: > i'm writing a layer 4 switch application and i'm trying to do the > following: when a TCP/UDP packet is identified the application checks in a > local database to see if the packet parameters are from a known attacker > (source IP, destination IP , destination port). > > If the packet matches one logged in the attacker database a flow is added > to the switch to drop the specific packet (this flow has a duration of 2 > hours), if the packet doesn't match a flow is added to forward a specific > switch port (this flow has a duration of 5 minutes). > > For more information (full code) please visit my stack overflow question: > https://stackoverflow.com/questions/55013032/ryu-controller-struct-error-when-adding-a-new-table-flow
This is happening while trying to struct.pack using ofproto.OFP_FLOW_MOD_PACK_STR0, which have three 'H's. You specified 432000 for hard_timeout. I think that is the cause. > The problem occurs when the controller is going to add the "security flow" > (the one with 2 hours of duration) : > > SimpleSwitch13: Exception occurred during handler processing. > Backtrace from offending handler [_packet_in_handler] servicing event > [EventOFPPacketIn] follows.Traceback (most recent call last):File > "/root/SecAPI/Code/lib/python3.5/site-packages/ryu/base/app_manager.py", > line 290, in _event_loop > handler(ev)File "/root/SecAPI/Flasks/Code/SDN/switchL3.py", line 237, > in _packet_in_handler > self.add_security_flow(datapath, 1, match, actions)File > "/root/SecAPI/Flasks/Code/SDN/switchL3.py", line 109, in > add_security_flow > datapath.send_msg(mod)File > "/root/SecAPI/Code/lib/python3.5/site-packages/ryu/controller/controller.py", > line 423, in send_msg > msg.serialize()File > "/root/SecAPI/Code/lib/python3.5/site-packages/ryu/ofproto/ofproto_parser.py", > line 270, in serialize > self._serialize_body()File > "/root/SecAPI/Code/lib/python3.5/site-packages/ryu/ofproto/ofproto_v1_3_parser.py", > line 2738, in _serialize_body > self.out_group, self.flags)File > "/root/SecAPI/Code/lib/python3.5/site-packages/ryu/lib/pack_utils.py", > line 25, in msg_pack_into > struct.pack_into(fmt, buf, offset, *args) > struct.error: 'H' format requires 0 <= number <= 65535 > > What am i doing wrong? Can someone please give me a light -- IWAMOTO Toshihiro _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel