route.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:isf 作者: w3h 项目源码 文件源码
def ifchange(self, iff, addr):
        self.invalidate_cache()
        the_addr,the_msk = (addr.split("/")+["32"])[:2]
        the_msk = itom(int(the_msk))
        the_rawaddr = atol(the_addr)
        the_net = the_rawaddr & the_msk


        for i, route in enumerate(self.routes):
            net, msk, gw, iface, addr = route
            if iface != iff:
                continue
            if gw == '0.0.0.0':
                self.routes[i] = (the_net,the_msk,gw,iface,the_addr)
            else:
                self.routes[i] = (net,msk,gw,iface,the_addr)
        conf.netcache.flush()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号