diff options
Diffstat (limited to 'net/netlabel/netlabel_unlabeled.c')
-rw-r--r-- | net/netlabel/netlabel_unlabeled.c | 92 |
1 files changed, 27 insertions, 65 deletions
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 3e745b72fded..4478f2f6079d 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1553,68 +1553,63 @@ unlabel_staticlistdef_return: | |||
1553 | * NetLabel Generic NETLINK Command Definitions | 1553 | * NetLabel Generic NETLINK Command Definitions |
1554 | */ | 1554 | */ |
1555 | 1555 | ||
1556 | static struct genl_ops netlbl_unlabel_genl_c_staticadd = { | 1556 | static struct genl_ops netlbl_unlabel_genl_ops[] = { |
1557 | { | ||
1557 | .cmd = NLBL_UNLABEL_C_STATICADD, | 1558 | .cmd = NLBL_UNLABEL_C_STATICADD, |
1558 | .flags = GENL_ADMIN_PERM, | 1559 | .flags = GENL_ADMIN_PERM, |
1559 | .policy = netlbl_unlabel_genl_policy, | 1560 | .policy = netlbl_unlabel_genl_policy, |
1560 | .doit = netlbl_unlabel_staticadd, | 1561 | .doit = netlbl_unlabel_staticadd, |
1561 | .dumpit = NULL, | 1562 | .dumpit = NULL, |
1562 | }; | 1563 | }, |
1563 | 1564 | { | |
1564 | static struct genl_ops netlbl_unlabel_genl_c_staticremove = { | ||
1565 | .cmd = NLBL_UNLABEL_C_STATICREMOVE, | 1565 | .cmd = NLBL_UNLABEL_C_STATICREMOVE, |
1566 | .flags = GENL_ADMIN_PERM, | 1566 | .flags = GENL_ADMIN_PERM, |
1567 | .policy = netlbl_unlabel_genl_policy, | 1567 | .policy = netlbl_unlabel_genl_policy, |
1568 | .doit = netlbl_unlabel_staticremove, | 1568 | .doit = netlbl_unlabel_staticremove, |
1569 | .dumpit = NULL, | 1569 | .dumpit = NULL, |
1570 | }; | 1570 | }, |
1571 | 1571 | { | |
1572 | static struct genl_ops netlbl_unlabel_genl_c_staticlist = { | ||
1573 | .cmd = NLBL_UNLABEL_C_STATICLIST, | 1572 | .cmd = NLBL_UNLABEL_C_STATICLIST, |
1574 | .flags = 0, | 1573 | .flags = 0, |
1575 | .policy = netlbl_unlabel_genl_policy, | 1574 | .policy = netlbl_unlabel_genl_policy, |
1576 | .doit = NULL, | 1575 | .doit = NULL, |
1577 | .dumpit = netlbl_unlabel_staticlist, | 1576 | .dumpit = netlbl_unlabel_staticlist, |
1578 | }; | 1577 | }, |
1579 | 1578 | { | |
1580 | static struct genl_ops netlbl_unlabel_genl_c_staticadddef = { | ||
1581 | .cmd = NLBL_UNLABEL_C_STATICADDDEF, | 1579 | .cmd = NLBL_UNLABEL_C_STATICADDDEF, |
1582 | .flags = GENL_ADMIN_PERM, | 1580 | .flags = GENL_ADMIN_PERM, |
1583 | .policy = netlbl_unlabel_genl_policy, | 1581 | .policy = netlbl_unlabel_genl_policy, |
1584 | .doit = netlbl_unlabel_staticadddef, | 1582 | .doit = netlbl_unlabel_staticadddef, |
1585 | .dumpit = NULL, | 1583 | .dumpit = NULL, |
1586 | }; | 1584 | }, |
1587 | 1585 | { | |
1588 | static struct genl_ops netlbl_unlabel_genl_c_staticremovedef = { | ||
1589 | .cmd = NLBL_UNLABEL_C_STATICREMOVEDEF, | 1586 | .cmd = NLBL_UNLABEL_C_STATICREMOVEDEF, |
1590 | .flags = GENL_ADMIN_PERM, | 1587 | .flags = GENL_ADMIN_PERM, |
1591 | .policy = netlbl_unlabel_genl_policy, | 1588 | .policy = netlbl_unlabel_genl_policy, |
1592 | .doit = netlbl_unlabel_staticremovedef, | 1589 | .doit = netlbl_unlabel_staticremovedef, |
1593 | .dumpit = NULL, | 1590 | .dumpit = NULL, |
1594 | }; | 1591 | }, |
1595 | 1592 | { | |
1596 | static struct genl_ops netlbl_unlabel_genl_c_staticlistdef = { | ||
1597 | .cmd = NLBL_UNLABEL_C_STATICLISTDEF, | 1593 | .cmd = NLBL_UNLABEL_C_STATICLISTDEF, |
1598 | .flags = 0, | 1594 | .flags = 0, |
1599 | .policy = netlbl_unlabel_genl_policy, | 1595 | .policy = netlbl_unlabel_genl_policy, |
1600 | .doit = NULL, | 1596 | .doit = NULL, |
1601 | .dumpit = netlbl_unlabel_staticlistdef, | 1597 | .dumpit = netlbl_unlabel_staticlistdef, |
1602 | }; | 1598 | }, |
1603 | 1599 | { | |
1604 | static struct genl_ops netlbl_unlabel_genl_c_accept = { | ||
1605 | .cmd = NLBL_UNLABEL_C_ACCEPT, | 1600 | .cmd = NLBL_UNLABEL_C_ACCEPT, |
1606 | .flags = GENL_ADMIN_PERM, | 1601 | .flags = GENL_ADMIN_PERM, |
1607 | .policy = netlbl_unlabel_genl_policy, | 1602 | .policy = netlbl_unlabel_genl_policy, |
1608 | .doit = netlbl_unlabel_accept, | 1603 | .doit = netlbl_unlabel_accept, |
1609 | .dumpit = NULL, | 1604 | .dumpit = NULL, |
1610 | }; | 1605 | }, |
1611 | 1606 | { | |
1612 | static struct genl_ops netlbl_unlabel_genl_c_list = { | ||
1613 | .cmd = NLBL_UNLABEL_C_LIST, | 1607 | .cmd = NLBL_UNLABEL_C_LIST, |
1614 | .flags = 0, | 1608 | .flags = 0, |
1615 | .policy = netlbl_unlabel_genl_policy, | 1609 | .policy = netlbl_unlabel_genl_policy, |
1616 | .doit = netlbl_unlabel_list, | 1610 | .doit = netlbl_unlabel_list, |
1617 | .dumpit = NULL, | 1611 | .dumpit = NULL, |
1612 | }, | ||
1618 | }; | 1613 | }; |
1619 | 1614 | ||
1620 | /* | 1615 | /* |
@@ -1629,53 +1624,20 @@ static struct genl_ops netlbl_unlabel_genl_c_list = { | |||
1629 | * mechanism. Returns zero on success, negative values on failure. | 1624 | * mechanism. Returns zero on success, negative values on failure. |
1630 | * | 1625 | * |
1631 | */ | 1626 | */ |
1632 | int netlbl_unlabel_genl_init(void) | 1627 | int __init netlbl_unlabel_genl_init(void) |
1633 | { | 1628 | { |
1634 | int ret_val; | 1629 | int ret_val, i; |
1635 | 1630 | ||
1636 | ret_val = genl_register_family(&netlbl_unlabel_gnl_family); | 1631 | ret_val = genl_register_family(&netlbl_unlabel_gnl_family); |
1637 | if (ret_val != 0) | 1632 | if (ret_val != 0) |
1638 | return ret_val; | 1633 | return ret_val; |
1639 | 1634 | ||
1640 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | 1635 | for (i = 0; i < ARRAY_SIZE(netlbl_unlabel_genl_ops); i++) { |
1641 | &netlbl_unlabel_genl_c_staticadd); | 1636 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, |
1642 | if (ret_val != 0) | 1637 | &netlbl_unlabel_genl_ops[i]); |
1643 | return ret_val; | 1638 | if (ret_val != 0) |
1644 | 1639 | return ret_val; | |
1645 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | 1640 | } |
1646 | &netlbl_unlabel_genl_c_staticremove); | ||
1647 | if (ret_val != 0) | ||
1648 | return ret_val; | ||
1649 | |||
1650 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1651 | &netlbl_unlabel_genl_c_staticlist); | ||
1652 | if (ret_val != 0) | ||
1653 | return ret_val; | ||
1654 | |||
1655 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1656 | &netlbl_unlabel_genl_c_staticadddef); | ||
1657 | if (ret_val != 0) | ||
1658 | return ret_val; | ||
1659 | |||
1660 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1661 | &netlbl_unlabel_genl_c_staticremovedef); | ||
1662 | if (ret_val != 0) | ||
1663 | return ret_val; | ||
1664 | |||
1665 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1666 | &netlbl_unlabel_genl_c_staticlistdef); | ||
1667 | if (ret_val != 0) | ||
1668 | return ret_val; | ||
1669 | |||
1670 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1671 | &netlbl_unlabel_genl_c_accept); | ||
1672 | if (ret_val != 0) | ||
1673 | return ret_val; | ||
1674 | |||
1675 | ret_val = genl_register_ops(&netlbl_unlabel_gnl_family, | ||
1676 | &netlbl_unlabel_genl_c_list); | ||
1677 | if (ret_val != 0) | ||
1678 | return ret_val; | ||
1679 | 1641 | ||
1680 | return 0; | 1642 | return 0; |
1681 | } | 1643 | } |
@@ -1699,7 +1661,7 @@ static struct notifier_block netlbl_unlhsh_netdev_notifier = { | |||
1699 | * non-zero values on error. | 1661 | * non-zero values on error. |
1700 | * | 1662 | * |
1701 | */ | 1663 | */ |
1702 | int netlbl_unlabel_init(u32 size) | 1664 | int __init netlbl_unlabel_init(u32 size) |
1703 | { | 1665 | { |
1704 | u32 iter; | 1666 | u32 iter; |
1705 | struct netlbl_unlhsh_tbl *hsh_tbl; | 1667 | struct netlbl_unlhsh_tbl *hsh_tbl; |
@@ -1803,7 +1765,7 @@ unlabel_getattr_nolabel: | |||
1803 | * and to send unlabeled network traffic by default. | 1765 | * and to send unlabeled network traffic by default. |
1804 | * | 1766 | * |
1805 | */ | 1767 | */ |
1806 | int netlbl_unlabel_defconf(void) | 1768 | int __init netlbl_unlabel_defconf(void) |
1807 | { | 1769 | { |
1808 | int ret_val; | 1770 | int ret_val; |
1809 | struct netlbl_dom_map *entry; | 1771 | struct netlbl_dom_map *entry; |