diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2022-11-09 14:23:54 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2022-11-09 14:23:54 +0000 |
commit | 8a26b53181958e43d1040369152349f5003a1543 (patch) | |
tree | 3e94ed7d3efe21797acd33009a01d0d9c48bea36 /usr.sbin/bgpd | |
parent | db8481d0501226032067d65e59e40d907d464dae (diff) |
Fix nlri parsing of L3VPN prefixes in withdrawals.
L3VPN NLRI have different encoding for updates and withdraws. The withdraw
carries one dummy MPLS label that needs to be skipped. The code doing that
did adjust the lenght but did not skip the the label in the buffer and so
the parsed prefix was off by 3 bytes.
OK tb@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/util.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c index 83ca442be04..1922f058312 100644 --- a/usr.sbin/bgpd/util.c +++ b/usr.sbin/bgpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.72 2022/11/07 11:33:24 mbuhl Exp $ */ +/* $OpenBSD: util.c,v 1.73 2022/11/09 14:23:53 claudio Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -131,7 +131,9 @@ log_rd(uint64_t rd) snprintf(buf, sizeof(buf), "rd %s:%hu", inet_ntoa(addr), u16); break; default: - return ("rd ?"); + snprintf(buf, sizeof(buf), "rd #%016llx", + (unsigned long long)rd); + break; } return (buf); } @@ -596,6 +598,7 @@ nlri_get_vpn4(u_char *p, uint16_t len, struct bgpd_addr *prefix, return (-1); if (withdraw) { /* on withdraw ignore the labelstack all together */ + p += 3; plen += 3; pfxlen -= 3 * 8; break; @@ -659,6 +662,7 @@ nlri_get_vpn6(u_char *p, uint16_t len, struct bgpd_addr *prefix, return (-1); if (withdraw) { /* on withdraw ignore the labelstack all together */ + p += 3; plen += 3; pfxlen -= 3 * 8; break; |