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

Function nd6_ioctl

freebsd/netinet6/nd6.c:1605–1834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1603}
1604
1605int
1606nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
1607{
1608 struct in6_ndireq *ndi = (struct in6_ndireq *)data;
1609 struct in6_nbrinfo *nbi = (struct in6_nbrinfo *)data;
1610 struct in6_ndifreq *ndif = (struct in6_ndifreq *)data;
1611 struct epoch_tracker et;
1612 int error = 0;
1613
1614 if (ifp->if_afdata[AF_INET6] == NULL)
1615 return (EPFNOSUPPORT);
1616 switch (cmd) {
1617 case OSIOCGIFINFO_IN6:
1618#define ND ndi->ndi
1619 /* XXX: old ndp(8) assumes a positive value for linkmtu. */
1620 bzero(&ND, sizeof(ND));
1621 ND.linkmtu = IN6_LINKMTU(ifp);
1622 ND.maxmtu = ND_IFINFO(ifp)->maxmtu;
1623 ND.basereachable = ND_IFINFO(ifp)->basereachable;
1624 ND.reachable = ND_IFINFO(ifp)->reachable;
1625 ND.retrans = ND_IFINFO(ifp)->retrans;
1626 ND.flags = ND_IFINFO(ifp)->flags;
1627 ND.recalctm = ND_IFINFO(ifp)->recalctm;
1628 ND.chlim = ND_IFINFO(ifp)->chlim;
1629 break;
1630 case SIOCGIFINFO_IN6:
1631 ND = *ND_IFINFO(ifp);
1632 break;
1633 case SIOCSIFINFO_IN6:
1634 /*
1635 * used to change host variables from userland.
1636 * intended for a use on router to reflect RA configurations.
1637 */
1638 /* 0 means 'unspecified' */
1639 if (ND.linkmtu != 0) {
1640 if (ND.linkmtu < IPV6_MMTU ||
1641 ND.linkmtu > IN6_LINKMTU(ifp)) {
1642 error = EINVAL;
1643 break;
1644 }
1645 ND_IFINFO(ifp)->linkmtu = ND.linkmtu;
1646 }
1647
1648 if (ND.basereachable != 0) {
1649 int obasereachable = ND_IFINFO(ifp)->basereachable;
1650
1651 ND_IFINFO(ifp)->basereachable = ND.basereachable;
1652 if (ND.basereachable != obasereachable)
1653 ND_IFINFO(ifp)->reachable =
1654 ND_COMPUTE_RTIME(ND.basereachable);
1655 }
1656 if (ND.retrans != 0)
1657 ND_IFINFO(ifp)->retrans = ND.retrans;
1658 if (ND.chlim != 0)
1659 ND_IFINFO(ifp)->chlim = ND.chlim;
1660 /* FALLTHROUGH */
1661 case SIOCSIFINFO_FLAGS:
1662 {

Callers 1

in6_controlFunction · 0.85

Calls 13

bzeroFunction · 0.85
in6_if_upFunction · 0.85
in6_ifattachFunction · 0.85
defrouter_resetFunction · 0.85
defrouter_select_fibFunction · 0.85
nd6_prefix_unlinkFunction · 0.85
in6_purgeaddrFunction · 0.85
nd6_prefix_delFunction · 0.85
nd6_defrouter_flush_allFunction · 0.85
in6_setscopeFunction · 0.85
nd6_lookupFunction · 0.85
nd6_setdefaultifaceFunction · 0.85

Tested by

no test coverage detected