BSD & non-/32 prefixes on p2p linkes

Ondrej Zajicek santiago at crfreenet.org
Sat Sep 21 12:02:47 CEST 2013


On Sat, Sep 21, 2013 at 11:45:08AM +0200, Ondrej Zajicek wrote:
> 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:

That would be:

  if (masklen < BITS_PER_IP_ADDRESS)
  {
    ifa.prefix = ipa_and(ifa.ip, ipa_mkmask(masklen));

    if (masklen == (BITS_PER_IP_ADDRESS - 1))
      ifa.opposite = ipa_opposite_m1(ifa.ip);

#ifndef IPV6
    if (masklen == (BITS_PER_IP_ADDRESS - 2))
      ifa.opposite = ipa_opposite_m2(ifa.ip);
#endif
  }
  else if (masklen == BITS_PER_IP_ADDRESS)
  {
    ifa.prefix = ifa.brd;

    if (ipa_equal(ifa.ip, ifa.brd))
      ifa.flags |= IA_HOST;
    else
    {
      ifa.flags |= IA_PEER;
      ifa.opposite = ifa.brd;
    }
  }
  else // BAD px len


-- 
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/20130921/ef1de9e0/attachment-0001.asc>


More information about the Bird-users mailing list