* Stores all groups from an interface in memory pointed to by ifgr. */
| 1674 | * Stores all groups from an interface in memory pointed to by ifgr. |
| 1675 | */ |
| 1676 | static int |
| 1677 | if_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 |
no test coverage detected