Hello,
This is an old patch which fix rip_peer_list_cmp. It was previously
rejected because we thought it only fixes problem with missing peers in
"show ip rip status", see "[quagga-dev 492] PATCH: fix
rip_peer_list_cmp()". The listnode_add_sort was fixed so all peers are
back again but they are still inserted in wrong order. listnode_add_sort()
expects negative value if new element should be insterted before current
one:
void
listnode_add_sort (struct list *list, void *val)
{
(...)
if ((*list->cmp) (val, n->data) < 0)
(...)
}
Current rip_peer_list_cmp can only return +1 or 0, so all new peers are
inserted at the end of the list:
int
rip_peer_list_cmp (struct rip_peer *p1, struct rip_peer *p2)
{
return htonl (p1->addr.s_addr) < htonl (p2->addr.s_addr);
}
Attached patch fixes this:
diff -Nur quagga-0.96.4-orig/ripd/rip_peer.c quagga-0.96.4/ripd/rip_peer.c
--- quagga-0.96.4-orig/ripd/rip_peer.c 2002-12-13 21:15:30.000000000 +0100
+++ quagga-0.96.4/ripd/rip_peer.c 2003-11-19 23:25:44.000000000 +0100
@@ -200,7 +200,13 @@
int
rip_peer_list_cmp (struct rip_peer *p1, struct rip_peer *p2)
{
- return htonl (p1->addr.s_addr) > htonl (p2->addr.s_addr);
+ if (htonl (p1->addr.s_addr) > htonl (p2->addr.s_addr))
+ return 1;
+
+ if (htonl (p1->addr.s_addr) < htonl (p2->addr.s_addr))
+ return -1;
+
+ return 0;
}
void
The same fix is required for the ripng_peer_list_cmp() - please see
"[quagga-dev 493] Re: PATCH: fix rip_peer_list_cmp()". Will do it soon.
Massage to the ripd/ChangeLog file:
2004-05-13 Krzysztof Oledzki <oleq@ans.pl>
* fix rip_peer_list_cmp() so it properly compares two peers
Best regards,
Krzysztof Olêdzki
This is an old patch which fix rip_peer_list_cmp. It was previously
rejected because we thought it only fixes problem with missing peers in
"show ip rip status", see "[quagga-dev 492] PATCH: fix
rip_peer_list_cmp()". The listnode_add_sort was fixed so all peers are
back again but they are still inserted in wrong order. listnode_add_sort()
expects negative value if new element should be insterted before current
one:
void
listnode_add_sort (struct list *list, void *val)
{
(...)
if ((*list->cmp) (val, n->data) < 0)
(...)
}
Current rip_peer_list_cmp can only return +1 or 0, so all new peers are
inserted at the end of the list:
int
rip_peer_list_cmp (struct rip_peer *p1, struct rip_peer *p2)
{
return htonl (p1->addr.s_addr) < htonl (p2->addr.s_addr);
}
Attached patch fixes this:
diff -Nur quagga-0.96.4-orig/ripd/rip_peer.c quagga-0.96.4/ripd/rip_peer.c
--- quagga-0.96.4-orig/ripd/rip_peer.c 2002-12-13 21:15:30.000000000 +0100
+++ quagga-0.96.4/ripd/rip_peer.c 2003-11-19 23:25:44.000000000 +0100
@@ -200,7 +200,13 @@
int
rip_peer_list_cmp (struct rip_peer *p1, struct rip_peer *p2)
{
- return htonl (p1->addr.s_addr) > htonl (p2->addr.s_addr);
+ if (htonl (p1->addr.s_addr) > htonl (p2->addr.s_addr))
+ return 1;
+
+ if (htonl (p1->addr.s_addr) < htonl (p2->addr.s_addr))
+ return -1;
+
+ return 0;
}
void
The same fix is required for the ripng_peer_list_cmp() - please see
"[quagga-dev 493] Re: PATCH: fix rip_peer_list_cmp()". Will do it soon.
Massage to the ripd/ChangeLog file:
2004-05-13 Krzysztof Oledzki <oleq@ans.pl>
* fix rip_peer_list_cmp() so it properly compares two peers
Best regards,
Krzysztof Olêdzki