From b769fdc88b2445cb6965ac70ffb87a87af26a79d Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Mon, 10 Apr 2023 15:20:43 +0800 Subject: ripd: Simplify code for distance Simplify the code for `rip_distance_apply()`. Signed-off-by: anlan_cs --- ripd/ripd.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'ripd') diff --git a/ripd/ripd.c b/ripd/ripd.c index 15e058a74..7dbe2bbcc 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2836,16 +2836,11 @@ uint8_t rip_distance_apply(struct rip *rip, struct rip_info *rinfo) if (access_list_apply(alist, &rinfo->rp->p) == FILTER_DENY) return 0; - - return rdistance->distance; - } else - return rdistance->distance; + } + return rdistance->distance; } - if (rip->distance) - return rip->distance; - - return 0; + return rip->distance; } static void rip_distance_show(struct vty *vty, struct rip *rip) -- cgit v1.2.3