Ryu控制器在固定数量的数据包或时间后丢弃数据包

问题描述 投票:0回答:1

达到某个阈值后,我试图阻止特定用户/会话的tcp数据包。目前,我能够编写一个脚本来丢弃tcp数据包。

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
    def switch_features_handler(self, ev):
        tcp_match = self.drop_tcp_packets_to_specfic_ip(parser)
        self.add_flow_for_clear(datapath, 2, tcp_match)

    def drop_tcp_packets_to_specfic_ip(self, parser):
        tcp_match = parser.OFPMatch(eth_type=0x0800, ip_proto=6, ipv4_src=conpot_ip)
        return tcp_match

谢谢。

sdn openflow ryu
1个回答
0
投票

您需要设置一些规则以匹配数据包流。之后,您需要创建一个循环以获取有关此规则的统计信息。最后,您阅读每个统计信息并验证数据包数量。因此,如果数据包数量达到您的阈值,则发送规则以阻止数据包。

© www.soinside.com 2019 - 2024. All rights reserved.