Thank you, the patch works without crashes.

How to create drop rule for flow? I tried using this e.g.
[http://sourceforge.net/p/ryu/mailman/message/31977966/]:

               datapath = ev.msg.datapath
                ofproto = datapath.ofproto
                ofproto_parser = datapath.ofproto_parser
                match = ofproto_parser.OFPMatch(eth_type=34525) #drop IPv6
packets
                self.add_flow(datapath, 0, match, [], 100)

        def add_flow(self, datapath, priority, match, actions, table):
                ofproto = datapath.ofproto
                parser = datapath.ofproto_parser
                inst =
[parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,
                                             actions)]
                mod = parser.OFPFlowMod(datapath=datapath, table_id=table,
priority=prioriority,
                                                                match=match,
instructions=inst)
                datapath.send_msg(mod)
                print('flow send')

in switch I see strange rule without Action:

Match
  Incoming Port : Any                   Ethernet Type    : IPv6
  Source MAC    : Any                   Destination MAC  : Any
  Destination MAC Mask      : 000000-000000
  VLAN ID       : Any                   VLAN priority    : Any
  Source IPv6 Address       : Any
  Destination IPv6 Address  : Any
  IPv6 Flow Label           : Any
  IPv6 Extension Header     : Any
  IPv6 Extension Header Mask: Any
  IP Protocol   : Any
  IP ECN        : Any                   IP DSCP          : Any
  Source Port   : Any                   Destination Port : Any
 Attributes
  Priority      : 0                     Duration         : 2 seconds
  Hard Timeout  : 0 seconds             Idle Timeout     : 0 seconds
  Byte Count    : NA                    Packet Count     : 0
  Flow Table ID : 100                   Controller ID    : 1
  Cookie        : 0x0
  Hardware Index: 0
 Instructions
   Apply Actions





-----Original Message-----
From: FUJITA Tomonori [mailto:[email protected]] 
Sent: Thursday, November 27, 2014 4:25 PM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [Ryu-devel] HP 2920 1.3OF

On Wed, 26 Nov 2014 10:41:27 +0200
"Vilius Palubinskas" <[email protected]> wrote:

> Hi Nitish and Ryu team,
> 
> Thank you for detailed info.
> 
> Still got problems with flows. I am trying to install default flow in
table 100 which sends packets to controller and after that installs new
flows in table 200 according to packets. I found that if I run controller
first time flow is not installed and if I run second time flow is installed
successfully. But after some time I got this error:
> 
> 
> packet in 585321643271168 00:15:2b:19:a9:c0 ff:ff:ff:ff:ff:ff 3 EVENT 
> ofp_event->SimpleSwitch13 EventOFPPacketIn
> hub: uncaught exception: Traceback (most recent call last):
>   File "/home/vilpalu/ryu/ryu/lib/hub.py", line 52, in _launch
>     func(*args, **kwargs)
>   File "/home/vilpalu/ryu/ryu/base/app_manager.py", line 274, in
_event_loop
>     handler(ev)
>   File "/home/vilpalu/ryu/ryu/app/HP_switch.py", line 80, in
_packet_in_handler
>     pkt = packet.Packet(msg.data)
>   File "/home/vilpalu/ryu/ryu/lib/packet/packet.py", line 45, in __init__
>     self._parser(parse_cls)
>   File "/home/vilpalu/ryu/ryu/lib/packet/packet.py", line 51, in _parser
>     proto, cls, rest_data = cls.parser(rest_data)
>   File "/home/vilpalu/ryu/ryu/lib/packet/ospf.py", line 625, in parser
>     raise InvalidChecksum
> InvalidChecksum
> 
> EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn EVENT 
> ofp_event->SimpleSwitch13 EventOFPPacketIn connected 
> socket:<eventlet.greenio.GreenSocket object at 0xb66e86ac> 
> address:('10.0.0.2', 54484) hello ev 
> <ryu.controller.ofp_event.EventOFPHello object at 0xb66e88cc> move 
> onto config mode EVENT ofp_event->SimpleSwitch13 
> EventOFPSwitchFeatures connected socket:<eventlet.greenio.GreenSocket 
> object at 0xb66e8a0c> address:('10.0.0.2', 58543)
> 
> 
> Looks like controller stuck after malformed packet? 

Yeah, looks so. But Ryu should not crash even with malformed packets. Please
try the following patch.


diff --git a/ryu/lib/packet/ospf.py b/ryu/lib/packet/ospf.py index
5f49402..cc84d88 100644
--- a/ryu/lib/packet/ospf.py
+++ b/ryu/lib/packet/ospf.py
@@ -612,7 +612,7 @@ class OSPFMessage(packet_base.PacketBase, _TypeDisp):
         self.authentication = authentication
 
     @classmethod
-    def parser(cls, buf):
+    def _parser(cls, buf):
         if len(buf) < cls._HDR_LEN:
             raise stream_parser.StreamParser.TooSmallException(
                 '%d < %d' % (len(buf), cls._HDR_LEN)) @@ -637,6 +637,13 @@
class OSPFMessage(packet_base.PacketBase, _TypeDisp):
         return subcls(length, router_id, area_id, au_type, authentication,
                       checksum, version, **kwargs), None, rest
 
+    @classmethod
+    def parser(cls, buf):
+        try:
+            return cls._parser(buf)
+        except:
+            return  None, None, buf
+
     def serialize(self):
         tail = self.serialize_tail()
         self.length = self._HDR_LEN + len(tail)



------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to