@@ -54,6 +54,28 @@ static const struct nla_policy calipso_genl_policy[NLBL_CALIPSO_A_MAX + 1] = {
54
54
[NLBL_CALIPSO_A_MTYPE ] = { .type = NLA_U32 },
55
55
};
56
56
57
+ static const struct netlbl_calipso_ops * calipso_ops ;
58
+
59
+ /**
60
+ * netlbl_calipso_ops_register - Register the CALIPSO operations
61
+ * @ops: ops to register
62
+ *
63
+ * Description:
64
+ * Register the CALIPSO packet engine operations.
65
+ *
66
+ */
67
+ const struct netlbl_calipso_ops *
68
+ netlbl_calipso_ops_register (const struct netlbl_calipso_ops * ops )
69
+ {
70
+ return xchg (& calipso_ops , ops );
71
+ }
72
+ EXPORT_SYMBOL (netlbl_calipso_ops_register );
73
+
74
+ static const struct netlbl_calipso_ops * netlbl_calipso_ops_get (void )
75
+ {
76
+ return READ_ONCE (calipso_ops );
77
+ }
78
+
57
79
/* NetLabel Command Handlers
58
80
*/
59
81
/**
@@ -96,15 +118,18 @@ static int netlbl_calipso_add_pass(struct genl_info *info,
96
118
*
97
119
*/
98
120
static int netlbl_calipso_add (struct sk_buff * skb , struct genl_info * info )
99
-
100
121
{
101
122
int ret_val = - EINVAL ;
102
123
struct netlbl_audit audit_info ;
124
+ const struct netlbl_calipso_ops * ops = netlbl_calipso_ops_get ();
103
125
104
126
if (!info -> attrs [NLBL_CALIPSO_A_DOI ] ||
105
127
!info -> attrs [NLBL_CALIPSO_A_MTYPE ])
106
128
return - EINVAL ;
107
129
130
+ if (!ops )
131
+ return - EOPNOTSUPP ;
132
+
108
133
netlbl_netlink_auditinfo (& audit_info );
109
134
switch (nla_get_u32 (info -> attrs [NLBL_CALIPSO_A_MTYPE ])) {
110
135
case CALIPSO_MAP_PASS :
@@ -363,28 +388,6 @@ int __init netlbl_calipso_genl_init(void)
363
388
return genl_register_family (& netlbl_calipso_gnl_family );
364
389
}
365
390
366
- static const struct netlbl_calipso_ops * calipso_ops ;
367
-
368
- /**
369
- * netlbl_calipso_ops_register - Register the CALIPSO operations
370
- * @ops: ops to register
371
- *
372
- * Description:
373
- * Register the CALIPSO packet engine operations.
374
- *
375
- */
376
- const struct netlbl_calipso_ops *
377
- netlbl_calipso_ops_register (const struct netlbl_calipso_ops * ops )
378
- {
379
- return xchg (& calipso_ops , ops );
380
- }
381
- EXPORT_SYMBOL (netlbl_calipso_ops_register );
382
-
383
- static const struct netlbl_calipso_ops * netlbl_calipso_ops_get (void )
384
- {
385
- return READ_ONCE (calipso_ops );
386
- }
387
-
388
391
/**
389
392
* calipso_doi_add - Add a new DOI to the CALIPSO protocol engine
390
393
* @doi_def: the DOI structure
0 commit comments