FreeBSD bugs ;)

Ondrej Zajicek santiago at crfreenet.org
Sun Jan 22 12:33:18 CET 2012


On Thu, Jan 19, 2012 at 03:34:30PM +0400, Alexander V. Chernikov wrote:
> >> So you removed it? Or renamed?
> > I  removed  it,  so another interface took it's interface id, but bird
> > kept associating previous name (vlan's) with this id. - renaming fails
> > in principally the same way: bird keeps previous name ;)
> > 
> >> It is supposed to work (it is handled as removing and readding the interface),
> >> but probably not tested.
> > Well,  I was supposed to be awfully rich by now, but it wasn't tested,
> > hence it didn't work :>
> Attached patch seems to work on FreeBSD.
> For OpenBSD rtsock events seems to be the same (and interface renaming
> is not supported there at all).
> I don't have any NetBSD instance to test on, unfortunately
> 
> Patch is not finished: interface renaming has to be handled in
> appropriate protocols. In OSPF, for example, it is a bit tricky due to
> the fact that interface can belong to several areas

I guess that seamless renaming is not really important, so it could be
handled just by IF_CHANGE_TOO_MUCH (i.e. virtual iface down and up),
that would work for any protocol. (or, because ifaces in BIRD are
generally keyed by name, just remove the old one before creating the new
one) BTW, AFAIK Linux does not allow iface renaming unless the iface is
down.

struct_iface should not be freed when interface disappears. There are
users for that (most recently link-local sticky neighbors, but AFAIK
there are others i don't remember now). Perhaps these structures should
be reference counted, but keeping them with IF_SHUTDOWN is OK. One
thing that was a cause for a bug related to renaming is that shutdown
ifaces kept their iface index and are returned by if_find_by_index().
Simple fix for that would probably make destroying and creating ifaces
work.

RTM_IFANNOUNCE seems useful. Am i understand that correctly that any
iface changes are notified using RTM_IFINFO, just create and destroy of
ifaces are notified using RTM_IFANNOUNCE? And also that when newly
created iface is announced by RTM_IFANNOUNCE, there is almost none
information in that announcement to really create the iface in BIRD?
Perhaps it is supposed to request RTM_IFINFO about that iface by some
sysctl? Or we could at least trigger early iface scan.

Some other comments below.

> +    /* Interface is renamed. */
> +    if (strcmp(iface->name, ifam->ifan_name))
> +    {
> +      DBG("KRT: Interface %s renamed to %s\n", iface->name, ifam->ifan_name);
> +      memcpy(&f, iface, sizeof(struct iface));
> +      /* Assume both strings are IFNAMSIZ length */
> +      memcpy(f.name, ifam->ifan_name, IFNAMSIZ);
> +      if_update(&f);
> +    }

This does not work well. Because if_update would match iface by name,
this would create a new iface structure so there would be two, until
the old one would be removed during another iface scan. As a consequence,
if_what_changed() would never return IF_CHANGE_NAME.

> @@ -588,6 +642,8 @@ krt_read_msg(struct proto *p, struct ks_msg *msg, int scan)
>      case RTM_DELETE:
>        krt_read_rt(msg, (struct krt_proto *)p, scan);
>        break;
> +    case RTM_IFANNOUNCE:
> +      krt_read_ifannounce(msg);
>      case RTM_IFINFO:
>        krt_read_ifinfo(msg);
>        break;

Missing break here?

-- 
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20120122/81b3ee85/attachment-0001.asc>


More information about the Bird-users mailing list