Some patches
Martin Mares
mj at ucw.cz
Mon Aug 25 13:16:12 CEST 2008
> Hmm
>
> #define ipa_opposite(x) _MI(_I(x) ^ 1)
>
> - this is correct for /31 ptp links (that are valid according to
> RFC 3021), but not for /30 ptp links. There should be ^ 3 ?
Yes, this is obviously wrong. Could you please try this patch?
diff -u -p -r1.6 ip.c
--- lib/ip.c 8 Jun 2000 12:37:21 -0000 1.6
+++ lib/ip.c 25 Aug 2008 11:19:02 -0000
@@ -153,13 +153,14 @@ int ipa_classify(ip_addr x) { DUMMY }
/**
* ipa_opposite - return address of point-to-point neighbor
* @x: IP address of our end of the link
+ * @pxlen: network prefix length
*
* ipa_opposite() returns an address of the opposite end of a numbered
* point-to-point link.
*
* This function is available in IPv4 version only.
*/
-ip_addr ipa_opposite(ip_addr x) { DUMMY }
+ip_addr ipa_opposite(ip_addr x, int pxlen) { DUMMY }
/**
* ipa_class_mask - guess netmask according to address class
diff -u -p -r1.17 ipv4.h
--- lib/ipv4.h 7 Jun 2000 01:18:36 -0000 1.17
+++ lib/ipv4.h 25 Aug 2008 11:19:02 -0000
@@ -53,7 +53,7 @@ typedef u32 ip_addr;
#define ipa_hton(x) x = _MI(htonl(_I(x)))
#define ipa_ntoh(x) x = _MI(ntohl(_I(x)))
#define ipa_classify(x) ipv4_classify(_I(x))
-#define ipa_opposite(x) _MI(_I(x) ^ 1)
+#define ipa_opposite(x,len) _MI(_I(x) ^ (len == 30 ? 3 : 1))
#define ipa_class_mask(x) _MI(ipv4_class_mask(_I(x)))
#define ipa_from_u32(x) _MI(x)
#define ipa_to_u32(x) _I(x)
diff -u -p -r1.39 netlink.c
--- sysdep/linux/netlink/netlink.c 5 Jun 2004 09:58:23 -0000 1.39
+++ sysdep/linux/netlink/netlink.c 25 Aug 2008 11:19:02 -0000
@@ -377,7 +377,7 @@ nl_parse_addr(struct nlmsghdr *h)
ifa.brd = ipa_or(ifa.ip, ipa_not(netmask));
#ifndef IPV6
if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS - 2)
- ifa.opposite = ipa_opposite(ifa.ip);
+ ifa.opposite = ipa_opposite(ifa.ip, i->ifa_prefixlen);
if ((ifi->flags & IF_BROADCAST) && a[IFA_BROADCAST])
{
memcpy(&xbrd, RTA_DATA(a[IFA_BROADCAST]), sizeof(xbrd));
diff -u -p -r1.16 krt-iface.c
--- sysdep/unix/krt-iface.c 31 May 2004 13:25:00 -0000 1.16
+++ sysdep/unix/krt-iface.c 25 Aug 2008 11:19:02 -0000
@@ -140,7 +140,7 @@ scan_ifs(struct ifreq *r, int cnt)
if (a.pxlen < 30)
i.flags |= IF_MULTIACCESS;
else
- a.opposite = ipa_opposite(a.ip);
+ a.opposite = ipa_opposite(a.ip, a.pxlen);
}
else
a.brd = a.opposite;
Have a nice fortnight
--
Martin `MJ' Mares <mj at ucw.cz> http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"In theory, practice and theory are the same, but in practice they are different." -- Larry McVoy
More information about the Bird-users
mailing list