diff options
author | Patrick McHardy <kaber@trash.net> | 2007-09-28 17:39:09 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:53:34 -0400 |
commit | fd8281adacd2ed68a92e7aa9dde239181f40ee15 (patch) | |
tree | 50f87bff5974586f5c1456aa5a82afc8793e1d24 | |
parent | e3730578285fcf0c628f08b0dc89425cfeafd4ba (diff) |
[NETFILTER]: nfnetlink_log: use netlink policy
Also remove unused nfula_min array.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index b656648537c6..a90a26bd618b 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -733,29 +733,13 @@ static struct nf_logger nfulnl_logger = { | |||
733 | .me = THIS_MODULE, | 733 | .me = THIS_MODULE, |
734 | }; | 734 | }; |
735 | 735 | ||
736 | static const int nfula_min[NFULA_MAX+1] = { | 736 | static const struct nla_policy nfula_cfg_policy[NFULA_CFG_MAX+1] = { |
737 | [NFULA_PACKET_HDR] = sizeof(struct nfulnl_msg_packet_hdr), | 737 | [NFULA_CFG_CMD] = { .len = sizeof(struct nfulnl_msg_config_cmd) }, |
738 | [NFULA_MARK] = sizeof(u_int32_t), | 738 | [NFULA_CFG_MODE] = { .len = sizeof(struct nfulnl_msg_config_mode) }, |
739 | [NFULA_TIMESTAMP] = sizeof(struct nfulnl_msg_packet_timestamp), | 739 | [NFULA_CFG_TIMEOUT] = { .type = NLA_U32 }, |
740 | [NFULA_IFINDEX_INDEV] = sizeof(u_int32_t), | 740 | [NFULA_CFG_QTHRESH] = { .type = NLA_U32 }, |
741 | [NFULA_IFINDEX_OUTDEV] = sizeof(u_int32_t), | 741 | [NFULA_CFG_NLBUFSIZ] = { .type = NLA_U32 }, |
742 | [NFULA_IFINDEX_PHYSINDEV] = sizeof(u_int32_t), | 742 | [NFULA_CFG_FLAGS] = { .type = NLA_U16 }, |
743 | [NFULA_IFINDEX_PHYSOUTDEV] = sizeof(u_int32_t), | ||
744 | [NFULA_HWADDR] = sizeof(struct nfulnl_msg_packet_hw), | ||
745 | [NFULA_PAYLOAD] = 0, | ||
746 | [NFULA_PREFIX] = 0, | ||
747 | [NFULA_UID] = sizeof(u_int32_t), | ||
748 | [NFULA_SEQ] = sizeof(u_int32_t), | ||
749 | [NFULA_SEQ_GLOBAL] = sizeof(u_int32_t), | ||
750 | }; | ||
751 | |||
752 | static const int nfula_cfg_min[NFULA_CFG_MAX+1] = { | ||
753 | [NFULA_CFG_CMD] = sizeof(struct nfulnl_msg_config_cmd), | ||
754 | [NFULA_CFG_MODE] = sizeof(struct nfulnl_msg_config_mode), | ||
755 | [NFULA_CFG_TIMEOUT] = sizeof(u_int32_t), | ||
756 | [NFULA_CFG_QTHRESH] = sizeof(u_int32_t), | ||
757 | [NFULA_CFG_NLBUFSIZ] = sizeof(u_int32_t), | ||
758 | [NFULA_CFG_FLAGS] = sizeof(u_int16_t), | ||
759 | }; | 743 | }; |
760 | 744 | ||
761 | static int | 745 | static int |
@@ -769,11 +753,6 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, | |||
769 | 753 | ||
770 | UDEBUG("entering for msg %u\n", NFNL_MSG_TYPE(nlh->nlmsg_type)); | 754 | UDEBUG("entering for msg %u\n", NFNL_MSG_TYPE(nlh->nlmsg_type)); |
771 | 755 | ||
772 | if (nlattr_bad_size(nfula, NFULA_CFG_MAX, nfula_cfg_min)) { | ||
773 | UDEBUG("bad attribute size\n"); | ||
774 | return -EINVAL; | ||
775 | } | ||
776 | |||
777 | inst = instance_lookup_get(group_num); | 756 | inst = instance_lookup_get(group_num); |
778 | if (nfula[NFULA_CFG_CMD]) { | 757 | if (nfula[NFULA_CFG_CMD]) { |
779 | u_int8_t pf = nfmsg->nfgen_family; | 758 | u_int8_t pf = nfmsg->nfgen_family; |
@@ -886,7 +865,8 @@ static const struct nfnl_callback nfulnl_cb[NFULNL_MSG_MAX] = { | |||
886 | [NFULNL_MSG_PACKET] = { .call = nfulnl_recv_unsupp, | 865 | [NFULNL_MSG_PACKET] = { .call = nfulnl_recv_unsupp, |
887 | .attr_count = NFULA_MAX, }, | 866 | .attr_count = NFULA_MAX, }, |
888 | [NFULNL_MSG_CONFIG] = { .call = nfulnl_recv_config, | 867 | [NFULNL_MSG_CONFIG] = { .call = nfulnl_recv_config, |
889 | .attr_count = NFULA_CFG_MAX, }, | 868 | .attr_count = NFULA_CFG_MAX, |
869 | .policy = nfula_cfg_policy }, | ||
890 | }; | 870 | }; |
891 | 871 | ||
892 | static const struct nfnetlink_subsystem nfulnl_subsys = { | 872 | static const struct nfnetlink_subsystem nfulnl_subsys = { |