| 102 | } |
| 103 | |
| 104 | static void |
| 105 | setcarp_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 | |
| 142 | static void |
| 143 | setcarp_callback(int s, void *arg __unused) |
nothing calls this directly
no test coverage detected