0

How do I send a flow entry to drop a package by using Ryu? I've learned from ryu official website how to send package out flow entry. Now I want to modify the simple_switch_13.py to drop the packet from the host1 to host2. But I can't find how to modify the PacketIn, can you help me?

In order to achieve this, I modify the app code like this: enter image description here

But you know, it does not conform to the communication in the network. But I can't have any idea.

Charlie
  • 323
  • 1
  • 5
  • 10

1 Answers1

1

To drop packets in OpenFlow you just need a flow without any action. So, just remove the actions from the flow and the packets that match the flows will be dropped.

To have a flow without actions just create an empty list.

# construct action list.
actions = [] 
ederlf
  • 262
  • 1
  • 3
  • 13
  • You means that using the default actions in OpenFlow to achieve it? – Charlie Mar 09 '17 at 23:03
  • No, you do not add an action at all. You can see it an empty list of actions. – ederlf Mar 10 '17 at 10:59
  • So, I need to defined a python def to achieve it, right? – Charlie Mar 10 '17 at 13:53
  • No, it is just an empty list in Python. I just updated the answer with the example. – ederlf Mar 10 '17 at 16:22
  • I retry it just now, and it works well. Does it work based on the default disposition of a packet in OpenFlow? – Charlie Mar 11 '17 at 02:55
  • Thank you for your help! – Charlie Mar 11 '17 at 02:57
  • It works because that is what the standard says: "There is no explicit action to represent drops. Instead, packets whose action sets have no output actions should be dropped. This result could come from empty instruction sets or empty action buckets in the processing pipeline, or after executing a Clear-Actions instruction." – ederlf Mar 13 '17 at 13:53
  • Oh, I think I know it. Thank you for your help! – Charlie Mar 13 '17 at 14:34