码迷,mamicode.com
首页 > 其他好文 > 详细

RYU 如何扔掉一个符合要求的数据包

时间:2017-05-20 20:35:26      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:mat   path   app   bsp   sel   clear   tac   policy   tap   

又遇到一个问题,使用OFPMatch匹配的某个数据包,但是怎么Drop掉?又不会了,翻到了下面的代码

参考网址:http://stackoverflow.com/questions/41023354/ryu-controller-drop-packet

def dropEthType(self,
                match_eth_type = 0x0800):
    parser = self.parser
    proto = self.proto
    match = parser.OFPMatch(eth_type = match_eth_type)
    instruction = [
        parser.OFPInstructionActions(proto.OFPIT_CLEAR_ACTIONS, [])
        ]
    msg = parser.OFPFlowMod(self.datapath,
                            table_id = OFDPA_FLOW_TABLE_ID_ACL_POLICY,
                            priority = 1,
                            command = proto.OFPFC_ADD,
                            match = match,
                            instructions = instruction
                            )
    self._log("dropEthType : %s" % str(msg))
    reply = api.send_msg(self.ryuapp, msg)
    if reply:
        raise Exception

 

RYU 如何扔掉一个符合要求的数据包

标签:mat   path   app   bsp   sel   clear   tac   policy   tap   

原文地址:http://www.cnblogs.com/hwy89289709/p/6883029.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!