| @@ -1632,17 +1632,20 @@ ctnetlink_expect_event(unsigned int events, struct nf_exp_event *item) · 1631 unmodified lines |
| 1632 | 1632 | struct nlmsghdr *nlh; |
| 1633 | 1633 | struct nfgenmsg *nfmsg; |
| 1634 | 1634 | struct sk_buff *skb; |
| 1635 | | − unsigned int type; |
| 1635 | + unsigned int type, group; |
| 1636 | 1636 | int flags = 0; |
| 1637 | 1637 | |
| 1638 | | − if (events & (1 << IPEXP_NEW)) { |
| 1638 | + if (events & (1 << IPEXP_DESTROY)) { |
| 1639 | + type = IPCTNL_MSG_EXP_DELETE; |
| 1640 | + group = NFNLGRP_CONNTRACK_EXP_DESTROY; |
| 1641 | + } else if (events & (1 << IPEXP_NEW)) { |
| 1639 | 1642 | type = IPCTNL_MSG_EXP_NEW; |
| 1640 | 1643 | flags = NLM_F_CREATE|NLM_F_EXCL; |
| 1644 | + group = NFNLGRP_CONNTRACK_EXP_NEW; |
| 1641 | 1645 | } else |
| 1642 | 1646 | return 0; |
| 1643 | 1647 | |
| 1644 | | − if (!item->report && |
| 1645 | | − !nfnetlink_has_listeners(net, NFNLGRP_CONNTRACK_EXP_NEW)) |
| 1648 | + if (!item->report && !nfnetlink_has_listeners(net, group)) |
| 1646 | 1649 | return 0; |
| 1647 | 1650 | |
| 1648 | 1651 | skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); |
| @@ -1665,8 +1668,7 @@ ctnetlink_expect_event(unsigned int events, struct nf_exp_event *item) · 16 unmodified lines |
| 1665 | 1668 | rcu_read_unlock(); |
| 1666 | 1669 | |
| 1667 | 1670 | nlmsg_end(skb, nlh); |
| 1668 | | − nfnetlink_send(skb, net, item->pid, NFNLGRP_CONNTRACK_EXP_NEW, |
| 1669 | | − item->report, GFP_ATOMIC); |
| 1671 | + nfnetlink_send(skb, net, item->pid, group, item->report, GFP_ATOMIC); |
| 1670 | 1672 | return 0; |
| 1671 | 1673 | |
| 1672 | 1674 | nla_put_failure: |
| @@ -1849,7 +1851,13 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, · 176 unmodified lines |
| 1849 | 1851 | } |
| 1850 | 1852 | |
| 1851 | 1853 | /* after list removal, usage count == 1 */ |
| 1852 | | − nf_ct_unexpect_related(exp); |
| 1854 | + spin_lock_bh(&nf_conntrack_lock); |
| 1855 | + if (del_timer(&exp->timeout)) { |
| 1856 | + nf_ct_unlink_expect_report(exp, NETLINK_CB(skb).pid, |
| 1857 | + nlmsg_report(nlh)); |
| 1858 | + nf_ct_expect_put(exp); |
| 1859 | + } |
| 1860 | + spin_unlock_bh(&nf_conntrack_lock); |
| 1853 | 1861 | /* have to put what we 'get' above. |
| 1854 | 1862 | * after this line usage count == 0 */ |
| 1855 | 1863 | nf_ct_expect_put(exp); |
| @@ -1866,7 +1874,9 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, · 10 unmodified lines |
| 1866 | 1874 | m_help = nfct_help(exp->master); |
| 1867 | 1875 | if (!strcmp(m_help->helper->name, name) && |
| 1868 | 1876 | del_timer(&exp->timeout)) { |
| 1869 | | − nf_ct_unlink_expect(exp); |
| 1877 | + nf_ct_unlink_expect_report(exp, |
| 1878 | + NETLINK_CB(skb).pid, |
| 1879 | + nlmsg_report(nlh)); |
| 1870 | 1880 | nf_ct_expect_put(exp); |
| 1871 | 1881 | } |
| 1872 | 1882 | } |
| @@ -1880,7 +1890,9 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, · 7 unmodified lines |
| 1880 | 1890 | &net->ct.expect_hash[i], |
| 1881 | 1891 | hnode) { |
| 1882 | 1892 | if (del_timer(&exp->timeout)) { |
| 1883 | | − nf_ct_unlink_expect(exp); |
| 1893 | + nf_ct_unlink_expect_report(exp, |
| 1894 | + NETLINK_CB(skb).pid, |
| 1895 | + nlmsg_report(nlh)); |
| 1884 | 1896 | nf_ct_expect_put(exp); |
| 1885 | 1897 | } |
| 1886 | 1898 | } |