diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-03-23 08:21:06 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-03-23 08:21:06 -0400 |
commit | dd5b6ce6fd465eab90357711c8e8124dc3a31ff0 (patch) | |
tree | ebc40b018356e8cac36ba575e3f183c1a16b782b /net | |
parent | 176252746ebbc8db97e304345af1f2563c7dc139 (diff) |
nefilter: nfnetlink: add nfnetlink_set_err and use it in ctnetlink
This patch adds nfnetlink_set_err() to propagate the error to netlink
broadcast listener in case of memory allocation errors in the
message building.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 2 | ||||
-rw-r--r-- | net/netfilter/nfnetlink.c | 6 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index d1fe9d15ac5c..1b75c9efb0eb 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -518,6 +518,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, | |||
518 | nla_put_failure: | 518 | nla_put_failure: |
519 | rcu_read_unlock(); | 519 | rcu_read_unlock(); |
520 | nlmsg_failure: | 520 | nlmsg_failure: |
521 | nfnetlink_set_err(0, group, -ENOBUFS); | ||
521 | kfree_skb(skb); | 522 | kfree_skb(skb); |
522 | return NOTIFY_DONE; | 523 | return NOTIFY_DONE; |
523 | } | 524 | } |
@@ -1514,6 +1515,7 @@ static int ctnetlink_expect_event(struct notifier_block *this, | |||
1514 | nla_put_failure: | 1515 | nla_put_failure: |
1515 | rcu_read_unlock(); | 1516 | rcu_read_unlock(); |
1516 | nlmsg_failure: | 1517 | nlmsg_failure: |
1518 | nfnetlink_set_err(0, 0, -ENOBUFS); | ||
1517 | kfree_skb(skb); | 1519 | kfree_skb(skb); |
1518 | return NOTIFY_DONE; | 1520 | return NOTIFY_DONE; |
1519 | } | 1521 | } |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 9c0ba17a1ddb..2785d66a7e38 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -113,6 +113,12 @@ int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo) | |||
113 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(nfnetlink_send); | 114 | EXPORT_SYMBOL_GPL(nfnetlink_send); |
115 | 115 | ||
116 | void nfnetlink_set_err(u32 pid, u32 group, int error) | ||
117 | { | ||
118 | netlink_set_err(nfnl, pid, group, error); | ||
119 | } | ||
120 | EXPORT_SYMBOL_GPL(nfnetlink_set_err); | ||
121 | |||
116 | int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags) | 122 | int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags) |
117 | { | 123 | { |
118 | return netlink_unicast(nfnl, skb, pid, flags); | 124 | return netlink_unicast(nfnl, skb, pid, flags); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 6ee69c27f806..5b33879c6422 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1106,6 +1106,7 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code) | |||
1106 | 1106 | ||
1107 | read_unlock(&nl_table_lock); | 1107 | read_unlock(&nl_table_lock); |
1108 | } | 1108 | } |
1109 | EXPORT_SYMBOL(netlink_set_err); | ||
1109 | 1110 | ||
1110 | /* must be called with netlink table grabbed */ | 1111 | /* must be called with netlink table grabbed */ |
1111 | static void netlink_update_socket_mc(struct netlink_sock *nlk, | 1112 | static void netlink_update_socket_mc(struct netlink_sock *nlk, |