aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_policy.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r--net/xfrm/xfrm_policy.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b153f7482052..a76280a14e72 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2266,29 +2266,37 @@ void __init xfrm_init(void)
2266static inline void xfrm_audit_common_policyinfo(struct xfrm_policy *xp, 2266static inline void xfrm_audit_common_policyinfo(struct xfrm_policy *xp,
2267 struct audit_buffer *audit_buf) 2267 struct audit_buffer *audit_buf)
2268{ 2268{
2269 if (xp->security) 2269 struct xfrm_sec_ctx *ctx = xp->security;
2270 struct xfrm_selector *sel = &xp->selector;
2271
2272 if (ctx)
2270 audit_log_format(audit_buf, " sec_alg=%u sec_doi=%u sec_obj=%s", 2273 audit_log_format(audit_buf, " sec_alg=%u sec_doi=%u sec_obj=%s",
2271 xp->security->ctx_alg, xp->security->ctx_doi, 2274 ctx->ctx_alg, ctx->ctx_doi, ctx->ctx_str);
2272 xp->security->ctx_str);
2273 2275
2274 switch(xp->selector.family) { 2276 switch(sel->family) {
2275 case AF_INET: 2277 case AF_INET:
2276 audit_log_format(audit_buf, " src=%u.%u.%u.%u dst=%u.%u.%u.%u", 2278 audit_log_format(audit_buf, " src=" NIPQUAD_FMT,
2277 NIPQUAD(xp->selector.saddr.a4), 2279 NIPQUAD(sel->saddr.a4));
2278 NIPQUAD(xp->selector.daddr.a4)); 2280 if (sel->prefixlen_s != 32)
2281 audit_log_format(audit_buf, " src_prefixlen=%d",
2282 sel->prefixlen_s);
2283 audit_log_format(audit_buf, " dst=" NIPQUAD_FMT,
2284 NIPQUAD(sel->daddr.a4));
2285 if (sel->prefixlen_d != 32)
2286 audit_log_format(audit_buf, " dst_prefixlen=%d",
2287 sel->prefixlen_d);
2279 break; 2288 break;
2280 case AF_INET6: 2289 case AF_INET6:
2281 { 2290 audit_log_format(audit_buf, " src=" NIP6_FMT,
2282 struct in6_addr saddr6, daddr6; 2291 NIP6(*(struct in6_addr *)sel->saddr.a6));
2283 2292 if (sel->prefixlen_s != 128)
2284 memcpy(&saddr6, xp->selector.saddr.a6, 2293 audit_log_format(audit_buf, " src_prefixlen=%d",
2285 sizeof(struct in6_addr)); 2294 sel->prefixlen_s);
2286 memcpy(&daddr6, xp->selector.daddr.a6, 2295 audit_log_format(audit_buf, " dst=" NIP6_FMT,
2287 sizeof(struct in6_addr)); 2296 NIP6(*(struct in6_addr *)sel->daddr.a6));
2288 audit_log_format(audit_buf, 2297 if (sel->prefixlen_d != 128)
2289 " src=" NIP6_FMT " dst=" NIP6_FMT, 2298 audit_log_format(audit_buf, " dst_prefixlen=%d",
2290 NIP6(saddr6), NIP6(daddr6)); 2299 sel->prefixlen_d);
2291 }
2292 break; 2300 break;
2293 } 2301 }
2294} 2302}