summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2019-02-15 09:55:22 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2019-02-15 09:55:22 +0000
commit6d27258c9c10b13a685e3764c34e84dd2b9a06b8 (patch)
treedabb5e71038179423e5824168040a307e86d16a4 /usr.sbin
parent41c1f99b6ff001801937394ba4e6290172619c26 (diff)
Use the posix version of betoh64() which is spelled be64toh() this is more
portable.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/parse.y4
-rw-r--r--usr.sbin/bgpd/rde_attr.c4
-rw-r--r--usr.sbin/bgpd/rde_prefix.c10
-rw-r--r--usr.sbin/bgpd/util.c12
4 files changed, 15 insertions, 15 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 53017ea3125..36e313d9aeb 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.372 2019/02/13 22:57:08 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.373 2019/02/15 09:55:21 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1111,7 +1111,7 @@ l3vpnopts : RD STRING {
yyerror("bad encoding of rd");
YYERROR;
}
- rd = betoh64(rd) & 0xffffffffffffULL;
+ rd = be64toh(rd) & 0xffffffffffffULL;
switch (ext.c.e.type) {
case EXT_COMMUNITY_TRANS_TWO_AS:
rd |= (0ULL << 48);
diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c
index efdee7330c4..fa8086842f0 100644
--- a/usr.sbin/bgpd/rde_attr.c
+++ b/usr.sbin/bgpd/rde_attr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_attr.c,v 1.117 2019/02/15 09:51:41 claudio Exp $ */
+/* $OpenBSD: rde_attr.c,v 1.118 2019/02/15 09:55:21 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -1205,7 +1205,7 @@ community_ext_matchone(struct filter_community *c, struct rde_peer *peer,
{
u_int64_t com, mask;
- community = betoh64(community);
+ community = be64toh(community);
com = (u_int64_t)c->c.e.type << 56;
mask = 0xffULL << 56;
diff --git a/usr.sbin/bgpd/rde_prefix.c b/usr.sbin/bgpd/rde_prefix.c
index 377667ded9d..1a662d247a6 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.37 2019/02/15 09:45:17 claudio Exp $ */
+/* $OpenBSD: rde_prefix.c,v 1.38 2019/02/15 09:55:21 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -266,9 +266,9 @@ pt_prefix_cmp(const struct pt_entry *a, const struct pt_entry *b)
case AID_VPN_IPv4:
va4 = (const struct pt_entry_vpn4 *)a;
vb4 = (const struct pt_entry_vpn4 *)b;
- if (betoh64(va4->rd) > betoh64(vb4->rd))
+ if (be64toh(va4->rd) > be64toh(vb4->rd))
return (1);
- if (betoh64(va4->rd) < betoh64(vb4->rd))
+ if (be64toh(va4->rd) < be64toh(vb4->rd))
return (-1);
if (ntohl(va4->prefix4.s_addr) > ntohl(vb4->prefix4.s_addr))
return (1);
@@ -282,9 +282,9 @@ pt_prefix_cmp(const struct pt_entry *a, const struct pt_entry *b)
case AID_VPN_IPv6:
va6 = (const struct pt_entry_vpn6 *)a;
vb6 = (const struct pt_entry_vpn6 *)b;
- if (betoh64(va6->rd) > betoh64(vb6->rd))
+ if (be64toh(va6->rd) > be64toh(vb6->rd))
return (1);
- if (betoh64(va6->rd) < betoh64(vb6->rd))
+ if (be64toh(va6->rd) < be64toh(vb6->rd))
return (-1);
i = memcmp(&va6->prefix6, &vb6->prefix6,
sizeof(struct in6_addr));
diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c
index 3c24500e750..1aa665f2b99 100644
--- a/usr.sbin/bgpd/util.c
+++ b/usr.sbin/bgpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.42 2018/12/30 13:53:07 denis Exp $ */
+/* $OpenBSD: util.c,v 1.43 2019/02/15 09:55:21 claudio Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -121,7 +121,7 @@ log_rd(u_int64_t rd)
u_int32_t u32;
u_int16_t u16;
- rd = betoh64(rd);
+ rd = be64toh(rd);
switch (rd >> 48) {
case EXT_COMMUNITY_TRANS_TWO_AS:
u32 = rd & 0xffffffff;
@@ -697,9 +697,9 @@ prefix_compare(const struct bgpd_addr *a, const struct bgpd_addr *b,
case AID_VPN_IPv4:
if (prefixlen > 32)
return (-1);
- if (betoh64(a->vpn4.rd) > betoh64(b->vpn4.rd))
+ if (be64toh(a->vpn4.rd) > be64toh(b->vpn4.rd))
return (1);
- if (betoh64(a->vpn4.rd) < betoh64(b->vpn4.rd))
+ if (be64toh(a->vpn4.rd) < be64toh(b->vpn4.rd))
return (-1);
mask = htonl(prefixlen2mask(prefixlen));
aa = ntohl(a->vpn4.addr.s_addr & mask);
@@ -715,9 +715,9 @@ prefix_compare(const struct bgpd_addr *a, const struct bgpd_addr *b,
case AID_VPN_IPv6:
if (prefixlen > 128)
return (-1);
- if (betoh64(a->vpn6.rd) > betoh64(b->vpn6.rd))
+ if (be64toh(a->vpn6.rd) > be64toh(b->vpn6.rd))
return (1);
- if (betoh64(a->vpn6.rd) < betoh64(b->vpn6.rd))
+ if (be64toh(a->vpn6.rd) < be64toh(b->vpn6.rd))
return (-1);
for (i = 0; i < prefixlen / 8; i++)
if (a->vpn6.addr.s6_addr[i] != b->vpn6.addr.s6_addr[i])