From 2b67b6f15aaa5b2013a6ff102f92741f88a2175a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 19 Oct 2018 20:38:03 -0400 Subject: [PATCH] bgpd: Prep commit to cleanup indentation Signed-off-by: Donald Sharp --- bgpd/bgp_routemap.c | 67 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index d468d48d86..1b2c1306f7 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1403,45 +1403,42 @@ static route_map_result_t route_set_ip_nexthop(void *rule, struct bgp_path_info *path; struct peer *peer; - if (type == RMAP_BGP) { - path = object; - peer = path->peer; + if (type != RMAP_BGP) + return RMAP_OKAY; - if (rins->unchanged) { - SET_FLAG(path->attr->rmap_change_flags, - BATTR_RMAP_NEXTHOP_UNCHANGED); - } else if (rins->peer_address) { - if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN) - || CHECK_FLAG(peer->rmap_type, - PEER_RMAP_TYPE_IMPORT)) - && peer->su_remote - && sockunion_family(peer->su_remote) == AF_INET) { - path->attr->nexthop.s_addr = - sockunion2ip(peer->su_remote); - path->attr->flag |= - ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP); - } else if (CHECK_FLAG(peer->rmap_type, - PEER_RMAP_TYPE_OUT)) { - /* The next hop value will be set as part of - * packet rewrite. - * Set the flags here to indicate that rewrite - * needs to be done. - * Also, clear the value. - */ - SET_FLAG(path->attr->rmap_change_flags, - BATTR_RMAP_NEXTHOP_PEER_ADDRESS); - path->attr->nexthop.s_addr = 0; - } - } else { - /* Set next hop value. */ + path = object; + peer = path->peer; + + if (rins->unchanged) { + SET_FLAG(path->attr->rmap_change_flags, + BATTR_RMAP_NEXTHOP_UNCHANGED); + } else if (rins->peer_address) { + if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN) + || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IMPORT)) + && peer->su_remote + && sockunion_family(peer->su_remote) == AF_INET) { + path->attr->nexthop.s_addr = + sockunion2ip(peer->su_remote); path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP); - path->attr->nexthop = *rins->address; + } else if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT)) { + /* The next hop value will be set as part of + * packet rewrite. Set the flags here to indicate + * that rewrite needs to be done. + * Also, clear the value. + */ SET_FLAG(path->attr->rmap_change_flags, - BATTR_RMAP_IPV4_NHOP_CHANGED); - /* case for MP-BGP : MPLS VPN */ - path->attr->mp_nexthop_global_in = *rins->address; - path->attr->mp_nexthop_len = sizeof(*rins->address); + BATTR_RMAP_NEXTHOP_PEER_ADDRESS); + path->attr->nexthop.s_addr = 0; } + } else { + /* Set next hop value. */ + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP); + path->attr->nexthop = *rins->address; + SET_FLAG(path->attr->rmap_change_flags, + BATTR_RMAP_IPV4_NHOP_CHANGED); + /* case for MP-BGP : MPLS VPN */ + path->attr->mp_nexthop_global_in = *rins->address; + path->attr->mp_nexthop_len = sizeof(*rins->address); } return RMAP_OKAY; -- 2.39.5