feature request - why not make netif_rx() a pointer?

Slavcho Nikolov (snikolov@okena.com)
Tue, 22 Oct 2002 17:01:53 -0400


Non GPL modules that want to attach themselves between all L2 drivers and
upper layers would not have to incur a performance loss if netif_rx() is
made a
pointer instead of a function (whether or not NET filters are compiled in
the kernel).
Currently control can be easily wrested from netif_rx() and others through
injection of a few instructions into the running kernel (SMC - self
modifying code)
but decreased performance is one sad consequence. Architecture specific
maintenance of SMC slows down portability, too.
The following suggestion would lead to the least amount of modifications.

The global variable "int (*netif_rx)(struct sk_buff *) = &default_netif_rx;"
gets initialized to the address of a function whose body is the default
implementation.
Drivers calling netif_rx explicitly need to be able to see the prototype
"extern int (*netif_rx)(struct sk_buff *);" or else blow up.
No further changes would be necessary because the current 200+ explicit
references
to "netif_rx(skb);" become a poorly written "(*netif_rx)(skb);" call.
S.N.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/