From: Marcel Röthke Date: Thu, 12 Apr 2018 12:13:07 +0000 (+0200) Subject: bgpd: fix rpki validation for ipv6 X-Git-Tag: frr-6.1-dev~195^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e42346020e0fd7c2eae144aaef8c99d651e94eb5;p=mirror%2Ffrr.git bgpd: fix rpki validation for ipv6 Signed-off-by: Marcel Röthke --- diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 82e857dbf4..db182eef98 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -5,8 +5,8 @@ * Berlin * Copyright (C) 2016-2017 Colin Sames (colin.sames@haw-hamburg.de), for HAW * Hamburg - * Copyright (C) 2017 Marcel Röthke (marcel.roethke@haw-hamburg.de), for HAW - * Hamburg + * Copyright (C) 2017-2018 Marcel Röthke (marcel.roethke@haw-hamburg.de), + * for HAW Hamburg * * This file is part of FRRouting. * @@ -185,6 +185,14 @@ static void free_tr_socket(struct cache *cache) static int rpki_validate_prefix(struct peer *peer, struct attr *attr, struct prefix *prefix); +static void ipv6_addr_to_host_byte_order(const uint32_t *src, uint32_t *dest) +{ + int i; + + for (i = 0; i < 4; i++) + dest[i] = ntohl(src[i]); +} + static route_map_result_t route_match(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -479,13 +487,11 @@ static int rpki_validate_prefix(struct peer *peer, struct attr *attr, ip_addr_prefix.u.addr4.addr = ntohl(prefix->u.prefix4.s_addr); break; -#ifdef HAVE_IPV6 case AF_INET6: ip_addr_prefix.ver = LRTR_IPV6; ipv6_addr_to_host_byte_order(prefix->u.prefix6.s6_addr32, ip_addr_prefix.u.addr6.addr); break; -#endif /* HAVE_IPV6 */ default: return 0;