netdev
[Top] [All Lists]

Incorrect sch_ingress registration to NF

To: <netdev@xxxxxxxxxxx>
Subject: Incorrect sch_ingress registration to NF
From: Julian Anastasov <ja@xxxxxx>
Date: Wed, 12 Sep 2001 12:46:57 +0300 (EEST)
Cc: "David S. Miller" <davem@xxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
        Hello,

        The diffserv guys know about this bug for already more than
2 months. What is going on, guys? I'm appending a modified version of
the patch posted to diffserv list on June 24, from Doron Oz. It is against
2.4. In short, the ingress support should not register itself twice to
netfilter.

Regards

--
Julian Anastasov <ja@xxxxxx>


--- linux/net/sched/sch_ingress.c.orig  Fri Aug 18 20:26:25 2000
+++ linux/net/sched/sch_ingress.c       Tue Sep 11 19:39:47 2001
@@ -42,7 +42,9 @@

 #define PRIV(sch) ((struct ingress_qdisc_data *) (sch)->data)

-
+#ifndef        MODULE
+static int nf_registered = 0;
+#endif

 struct ingress_qdisc_data {
        struct Qdisc            *q;
@@ -241,10 +243,11 @@
        p->filter_list = NULL;
        p->q = &noop_qdisc;
 #ifndef MODULE
-       if (nf_register_hook(&ing_ops) < 0) {
+       if (!nf_registered && nf_register_hook(&ing_ops) < 0) {
                printk("Unable to register ingress \n");
                goto error;
        }
+       nf_registered ++;
 #endif
        DPRINTK("ingress_init: qdisc %p\n", sch);
        MOD_INC_USE_COUNT;
@@ -297,7 +300,8 @@
 #endif

 #ifndef MODULE
-       nf_unregister_hook(&ing_ops);
+       if (!--nf_registered)
+               nf_unregister_hook(&ing_ops);
 #endif

        MOD_DEC_USE_COUNT;


<Prev in Thread] Current Thread [Next in Thread>