diff options
| author | David Lamparter <equinox@diac24.net> | 2021-04-18 12:11:14 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2022-05-21 14:14:01 +0200 |
| commit | 7ca9c407ed100801de5f831b1b08b5243cdb92b0 (patch) | |
| tree | ec60b025a42ed3be336f67bb05fbbd248aa81d1e /zebra/interface.c | |
| parent | d37879b7a25fc3c0323d88c666b6a7646860a9c3 (diff) | |
zebra: clean up rtadv integration
Move a few things into places they actually belong, and reduce the
number of places we have `#ifdev HAVE_RTADV`. Just overall code
prettification.
... I had actually done this quite a while ago while doing some other
random hacking and thought it more useful to not be sitting on it on my
disk...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/interface.c')
| -rw-r--r-- | zebra/interface.c | 63 |
1 files changed, 4 insertions, 59 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index d5f2dc4c9a..7eb98faeb1 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -155,48 +155,8 @@ static int if_zebra_new_hook(struct interface *ifp) zebra_ptm_if_init(zebra_if); ifp->ptm_enable = zebra_ptm_get_enable_state(); -#if defined(HAVE_RTADV) - { - /* Set default router advertise values. */ - struct rtadvconf *rtadv; - - rtadv = &zebra_if->rtadv; - - rtadv->AdvSendAdvertisements = 0; - rtadv->MaxRtrAdvInterval = RTADV_MAX_RTR_ADV_INTERVAL; - rtadv->MinRtrAdvInterval = RTADV_MIN_RTR_ADV_INTERVAL; - rtadv->AdvIntervalTimer = 0; - rtadv->AdvManagedFlag = 0; - rtadv->AdvOtherConfigFlag = 0; - rtadv->AdvHomeAgentFlag = 0; - rtadv->AdvLinkMTU = 0; - rtadv->AdvReachableTime = 0; - rtadv->AdvRetransTimer = 0; - rtadv->AdvCurHopLimit = RTADV_DEFAULT_HOPLIMIT; - memset(&rtadv->lastadvcurhoplimit, 0, - sizeof(rtadv->lastadvcurhoplimit)); - memset(&rtadv->lastadvmanagedflag, 0, - sizeof(rtadv->lastadvmanagedflag)); - memset(&rtadv->lastadvotherconfigflag, 0, - sizeof(rtadv->lastadvotherconfigflag)); - memset(&rtadv->lastadvreachabletime, 0, - sizeof(rtadv->lastadvreachabletime)); - memset(&rtadv->lastadvretranstimer, 0, - sizeof(rtadv->lastadvretranstimer)); - rtadv->AdvDefaultLifetime = - -1; /* derive from MaxRtrAdvInterval */ - rtadv->HomeAgentPreference = 0; - rtadv->HomeAgentLifetime = - -1; /* derive from AdvDefaultLifetime */ - rtadv->AdvIntervalOption = 0; - rtadv->UseFastRexmit = true; - rtadv->DefaultPreference = RTADV_PREF_MEDIUM; - - rtadv->AdvPrefixList = list_new(); - rtadv->AdvRDNSSList = list_new(); - rtadv->AdvDNSSLList = list_new(); - } -#endif /* HAVE_RTADV */ + + rtadv_if_init(zebra_if); memset(&zebra_if->neigh_mac[0], 0, 6); @@ -271,15 +231,8 @@ static int if_zebra_delete_hook(struct interface *ifp) /* Free installed address chains tree. */ if (zebra_if->ipv4_subnets) route_table_finish(zebra_if->ipv4_subnets); -#if defined(HAVE_RTADV) - - struct rtadvconf *rtadv; - rtadv = &zebra_if->rtadv; - list_delete(&rtadv->AdvPrefixList); - list_delete(&rtadv->AdvRDNSSList); - list_delete(&rtadv->AdvDNSSLList); -#endif /* HAVE_RTADV */ + rtadv_if_fini(zebra_if); zebra_evpn_if_cleanup(zebra_if); zebra_evpn_mac_ifp_del(ifp); @@ -1078,15 +1031,7 @@ void if_up(struct interface *ifp, bool install_connected) if_nbr_ipv6ll_to_ipv4ll_neigh_add_all(ifp); -#if defined(HAVE_RTADV) - /* Enable fast tx of RA if enabled && RA interval is not in msecs */ - if (zif->rtadv.AdvSendAdvertisements - && (zif->rtadv.MaxRtrAdvInterval >= 1000) - && zif->rtadv.UseFastRexmit) { - zif->rtadv.inFastRexmit = 1; - zif->rtadv.NumFastReXmitsRemain = RTADV_NUM_FAST_REXMITS; - } -#endif + rtadv_if_up(zif); /* Install connected routes to the kernel. */ if (install_connected) |
