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

Function cleanup_xaddrs_inet6

lib/ff_route.c:281–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279
280#ifdef INET6
281static int
282cleanup_xaddrs_inet6(struct rt_addrinfo *info)
283{
284 struct sockaddr_in6 *dst_sa, *mask_sa;
285 struct in6_addr mask;
286
287 /* Check & fixup dst/netmask combination first */
288 dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST];
289 mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK];
290
291 mask = mask_sa ? mask_sa->sin6_addr : in6mask128;
292 IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask);
293
294 if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) {
295 printf("dst sin6_len too small\n");
296 return (EINVAL);
297 }
298 if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) {
299 printf("mask sin6_len too small\n");
300 return (EINVAL);
301 }
302 fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0);
303
304 if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128))
305 fill_sockaddr_inet6(mask_sa, &mask, 0);
306 else
307 remove_netmask(info);
308
309 /* Check gateway */
310 if (info->rti_info[RTAX_GATEWAY] != NULL)
311 return (cleanup_xaddrs_gateway(info));
312
313 return (0);
314}
315#endif
316
317static int

Callers 1

cleanup_xaddrsFunction · 0.70

Calls 4

printfFunction · 0.70
fill_sockaddr_inet6Function · 0.70
remove_netmaskFunction · 0.70
cleanup_xaddrs_gatewayFunction · 0.70

Tested by

no test coverage detected