Skip to content

Commit 1634d0b

Browse files
committed
zebra: V6 RA not sent anymore after interface up-down-up
Issue: Once interface is shutdown, the interface is removed from wheel timer. Now when the interface is up again, current code won't add the interface to wheel timer again, so it won't send RA anymore for that interface Fix: Moved wheel_add for interface inside rtadv_start_interface_events This is more common function which gets triggered for both RA enable and interface up event Also on any kind of interface activation event, we try to send RA as soon as possible. This is to satisfy requirement where quick RA is needed, especially for some convergence, dependent on RA. Testing: Did ineterface up to down to up Added debug log for RA, checked it is getting advertised preodically after when up at up state show bgp summary for 512 bgp peers for bgp bgp unnumbered works fine. Signed-off-by: Soumya Roy <[email protected]>
1 parent 3dd4d41 commit 1634d0b

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

zebra/interface.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "log.h"
1919
#include "zclient.h"
2020
#include "vrf.h"
21+
#include "wheel.h"
2122

2223
#include "zebra/rtadv.h"
2324
#include "zebra_ns.h"
@@ -990,6 +991,7 @@ void if_down(struct interface *ifp)
990991
zif->down_count++;
991992
frr_timestamp(2, zif->down_last, sizeof(zif->down_last));
992993

994+
rtadv_stop_ra(ifp, true);
993995
if_down_nhg_dependents(ifp);
994996

995997
/* Handle interface down for specific types for EVPN. Non-VxLAN
@@ -3706,7 +3708,7 @@ int if_shutdown(struct interface *ifp)
37063708

37073709
if (ifp->ifindex != IFINDEX_INTERNAL) {
37083710
/* send RA lifetime of 0 before stopping. rfc4861/6.2.5 */
3709-
rtadv_stop_ra(ifp);
3711+
rtadv_stop_ra(ifp, false);
37103712
if (if_unset_flags(ifp, IFF_UP) < 0) {
37113713
zlog_debug("Can't shutdown interface %s", ifp->name);
37123714
return -1;

zebra/rtadv.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,8 +1400,11 @@ static void rtadv_start_interface_events(struct zebra_vrf *zvrf,
14001400
}
14011401

14021402
adv_if = adv_if_add(zvrf, zif->ifp->name);
1403-
if (adv_if != NULL)
1403+
if (adv_if != NULL) {
1404+
rtadv_send_packet(zvrf->rtadv.sock, zif->ifp, RA_ENABLE);
1405+
wheel_add_item(zrouter.ra_wheel, zif->ifp);
14041406
return; /* Already added */
1407+
}
14051408

14061409
if (if_join_all_router(zvrf->rtadv.sock, zif->ifp)) {
14071410
/*Failed to join on 1st attempt, wait random amount of time between 1 ms
@@ -1413,6 +1416,9 @@ static void rtadv_start_interface_events(struct zebra_vrf *zvrf,
14131416

14141417
if (adv_if_list_count(&zvrf->rtadv.adv_if) == 1)
14151418
rtadv_event(zvrf, RTADV_START, 0);
1419+
1420+
rtadv_send_packet(zvrf->rtadv.sock, zif->ifp, RA_ENABLE);
1421+
wheel_add_item(zrouter.ra_wheel, zif->ifp);
14161422
}
14171423

14181424
void ipv6_nd_suppress_ra_set(struct interface *ifp,
@@ -1461,7 +1467,6 @@ void ipv6_nd_suppress_ra_set(struct interface *ifp,
14611467
RTADV_NUM_FAST_REXMITS;
14621468
}
14631469

1464-
wheel_add_item(zrouter.ra_wheel, ifp);
14651470
rtadv_start_interface_events(zvrf, zif);
14661471
}
14671472
}
@@ -1581,17 +1586,22 @@ static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable)
15811586
* ceasing to advertise and want to let our neighbors know.
15821587
* RFC 4861 secion 6.2.5
15831588
*/
1584-
void rtadv_stop_ra(struct interface *ifp)
1589+
void rtadv_stop_ra(struct interface *ifp, bool if_down_event)
15851590
{
15861591
struct zebra_if *zif;
15871592
struct zebra_vrf *zvrf;
15881593

1589-
zif = ifp->info;
1590-
zvrf = rtadv_interface_get_zvrf(ifp);
1591-
15921594
/*Try to delete from ra wheels */
15931595
wheel_remove_item(zrouter.ra_wheel, ifp);
15941596

1597+
if (if_down_event) {
1598+
/* Nothing to do more, return */
1599+
return;
1600+
}
1601+
1602+
zif = ifp->info;
1603+
zvrf = rtadv_interface_get_zvrf(ifp);
1604+
15951605
/*Turn off event for ICMPv6 join*/
15961606
EVENT_OFF(zif->icmpv6_join_timer);
15971607

@@ -1622,7 +1632,7 @@ void rtadv_stop_ra_all(void)
16221632
rprefix)
16231633
rtadv_prefix_reset(zif, rprefix, rprefix);
16241634

1625-
rtadv_stop_ra(ifp);
1635+
rtadv_stop_ra(ifp, false);
16261636
}
16271637
}
16281638

zebra/rtadv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ enum ipv6_nd_suppress_ra_status {
404404

405405
extern void rtadv_vrf_init(struct zebra_vrf *zvrf);
406406
extern void rtadv_vrf_terminate(struct zebra_vrf *zvrf);
407-
extern void rtadv_stop_ra(struct interface *ifp);
407+
extern void rtadv_stop_ra(struct interface *ifp, bool if_down_event);
408408
extern void rtadv_stop_ra_all(void);
409409
extern void rtadv_cmd_init(void);
410410
extern void rtadv_if_init(struct zebra_if *zif);
@@ -494,7 +494,7 @@ static inline void rtadv_delete_prefix(struct zebra_if *zif,
494494
const struct prefix *p)
495495
{
496496
}
497-
static inline void rtadv_stop_ra(struct interface *ifp)
497+
static inline void rtadv_stop_ra(struct interface *ifp, bool if_down_event)
498498
{
499499
}
500500
static inline void rtadv_stop_ra_all(void)

0 commit comments

Comments
 (0)