len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire)); skb = alloc_skb(len, GFP_ATOMIC); if (skb == NULL) return -ENOMEM;
switch (c->event) { case XFRM_SAP_ADDED: case XFRM_SAP_UPDATED: case XFRM_SAP_DELETED: return xfrm_notify_policy(xp, dir, c); case XFRM_SAP_FLUSHED: return xfrm_notify_policy_flush(c); case XFRM_SAP_EXPIRED: return xfrm_exp_policy_notify(xp, dir, c); default: printk("xfrm_user: Unknown Policy event %d\n", c->event); }
static int xfrm_send_policy_notify(struct xfrm_policy *xp, int dir, int hard){	struct sk_buff *skb;	size_t len;	len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);	len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire));	skb = alloc_skb(len, GFP_ATOMIC);	if (skb == NULL)		return -ENOMEM;	if (build_polexpire(skb, xp, dir, hard) < 0)		BUG();	NETLINK_CB(skb).dst_groups = XFRMGRP_EXPIRE;	return netlink_broadcast(xfrm_nl, skb, 0, XFRMGRP_EXPIRE, GFP_ATOMIC);}