From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: [PATCH net-next 4/6] net/ipv4: Allow notifier to fail route replace Date: Tue, 27 Mar 2018 18:21:58 -0700 Message-ID: <20180328012200.15175-5-dsa@cumulusnetworks.com> References: <20180328012200.15175-1-dsa@cumulusnetworks.com> Cc: davem@davemloft.net, roopa@cumulusnetworks.com, shm@cumulusnetworks.com, jiri@mellanox.com, idosch@mellanox.com, jakub.kicinski@netronome.com, andy.roulin@gmail.com, David Ahern To: netdev@vger.kernel.org Return-path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:45881 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752852AbeC1BWM (ORCPT ); Tue, 27 Mar 2018 21:22:12 -0400 Received: by mail-pl0-f67.google.com with SMTP id n15-v6so562716plp.12 for ; Tue, 27 Mar 2018 18:22:12 -0700 (PDT) In-Reply-To: <20180328012200.15175-1-dsa@cumulusnetworks.com> Sender: netdev-owner@vger.kernel.org List-ID: Add checking to call to call_fib_entry_notifiers for IPv4 route replace. Allows a notifier handler to fail the replace. Signed-off-by: David Ahern --- net/ipv4/fib_trie.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 67116233e2bc..3dcffd3ce98c 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1219,8 +1219,13 @@ int fib_table_insert(struct net *net, struct fib_table *tb, new_fa->tb_id = tb->tb_id; new_fa->fa_default = -1; - call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, - key, plen, new_fa, extack); + err = call_fib_entry_notifiers(net, + FIB_EVENT_ENTRY_REPLACE, + key, plen, new_fa, + extack); + if (err) + goto out_free_new_fa; + rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, &cfg->fc_nlinfo, nlflags); -- 2.11.0