| 1157 | } |
| 1158 | |
| 1159 | static void |
| 1160 | settunnel(const char *src, const char *dst, int s, const struct afswtch *afp) |
| 1161 | { |
| 1162 | struct addrinfo *srcres, *dstres; |
| 1163 | int ecode; |
| 1164 | |
| 1165 | if (afp->af_settunnel == NULL) { |
| 1166 | warn("address family %s does not support tunnel setup", |
| 1167 | afp->af_name); |
| 1168 | return; |
| 1169 | } |
| 1170 | |
| 1171 | if ((ecode = getaddrinfo(src, NULL, NULL, &srcres)) != 0) |
| 1172 | errx(1, "error in parsing address string: %s", |
| 1173 | gai_strerror(ecode)); |
| 1174 | |
| 1175 | if ((ecode = getaddrinfo(dst, NULL, NULL, &dstres)) != 0) |
| 1176 | errx(1, "error in parsing address string: %s", |
| 1177 | gai_strerror(ecode)); |
| 1178 | |
| 1179 | if (srcres->ai_addr->sa_family != dstres->ai_addr->sa_family) |
| 1180 | errx(1, |
| 1181 | "source and destination address families do not match"); |
| 1182 | |
| 1183 | afp->af_settunnel(s, srcres, dstres); |
| 1184 | |
| 1185 | freeaddrinfo(srcres); |
| 1186 | freeaddrinfo(dstres); |
| 1187 | } |
| 1188 | |
| 1189 | /* ARGSUSED */ |
| 1190 | static void |
nothing calls this directly
no test coverage detected