summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-09-10 08:47:52 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-09-10 08:47:52 +0000
commit50d612c0017c7e1a6d8a14a8cd1d1858c8852053 (patch)
treec7b18ab01f3431c6a513ee28daacfda747c41a5d /usr.sbin
parent668410ddf6aac6b23b0c0b66e226e6bb4952ddf2 (diff)
AID_VPN_IPv4 and AID_VPN_IPv6 require a labellen that is non-zero.
OK tb@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/rde_prefix.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde_prefix.c b/usr.sbin/bgpd/rde_prefix.c
index a6720b00b18..d813003870f 100644
--- a/usr.sbin/bgpd/rde_prefix.c
+++ b/usr.sbin/bgpd/rde_prefix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_prefix.c,v 1.51 2024/06/25 13:21:18 claudio Exp $ */
+/* $OpenBSD: rde_prefix.c,v 1.52 2024/09/10 08:47:51 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -225,6 +225,8 @@ pt_fill(struct bgpd_addr *prefix, int prefixlen)
pte_vpn4.prefixlen = prefixlen;
pte_vpn4.rd = prefix->rd;
pte_vpn4.labellen = prefix->labellen;
+ if (prefix->labellen == 0)
+ fatalx("pt_fill: no MPLS label in VPN addr");
memcpy(pte_vpn4.labelstack, prefix->labelstack,
prefix->labellen);
return ((struct pt_entry *)&pte_vpn4);
@@ -239,6 +241,8 @@ pt_fill(struct bgpd_addr *prefix, int prefixlen)
pte_vpn6.prefixlen = prefixlen;
pte_vpn6.rd = prefix->rd;
pte_vpn6.labellen = prefix->labellen;
+ if (prefix->labellen == 0)
+ fatalx("pt_fill: no MPLS label in VPN addr");
memcpy(pte_vpn6.labelstack, prefix->labelstack,
prefix->labellen);
return ((struct pt_entry *)&pte_vpn6);