Skip to content

Commit

Permalink
[NETFILTER]: ctnetlink: ctnetlink_event cleanup
Browse files Browse the repository at this point in the history
Cleanup: Use 'else if' instead of a ugly 'goto' statement.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pablo Neira Ayuso authored and David S. Miller committed Jan 5, 2006
1 parent 47116eb commit 0368309
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions net/ipv4/netfilter/ip_conntrack_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,29 +312,22 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
if (events & IPCT_DESTROY) {
type = IPCTNL_MSG_CT_DELETE;
group = NFNLGRP_CONNTRACK_DESTROY;
goto alloc_skb;
}
if (events & (IPCT_NEW | IPCT_RELATED)) {
} else if (events & (IPCT_NEW | IPCT_RELATED)) {
type = IPCTNL_MSG_CT_NEW;
flags = NLM_F_CREATE|NLM_F_EXCL;
/* dump everything */
events = ~0UL;
group = NFNLGRP_CONNTRACK_NEW;
goto alloc_skb;
}
if (events & (IPCT_STATUS |
} else if (events & (IPCT_STATUS |
IPCT_PROTOINFO |
IPCT_HELPER |
IPCT_HELPINFO |
IPCT_NATINFO)) {
type = IPCTNL_MSG_CT_NEW;
group = NFNLGRP_CONNTRACK_UPDATE;
goto alloc_skb;
}
} else
return NOTIFY_DONE;

return NOTIFY_DONE;

alloc_skb:
/* FIXME: Check if there are any listeners before, don't hurt performance */

skb = alloc_skb(NLMSG_GOODSIZE, GFP_ATOMIC);
Expand Down

0 comments on commit 0368309

Please sign in to comment.