]> git.proxmox.com Git - mirror_frr.git/blobdiff - bfdd/bfdd_nb_config.c
Merge pull request #12310 from kuldeepkash/pim_v6
[mirror_frr.git] / bfdd / bfdd_nb_config.c
index 859e9475d0f1707625ecd53efccf98c76cecee0a..e4e97404d8b9cc8140a951de5ceb2aa7a2cd3b9b 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * BFD daemon northbound implementation.
  *
  * Copyright (C) 2019 Network Device Education Foundation, Inc. ("NetDEF")
  *                    Rafael Zalamena
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
  */
 
 #include <zebra.h>
@@ -333,13 +319,9 @@ int bfdd_bfd_profile_desired_transmission_interval_modify(
        struct nb_cb_modify_args *args)
 {
        struct bfd_profile *bp;
-       uint32_t min_tx;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               min_tx = yang_dnode_get_uint32(args->dnode, NULL);
-               if (min_tx < 10000 || min_tx > 60000000)
-                       return NB_ERR_VALIDATION;
                break;
 
        case NB_EV_PREPARE:
@@ -347,12 +329,8 @@ int bfdd_bfd_profile_desired_transmission_interval_modify(
                break;
 
        case NB_EV_APPLY:
-               min_tx = yang_dnode_get_uint32(args->dnode, NULL);
                bp = nb_running_get_entry(args->dnode, NULL, true);
-               if (bp->min_tx == min_tx)
-                       return NB_OK;
-
-               bp->min_tx = min_tx;
+               bp->min_tx = yang_dnode_get_uint32(args->dnode, NULL);
                bfd_profile_update(bp);
                break;
 
@@ -371,13 +349,9 @@ int bfdd_bfd_profile_required_receive_interval_modify(
        struct nb_cb_modify_args *args)
 {
        struct bfd_profile *bp;
-       uint32_t min_rx;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               min_rx = yang_dnode_get_uint32(args->dnode, NULL);
-               if (min_rx < 10000 || min_rx > 60000000)
-                       return NB_ERR_VALIDATION;
                break;
 
        case NB_EV_PREPARE:
@@ -385,12 +359,8 @@ int bfdd_bfd_profile_required_receive_interval_modify(
                break;
 
        case NB_EV_APPLY:
-               min_rx = yang_dnode_get_uint32(args->dnode, NULL);
                bp = nb_running_get_entry(args->dnode, NULL, true);
-               if (bp->min_rx == min_rx)
-                       return NB_OK;
-
-               bp->min_rx = min_rx;
+               bp->min_rx = yang_dnode_get_uint32(args->dnode, NULL);
                bfd_profile_update(bp);
                break;
 
@@ -408,17 +378,12 @@ int bfdd_bfd_profile_required_receive_interval_modify(
 int bfdd_bfd_profile_administrative_down_modify(struct nb_cb_modify_args *args)
 {
        struct bfd_profile *bp;
-       bool shutdown;
 
        if (args->event != NB_EV_APPLY)
                return NB_OK;
 
-       shutdown = yang_dnode_get_bool(args->dnode, NULL);
        bp = nb_running_get_entry(args->dnode, NULL, true);
-       if (bp->admin_shutdown == shutdown)
-               return NB_OK;
-
-       bp->admin_shutdown = shutdown;
+       bp->admin_shutdown = yang_dnode_get_bool(args->dnode, NULL);
        bfd_profile_update(bp);
 
        return NB_OK;
@@ -430,17 +395,12 @@ int bfdd_bfd_profile_administrative_down_modify(struct nb_cb_modify_args *args)
 int bfdd_bfd_profile_passive_mode_modify(struct nb_cb_modify_args *args)
 {
        struct bfd_profile *bp;
-       bool passive;
 
        if (args->event != NB_EV_APPLY)
                return NB_OK;
 
-       passive = yang_dnode_get_bool(args->dnode, NULL);
        bp = nb_running_get_entry(args->dnode, NULL, true);
-       if (bp->passive == passive)
-               return NB_OK;
-
-       bp->passive = passive;
+       bp->passive = yang_dnode_get_bool(args->dnode, NULL);
        bfd_profile_update(bp);
 
        return NB_OK;
@@ -452,17 +412,12 @@ int bfdd_bfd_profile_passive_mode_modify(struct nb_cb_modify_args *args)
 int bfdd_bfd_profile_minimum_ttl_modify(struct nb_cb_modify_args *args)
 {
        struct bfd_profile *bp;
-       uint8_t minimum_ttl;
 
        if (args->event != NB_EV_APPLY)
                return NB_OK;
 
-       minimum_ttl = yang_dnode_get_uint8(args->dnode, NULL);
        bp = nb_running_get_entry(args->dnode, NULL, true);
-       if (bp->minimum_ttl == minimum_ttl)
-               return NB_OK;
-
-       bp->minimum_ttl = minimum_ttl;
+       bp->minimum_ttl = yang_dnode_get_uint8(args->dnode, NULL);
        bfd_profile_update(bp);
 
        return NB_OK;
@@ -511,13 +466,9 @@ int bfdd_bfd_profile_desired_echo_transmission_interval_modify(
        struct nb_cb_modify_args *args)
 {
        struct bfd_profile *bp;
-       uint32_t min_tx;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               min_tx = yang_dnode_get_uint32(args->dnode, NULL);
-               if (min_tx < 10000 || min_tx > 60000000)
-                       return NB_ERR_VALIDATION;
                break;
 
        case NB_EV_PREPARE:
@@ -525,12 +476,8 @@ int bfdd_bfd_profile_desired_echo_transmission_interval_modify(
                break;
 
        case NB_EV_APPLY:
-               min_tx = yang_dnode_get_uint32(args->dnode, NULL);
                bp = nb_running_get_entry(args->dnode, NULL, true);
-               if (bp->min_echo_tx == min_tx)
-                       return NB_OK;
-
-               bp->min_echo_tx = min_tx;
+               bp->min_echo_tx = yang_dnode_get_uint32(args->dnode, NULL);
                bfd_profile_update(bp);
                break;
 
@@ -549,15 +496,9 @@ int bfdd_bfd_profile_required_echo_receive_interval_modify(
        struct nb_cb_modify_args *args)
 {
        struct bfd_profile *bp;
-       uint32_t min_rx;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               min_rx = yang_dnode_get_uint32(args->dnode, NULL);
-               if (min_rx == 0)
-                       return NB_OK;
-               if (min_rx < 10000 || min_rx > 60000000)
-                       return NB_ERR_VALIDATION;
                break;
 
        case NB_EV_PREPARE:
@@ -565,12 +506,8 @@ int bfdd_bfd_profile_required_echo_receive_interval_modify(
                break;
 
        case NB_EV_APPLY:
-               min_rx = yang_dnode_get_uint32(args->dnode, NULL);
                bp = nb_running_get_entry(args->dnode, NULL, true);
-               if (bp->min_echo_rx == min_rx)
-                       return NB_OK;
-
-               bp->min_echo_rx = min_rx;
+               bp->min_echo_rx = yang_dnode_get_uint32(args->dnode, NULL);
                bfd_profile_update(bp);
                break;
 
@@ -677,13 +614,10 @@ int bfdd_bfd_sessions_single_hop_detection_multiplier_modify(
 int bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify(
        struct nb_cb_modify_args *args)
 {
-       uint32_t tx_interval = yang_dnode_get_uint32(args->dnode, NULL);
        struct bfd_session *bs;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               if (tx_interval < 10000 || tx_interval > 60000000)
-                       return NB_ERR_VALIDATION;
                break;
 
        case NB_EV_PREPARE:
@@ -692,10 +626,8 @@ int bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify(
 
        case NB_EV_APPLY:
                bs = nb_running_get_entry(args->dnode, NULL, true);
-               if (tx_interval == bs->timers.desired_min_tx)
-                       return NB_OK;
-
-               bs->peer_profile.min_tx = tx_interval;
+               bs->peer_profile.min_tx =
+                       yang_dnode_get_uint32(args->dnode, NULL);
                bfd_session_apply(bs);
                break;
 
@@ -713,13 +645,10 @@ int bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify(
 int bfdd_bfd_sessions_single_hop_required_receive_interval_modify(
        struct nb_cb_modify_args *args)
 {
-       uint32_t rx_interval = yang_dnode_get_uint32(args->dnode, NULL);
        struct bfd_session *bs;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               if (rx_interval < 10000 || rx_interval > 60000000)
-                       return NB_ERR_VALIDATION;
                break;
 
        case NB_EV_PREPARE:
@@ -728,10 +657,8 @@ int bfdd_bfd_sessions_single_hop_required_receive_interval_modify(
 
        case NB_EV_APPLY:
                bs = nb_running_get_entry(args->dnode, NULL, true);
-               if (rx_interval == bs->timers.required_min_rx)
-                       return NB_OK;
-
-               bs->peer_profile.min_rx = rx_interval;
+               bs->peer_profile.min_rx =
+                       yang_dnode_get_uint32(args->dnode, NULL);
                bfd_session_apply(bs);
                break;
 
@@ -836,13 +763,10 @@ int bfdd_bfd_sessions_single_hop_echo_mode_modify(
 int bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify(
        struct nb_cb_modify_args *args)
 {
-       uint32_t echo_interval = yang_dnode_get_uint32(args->dnode, NULL);
        struct bfd_session *bs;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               if (echo_interval < 10000 || echo_interval > 60000000)
-                       return NB_ERR_VALIDATION;
                break;
 
        case NB_EV_PREPARE:
@@ -851,10 +775,8 @@ int bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify(
 
        case NB_EV_APPLY:
                bs = nb_running_get_entry(args->dnode, NULL, true);
-               if (echo_interval == bs->timers.desired_min_echo_tx)
-                       return NB_OK;
-
-               bs->peer_profile.min_echo_tx = echo_interval;
+               bs->peer_profile.min_echo_tx =
+                       yang_dnode_get_uint32(args->dnode, NULL);
                bfd_session_apply(bs);
                break;
 
@@ -873,15 +795,10 @@ int bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify(
 int bfdd_bfd_sessions_single_hop_required_echo_receive_interval_modify(
        struct nb_cb_modify_args *args)
 {
-       uint32_t echo_interval = yang_dnode_get_uint32(args->dnode, NULL);
        struct bfd_session *bs;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               if (echo_interval == 0)
-                        return NB_OK;
-               if (echo_interval < 10000 || echo_interval > 60000000)
-                       return NB_ERR_VALIDATION;
                break;
 
        case NB_EV_PREPARE:
@@ -890,10 +807,8 @@ int bfdd_bfd_sessions_single_hop_required_echo_receive_interval_modify(
 
        case NB_EV_APPLY:
                bs = nb_running_get_entry(args->dnode, NULL, true);
-               if (echo_interval == bs->timers.required_min_echo_rx)
-                       return NB_OK;
-
-               bs->peer_profile.min_echo_rx = echo_interval;
+               bs->peer_profile.min_echo_rx =
+                       yang_dnode_get_uint32(args->dnode, NULL);
                bfd_session_apply(bs);
                break;