History

netfilter: ctnetlink: fix reliable event delivery if message building fails

This patch fixes a bug that allows to lose events when reliable event delivery mode is used, ie. if NETLINK_BROADCAST_SEND_ERROR and NETLINK_RECV_NO_ENOBUFS socket options are set.

Pablo Neira Ayuso committed 16 years ago

Commit 37b7ef71 parent 1a503073 files · +6 −4Browse files

Unified · Split

3 files
  1. include/linux/netfilter/nfnetlink.h +1 −1
  2. net/netfilter/nf_conntrack_netlink.c +3 −1
  3. net/netfilter/nfnetlink.c +2 −2
include/linux/netfilter/nfnetlink.h+1−1
@@ -76,7 +76,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); · 75 unmodified lines
7676 extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
7777 extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group,
7878 int echo, gfp_t flags);
79−extern void nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
79+extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
8080 extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
8181
8282 extern void nfnl_lock(void);
net/netfilter/nf_conntrack_netlink.c+3−1
@@ -582,7 +582,9 @@ nla_put_failure: · 581 unmodified lines
582582 nlmsg_failure:
583583 kfree_skb(skb);
584584 errout:
585− nfnetlink_set_err(net, 0, group, -ENOBUFS);
585+ if (nfnetlink_set_err(net, 0, group, -ENOBUFS) > 0)
586+ return -ENOBUFS;
587+
586588 return 0;
587589 }
588590 #endif /* CONFIG_NF_CONNTRACK_EVENTS */
net/netfilter/nfnetlink.c+2−2
@@ -113,9 +113,9 @@ int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, · 112 unmodified lines
113113 }
114114 EXPORT_SYMBOL_GPL(nfnetlink_send);
115115
116−void nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error)
116+int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error)
117117 {
118− netlink_set_err(net->nfnl, pid, group, error);
118+ return netlink_set_err(net->nfnl, pid, group, error);
119119 }
120120 EXPORT_SYMBOL_GPL(nfnetlink_set_err);
121121

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t