Remi Locherer(remi.loche...@relo.ch) on 2019.04.22 11:14:30 +0200: > Hi Stefan > > On Tue, Apr 09, 2019 at 04:16:32PM +0200, Stefan Sperling wrote: > > I want to announce a host-route to the address of a tun0 interface > > over OSPF. The config snippet I use for this looks like: > > > > interface tun0:217.197.85.96 { > > passive > > depend on carp0 > > } > > > > With this configuration, the tun interface is permanently marked DOWN > > and the route is not announced: > > > > Interface Address State HelloTimer Linkstate Uptime nc ac > > tun0 217.197.85.96/32 DOWN - active 00:00:00 0 0 > > > > If I omit 'passive' it works as expected: > > > > interface tun0:217.197.85.96 { > > depend on carp0 > > } > > > > Interface Address State HelloTimer Linkstate Uptime nc ac > > tun0 217.197.85.96/32 P2P 00:00:06 active 00:02:13 0 0 > > > > However, osfpd now sends useless OSPF packets, and my logs are being > > spammed with the message: > > send_packet: error sending packet on interface tun0: Permission denied > > > > 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, ok benno@ > 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"); >