aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_policy.c
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2007-12-20 23:49:33 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:59:40 -0500
commit68277accb3a5f004344f4346498640601b8b7016 (patch)
treee6b541283a516406fbd936051028845a20f5a7c4 /net/xfrm/xfrm_policy.c
parent8ea843495df36036cb7f22f61994b34f8362b443 (diff)
[XFRM]: Assorted IPsec fixups
This patch fixes a number of small but potentially troublesome things in the XFRM/IPsec code: * Use the 'audit_enabled' variable already in include/linux/audit.h Removed the need for extern declarations local to each XFRM audit fuction * Convert 'sid' to 'secid' everywhere we can The 'sid' name is specific to SELinux, 'secid' is the common naming convention used by the kernel when refering to tokenized LSM labels, unfortunately we have to leave 'ctx_sid' in 'struct xfrm_sec_ctx' otherwise we risk breaking userspace * Convert address display to use standard NIP* macros Similar to what was recently done with the SPD audit code, this also also includes the removal of some unnecessary memcpy() calls * Move common code to xfrm_audit_common_stateinfo() Code consolidation from the "less is more" book on software development * Proper spacing around commas in function arguments Minor style tweak since I was already touching the code Signed-off-by: Paul Moore <paul.moore@hp.com> Acked-by: James Morris <jmorris@namei.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r--net/xfrm/xfrm_policy.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 74807a7d3d69..abc3e39b115b 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -24,6 +24,7 @@
24#include <linux/netfilter.h> 24#include <linux/netfilter.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/cache.h> 26#include <linux/cache.h>
27#include <linux/audit.h>
27#include <net/dst.h> 28#include <net/dst.h>
28#include <net/xfrm.h> 29#include <net/xfrm.h>
29#include <net/ip.h> 30#include <net/ip.h>
@@ -2401,15 +2402,14 @@ static inline void xfrm_audit_common_policyinfo(struct xfrm_policy *xp,
2401 } 2402 }
2402} 2403}
2403 2404
2404void 2405void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
2405xfrm_audit_policy_add(struct xfrm_policy *xp, int result, u32 auid, u32 sid) 2406 u32 auid, u32 secid)
2406{ 2407{
2407 struct audit_buffer *audit_buf; 2408 struct audit_buffer *audit_buf;
2408 extern int audit_enabled;
2409 2409
2410 if (audit_enabled == 0) 2410 if (audit_enabled == 0)
2411 return; 2411 return;
2412 audit_buf = xfrm_audit_start(auid, sid); 2412 audit_buf = xfrm_audit_start(auid, secid);
2413 if (audit_buf == NULL) 2413 if (audit_buf == NULL)
2414 return; 2414 return;
2415 audit_log_format(audit_buf, " op=SPD-add res=%u", result); 2415 audit_log_format(audit_buf, " op=SPD-add res=%u", result);
@@ -2418,15 +2418,14 @@ xfrm_audit_policy_add(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
2418} 2418}
2419EXPORT_SYMBOL_GPL(xfrm_audit_policy_add); 2419EXPORT_SYMBOL_GPL(xfrm_audit_policy_add);
2420 2420
2421void 2421void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
2422xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, u32 auid, u32 sid) 2422 u32 auid, u32 secid)
2423{ 2423{
2424 struct audit_buffer *audit_buf; 2424 struct audit_buffer *audit_buf;
2425 extern int audit_enabled;
2426 2425
2427 if (audit_enabled == 0) 2426 if (audit_enabled == 0)
2428 return; 2427 return;
2429 audit_buf = xfrm_audit_start(auid, sid); 2428 audit_buf = xfrm_audit_start(auid, secid);
2430 if (audit_buf == NULL) 2429 if (audit_buf == NULL)
2431 return; 2430 return;
2432 audit_log_format(audit_buf, " op=SPD-delete res=%u", result); 2431 audit_log_format(audit_buf, " op=SPD-delete res=%u", result);