Exemple #1
0
    def vrrp_received(self, ev):
        vrrp_router = self.vrrp_router
        vrrp_router.logger.debug("%s vrrp_received", self.__class__.__name__)

        ip, vrrp_ = vrrp.vrrp.get_payload(ev.packet)
        config = vrrp_router.config
        if vrrp_.priority == 0:
            vrrp_router.send_advertisement()
            vrrp_router.adver_timer.start(config.advertisement_interval)
        else:
            params = vrrp_router.params
            if config.priority < vrrp_.priority or (
                config.priority == vrrp_.priority
                and vrrp.ip_address_lt(vrrp_router.interface.primary_ip_address, ip.src)
            ):
                vrrp_router.adver_timer.cancel()

                vrrp_router.state_change(vrrp_event.VRRP_STATE_BACKUP)
                vrrp_router.master_down_timer.start(params.master_down_interval)
    def vrrp_received(self, ev):
        vrrp_router = self.vrrp_router
        vrrp_router.logger.debug('%s vrrp_received', self.__class__.__name__)

        ip, vrrp_ = vrrp.vrrp.get_payload(ev.packet)
        config = vrrp_router.config
        if vrrp_.priority == 0:
            vrrp_router.send_advertisement()
            vrrp_router.adver_timer.start(config.advertisement_interval)
        else:
            params = vrrp_router.params
            if (config.priority < vrrp_.priority or
                (config.priority == vrrp_.priority and vrrp.ip_address_lt(
                    vrrp_router.interface.primary_ip_address, ip.src))):
                vrrp_router.adver_timer.cancel()

                vrrp_router.state_change(vrrp_event.VRRP_STATE_BACKUP)
                vrrp_router.master_down_timer.start(
                    params.master_down_interval)