又遇到一个问题,使用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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2021-12-17
  • 2021-06-02
  • 2021-07-03
  • 2021-08-10
猜你喜欢
  • 2022-12-23
  • 2021-12-04
  • 2022-02-08
  • 2022-02-16
  • 2021-09-28
  • 2021-08-10
  • 2022-12-23
相关资源
相似解决方案