netfilter: remove unneccessary checks from netlink notifiers
authorPatrick McHardy <kaber@trash.net>
Fri, 6 Nov 2009 16:04:00 +0000 (17:04 +0100)
committerPatrick McHardy <kaber@trash.net>
Fri, 6 Nov 2009 16:04:00 +0000 (17:04 +0100)
The NETLINK_URELEASE notifier is only invoked for bound sockets, so
there is no need to check ->pid again.

Signed-off-by: Patrick McHardy <kaber@trash.net>
net/ipv4/netfilter/ip_queue.c
net/ipv6/netfilter/ip6_queue.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c

index 9811a45..9f07870 100644 (file)
@@ -497,8 +497,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
 {
        struct netlink_notify *n = ptr;
 
-       if (event == NETLINK_URELEASE &&
-           n->protocol == NETLINK_FIREWALL && n->pid) {
+       if (event == NETLINK_URELEASE && n->protocol == NETLINK_FIREWALL) {
                write_lock_bh(&queue_lock);
                if ((n->net == &init_net) && (n->pid == peer_pid))
                        __ipq_reset();
index a82016f..47a3623 100644 (file)
@@ -499,8 +499,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
 {
        struct netlink_notify *n = ptr;
 
-       if (event == NETLINK_URELEASE &&
-           n->protocol == NETLINK_IP6_FW && n->pid) {
+       if (event == NETLINK_URELEASE && n->protocol == NETLINK_IP6_FW) {
                write_lock_bh(&queue_lock);
                if ((n->net == &init_net) && (n->pid == peer_pid))
                        __ipq_reset();
index f900dc3..3aa66b2 100644 (file)
@@ -666,8 +666,7 @@ nfulnl_rcv_nl_event(struct notifier_block *this,
 {
        struct netlink_notify *n = ptr;
 
-       if (event == NETLINK_URELEASE &&
-           n->protocol == NETLINK_NETFILTER && n->pid) {
+       if (event == NETLINK_URELEASE && n->protocol == NETLINK_NETFILTER) {
                int i;
 
                /* destroy all instances for this pid */
index 7a9dec9..7e3fa41 100644 (file)
@@ -574,8 +574,7 @@ nfqnl_rcv_nl_event(struct notifier_block *this,
 {
        struct netlink_notify *n = ptr;
 
-       if (event == NETLINK_URELEASE &&
-           n->protocol == NETLINK_NETFILTER && n->pid) {
+       if (event == NETLINK_URELEASE && n->protocol == NETLINK_NETFILTER) {
                int i;
 
                /* destroy all instances for this pid */