===== include/linux/xfrm.h 1.24 vs edited ===== --- 1.24/include/linux/xfrm.h 2005-04-08 23:08:26 +10:00 +++ edited/include/linux/xfrm.h 2005-04-10 19:25:22 +10:00 @@ -227,6 +227,11 @@ __u8 dir; }; +struct xfrm_userpolicy_delete { + struct xfrm_userpolicy_info pol; + __u8 byid; +}; + struct xfrm_user_acquire { struct xfrm_id id; xfrm_address_t saddr; ===== net/xfrm/xfrm_user.c 1.56 vs edited ===== --- 1.56/net/xfrm/xfrm_user.c 2005-04-10 19:03:30 +10:00 +++ edited/net/xfrm/xfrm_user.c 2005-04-10 19:30:30 +10:00 @@ -1386,20 +1386,30 @@ static int xfrm_notify_policy( struct xfrm_policy *xp, int dir, struct km_event *c) { struct xfrm_userpolicy_info *p; + struct xfrm_userpolicy_delete *pdel; struct nlmsghdr *nlh; struct sk_buff *skb; unsigned char *b; int len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); - len += NLMSG_SPACE(sizeof(struct xfrm_userpolicy_info)); + int payload; + + payload = (c->event == XFRM_MSG_DELPOLICY) ? + sizeof(*pdel) : sizeof(*p); + len += NLMSG_SPACE(payload); skb = alloc_skb(len, GFP_ATOMIC); if (skb == NULL) return -ENOMEM; b = skb->tail; - nlh = NLMSG_PUT(skb, c->pid, c->seq, c->event, sizeof(*p)); + nlh = NLMSG_PUT(skb, c->pid, c->seq, c->event, payload); p = NLMSG_DATA(nlh); + if (c->event == XFRM_MSG_DELPOLICY) { + pdel = NLMSG_DATA(nlh); + pdel->byid = !!c->data.byid; + p = &pdel->pol; + } nlh->nlmsg_flags = 0;