aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/xfrm4_protocol.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2014-03-14 02:28:07 -0400
committerSteffen Klassert <steffen.klassert@secunet.com>2014-03-14 02:28:07 -0400
commit2f32b51b609faea1e40bb8c5bd305f1351740936 (patch)
treea114ff4244c4c10c7aeedd64886a0ece4ff45b8f /net/ipv4/xfrm4_protocol.c
parent870a2df4ca026817eb87bb2f9daaa60a93fd051a (diff)
xfrm: Introduce xfrm_input_afinfo to access the the callbacks properly
IPv6 can be build as a module, so we need mechanism to access the address family dependent callback functions properly. Therefore we introduce xfrm_input_afinfo, similar to that what we have for the address family dependent part of policies and states. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv4/xfrm4_protocol.c')
-rw-r--r--net/ipv4/xfrm4_protocol.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/net/ipv4/xfrm4_protocol.c b/net/ipv4/xfrm4_protocol.c
index cdc09efca442..7f7b243e8139 100644
--- a/net/ipv4/xfrm4_protocol.c
+++ b/net/ipv4/xfrm4_protocol.c
@@ -179,6 +179,12 @@ static const struct net_protocol ipcomp4_protocol = {
179 .netns_ok = 1, 179 .netns_ok = 1,
180}; 180};
181 181
182static struct xfrm_input_afinfo xfrm4_input_afinfo = {
183 .family = AF_INET,
184 .owner = THIS_MODULE,
185 .callback = xfrm4_rcv_cb,
186};
187
182static inline const struct net_protocol *netproto(unsigned char protocol) 188static inline const struct net_protocol *netproto(unsigned char protocol)
183{ 189{
184 switch (protocol) { 190 switch (protocol) {
@@ -199,7 +205,6 @@ int xfrm4_protocol_register(struct xfrm4_protocol *handler,
199 struct xfrm4_protocol __rcu **pprev; 205 struct xfrm4_protocol __rcu **pprev;
200 struct xfrm4_protocol *t; 206 struct xfrm4_protocol *t;
201 bool add_netproto = false; 207 bool add_netproto = false;
202
203 int ret = -EEXIST; 208 int ret = -EEXIST;
204 int priority = handler->priority; 209 int priority = handler->priority;
205 210
@@ -273,3 +278,9 @@ int xfrm4_protocol_deregister(struct xfrm4_protocol *handler,
273 return ret; 278 return ret;
274} 279}
275EXPORT_SYMBOL(xfrm4_protocol_deregister); 280EXPORT_SYMBOL(xfrm4_protocol_deregister);
281
282void __init xfrm4_protocol_init(void)
283{
284 xfrm_input_register_afinfo(&xfrm4_input_afinfo);
285}
286EXPORT_SYMBOL(xfrm4_protocol_init);