|
@@ -16,7 +16,7 @@
|
|
|
* long term mutex. The handler must provide an an outfn() to accept packets
|
|
|
* for queueing and must reinject all packets it receives, no matter what.
|
|
|
*/
|
|
|
-static const struct nf_queue_handler *queue_handler[NPROTO];
|
|
|
+static const struct nf_queue_handler *queue_handler[NFPROTO_NUMPROTO] __read_mostly;
|
|
|
|
|
|
static DEFINE_MUTEX(queue_handler_mutex);
|
|
|
|
|
@@ -26,7 +26,7 @@ int nf_register_queue_handler(u_int8_t pf, const struct nf_queue_handler *qh)
|
|
|
{
|
|
|
int ret;
|
|
|
|
|
|
- if (pf >= NPROTO)
|
|
|
+ if (pf >= ARRAY_SIZE(queue_handler))
|
|
|
return -EINVAL;
|
|
|
|
|
|
mutex_lock(&queue_handler_mutex);
|
|
@@ -47,7 +47,7 @@ EXPORT_SYMBOL(nf_register_queue_handler);
|
|
|
/* The caller must flush their queue before this */
|
|
|
int nf_unregister_queue_handler(u_int8_t pf, const struct nf_queue_handler *qh)
|
|
|
{
|
|
|
- if (pf >= NPROTO)
|
|
|
+ if (pf >= ARRAY_SIZE(queue_handler))
|
|
|
return -EINVAL;
|
|
|
|
|
|
mutex_lock(&queue_handler_mutex);
|
|
@@ -70,7 +70,7 @@ void nf_unregister_queue_handlers(const struct nf_queue_handler *qh)
|
|
|
u_int8_t pf;
|
|
|
|
|
|
mutex_lock(&queue_handler_mutex);
|
|
|
- for (pf = 0; pf < NPROTO; pf++) {
|
|
|
+ for (pf = 0; pf < ARRAY_SIZE(queue_handler); pf++) {
|
|
|
if (queue_handler[pf] == qh)
|
|
|
rcu_assign_pointer(queue_handler[pf], NULL);
|
|
|
}
|
|
@@ -285,7 +285,7 @@ EXPORT_SYMBOL(nf_reinject);
|
|
|
#ifdef CONFIG_PROC_FS
|
|
|
static void *seq_start(struct seq_file *seq, loff_t *pos)
|
|
|
{
|
|
|
- if (*pos >= NPROTO)
|
|
|
+ if (*pos >= ARRAY_SIZE(queue_handler))
|
|
|
return NULL;
|
|
|
|
|
|
return pos;
|
|
@@ -295,7 +295,7 @@ static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
|
|
|
{
|
|
|
(*pos)++;
|
|
|
|
|
|
- if (*pos >= NPROTO)
|
|
|
+ if (*pos >= ARRAY_SIZE(queue_handler))
|
|
|
return NULL;
|
|
|
|
|
|
return pos;
|