Hello,
Around the 0.96.3 relase of quagga the listnode_add_sort() function from
the lib/linklist.c file was changed. Now, it has one additional check:
+ if ((*list->cmp) (val, n->data) == 0)
+ return;
Current rip_peer_list_cmp() function looks like this:
int
rip_peer_list_cmp (struct rip_peer *p1, struct rip_peer *p2)
{
return htonl (p1->addr.s_addr) > htonl (p2->addr.s_addr);
}
So, if first RIP packet comes from for example 192.168.0.3 then peers
with lower IPs (ex. 192.168.0.2, 192.168.0.1) will not be added. This
patch fix this, changing the rip_peer_list_cmp() function to one which
really compares p1 and p2, like other "cmp" functions:
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
With this patch "show ip rip status" works now as expected, without
missing peers.
Best regards,
Krzysztof Olêdzki
Around the 0.96.3 relase of quagga the listnode_add_sort() function from
the lib/linklist.c file was changed. Now, it has one additional check:
+ if ((*list->cmp) (val, n->data) == 0)
+ return;
Current rip_peer_list_cmp() function looks like this:
int
rip_peer_list_cmp (struct rip_peer *p1, struct rip_peer *p2)
{
return htonl (p1->addr.s_addr) > htonl (p2->addr.s_addr);
}
So, if first RIP packet comes from for example 192.168.0.3 then peers
with lower IPs (ex. 192.168.0.2, 192.168.0.1) will not be added. This
patch fix this, changing the rip_peer_list_cmp() function to one which
really compares p1 and p2, like other "cmp" functions:
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
With this patch "show ip rip status" works now as expected, without
missing peers.
Best regards,
Krzysztof Olêdzki