[PATCH] BGP: Log value of invalid NEXT_HOP in bgp_apply_next_hop()

Simon Ruderich simon at ruderich.org
Sat Dec 11 09:22:46 CET 2021


---
Hello,

while debugging "Invalid NEXT_HOP attribute" messages in my setup
I had to recompile bird2 with additional debug output to
determine which BAD_NEXT_HOP line was triggered and with which
NEXT_HOP value. After adding this patch determining the problem
was very easy.

I also looked at the other BAD_NEXT_HOP in the file but I'm not
sure how to properly print their values.

Regards
Simon

 proto/bgp/packets.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 99b5d5b4..830a2060 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -955,7 +955,7 @@ bgp_apply_next_hop(struct bgp_parse_state *s, rta *a, ip_addr gw, ip_addr ll)
       nbr = neigh_find(&p->p, ll, p->neigh->iface, 0);
 
     if (!nbr || (nbr->scope == SCOPE_HOST))
-      WITHDRAW(BAD_NEXT_HOP);
+      WITHDRAW(BAD_NEXT_HOP " %I (direct)", gw);
 
     a->dest = RTD_UNICAST;
     a->nh.gw = nbr->addr;
@@ -965,7 +965,7 @@ bgp_apply_next_hop(struct bgp_parse_state *s, rta *a, ip_addr gw, ip_addr ll)
   else /* GW_RECURSIVE */
   {
     if (ipa_zero(gw))
-      WITHDRAW(BAD_NEXT_HOP);
+      WITHDRAW(BAD_NEXT_HOP " %I (recursive)", gw);
 
     rtable *tab = ipa_is_ip4(gw) ? c->igp_table_ip4 : c->igp_table_ip6;
     s->hostentry = rt_get_hostentry(tab, gw, ll, c->c.table);
-- 
2.34.1

-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20211211/239afe93/attachment.sig>


More information about the Bird-users mailing list