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

Function settunnel

tools/ifconfig/ifconfig.c:1159–1187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1157}
1158
1159static void
1160settunnel(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 */
1190static void

Callers

nothing calls this directly

Calls 3

getaddrinfoFunction · 0.85
gai_strerrorFunction · 0.85
freeaddrinfoFunction · 0.85

Tested by

no test coverage detected