BSD & non-/32 prefixes on p2p linkes
Ondrej Zajicek
santiago at crfreenet.org
Sat Sep 21 11:45:08 CEST 2013
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: 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/3c3dfa5c/attachment-0001.asc>
More information about the Bird-users
mailing list