On Fri, Sep 20, 2013 at 09:09:32PM +0400, Alexander V. Chernikov wrote:
> Hello list!
>
> Currently bird assumes (bsd sysdep) that any prefix on p2p link is /32.
>
> For example:
>
> bird: direct1 < primary address 10.0.0.3/31 on interface gif15 added
> bird: Ignoring bogus prefix 10.0.0.3/31 received via direct1
> bird: direct1 > invalid 10.0.0.3/31 dev gif15
>
> Can we do the same for IPv4 ?

That could be done, but i wonder why ever check for IF_MULTIACCESS, is
that relevant for IPs on BSD? Does BSD support peer addresses on
multiaccess interfaces?

Do you think we could do it with the same logic as it is done in Linux:

if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS)
{
      ip_addr addr;
      memcpy(&addr, RTA_DATA(a[IFA_ADDRESS]), sizeof(addr));
      ipa_ntoh(addr);
      ifa.prefix = ifa.brd = addr;

      /* It is either a host address or a peer address */
      if (ipa_equal(ifa.ip, addr))
        ifa.flags |= IA_HOST;
      else
        {
          ifa.flags |= IA_PEER;
          ifa.opposite = addr;
        }
}
else
{
      ip_addr netmask = ipa_mkmask(ifa.pxlen);
      ifa.prefix = ipa_and(ifa.ip, netmask);
      ifa.brd = ipa_or(ifa.ip, ipa_not(netmask));
      if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS - 1)
        ifa.opposite = ipa_opposite_m1(ifa.ip);

#ifndef IPV6
      if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS - 2)
        ifa.opposite = ipa_opposite_m2(ifa.ip);

}


-- 
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santi...@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."

Attachment: signature.asc
Description: Digital signature

Reply via email to