summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-06-22 14:48:52 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-06-22 14:48:52 +0000
commit58be14f202d50e5bf3bca72a13345d55250c96f8 (patch)
treec7efa54ce29b52e759a529fedbec328be4d13589 /usr.sbin
parent0999af8a1eda2e77631d30b3d128f9b1033942d0 (diff)
Use struct kroute_full instead of a union of struct kroute & kroute6.
struct kroute_full is address family independent and so more portable. Also struct kroute and struct kroute6 will be kroute.c internal soon. OK tb@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.h7
-rw-r--r--usr.sbin/bgpd/kroute.c8
2 files changed, 5 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index cc190a33496..ac1545b844d 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.432 2022/06/19 10:30:09 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.433 2022/06/22 14:48:51 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -769,10 +769,7 @@ struct ctl_show_interface {
struct ctl_show_nexthop {
struct bgpd_addr addr;
struct ctl_show_interface iface;
- union {
- struct kroute kr4;
- struct kroute6 kr6;
- } kr;
+ struct kroute_full kr;
uint8_t valid;
uint8_t krvalid;
};
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index 25476db58d0..70534b417eb 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.261 2022/06/22 12:28:33 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.262 2022/06/22 14:48:51 claudio Exp $ */
/*
* Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
@@ -1149,16 +1149,14 @@ kr_show_route(struct imsg *imsg)
kr = h->kroute;
snh.valid = kroute_validate(&kr->r);
snh.krvalid = 1;
- memcpy(&snh.kr.kr4, &kr->r,
- sizeof(snh.kr.kr4));
+ snh.kr = *kr_tofull(&kr->r);
ifindex = kr->r.ifindex;
break;
case AID_INET6:
kr6 = h->kroute;
snh.valid = kroute6_validate(&kr6->r);
snh.krvalid = 1;
- memcpy(&snh.kr.kr6, &kr6->r,
- sizeof(snh.kr.kr6));
+ snh.kr = *kr6_tofull(&kr6->r);
ifindex = kr6->r.ifindex;
break;
}