netdev
[Top] [All Lists]

FreeSWAN's pfkey_v2.c

To: design@xxxxxxxxxxxxxxxxxx
Subject: FreeSWAN's pfkey_v2.c
From: Michael Richardson <mcr@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 16 Oct 2002 22:48:06 -0400
Cc: netdev@xxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
-----BEGIN PGP SIGNED MESSAGE-----


In our pfkey_v2.c, we had:

struct proto_ops SOCKOPS_WRAPPED(pfkey_ops);
...
pfkey_create() {
sock->ops = &SOCKOPS_WRAPPED(pfkey_ops);
}
...
struct proto_ops SOCKOPS_WRAPPED(pfkey_ops) = {
}

#ifdef NETDEV_23
#include <linux/smp_lock.h>
SOCKOPS_WRAP(pfkey, PF_KEY);
#endif /* NETDEV_23 */

When building with -Werror, we get a fatal error when SMP is defined, because
we get a pfkey_ops which is never used.

I believe that the error is that we should not be initializing the sock->ops
to the WRAPPED version, but rather to "pfkey_ops", so that we actually are
using the wrapped functions which lock stuff.

I.e. we never actually were using the interface which the SOCKOPS_WRAP()
macro so meticulously created for us.

We probably haven't hit a problem before, because we tend to run on
uniprocessors a lot, and we also tend to have only one single threaded
process (pluto) that talks PF_KEY.

I am looking for confirmation from network stack people that my conclusions
from reading of the macros in linux/net.h is correct.

]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] mcr@xxxxxxxxxxxxxxxxxxxxxx http://www.sandelman.ottawa.on.ca/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Finger me for keys

iQCVAwUBPa4k44qHRg3pndX9AQHArwQAmePHXduPugmIQemek8PDx7spY82uN25u
MlZu+uuuGK1k0YvOiOLJUyaCmhdXRGtYOKd+GoDHVX5NJsnI7AbJzTmhy2H8DjZI
/gR8sblD3w6Q/Fi/M4jQvLdsNSWZVSoMR1tnsRLorfQva8C737LTJ8Ipa9KrnWNH
qx/0EyQnQ3o=
=6xM7
-----END PGP SIGNATURE-----


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