diff options
| -rw-r--r-- | bgpd/bgp_nexthop.c | 107 | ||||
| -rw-r--r-- | lib/routemap_cli.c | 1 | ||||
| -rw-r--r-- | pimd/pimd.c | 1 | ||||
| -rw-r--r-- | pimd/pimd.h | 10 | ||||
| -rwxr-xr-x | tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py | 12 | ||||
| -rw-r--r-- | tests/topotests/rip-topo1/r1/rip_status.ref | 4 | ||||
| -rw-r--r-- | tests/topotests/rip-topo1/r1/ripd.conf | 1 | ||||
| -rw-r--r-- | tests/topotests/rip-topo1/r2/rip_status.ref | 4 | ||||
| -rw-r--r-- | tests/topotests/rip-topo1/r2/ripd.conf | 1 | ||||
| -rw-r--r-- | tests/topotests/rip-topo1/r3/rip_status.ref | 4 | ||||
| -rw-r--r-- | tests/topotests/rip-topo1/r3/ripd.conf | 1 | ||||
| -rwxr-xr-x | tests/topotests/rip-topo1/test_rip_topo1.py | 5 | ||||
| -rw-r--r-- | tests/topotests/ripng-topo1/r1/ripng_status.ref | 4 | ||||
| -rw-r--r-- | tests/topotests/ripng-topo1/r1/ripngd.conf | 1 | ||||
| -rw-r--r-- | tests/topotests/ripng-topo1/r2/ripng_status.ref | 4 | ||||
| -rw-r--r-- | tests/topotests/ripng-topo1/r2/ripngd.conf | 1 | ||||
| -rw-r--r-- | tests/topotests/ripng-topo1/r3/ripng_status.ref | 4 | ||||
| -rw-r--r-- | tests/topotests/ripng-topo1/r3/ripngd.conf | 1 | ||||
| -rwxr-xr-x | tests/topotests/ripng-topo1/test_ripng_topo1.py | 5 |
19 files changed, 78 insertions, 93 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 7116c80941..ab0c3a3f11 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -180,7 +180,7 @@ void bgp_tip_del(struct bgp *bgp, struct in_addr *tip) /* BGP own address structure */ struct bgp_addr { - struct prefix *p; + struct prefix p; struct list *ifp_name_list; }; @@ -192,17 +192,10 @@ static void show_address_entry(struct hash_bucket *bucket, void *args) struct listnode *node; char str[INET6_ADDRSTRLEN] = {0}; - if (addr->p->family == AF_INET) { - vty_out(vty, "addr: %s, count: %d : ", inet_ntop(AF_INET, - &(addr->p->u.prefix4), - str, INET_ADDRSTRLEN), - addr->ifp_name_list->count); - } else if (addr->p->family == AF_INET6) { - vty_out(vty, "addr: %s, count: %d : ", inet_ntop(AF_INET6, - &(addr->p->u.prefix6), - str, INET6_ADDRSTRLEN), - addr->ifp_name_list->count); - } + vty_out(vty, "addr: %s, count: %d : ", + inet_ntop(addr->p.family, &(addr->p.u.prefix), + str, INET6_ADDRSTRLEN), + addr->ifp_name_list->count); for (ALL_LIST_ELEMENTS_RO(addr->ifp_name_list, node, name)) { vty_out(vty, " %s,", name); @@ -231,8 +224,7 @@ static void *bgp_address_hash_alloc(void *p) struct bgp_addr *addr = NULL; addr = XMALLOC(MTYPE_BGP_ADDR, sizeof(struct bgp_addr)); - addr->p = prefix_new(); - prefix_copy(addr->p, copy_addr->p); + prefix_copy(&addr->p, ©_addr->p); addr->ifp_name_list = list_new(); addr->ifp_name_list->del = bgp_address_hash_string_del; @@ -244,7 +236,6 @@ static void bgp_address_hash_free(void *data) { struct bgp_addr *addr = data; - prefix_free(&addr->p); list_delete(&addr->ifp_name_list); XFREE(MTYPE_BGP_ADDR, addr); } @@ -253,7 +244,7 @@ static unsigned int bgp_address_hash_key_make(const void *p) { const struct bgp_addr *addr = p; - return prefix_hash_key((const void *)(addr->p)); + return prefix_hash_key(&addr->p); } static bool bgp_address_hash_cmp(const void *p1, const void *p2) @@ -261,7 +252,7 @@ static bool bgp_address_hash_cmp(const void *p1, const void *p2) const struct bgp_addr *addr1 = p1; const struct bgp_addr *addr2 = p2; - return prefix_same(addr1->p, addr2->p); + return prefix_same(&addr1->p, &addr2->p); } void bgp_address_init(struct bgp *bgp) @@ -288,12 +279,12 @@ static void bgp_address_add(struct bgp *bgp, struct connected *ifc, struct listnode *node; char *name; - tmp.p = p; + tmp.p = *p; - if (tmp.p->family == AF_INET) - tmp.p->prefixlen = IPV4_MAX_BITLEN; - else if (tmp.p->family == AF_INET6) - tmp.p->prefixlen = IPV6_MAX_BITLEN; + if (tmp.p.family == AF_INET) + tmp.p.prefixlen = IPV4_MAX_BITLEN; + else if (tmp.p.family == AF_INET6) + tmp.p.prefixlen = IPV6_MAX_BITLEN; addr = hash_get(bgp->address_hash, &tmp, bgp_address_hash_alloc); @@ -315,12 +306,12 @@ static void bgp_address_del(struct bgp *bgp, struct connected *ifc, struct listnode *node; char *name; - tmp.p = p; + tmp.p = *p; - if (tmp.p->family == AF_INET) - tmp.p->prefixlen = IPV4_MAX_BITLEN; - else if (tmp.p->family == AF_INET6) - tmp.p->prefixlen = IPV6_MAX_BITLEN; + if (tmp.p.family == AF_INET) + tmp.p.prefixlen = IPV4_MAX_BITLEN; + else if (tmp.p.family == AF_INET6) + tmp.p.prefixlen = IPV6_MAX_BITLEN; addr = hash_lookup(bgp->address_hash, &tmp); /* may have been deleted earlier by bgp_interface_down() */ @@ -482,75 +473,67 @@ static void bgp_connected_cleanup(struct route_table *table, int bgp_nexthop_self(struct bgp *bgp, afi_t afi, uint8_t type, uint8_t sub_type, struct attr *attr, struct bgp_node *rn) { - struct prefix p = {0}; - afi_t new_afi = afi; - struct bgp_addr tmp_addr = {0}, *addr = NULL; + uint8_t new_afi = afi == AFI_IP ? AF_INET : AF_INET6; + struct bgp_addr tmp_addr = {{0}}, *addr = NULL; struct tip_addr tmp_tip, *tip = NULL; - bool is_bgp_static_route = ((type == ZEBRA_ROUTE_BGP) - && (sub_type == BGP_ROUTE_STATIC)) + bool is_bgp_static_route = + ((type == ZEBRA_ROUTE_BGP) && (sub_type == BGP_ROUTE_STATIC)) ? true : false; if (!is_bgp_static_route) - new_afi = BGP_ATTR_NEXTHOP_AFI_IP6(attr) ? AFI_IP6 : AFI_IP; + new_afi = BGP_ATTR_NEXTHOP_AFI_IP6(attr) ? AF_INET6 : AF_INET; + tmp_addr.p.family = new_afi; switch (new_afi) { - case AFI_IP: - p.family = AF_INET; + case AF_INET: if (is_bgp_static_route) { - p.u.prefix4 = rn->p.u.prefix4; - p.prefixlen = rn->p.prefixlen; + tmp_addr.p.u.prefix4 = rn->p.u.prefix4; + tmp_addr.p.prefixlen = rn->p.prefixlen; } else { /* Here we need to find out which nexthop to be used*/ - if (attr->flag & - ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) { - - p.u.prefix4 = attr->nexthop; - p.prefixlen = IPV4_MAX_BITLEN; - - } else if ((attr->mp_nexthop_len) && - ((attr->mp_nexthop_len == - BGP_ATTR_NHLEN_IPV4) || - (attr->mp_nexthop_len == - BGP_ATTR_NHLEN_VPNV4))) { - p.u.prefix4 = + if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) { + tmp_addr.p.u.prefix4 = attr->nexthop; + tmp_addr.p.prefixlen = IPV4_MAX_BITLEN; + } else if ((attr->mp_nexthop_len) + && ((attr->mp_nexthop_len + == BGP_ATTR_NHLEN_IPV4) + || (attr->mp_nexthop_len + == BGP_ATTR_NHLEN_VPNV4))) { + tmp_addr.p.u.prefix4 = attr->mp_nexthop_global_in; - p.prefixlen = IPV4_MAX_BITLEN; + tmp_addr.p.prefixlen = IPV4_MAX_BITLEN; } else return 0; } break; - case AFI_IP6: - p.family = AF_INET6; - + case AF_INET6: if (is_bgp_static_route) { - p.u.prefix6 = rn->p.u.prefix6; - p.prefixlen = rn->p.prefixlen; + tmp_addr.p.u.prefix6 = rn->p.u.prefix6; + tmp_addr.p.prefixlen = rn->p.prefixlen; } else { - p.u.prefix6 = attr->mp_nexthop_global; - p.prefixlen = IPV6_MAX_BITLEN; + tmp_addr.p.u.prefix6 = attr->mp_nexthop_global; + tmp_addr.p.prefixlen = IPV6_MAX_BITLEN; } break; default: break; } - tmp_addr.p = &p; addr = hash_lookup(bgp->address_hash, &tmp_addr); if (addr) return 1; - if (new_afi == AFI_IP) { + if (new_afi == AF_INET) { memset(&tmp_tip, 0, sizeof(struct tip_addr)); tmp_tip.addr = attr->nexthop; if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) { tmp_tip.addr = attr->nexthop; } else if ((attr->mp_nexthop_len) && - ((attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4) - || (attr->mp_nexthop_len == - BGP_ATTR_NHLEN_VPNV4))) { + ((attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4) + || (attr->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV4))) { tmp_tip.addr = attr->mp_nexthop_global_in; } diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c index 7023710564..5b03b5266f 100644 --- a/lib/routemap_cli.c +++ b/lib/routemap_cli.c @@ -1064,7 +1064,6 @@ void route_map_cli_init(void) install_element(CONFIG_NODE, &no_route_map_all_cmd); /* Install the on-match stuff */ - install_element(RMAP_NODE, &route_map_cmd); install_element(RMAP_NODE, &rmap_onmatch_next_cmd); install_element(RMAP_NODE, &no_rmap_onmatch_next_cmd); install_element(RMAP_NODE, &rmap_onmatch_goto_cmd); diff --git a/pimd/pimd.c b/pimd/pimd.c index 889a83a136..0a7ac3b31f 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -50,6 +50,7 @@ const char *const PIM_ALL_IGMP_ROUTERS = MCAST_ALL_IGMP_ROUTERS; DEFINE_MTYPE_STATIC(PIMD, ROUTER, "PIM Router information"); struct pim_router *router = NULL; +struct in_addr qpim_all_pim_routers_addr; void pim_prefix_list_update(struct prefix_list *plist) { diff --git a/pimd/pimd.h b/pimd/pimd.h index 70d2766220..88e692b50d 100644 --- a/pimd/pimd.h +++ b/pimd/pimd.h @@ -131,14 +131,14 @@ #define PIM_UPDATE_SOURCE_DUP -10 #define PIM_GROUP_BAD_ADDR_MASK_COMBO -11 -const char *const PIM_ALL_SYSTEMS; -const char *const PIM_ALL_ROUTERS; -const char *const PIM_ALL_PIM_ROUTERS; -const char *const PIM_ALL_IGMP_ROUTERS; +extern const char *const PIM_ALL_SYSTEMS; +extern const char *const PIM_ALL_ROUTERS; +extern const char *const PIM_ALL_PIM_ROUTERS; +extern const char *const PIM_ALL_IGMP_ROUTERS; extern struct pim_router *router; extern struct zebra_privs_t pimd_privs; -struct in_addr qpim_all_pim_routers_addr; +extern struct in_addr qpim_all_pim_routers_addr; extern uint8_t qpim_ecmp_enable; extern uint8_t qpim_ecmp_rebalance_enable; diff --git a/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py b/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py index 7607fe986b..c851567dda 100755 --- a/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py +++ b/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py @@ -151,8 +151,7 @@ def setup_module(module): net['r%s' % i].startRouter() # Starting PE Hosts and init ExaBGP on each of them - print('*** Starting BGP on all 8 Peers in 10s') - sleep(10) + print('*** Starting BGP on all 8 Peers') for i in range(1, 9): net['peer%s' % i].cmd('cp %s/exabgp.env /etc/exabgp/exabgp.env' % thisDir) net['peer%s' % i].cmd('cp %s/peer%s/* /etc/exabgp/' % (thisDir, i)) @@ -191,7 +190,6 @@ def test_router_running(): print("\n\n** Check if FRR/Quagga is running on each Router node") print("******************************************\n") - sleep(5) # Starting Routers for i in range(1, 2): @@ -215,7 +213,7 @@ def test_bgp_converge(): # Wait for BGP to converge (All Neighbors in either Full or TwoWay State) print("\n\n** Verify for BGP to converge") print("******************************************\n") - timeout = 60 + timeout = 125 while timeout > 0: print("Timeout in %s: " % timeout), sys.stdout.flush() @@ -240,9 +238,9 @@ def test_bgp_converge(): bgpStatus = net['r%s' % i].cmd('vtysh -c "show ip bgp view %s summary"' % view) assert False, "BGP did not converge:\n%s" % bgpStatus - # Wait for an extra 30s to announce all routes - print('Waiting 30s for routes to be announced'); - sleep(30) + # Wait for an extra 5s to announce all routes + print('Waiting 5s for routes to be announced'); + sleep(5) print("BGP converged.") diff --git a/tests/topotests/rip-topo1/r1/rip_status.ref b/tests/topotests/rip-topo1/r1/rip_status.ref index 30c840e508..d75fbe85bb 100644 --- a/tests/topotests/rip-topo1/r1/rip_status.ref +++ b/tests/topotests/rip-topo1/r1/rip_status.ref @@ -1,6 +1,6 @@ Routing Protocol is "rip" - Sending updates every 30 seconds with +/-50%, next due in XX seconds - Timeout after 180 seconds, garbage collect after 120 seconds + Sending updates every 5 seconds with +/-50%, next due in XX seconds + Timeout after 180 seconds, garbage collect after 5 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 diff --git a/tests/topotests/rip-topo1/r1/ripd.conf b/tests/topotests/rip-topo1/r1/ripd.conf index 70e70d3590..935ec312e5 100644 --- a/tests/topotests/rip-topo1/r1/ripd.conf +++ b/tests/topotests/rip-topo1/r1/ripd.conf @@ -1,6 +1,7 @@ log file ripd.log ! router rip + timers basic 5 180 5 version 2 network 193.1.1.0/26 ! diff --git a/tests/topotests/rip-topo1/r2/rip_status.ref b/tests/topotests/rip-topo1/r2/rip_status.ref index b539d321d5..da1abd041a 100644 --- a/tests/topotests/rip-topo1/r2/rip_status.ref +++ b/tests/topotests/rip-topo1/r2/rip_status.ref @@ -1,6 +1,6 @@ Routing Protocol is "rip" - Sending updates every 30 seconds with +/-50%, next due in XX seconds - Timeout after 180 seconds, garbage collect after 120 seconds + Sending updates every 5 seconds with +/-50%, next due in XX seconds + Timeout after 180 seconds, garbage collect after 5 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 diff --git a/tests/topotests/rip-topo1/r2/ripd.conf b/tests/topotests/rip-topo1/r2/ripd.conf index 179a1ebd0f..2e94cfa262 100644 --- a/tests/topotests/rip-topo1/r2/ripd.conf +++ b/tests/topotests/rip-topo1/r2/ripd.conf @@ -3,6 +3,7 @@ log file ripd.log ! router rip version 2 + timers basic 5 180 5 network 193.1.1.0/26 network 193.1.2.0/24 ! diff --git a/tests/topotests/rip-topo1/r3/rip_status.ref b/tests/topotests/rip-topo1/r3/rip_status.ref index 0e3a4be944..040d3c32a1 100644 --- a/tests/topotests/rip-topo1/r3/rip_status.ref +++ b/tests/topotests/rip-topo1/r3/rip_status.ref @@ -1,6 +1,6 @@ Routing Protocol is "rip" - Sending updates every 30 seconds with +/-50%, next due in XX seconds - Timeout after 180 seconds, garbage collect after 120 seconds + Sending updates every 5 seconds with +/-50%, next due in XX seconds + Timeout after 180 seconds, garbage collect after 5 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 diff --git a/tests/topotests/rip-topo1/r3/ripd.conf b/tests/topotests/rip-topo1/r3/ripd.conf index 363b91b33a..e27e67503f 100644 --- a/tests/topotests/rip-topo1/r3/ripd.conf +++ b/tests/topotests/rip-topo1/r3/ripd.conf @@ -3,6 +3,7 @@ log file ripd.log ! router rip version 2 + timers basic 5 180 5 redistribute connected redistribute static network 193.1.2.0/24 diff --git a/tests/topotests/rip-topo1/test_rip_topo1.py b/tests/topotests/rip-topo1/test_rip_topo1.py index 7aaaacacfb..8f3c25e910 100755 --- a/tests/topotests/rip-topo1/test_rip_topo1.py +++ b/tests/topotests/rip-topo1/test_rip_topo1.py @@ -144,7 +144,6 @@ def test_router_running(): print("\n\n** Check if FRR/Quagga is running on each Router node") print("******************************************\n") - sleep(5) # Make sure that all daemons are running for i in range(1, 4): @@ -168,8 +167,8 @@ def test_converge_protocols(): print("\n\n** Waiting for protocols convergence") print("******************************************\n") - # Not really implemented yet - just sleep 60 secs for now - sleep(60) + # Not really implemented yet - just sleep 11 secs for now + sleep(11) # Make sure that all daemons are still running for i in range(1, 4): diff --git a/tests/topotests/ripng-topo1/r1/ripng_status.ref b/tests/topotests/ripng-topo1/r1/ripng_status.ref index 48816c1a9b..e6197f179b 100644 --- a/tests/topotests/ripng-topo1/r1/ripng_status.ref +++ b/tests/topotests/ripng-topo1/r1/ripng_status.ref @@ -1,6 +1,6 @@ Routing Protocol is "RIPng" - Sending updates every 30 seconds with +/-50%, next due in XX seconds - Timeout after 180 seconds, garbage collect after 120 seconds + Sending updates every 5 seconds with +/-50%, next due in XX seconds + Timeout after 180 seconds, garbage collect after 5 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 diff --git a/tests/topotests/ripng-topo1/r1/ripngd.conf b/tests/topotests/ripng-topo1/r1/ripngd.conf index 5eb78eafe2..dd54c43557 100644 --- a/tests/topotests/ripng-topo1/r1/ripngd.conf +++ b/tests/topotests/ripng-topo1/r1/ripngd.conf @@ -5,6 +5,7 @@ debug ripng packet debug ripng zebra ! router ripng + timers basic 5 180 5 network fc00:5::/64 ! line vty diff --git a/tests/topotests/ripng-topo1/r2/ripng_status.ref b/tests/topotests/ripng-topo1/r2/ripng_status.ref index fddcf63e5b..640df9a4a0 100644 --- a/tests/topotests/ripng-topo1/r2/ripng_status.ref +++ b/tests/topotests/ripng-topo1/r2/ripng_status.ref @@ -1,6 +1,6 @@ Routing Protocol is "RIPng" - Sending updates every 30 seconds with +/-50%, next due in XX seconds - Timeout after 180 seconds, garbage collect after 120 seconds + Sending updates every 5 seconds with +/-50%, next due in XX seconds + Timeout after 180 seconds, garbage collect after 5 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 diff --git a/tests/topotests/ripng-topo1/r2/ripngd.conf b/tests/topotests/ripng-topo1/r2/ripngd.conf index a25a3cd490..ef2c42195d 100644 --- a/tests/topotests/ripng-topo1/r2/ripngd.conf +++ b/tests/topotests/ripng-topo1/r2/ripngd.conf @@ -5,6 +5,7 @@ debug ripng packet debug ripng zebra ! router ripng + timers basic 5 180 5 network fc00:5::/64 network fc00:6::/62 ! diff --git a/tests/topotests/ripng-topo1/r3/ripng_status.ref b/tests/topotests/ripng-topo1/r3/ripng_status.ref index 1a8dabbf5f..f4bfff0c59 100644 --- a/tests/topotests/ripng-topo1/r3/ripng_status.ref +++ b/tests/topotests/ripng-topo1/r3/ripng_status.ref @@ -1,6 +1,6 @@ Routing Protocol is "RIPng" - Sending updates every 30 seconds with +/-50%, next due in XX seconds - Timeout after 180 seconds, garbage collect after 120 seconds + Sending updates every 5 seconds with +/-50%, next due in XX seconds + Timeout after 180 seconds, garbage collect after 5 seconds Outgoing update filter list for all interface is not set Incoming update filter list for all interface is not set Default redistribution metric is 1 diff --git a/tests/topotests/ripng-topo1/r3/ripngd.conf b/tests/topotests/ripng-topo1/r3/ripngd.conf index dfa5700adb..506eaac442 100644 --- a/tests/topotests/ripng-topo1/r3/ripngd.conf +++ b/tests/topotests/ripng-topo1/r3/ripngd.conf @@ -5,6 +5,7 @@ debug ripng packet debug ripng zebra ! router ripng + timers basic 5 180 5 network fc00:6::/62 redistribute connected redistribute static diff --git a/tests/topotests/ripng-topo1/test_ripng_topo1.py b/tests/topotests/ripng-topo1/test_ripng_topo1.py index 145b1a7efe..32b137240c 100755 --- a/tests/topotests/ripng-topo1/test_ripng_topo1.py +++ b/tests/topotests/ripng-topo1/test_ripng_topo1.py @@ -145,7 +145,6 @@ def test_router_running(): print("\n\n** Check if FRR/Quagga is running on each Router node") print("******************************************\n") - sleep(5) # Starting Routers for i in range(1, 4): @@ -169,8 +168,8 @@ def test_converge_protocols(): print("\n\n** Waiting for protocols convergence") print("******************************************\n") - # Not really implemented yet - just sleep 60 secs for now - sleep(60) + # Not really implemented yet - just sleep 11 secs for now + sleep(11) # Make sure that all daemons are running for i in range(1, 4): |
