aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2007-12-12 14:10:16 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-12-14 16:54:35 -0500
commit9ab4c954ce2b2b3c485bee7e425fda05946893be (patch)
tree111c1cd3b765d06fd42325b1904a2289297142a8 /net/xfrm
parenta18aa31b7774d8b36048e256a02d9d689533fc96 (diff)
[XFRM]: Display the audited SPI value in host byte order.
Currently the IPsec protocol SPI values are written to the audit log in network byte order which is different from almost all other values which are recorded in host byte order. This patch corrects this inconsistency by writing the SPI values to the audit record in host byte order. Signed-off-by: Paul Moore <paul.moore@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_state.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index cf43c49eab3..1af522bf12c 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2028,6 +2028,7 @@ void
2028xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid) 2028xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
2029{ 2029{
2030 struct audit_buffer *audit_buf; 2030 struct audit_buffer *audit_buf;
2031 u32 spi;
2031 extern int audit_enabled; 2032 extern int audit_enabled;
2032 2033
2033 if (audit_enabled == 0) 2034 if (audit_enabled == 0)
@@ -2037,8 +2038,8 @@ xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
2037 return; 2038 return;
2038 audit_log_format(audit_buf, " op=SAD-add res=%u",result); 2039 audit_log_format(audit_buf, " op=SAD-add res=%u",result);
2039 xfrm_audit_common_stateinfo(x, audit_buf); 2040 xfrm_audit_common_stateinfo(x, audit_buf);
2040 audit_log_format(audit_buf, " spi=%lu(0x%lx)", 2041 spi = ntohl(x->id.spi);
2041 (unsigned long)x->id.spi, (unsigned long)x->id.spi); 2042 audit_log_format(audit_buf, " spi=%u(0x%x)", spi, spi);
2042 audit_log_end(audit_buf); 2043 audit_log_end(audit_buf);
2043} 2044}
2044EXPORT_SYMBOL_GPL(xfrm_audit_state_add); 2045EXPORT_SYMBOL_GPL(xfrm_audit_state_add);
@@ -2047,6 +2048,7 @@ void
2047xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid) 2048xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
2048{ 2049{
2049 struct audit_buffer *audit_buf; 2050 struct audit_buffer *audit_buf;
2051 u32 spi;
2050 extern int audit_enabled; 2052 extern int audit_enabled;
2051 2053
2052 if (audit_enabled == 0) 2054 if (audit_enabled == 0)
@@ -2056,8 +2058,8 @@ xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
2056 return; 2058 return;
2057 audit_log_format(audit_buf, " op=SAD-delete res=%u",result); 2059 audit_log_format(audit_buf, " op=SAD-delete res=%u",result);
2058 xfrm_audit_common_stateinfo(x, audit_buf); 2060 xfrm_audit_common_stateinfo(x, audit_buf);
2059 audit_log_format(audit_buf, " spi=%lu(0x%lx)", 2061 spi = ntohl(x->id.spi);
2060 (unsigned long)x->id.spi, (unsigned long)x->id.spi); 2062 audit_log_format(audit_buf, " spi=%u(0x%x)", spi, spi);
2061 audit_log_end(audit_buf); 2063 audit_log_end(audit_buf);
2062} 2064}
2063EXPORT_SYMBOL_GPL(xfrm_audit_state_delete); 2065EXPORT_SYMBOL_GPL(xfrm_audit_state_delete);