feature request - why not make netif_rx() a pointer?
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.
Quoted 2 lines · Slavcho Nikolov
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
You could of course write GPL code 8)
Quoted 10 lines · Slavcho Nikolov
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 fromnetif_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.
ftp://zmailer.org/linux/netif_rx.patch
Done for 2.3.99-pre7-3 but should be easy to port to 2.5.x ...
Quoted 1 line
S.N.
/Matti Aarnio
Quoted 1 line · Matti Aarnio
ftp://zmailer.org/linux/netif_rx.patch
Please EXPORT_GPL this, if you are going to do it at all.
Only non-GPL compliant binary-modules can result from this change.
People can easily do things like implement their own entire networking stack with this hook, which is not what we want nor is it allowed.
Quoted 5 lines · David S. Miller
Quoted 1 line · Matti Aarnio
ftp://zmailer.org/linux/netif_rx.patch
Quoted 8 lines
Please
EXPORT_GPLthis, if you are going to do it at all.Only non-GPL compliant binary-modules can result from this change.
People can easily do things like implement their own entire networking stack with this hook, which is not what we want nor is it allowed.
Don't assume we all want what you want.
As for allowed, it can
be worked around fairly easily by removing all protocol handlers and then registering only yourself as the proprietary protocol handler, and gobble all packets. Sure, it's a bit of a kludge, and will have the various crufts (like the gettimeofday code) in there, but it will basically allow you to replace the entire stack.
If I'm right about that, then what is the difference between replacing the stack like that and replacing the netif_rx method entirely?
Ben
Quoted 7 lines
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 3 lines
Ben Greear <[email protected]> <Ben_Greear AT excite.com> President of Candela Technologies Inc http://www.candelatech.com ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear
Quoted 6 lines · David S. Miller
Quoted 1 line · Matti Aarnio
ftp://zmailer.org/linux/netif_rx.patch
Please
EXPORT_GPLthis, if you are going to do it at all.
ug :( Can we please have this not be in the fast path. Thanks.
Make netif_rx_ the pointer, don't slow down my net drivers further...
Jeff
Quoted 11 lines · David S. Miller
Quoted 1 line · Matti Aarnio
ftp://zmailer.org/linux/netif_rx.patch
Please
EXPORT_GPLthis, if you are going to do it at all.Only non-GPL compliant binary-modules can result from this change.
People can easily do things like implement their own entire networking stack with this hook, which is not what we want nor is it allowed.
You will never understand, that <insert evil vendor here> can simply add this modification to the kernel source ("vendor tree"), give this source away under GPL license and then ship its binary kernel modules with the source tree.
You won't be able to stop anyone doing this "illegal" thing. But you hinder many legal users of this.
Not putting an export into the source or exporting GPL_ONLY symbols won't hinder anyone. Because putting the hooks into a GPL source and then releasing the result (code + hooks) under GPL is perfectly legal.
The only result are questions on this list, why the <insert your video card / network / hw driver here> module works under "foobar" Linux and not with the pristine sources.
Ah and lots of patches like "please put this into the kernel so I can use the <insert your video card / network / hw driver here> module.
Regards
Henning
Signature · 5 lines
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen -- Geschaeftsfuehrer INTERMETA - Gesellschaft fuer Mehrwertdienste mbH [email protected] Am Schwabachgrund 22 Fon.: 09131 / 50654-0 [email protected] D-91054 Buckenhof Fax.: 09131 / 50654-20
Quoted 4 lines · Henning P. Schmiedehausen
You will never understand, that <insert evil vendor here> can simply add this modification to the kernel source ("vendor tree"), give this source away under GPL license and then ship its binary kernel modules with the source tree.
Thats what lawyers are for.
Quoted 3 lines
Not putting an export into the source or exporting
GPL_ONLYsymbols won't hinder anyone. Because putting the hooks into a GPL source and then releasing the result (code + hooks) under GPL is perfectly legal.
Not according to lawyers
Quoted 5 lines · Alan Cox
Quoted 3 lines
Not putting an export into the source or exporting
GPL_ONLYsymbols won't hinder anyone. Because putting the hooks into a GPL source and then releasing the result (code + hooks) under GPL is perfectly legal.Not according to lawyers
"The kernel source code + hooks under GPL" definitely are.
"The kernel source code + hooks + binary modules" are doubtful, correct.
Sorry, my wording wasn't clear.
Regards
Henning
Signature · 5 lines
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen -- Geschaeftsfuehrer INTERMETA - Gesellschaft fuer Mehrwertdienste mbH [email protected] Am Schwabachgrund 22 Fon.: 09131 / 50654-0 [email protected] D-91054 Buckenhof Fax.: 09131 / 50654-20
Quoted 3 lines · Slavcho Nikolov
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
What you are suggesting can only result in illegal binary-only modules.
If you override netif_rx(), you are by definition implementing a derived work of the kernel reimplementing core functionality, thus your binary only driver is not abiding by the GPL and you are on very shaky legal ground.
It isn't exported for a reason, there is legitimate use of it from modules.