diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-12-19 23:11:26 +0100 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2020-04-09 19:37:55 +0200 |
commit | 3ae327cb966d8e982a9d94fd47fad636444e8a31 (patch) | |
tree | c5bf7e257ca854f60614ca37d8c629b56aeb5d57 /zebra/rule_netlink.c | |
parent | Merge pull request #6124 from kuldeepkash/bgp_basic_functionality (diff) | |
download | frr-3ae327cb966d8e982a9d94fd47fad636444e8a31.tar.xz frr-3ae327cb966d8e982a9d94fd47fad636444e8a31.zip |
zebra: define some explicit rule replace code paths
Define some explicit rule replace code paths into the dataplane
code and improve the handling around it/releasing the the old
rule from the hash table.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'zebra/rule_netlink.c')
-rw-r--r-- | zebra/rule_netlink.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c index c9699c7d9..34df2485c 100644 --- a/zebra/rule_netlink.c +++ b/zebra/rule_netlink.c @@ -174,6 +174,31 @@ enum zebra_dplane_result kernel_del_pbr_rule(struct zebra_pbr_rule *rule) } /* + * Update specified rule for a specific interface. + */ +enum zebra_dplane_result kernel_update_pbr_rule(struct zebra_pbr_rule *old_rule, + struct zebra_pbr_rule *new_rule) +{ + int ret = 0; + + /* Add the new, updated one */ + ret = netlink_rule_update(RTM_NEWRULE, new_rule); + + /** + * Delete the old one. + * + * Don't care about this result right? + */ + netlink_rule_update(RTM_DELRULE, old_rule); + + kernel_pbr_rule_add_del_status(new_rule, + (!ret) ? ZEBRA_DPLANE_INSTALL_SUCCESS + : ZEBRA_DPLANE_INSTALL_FAILURE); + + return ZEBRA_DPLANE_REQUEST_SUCCESS; +} + +/* * Handle netlink notification informing a rule add or delete. * Handling of an ADD is TBD. * DELs are notified up, if other attributes indicate it may be a |