Skip to contentSkip to conversation

: Sub-policies beautification

PATCH Applied jamal 1 participant 1 message Nov 17, 2006

Subsystems (3)
lore
Share & tools
lore

jamal

author
#0 lore raw

PATCH 2/2 : Sub-policies beautification

Second one ..

cheers,
jamal

[XFRM]: Make flush notifier prettier when subpolicy used

Might as well make flush notifier prettier when subpolicy used

---
commit eb52e3df145c2f8676da51a21cbe664d7794949c
tree d51daec2222f0feb1119f7c00bf9949b255a9494
parent 5e6a47d1e7baabd38cca9d01f3d78ae1319db535
author Jamal Hadi Salim <[email protected]> Fri, 17 Nov 2006 08:56:34 -0500 committer Jamal Hadi Salim <hadi@jzny2.(none)> Fri, 17 Nov 2006 08:56:34 -0500

 net/xfrm/xfrm_user.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
net/xfrm/xfrm_user.c +2 -10
index 3c34385..793b241 100644
@@ -2117,7 +2117,6 @@ static int xfrm_notify_policy_flush(stru
 	unsigned char *b;
 	int len = 0;
 #ifdef CONFIG_XFRM_SUB_POLICY
-	struct xfrm_userpolicy_type upt;
 	len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
 #endif
 	len += NLMSG_LENGTH(0);
@@ -2130,12 +2129,8 @@ #endif
 
 	nlh = NLMSG_PUT(skb, c->pid, c->seq, XFRM_MSG_FLUSHPOLICY, 0);
 	nlh->nlmsg_flags = 0;
-
-#ifdef CONFIG_XFRM_SUB_POLICY
-	memset(&upt, 0, sizeof(upt));
-	upt.type = c->data.type;
-	RTA_PUT(skb, XFRMA_POLICY_TYPE, sizeof(upt), &upt);
-#endif
+	if (copy_to_user_policy_type(c->data.type, skb) < 0)
+		goto nlmsg_failure;
 
 	nlh->nlmsg_len = skb->tail - b;
 
@@ -2143,9 +2138,6 @@ #endif
 	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_POLICY, GFP_ATOMIC);
 
 nlmsg_failure:
-#ifdef CONFIG_XFRM_SUB_POLICY
-rtattr_failure:
-#endif
 	kfree_skb(skb);
 	return -1;
 }