Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171150147
D28955.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28955.diff
View Options
diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c
--- a/sbin/ifconfig/carp.c
+++ b/sbin/ifconfig/carp.c
@@ -50,6 +50,8 @@
#include <err.h>
#include <errno.h>
+#include <libifconfig.h>
+
#include "ifconfig.h"
static const char *carp_states[] = { CARP_STATES };
@@ -71,16 +73,16 @@
carp_status(int s)
{
struct carpreq carpr[CARP_MAXVHID];
- int i;
+ ifconfig_handle_t *lifh;
- bzero(carpr, sizeof(struct carpreq) * CARP_MAXVHID);
- carpr[0].carpr_count = CARP_MAXVHID;
- ifr.ifr_data = (caddr_t)&carpr;
-
- if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1)
+ lifh = ifconfig_open();
+ if (lifh == NULL)
return;
- for (i = 0; i < carpr[0].carpr_count; i++) {
+ if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1)
+ goto close;
+
+ for (size_t i = 0; i < carpr[0].carpr_count; i++) {
printf("\tcarp: %s vhid %d advbase %d advskew %d",
carp_states[carpr[i].carpr_state], carpr[i].carpr_vhid,
carpr[i].carpr_advbase, carpr[i].carpr_advskew);
@@ -89,6 +91,8 @@
else
printf("\n");
}
+close:
+ ifconfig_close(lifh);
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Sep 10, 12:56 AM (2 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38623567
Default Alt Text
D28955.diff (1 KB)
Attached To
Mode
D28955: sbin/ifconfig: Use libifconfig to get carp status
Attached
Detach File
Event Timeline
Log In to Comment