summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_routemap.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-10-20 02:38:03 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-10-20 02:38:03 +0200
commit2b67b6f15aaa5b2013a6ff102f92741f88a2175a (patch)
tree07eb41228b809e9238806fdea881c7f7d96eb1d5 /bgpd/bgp_routemap.c
parentMerge pull request #3203 from opensourcerouting/buildfoo-20181015 (diff)
downloadfrr-2b67b6f15aaa5b2013a6ff102f92741f88a2175a.tar.xz
frr-2b67b6f15aaa5b2013a6ff102f92741f88a2175a.zip
bgpd: Prep commit to cleanup indentation
Signed-off-by: Donald Sharp <sahrpd@cumulusnetworks.com>
Diffstat (limited to '')
-rw-r--r--bgpd/bgp_routemap.c67
1 files changed, 32 insertions, 35 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index d468d48d8..1b2c1306f 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;