carp.c (da393346ac47b22b5f8af4040a59971faadd2c5c) carp.c (8b22242550c98d0a59b6589f2be0beb1dc2eac13)
1/* $FreeBSD$ */
2/* from $OpenBSD: ifconfig.c,v 1.82 2003/10/19 05:43:35 mcbride Exp $ */
3
4/*-
5 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
6 *
7 * Copyright (c) 2002 Michael Shalayeff. All rights reserved.
8 * Copyright (c) 2003 Ryan McBride. All rights reserved.

--- 59 unchanged lines hidden (view full) ---

68static int carpr_advbase = -1;
69static int carpr_state = -1;
70static unsigned char const *carpr_key;
71
72static void
73carp_status(int s)
74{
75 struct carpreq carpr[CARP_MAXVHID];
1/* $FreeBSD$ */
2/* from $OpenBSD: ifconfig.c,v 1.82 2003/10/19 05:43:35 mcbride Exp $ */
3
4/*-
5 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
6 *
7 * Copyright (c) 2002 Michael Shalayeff. All rights reserved.
8 * Copyright (c) 2003 Ryan McBride. All rights reserved.

--- 59 unchanged lines hidden (view full) ---

68static int carpr_advbase = -1;
69static int carpr_state = -1;
70static unsigned char const *carpr_key;
71
72static void
73carp_status(int s)
74{
75 struct carpreq carpr[CARP_MAXVHID];
76 ifconfig_handle_t *lifh;
77
76
78 lifh = ifconfig_open();
79 if (lifh == NULL)
77 if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1)
80 return;
81
78 return;
79
82 if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1)
83 goto close;
84
85 for (size_t i = 0; i < carpr[0].carpr_count; i++) {
86 printf("\tcarp: %s vhid %d advbase %d advskew %d",
87 carp_states[carpr[i].carpr_state], carpr[i].carpr_vhid,
88 carpr[i].carpr_advbase, carpr[i].carpr_advskew);
89 if (printkeys && carpr[i].carpr_key[0] != '\0')
90 printf(" key \"%s\"\n", carpr[i].carpr_key);
91 else
92 printf("\n");
93 }
80 for (size_t i = 0; i < carpr[0].carpr_count; i++) {
81 printf("\tcarp: %s vhid %d advbase %d advskew %d",
82 carp_states[carpr[i].carpr_state], carpr[i].carpr_vhid,
83 carpr[i].carpr_advbase, carpr[i].carpr_advskew);
84 if (printkeys && carpr[i].carpr_key[0] != '\0')
85 printf(" key \"%s\"\n", carpr[i].carpr_key);
86 else
87 printf("\n");
88 }
94close:
95 ifconfig_close(lifh);
96}
97
98static void
99setcarp_vhid(const char *val, int d, int s, const struct afswtch *afp)
100{
101
102 carpr_vhid = atoi(val);
103

--- 128 unchanged lines hidden ---
89}
90
91static void
92setcarp_vhid(const char *val, int d, int s, const struct afswtch *afp)
93{
94
95 carpr_vhid = atoi(val);
96

--- 128 unchanged lines hidden ---