MCPcopy Create free account
hub / github.com/F-Stack/f-stack / setcarp_vhid

Function setcarp_vhid

tools/ifconfig/carp.c:104–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104static void
105setcarp_vhid(const char *val, int d, int s, const struct afswtch *afp)
106{
107
108 carpr_vhid = atoi(val);
109
110 if (carpr_vhid <= 0 || carpr_vhid > CARP_MAXVHID)
111 errx(1, "vhid must be greater than 0 and less than %u",
112 CARP_MAXVHID);
113
114 switch (afp->af_af) {
115#ifdef INET
116 case AF_INET:
117 {
118 struct in_aliasreq *ifra;
119
120 ifra = (struct in_aliasreq *)afp->af_addreq;
121 ifra->ifra_vhid = carpr_vhid;
122 break;
123 }
124#endif
125#ifdef INET6
126 case AF_INET6:
127 {
128 struct in6_aliasreq *ifra;
129
130 ifra = (struct in6_aliasreq *)afp->af_addreq;
131 ifra->ifra_vhid = carpr_vhid;
132 break;
133 }
134#endif
135 default:
136 errx(1, "%s doesn't support carp(4)", afp->af_name);
137 }
138
139 callback_register(setcarp_callback, NULL);
140}
141
142static void
143setcarp_callback(int s, void *arg __unused)

Callers

nothing calls this directly

Calls 1

callback_registerFunction · 0.85

Tested by

no test coverage detected