[FROG] OSPF, FreeBSD and aliases

Donald Sharp donaldsharp72 at gmail.com
Tue Jul 20 14:38:24 UTC 2021


Eugene -

Can you look at this PR and see if it fixes your issue:

https://github.com/FRRouting/frr/pull/9098

thanks!

donald

On Sun, Jul 18, 2021 at 6:17 PM Eugene Grosbein <eugen at grosbein.net> wrote:

> 18.07.2021 18:30, Chriztoffer Hansen wrote:
>
> >> I'm trying to move from quagga to frr 7.5.1. I have existing working
> setup with OSPF
> >> and FreeBSD servers that have some aliases on its OSPF-enabled
> interfaces.
> >> In FreeBSD, if one needs several IP addresses in same IP subnet on one
> interfaces (for CARP etc.)
> >> then one assigns one of IPs with "real" subnet mask and others with /32
> mask:
>
> [skip]
>
> I've used "show interface" command and noted that FRR marked my aliases as
> "unnumbered"
> instead of needed "secondary".
>
> I've spent some time making me familiar with FRR code a bit, and came with
> a patch that
> teaches FRR to flag aliases as "secondary" and this solves my problem:
> OSPF neighborship
> with Quagga is established. The patch is pretty naive and straightforward
> but I'm not sure if it is completely correct and/or effective.
>
> --- zebra/interface.c.orig      2021-03-04 02:14:50 UTC
> +++ zebra/interface.c
> @@ -358,7 +358,36 @@ int if_subnet_add(struct interface *ifp, struct connec
>
>         if ((addr_list = rn->info))
>                 SET_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY);
> -       else {
> +#ifdef __FreeBSD__
> +       else if (cp.prefixlen == 32) {
> +               struct listnode *node;
> +               struct connected *pc;
> +               struct prefix *p;
> +               uint32_t mask;
> +
> +               /*
> +                * Find any non-secondary AF_INET node with non-NULL info
> +                * that covers ifc.
> +               */
> +                for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, pc)) {
> +                       if (CHECK_FLAG(pc->flags, ZEBRA_IFA_SECONDARY))
> +                               continue;
> +                       p = pc->address;
> +                       if (p->family != AF_INET)
> +                               continue;
> +                       mask = ((1 << (32-p->prefixlen))-1);
> +                       if ((p->u.prefix4.s_addr & mask) ==
> +                           (cp.u.prefix4.s_addr & mask)) {
> +                               rn =
> route_node_get(zebra_if->ipv4_subnets, p);
> +                               if ((addr_list = rn->info)) {
> +                                       SET_FLAG(ifc->flags,
> ZEBRA_IFA_SECONDARY);
> +                                       break;
> +                               }
> +                       }
> +               }
> +       }
> +#endif
> +       if(!addr_list) {
>                 UNSET_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY);
>                 rn->info = addr_list = list_new();
>                 route_lock_node(rn);
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.frrouting.org/pipermail/frog/attachments/20210720/b36f94fd/attachment.htm>


More information about the frog mailing list