On Mon, Apr 22, 2019 at 11:14:30AM +0200, Remi Locherer wrote:
> On Tue, Apr 09, 2019 at 04:16:32PM +0200, Stefan Sperling wrote:
> > I believe this is a bug. I expect to be able to announce the address
> > of a passive point-to-point interface with ospfd.
> >
>
> The problem is that ospfd only originates the LSA you need when the interface
> is in state IF_STA_POINTTOPOINT. But when the interface is passive it is in
> state IF_STA_DOWN.
>
> I think we should check the status of the link instead.
>
> The diff below does that and adds the "depend on" logic.
>
> OK?
Yes, with this diff it all works as expected. Thanks a lot!
ok stsp@
> Remi
>
>
> Index: ospfe.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospfd/ospfe.c,v
> retrieving revision 1.103
> diff -u -p -r1.103 ospfe.c
> --- ospfe.c 27 Sep 2018 12:34:06 -0000 1.103
> +++ ospfe.c 22 Apr 2019 09:08:53 -0000
> @@ -900,7 +900,8 @@ orig_rtr_lsa(struct area *area)
> if (ibuf_add(buf, &rtr_link, sizeof(rtr_link)))
> fatalx("orig_rtr_lsa: ibuf_add failed");
> }
> - if (iface->state & IF_STA_POINTTOPOINT) {
> + if ((iface->flags & IFF_UP) &&
> + LINK_STATE_IS_UP(iface->linkstate)) {
> log_debug("orig_rtr_lsa: stub net, "
> "interface %s", iface->name);
> bzero(&rtr_link, sizeof(rtr_link));
> @@ -912,7 +913,11 @@ orig_rtr_lsa(struct area *area)
> rtr_link.data = iface->mask.s_addr;
> }
> rtr_link.type = LINK_TYPE_STUB_NET;
> - rtr_link.metric = htons(iface->metric);
> + if (iface->dependon[0] != '\0' &&
> + iface->depend_ok == 0)
> + rtr_link.metric = MAX_METRIC;
> + else
> + rtr_link.metric = htons(iface->metric);
> num_links++;
> if (ibuf_add(buf, &rtr_link, sizeof(rtr_link)))
> fatalx("orig_rtr_lsa: ibuf_add failed");