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

Function cleanup_xaddrs

freebsd/net/rtsock.c:1492–1523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1490#endif
1491
1492static int
1493cleanup_xaddrs(struct rt_addrinfo *info)
1494{
1495 int error = EAFNOSUPPORT;
1496
1497 if (info->rti_info[RTAX_DST] == NULL)
1498 return (EINVAL);
1499
1500 if (info->rti_flags & RTF_LLDATA) {
1501 /*
1502 * arp(8)/ndp(8) sends RTA_NETMASK for the associated
1503 * prefix along with the actual address in RTA_DST.
1504 * Remove netmask to avoid unnecessary address masking.
1505 */
1506 remove_netmask(info);
1507 }
1508
1509 switch (info->rti_info[RTAX_DST]->sa_family) {
1510#ifdef INET
1511 case AF_INET:
1512 error = cleanup_xaddrs_inet(info);
1513 break;
1514#endif
1515#ifdef INET6
1516 case AF_INET6:
1517 error = cleanup_xaddrs_inet6(info);
1518 break;
1519#endif
1520 }
1521
1522 return (error);
1523}
1524
1525/*
1526 * Fill in @dmask with valid netmask leaving original @smask

Callers 1

fill_addrinfoFunction · 0.70

Calls 3

remove_netmaskFunction · 0.70
cleanup_xaddrs_inetFunction · 0.70
cleanup_xaddrs_inet6Function · 0.70

Tested by

no test coverage detected