Lines Matching defs:vr

66  * - The VRRP router is enabled (vr->vvr_conf.vvc_enabled is _B_TRUE)
136 #define SKEW_TIME_VR(vr) \
137 SKEW_TIME((vr)->vvr_conf.vvc_pri, (vr)->vvr_master_adver_int)
138 #define MASTER_DOWN_INTERVAL_VR(vr) \
139 MASTER_DOWN_INTERVAL((vr)->vvr_conf.vvc_pri, (vr)->vvr_master_adver_int)
336 vrrp_vr_t *vr;
338 TAILQ_FOREACH(vr, &vrrp_vr_list, vvr_next) {
339 if (strcmp(vr->vvr_conf.vvc_link, ifname) == 0 &&
340 vr->vvr_conf.vvc_vrid == vrid &&
341 vr->vvr_conf.vvc_af == af) {
345 return (vr);
351 vrrp_vr_t *vr;
353 TAILQ_FOREACH(vr, &vrrp_vr_list, vvr_next) {
354 if (strcmp(vr->vvr_conf.vvc_name, name) == 0)
357 return (vr);
872 vrrp_vr_t *vr;
878 vr = TAILQ_FIRST(&vrrp_vr_list);
879 vrrpd_delete_vr(vr);
1962 vrrp_vr_t *vr;
1966 TAILQ_FOREACH(vr, &vrrp_vr_list, vvr_next) {
1967 if (vr->vvr_conf.vvc_enabled)
1968 (void) vrrpd_enable_vr(vr);
1980 vrrp_vr_t *vr;
1985 TAILQ_FOREACH(vr, &vrrp_vr_list, vvr_next) {
1986 if (vr->vvr_conf.vvc_enabled)
1987 vrrpd_disable_vr(vr, intf, primary_addr_gone);
2386 vrrp_vr_t *vr;
2390 if ((vr = malloc(sizeof (vrrp_vr_t))) == NULL) {
2396 bzero(vr, sizeof (vrrp_vr_t));
2397 vr->vvr_state = VRRP_STATE_NONE;
2398 vr->vvr_timer_id = -1;
2399 vrrpd_state_trans(VRRP_STATE_NONE, VRRP_STATE_INIT, vr);
2400 (void) memcpy(&vr->vvr_conf, conf, sizeof (vrrp_vr_conf_t));
2401 vr->vvr_conf.vvc_enabled = _B_FALSE;
2402 TAILQ_INSERT_HEAD(&vrrp_vr_list, vr, vvr_next);
2407 vrrpd_delete_vr(vrrp_vr_t *vr)
2409 vrrp_log(VRRP_DBG0, "vrrpd_delete_vr(%s)", vr->vvr_conf.vvc_name);
2410 if (vr->vvr_conf.vvc_enabled)
2411 vrrpd_disable_vr(vr, NULL, _B_FALSE);
2412 assert(vr->vvr_state == VRRP_STATE_INIT);
2413 vrrpd_state_trans(VRRP_STATE_INIT, VRRP_STATE_NONE, vr);
2414 TAILQ_REMOVE(&vrrp_vr_list, vr, vvr_next);
2415 (void) free(vr);
2419 vrrpd_enable_vr(vrrp_vr_t *vr)
2423 vrrp_log(VRRP_DBG0, "vrrpd_enable_vr(%s)", vr->vvr_conf.vvc_name);
2425 assert(vr->vvr_conf.vvc_enabled);
2431 if (vr->vvr_state != VRRP_STATE_INIT)
2434 if ((rx_err = vrrpd_init_rxsock(vr)) == VRRP_SUCCESS) {
2440 vrrpd_reselect_primary(vr->vvr_pif);
2441 if (vr->vvr_pif->vvi_pip == NULL) {
2444 vr->vvr_conf.vvc_name, vr->vvr_pif->vvi_ifname);
2453 tx_err = vrrpd_init_txsock(vr);
2463 vr->vvr_err = (rx_err == VRRP_SUCCESS) ? tx_err : rx_err;
2467 if (vr->vvr_conf.vvc_pri == 255)
2468 err = vrrpd_state_i2m(vr);
2470 err = vrrpd_state_i2b(vr);
2473 vr->vvr_err = err;
2474 vr->vvr_pif->vvi_pip = NULL;
2475 vrrpd_fini_txsock(vr);
2476 vrrpd_fini_rxsock(vr);
2488 vrrpd_disable_vr(vrrp_vr_t *vr, vrrp_intf_t *intf, boolean_t primary_addr_gone)
2490 vrrp_log(VRRP_DBG0, "vrrpd_disable_vr(%s): %s%s", vr->vvr_conf.vvc_name,
2500 if (!primary_addr_gone && (intf != NULL) && (intf != vr->vvr_pif) &&
2501 (intf != vr->vvr_vif)) {
2510 if (primary_addr_gone && intf != vr->vvr_pif)
2514 vr->vvr_conf.vvc_name);
2516 if (vr->vvr_state == VRRP_STATE_MASTER) {
2523 (void) vrrpd_send_adv(vr, _B_TRUE);
2525 vrrpd_state_m2i(vr);
2526 } else if (vr->vvr_state == VRRP_STATE_BACKUP) {
2527 vrrpd_state_b2i(vr);
2537 "is removed", vr->vvr_conf.vvc_name);
2538 vr->vvr_err = VRRP_ENOPRIM;
2544 vr->vvr_conf.vvc_name);
2545 vr->vvr_err = VRRP_SUCCESS;
2546 vrrpd_fini_txsock(vr);
2547 vrrpd_fini_rxsock(vr);
2548 } else if (intf == vr->vvr_pif) {
2550 "%s removed", vr->vvr_conf.vvc_name, intf->vvi_ifname);
2551 vr->vvr_err = VRRP_ENOPRIM;
2552 vrrpd_fini_rxsock(vr);
2553 } else if (intf == vr->vvr_vif) {
2555 " removed", vr->vvr_conf.vvc_name, intf->vvi_ifname);
2556 vr->vvr_err = VRRP_ENOVIRT;
2557 vrrpd_fini_txsock(vr);
2626 vrrp_vr_t *vr;
2631 if ((vr = vrrpd_lookup_vr_by_name(vn)) == NULL) {
2636 err = vrrpd_updateconf(&vr->vvr_conf, VRRP_CONF_DELETE);
2639 "configuration for %s", vr->vvr_conf.vvc_name);
2643 vrrpd_delete_vr(vr);
2650 vrrp_vr_t *vr;
2658 if ((vr = vrrpd_lookup_vr_by_name(vn)) == NULL) {
2666 conf = &vr->vvr_conf;
2691 conf->vvc_af, conf->vvc_link, NULL, NULL, vr->vvr_vnic,
2692 sizeof (vr->vvr_vnic));
2708 vr->vvr_conf.vvc_enabled = _B_TRUE;
2709 if (updateconf && (err = vrrpd_updateconf(&vr->vvr_conf,
2712 "configuration for %s", vr->vvr_conf.vvc_name);
2723 (void) vrrpd_enable_vr(vr);
2727 vr->vvr_conf.vvc_enabled = _B_FALSE;
2728 vr->vvr_vnic[0] = '\0';
2735 vrrp_vr_t *vr;
2740 if ((vr = vrrpd_lookup_vr_by_name(vn)) == NULL) {
2748 if (!vr->vvr_conf.vvc_enabled) {
2753 vr->vvr_conf.vvc_enabled = _B_FALSE;
2754 err = vrrpd_updateconf(&vr->vvr_conf, VRRP_CONF_UPDATE);
2756 vr->vvr_conf.vvc_enabled = _B_TRUE;
2758 "configuration for %s", vr->vvr_conf.vvc_name);
2762 vrrpd_disable_vr(vr, NULL, _B_FALSE);
2763 vr->vvr_vnic[0] = '\0';
2770 vrrp_vr_t *vr;
2781 if ((vr = vrrpd_lookup_vr_by_name(conf->vvc_name)) == NULL) {
2797 pri = vr->vvr_conf.vvc_pri;
2808 accept = vr->vvr_conf.vvc_accept;
2818 if ((mask & VRRP_CONF_ACCEPT) && (vr->vvr_conf.vvc_accept != accept)) {
2819 err = vrrpd_set_noaccept(vr, !accept);
2833 (void) memcpy(&savconf, &vr->vvr_conf, sizeof (vrrp_vr_conf_t));
2835 vr->vvr_conf.vvc_preempt = conf->vvc_preempt;
2838 vr->vvr_conf.vvc_accept = accept;
2841 vr->vvr_conf.vvc_pri = pri;
2844 vr->vvr_conf.vvc_adver_int = conf->vvc_adver_int;
2846 err = vrrpd_updateconf(&vr->vvr_conf, VRRP_CONF_UPDATE);
2851 (void) vrrpd_set_noaccept(vr, accept);
2852 (void) memcpy(&vr->vvr_conf, &savconf, sizeof (vrrp_vr_conf_t));
2856 if ((mask & VRRP_CONF_PRIORITY) && (vr->vvr_state == VRRP_STATE_BACKUP))
2857 vr->vvr_timeout = MASTER_DOWN_INTERVAL_VR(vr);
2859 if ((mask & VRRP_CONF_INTERVAL) && (vr->vvr_state == VRRP_STATE_MASTER))
2860 vr->vvr_timeout = conf->vvc_adver_int;
2869 vrrp_vr_t *vr;
2876 TAILQ_FOREACH(vr, &vrrp_vr_list, vvr_next) {
2877 if (vrid != VRRP_VRID_NONE && vr->vvr_conf.vvc_vrid != vrid)
2881 vr->vvr_conf.vvc_link) == 0) {
2886 vr->vvr_conf.vvc_af != af)
2896 (void) strlcpy(p, vr->vvr_conf.vvc_name, VRRP_NAME_MAX);
2897 p += (strlen(vr->vvr_conf.vvc_name) + 1);
2911 vrrp_vr_t *vr;
2920 if ((vr = vrrpd_lookup_vr_by_name(vn)) == NULL) {
2930 if (vr->vvr_state != VRRP_STATE_INIT) {
2931 vif = vr->vvr_vif;
2952 &(vr->vvr_conf), sizeof (vrrp_vr_conf_t));
2954 &(vr->vvr_sinfo), sizeof (vrrp_stateinfo_t));
2955 (void) strlcpy(infop->show_va.va_vnic, vr->vvr_vnic, MAXLINKNAMELEN);
2957 timeval_delta(now, vr->vvr_sinfo.vs_st_time));
2959 if (vr->vvr_state == VRRP_STATE_INIT) {
2972 &vr->vvr_pif->vvi_pip->vip_addr, sizeof (vrrp_addr_t));
2974 (void) memcpy(&infop->show_vp, &(vr->vvr_peer), sizeof (vrrp_peer_t));
2979 if (!VRRPADDR_UNSPECIFIED(vr->vvr_conf.vvc_af,
2980 &(vr->vvr_peer.vp_addr))) {
2982 timeval_delta(now, vr->vvr_peer.vp_time));
2985 if (vr->vvr_state == VRRP_STATE_BACKUP) {
2987 MASTER_DOWN_INTERVAL_VR(vr);
3002 vrrpd_build_vrrp(vrrp_vr_t *vr, uchar_t *buf, int buflen, boolean_t zero_pri)
3010 vrrp_intf_t *vif = vr->vvr_vif;
3018 vr->vvr_conf.vvc_name, zero_pri ? "zero" : "non-zero",
3019 vr->vvr_conf.vvc_adver_int);
3025 "not big enough %d", vr->vvr_conf.vvc_name, size);
3037 "address", vr->vvr_conf.vvc_name);
3042 vp->vp_vrid = vr->vvr_conf.vvc_vrid;
3043 vp->vp_prio = zero_pri ? VRRP_PRIO_ZERO : vr->vvr_conf.vvc_pri;
3045 rsvd_adver_int = MSEC2CENTISEC(vr->vvr_conf.vvc_adver_int) & 0x0fff;
3055 &vr->vvr_pif->vvi_pip->vip_addr.in4.sin_addr,
3059 &vr->vvr_pif->vvi_pip->vip_addr.in6.sin6_addr,
3070 vrrpd_send_adv_v4(vrrp_vr_t *vr, uchar_t *buf, size_t len, boolean_t zero_pri)
3076 vrrp_log(VRRP_DBG1, "vrrpd_send_adv_v4(%s)", vr->vvr_conf.vvc_name);
3078 if ((plen = vrrpd_build_vrrp(vr, buf + sizeof (struct ip),
3091 ip->ip_src = vr->vvr_pif->vvi_pip->vip_addr.in4.sin_addr;
3100 if ((len = sendto(vr->vvr_vif->vvi_sockfd, buf, plen, 0,
3105 vr->vvr_conf.vvc_vrid, vr->vvr_vif->vvi_ifname,
3106 af_str(vr->vvr_conf.vvc_af), strerror(errno), len, plen);
3111 vr->vvr_conf.vvc_name);
3116 vrrpd_send_adv_v6(vrrp_vr_t *vr, uchar_t *buf, size_t len, boolean_t zero_pri)
3128 vrrp_log(VRRP_DBG1, "vrrpd_send_adv_v6(%s)", vr->vvr_conf.vvc_name);
3130 if ((plen = vrrpd_build_vrrp(vr, buf, len, zero_pri)) == 0)
3155 "failed: %s", vr->vvr_conf.vvc_name, strerror(errno));
3179 (void) bcopy(&vr->vvr_pif->vvi_pip->vip_addr.in6.sin6_addr,
3185 pktinfop->ipi6_ifindex = vr->vvr_vif->vvi_ifindex;
3198 if ((len = sendmsg(vr->vvr_vif->vvi_sockfd,
3201 "%s expect %d sent %d", vr->vvr_conf.vvc_name,
3208 vr->vvr_conf.vvc_name);
3217 vrrpd_send_adv(vrrp_vr_t *vr, boolean_t zero_pri)
3222 vr->vvr_conf.vvc_name, zero_pri ? "zero" : "non_zero");
3224 assert(vr->vvr_pif->vvi_pip != NULL);
3226 if (vr->vvr_pif->vvi_pip == NULL) {
3228 "address", vr->vvr_conf.vvc_name);
3232 if (vr->vvr_conf.vvc_af == AF_INET) {
3233 return (vrrpd_send_adv_v4(vr, (uchar_t *)buf,
3236 return (vrrpd_send_adv_v6(vr, (uchar_t *)buf,
3242 vrrpd_process_adv(vrrp_vr_t *vr, vrrp_addr_t *from, vrrp_pkt_t *vp)
3244 vrrp_vr_conf_t *conf = &vr->vvr_conf;
3251 VRRPADDR2STR(vr->vvr_conf.vvc_af, from, peer, INET6_ADDRSTRLEN,
3256 if (vr->vvr_state <= VRRP_STATE_INIT) {
3258 "ready", conf->vvc_name, vrrp_state2str(vr->vvr_state));
3265 VRRPADDR2STR(vr->vvr_pif->vvi_af, &vr->vvr_pif->vvi_pip->vip_addr,
3269 vrrp_state2str(vr->vvr_state), conf->vvc_pri, peer,
3272 addr_cmp = ipaddr_cmp(vr->vvr_pif->vvi_af, from,
3273 &vr->vvr_pif->vvi_pip->vip_addr);
3291 (void) gettimeofday(&vr->vvr_peer_time, NULL);
3292 (void) memcpy(&vr->vvr_peer_addr, from, sizeof (vrrp_addr_t));
3293 vr->vvr_peer_prio = vp->vp_prio;
3294 vr->vvr_peer_adver_int = peer_adver_int;
3296 if (vr->vvr_state == VRRP_STATE_BACKUP) {
3297 vr->vvr_master_adver_int = vr->vvr_peer_adver_int;
3302 vr->vvr_timer_id, NULL);
3305 vr->vvr_timeout = SKEW_TIME_VR(vr);
3307 vr->vvr_timeout = MASTER_DOWN_INTERVAL_VR(vr);
3309 if ((vr->vvr_timer_id = iu_schedule_timer_ms(
3310 vrrpd_timerq, vr->vvr_timeout, vrrp_b2m_timeout,
3311 vr)) == -1) {
3314 conf->vvc_name, vr->vvr_timeout);
3318 conf->vvc_name, vr->vvr_timeout);
3321 } else if (vr->vvr_state == VRRP_STATE_MASTER) {
3323 (void) vrrpd_send_adv(vr, _B_FALSE);
3325 vr->vvr_timer_id, NULL);
3326 if ((vr->vvr_timer_id = iu_schedule_timer_ms(
3327 vrrpd_timerq, vr->vvr_timeout, vrrp_adv_timeout,
3328 vr)) == -1) {
3331 conf->vvc_name, vr->vvr_timeout);
3335 conf->vvc_name, vr->vvr_timeout);
3339 (void) vrrpd_state_m2b(vr);
3350 vrrp_vr_t *vr;
3413 if ((vr = vrrpd_lookup_vr_by_vrid(pif->vvi_ifname, vp->vp_vrid,
3415 vrrpd_process_adv(vr, from, vp);
3581 vrrpd_init_rxsock(vrrp_vr_t *vr)
3590 vrrp_log(VRRP_DBG1, "vrrpd_init_rxsock(%s)", vr->vvr_conf.vvc_name);
3595 if ((pif = vr->vvr_pif) != NULL) {
3597 vr->vvr_conf.vvc_name, pif->vvi_ifname);
3606 af = vr->vvr_conf.vvc_af;
3607 pif = vrrpd_lookup_if(vr->vvr_conf.vvc_link, af);
3610 "over %s/%s", vr->vvr_conf.vvc_name,
3611 vr->vvr_conf.vvc_link, af_str(af));
3621 "failed %s", vr->vvr_conf.vvc_name,
3644 "join_group(%d) failed: %s", vr->vvr_conf.vvc_name,
3650 "join_group(%d) succeeded", vr->vvr_conf.vvc_name,
3667 vr->vvr_conf.vvc_name, strerror(errno));
3679 vr->vvr_conf.vvc_name, strerror(errno));
3689 vr->vvr_conf.vvc_name);
3695 "done %d", vr->vvr_conf.vvc_name, pif->vvi_ifname,
3701 vr->vvr_pif = pif;
3703 vrrpd_fini_rxsock(vr);
3715 vrrpd_fini_rxsock(vrrp_vr_t *vr)
3717 vrrp_intf_t *pif = vr->vvr_pif;
3719 vrrp_log(VRRP_DBG1, "vrrpd_fini_rxsock(%s)", vr->vvr_conf.vvc_name);
3726 vr->vvr_conf.vvc_name, pif->vvi_ifname);
3734 vr->vvr_conf.vvc_name, pif->vvi_ifname, pif->vvi_nvr);
3736 vr->vvr_pif = NULL;
3744 vrrpd_init_txsock(vrrp_vr_t *vr)
3750 vrrp_log(VRRP_DBG1, "vrrpd_init_txsock(%s)", vr->vvr_conf.vvc_name);
3752 if (vr->vvr_vif != NULL) {
3754 vr->vvr_conf.vvc_name, vr->vvr_vif->vvi_ifname);
3758 af = vr->vvr_conf.vvc_af;
3759 if ((vif = vrrpd_lookup_if(vr->vvr_vnic, af)) == NULL) {
3761 "%s/%s", vr->vvr_conf.vvc_name, vr->vvr_vnic, af_str(af));
3765 vr->vvr_vif = vif;
3766 if (vr->vvr_conf.vvc_af == AF_INET)
3767 err = vrrpd_init_txsock_v4(vr);
3769 err = vrrpd_init_txsock_v6(vr);
3778 if (!vr->vvr_conf.vvc_accept)
3779 err = vrrpd_set_noaccept(vr, _B_TRUE);
3785 vr->vvr_vif = NULL;
3797 vrrpd_init_txsock_v4(vrrp_vr_t *vr)
3806 vif = vr->vvr_vif;
3807 assert(vr->vvr_conf.vvc_af == AF_INET);
3811 vr->vvr_conf.vvc_name, vif->vvi_ifname);
3815 "over %s", vr->vvr_conf.vvc_name, vif->vvi_ifname);
3822 "failed: %s", vr->vvr_conf.vvc_name, strerror(errno));
3833 "failed: %s", vr->vvr_conf.vvc_name, strerror(errno));
3844 "multicast_loop failed: %s", vr->vvr_conf.vvc_name,
3861 "failed: %s", vr->vvr_conf.vvc_name, abuf, strerror(errno));
3865 "succeed", vr->vvr_conf.vvc_name, abuf);
3883 vrrpd_init_txsock_v6(vrrp_vr_t *vr)
3889 vif = vr->vvr_vif;
3890 assert(vr->vvr_conf.vvc_af == AF_INET6);
3894 vr->vvr_conf.vvc_name, vif->vvi_ifname);
3898 "over %s", vr->vvr_conf.vvc_name, vif->vvi_ifname);
3905 "failed: %s", vr->vvr_conf.vvc_name, strerror(errno));
3916 "multicast_loop failed: %s", vr->vvr_conf.vvc_name,
3928 "multicast_hops %d failed: %s", vr->vvr_conf.vvc_name,
3940 "failed: %s", vr->vvr_conf.vvc_name, vif->vvi_ifindex,
3945 " succeed", vr->vvr_conf.vvc_name, vif->vvi_ifindex);
3962 vrrpd_fini_txsock(vrrp_vr_t *vr)
3964 vrrp_intf_t *vif = vr->vvr_vif;
3966 vrrp_log(VRRP_DBG1, "vrrpd_fini_txsock(%s)", vr->vvr_conf.vvc_name);
3969 if (!vr->vvr_conf.vvc_accept)
3970 (void) vrrpd_set_noaccept(vr, _B_FALSE);
3973 vr->vvr_vif = NULL;
4102 vrrpd_state_i2m(vrrp_vr_t *vr)
4106 vrrp_log(VRRP_DBG1, "vrrpd_state_i2m(%s)", vr->vvr_conf.vvc_name);
4108 vrrpd_state_trans(VRRP_STATE_INIT, VRRP_STATE_MASTER, vr);
4109 if ((err = vrrpd_virtualip_update(vr, _B_FALSE)) != VRRP_SUCCESS)
4112 (void) vrrpd_send_adv(vr, _B_FALSE);
4114 vr->vvr_err = VRRP_SUCCESS;
4115 vr->vvr_timeout = vr->vvr_conf.vvc_adver_int;
4116 if ((vr->vvr_timer_id = iu_schedule_timer_ms(vrrpd_timerq,
4117 vr->vvr_timeout, vrrp_adv_timeout, vr)) == -1) {
4122 "vrrp_adv_timeout(%d)", vr->vvr_conf.vvc_name,
4123 vr->vvr_timeout);
4129 vrrpd_state_i2b(vrrp_vr_t *vr)
4133 vrrp_log(VRRP_DBG1, "vrrpd_state_i2b(%s)", vr->vvr_conf.vvc_name);
4135 vrrpd_state_trans(VRRP_STATE_INIT, VRRP_STATE_BACKUP, vr);
4136 if ((err = vrrpd_virtualip_update(vr, _B_FALSE)) != VRRP_SUCCESS)
4143 vr->vvr_err = VRRP_SUCCESS;
4144 vr->vvr_master_adver_int = vr->vvr_conf.vvc_adver_int;
4145 vr->vvr_timeout = MASTER_DOWN_INTERVAL_VR(vr);
4146 if ((vr->vvr_timer_id = iu_schedule_timer_ms(vrrpd_timerq,
4147 vr->vvr_timeout, vrrp_b2m_timeout, vr)) == -1) {
4152 "vrrp_b2m_timeout(%d)", vr->vvr_conf.vvc_name,
4153 vr->vvr_timeout);
4159 vrrpd_state_m2i(vrrp_vr_t *vr)
4161 vrrp_log(VRRP_DBG1, "vrrpd_state_m2i(%s)", vr->vvr_conf.vvc_name);
4163 vrrpd_state_trans(VRRP_STATE_MASTER, VRRP_STATE_INIT, vr);
4164 (void) vrrpd_virtualip_update(vr, _B_TRUE);
4165 bzero(&vr->vvr_peer, sizeof (vrrp_peer_t));
4166 (void) iu_cancel_timer(vrrpd_timerq, vr->vvr_timer_id, NULL);
4170 vrrpd_state_b2i(vrrp_vr_t *vr)
4172 vrrp_log(VRRP_DBG1, "vrrpd_state_b2i(%s)", vr->vvr_conf.vvc_name);
4174 bzero(&vr->vvr_peer, sizeof (vrrp_peer_t));
4175 (void) iu_cancel_timer(vrrpd_timerq, vr->vvr_timer_id, NULL);
4176 vrrpd_state_trans(VRRP_STATE_BACKUP, VRRP_STATE_INIT, vr);
4177 (void) vrrpd_virtualip_update(vr, _B_TRUE);
4184 vrrp_vr_t *vr = (vrrp_vr_t *)arg;
4186 vrrp_log(VRRP_DBG1, "vrrp_b2m_timeout(%s)", vr->vvr_conf.vvc_name);
4187 (void) vrrpd_state_b2m(vr);
4194 vrrp_vr_t *vr = (vrrp_vr_t *)arg;
4196 vrrp_log(VRRP_DBG1, "vrrp_adv_timeout(%s)", vr->vvr_conf.vvc_name);
4198 (void) vrrpd_send_adv(vr, _B_FALSE);
4199 if ((vr->vvr_timer_id = iu_schedule_timer_ms(vrrpd_timerq,
4200 vr->vvr_timeout, vrrp_adv_timeout, vr)) == -1) {
4202 vr->vvr_conf.vvc_name);
4205 "vrrp_adv_timeout(%d)", vr->vvr_conf.vvc_name,
4206 vr->vvr_timeout);
4211 vrrpd_state_b2m(vrrp_vr_t *vr)
4215 vrrp_log(VRRP_DBG1, "vrrpd_state_b2m(%s)", vr->vvr_conf.vvc_name);
4217 vrrpd_state_trans(VRRP_STATE_BACKUP, VRRP_STATE_MASTER, vr);
4218 if ((err = vrrpd_virtualip_update(vr, _B_FALSE)) != VRRP_SUCCESS)
4220 (void) vrrpd_send_adv(vr, _B_FALSE);
4222 vr->vvr_timeout = vr->vvr_conf.vvc_adver_int;
4223 if ((vr->vvr_timer_id = iu_schedule_timer_ms(vrrpd_timerq,
4224 vr->vvr_timeout, vrrp_adv_timeout, vr)) == -1) {
4226 vr->vvr_conf.vvc_name);
4230 "vrrp_adv_timeout(%d)", vr->vvr_conf.vvc_name,
4231 vr->vvr_timeout);
4237 vrrpd_state_m2b(vrrp_vr_t *vr)
4241 vrrp_log(VRRP_DBG1, "vrrpd_state_m2b(%s)", vr->vvr_conf.vvc_name);
4243 vrrpd_state_trans(VRRP_STATE_MASTER, VRRP_STATE_BACKUP, vr);
4244 if ((err = vrrpd_virtualip_update(vr, _B_FALSE)) != VRRP_SUCCESS)
4250 vr->vvr_master_adver_int = vr->vvr_peer_adver_int;
4251 (void) iu_cancel_timer(vrrpd_timerq, vr->vvr_timer_id, NULL);
4252 vr->vvr_timeout = MASTER_DOWN_INTERVAL_VR(vr);
4253 if ((vr->vvr_timer_id = iu_schedule_timer_ms(vrrpd_timerq,
4254 vr->vvr_timeout, vrrp_b2m_timeout, vr)) == -1) {
4256 vr->vvr_conf.vvc_name);
4259 "vrrp_b2m_timeout(%d)", vr->vvr_conf.vvc_name,
4260 vr->vvr_timeout);
4270 vrrpd_set_noaccept(vrrp_vr_t *vr, boolean_t on)
4272 vrrp_intf_t *vif = vr->vvr_vif;
4278 vr->vvr_conf.vvc_name, on ? "on" : "off");
4287 vif->vvi_ifname, vrrp_state2str(vr->vvr_state));
4380 vrrpd_virtualip_update(vrrp_vr_t *vr, boolean_t checkonly)
4383 vrrp_intf_t *vif = vr->vvr_vif;
4389 vr->vvr_conf.vvc_name, vrrp_state2str(vr->vvr_state),
4392 state = vr->vvr_state;
4424 vrrpd_state_trans(vrrp_state_t prev_s, vrrp_state_t s, vrrp_vr_t *vr)
4427 vr->vvr_conf.vvc_name, vrrp_state2str(prev_s), vrrp_state2str(s));
4429 assert(vr->vvr_state == prev_s);
4430 vr->vvr_state = s;
4431 vr->vvr_prev_state = prev_s;
4432 (void) gettimeofday(&vr->vvr_st_time, NULL);
4433 (void) vrrpd_post_event(vr->vvr_conf.vvc_name, prev_s, s);