我正在尝试实现一种阻止特定流并因此丢弃数据包的方法。我将数据路径、源 ip 和目标 ip 传递给它。应用程序检测到流,但流继续工作,源发送数据,目标主机接收。我究竟做错了什么?
def drop_flow(self, datapath, ip_src, ip_dst):
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
match = parser.OFPMatch(ipv4_src=ip_src,
ipv4_dst=ip_dst)
inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS, [])]
mod = parser.OFPFlowMod(datapath=datapath,
command=ofproto.OFPFC_DELETE,
out_port=ofproto.OFPP_ANY,
out_group=ofproto.OFPG_ANY,
match=match, instructions=inst)
print "deleting flow entries in the table "
datapath.send_msg(mod)
谢谢!