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

Function if_getgroup

freebsd/net/if.c:1676–1707  ·  view source on GitHub ↗

* Stores all groups from an interface in memory pointed to by ifgr. */

Source from the content-addressed store, hash-verified

1674 * Stores all groups from an interface in memory pointed to by ifgr.
1675 */
1676static int
1677if_getgroup(struct ifgroupreq *ifgr, struct ifnet *ifp)
1678{
1679 int len, error;
1680 struct ifg_list *ifgl;
1681 struct ifg_req ifgrq, *ifgp;
1682
1683 NET_EPOCH_ASSERT();
1684
1685 if (ifgr->ifgr_len == 0) {
1686 CK_STAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next)
1687 ifgr->ifgr_len += sizeof(struct ifg_req);
1688 return (0);
1689 }
1690
1691 len = ifgr->ifgr_len;
1692 ifgp = ifgr_groups_get(ifgr);
1693 /* XXX: wire */
1694 CK_STAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) {
1695 if (len < sizeof(ifgrq))
1696 return (EINVAL);
1697 bzero(&ifgrq, sizeof ifgrq);
1698 strlcpy(ifgrq.ifgrq_group, ifgl->ifgl_group->ifg_group,
1699 sizeof(ifgrq.ifgrq_group));
1700 if ((error = copyout(&ifgrq, ifgp, sizeof(struct ifg_req))))
1701 return (error);
1702 len -= sizeof(ifgrq);
1703 ifgp++;
1704 }
1705
1706 return (0);
1707}
1708
1709/*
1710 * Stores all members of a group in memory pointed to by igfr

Callers 1

ifhwioctlFunction · 0.85

Calls 4

ifgr_groups_getFunction · 0.85
bzeroFunction · 0.85
strlcpyFunction · 0.50
copyoutFunction · 0.50

Tested by

no test coverage detected