From adbdfdf7489e1909f29e2dd02edb7d15c258ed19 Mon Sep 17 00:00:00 2001 From: Jordan Augé Date: Fri, 16 Sep 2022 13:56:34 +0200 Subject: fix(hicn-light): fix routing issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref: HICN-786 Change-Id: I541c87d2d810907489ca4f59b3d7740a18c108fb Signed-off-by: Jordan Augé --- lib/src/util/ip_address.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/src/util') diff --git a/lib/src/util/ip_address.c b/lib/src/util/ip_address.c index ba7c6475b..3624a6fca 100644 --- a/lib/src/util/ip_address.c +++ b/lib/src/util/ip_address.c @@ -164,7 +164,7 @@ hicn_ip_address_pton (const char *hicn_ip_address_str, if (pton_fd <= 0) return -1; - return 1; + return 0; } int @@ -292,7 +292,7 @@ hicn_ip_prefix_pton (const char *hicn_ip_address_str, goto ERR; free (addr); - return 1; + return 0; ERR: free (addr); return -1; @@ -409,11 +409,12 @@ hicn_ip_prefix_cmp (const hicn_ip_prefix_t *prefix1, return hicn_ip_address_cmp (&prefix1->address, &prefix2->address); } +/* Network byte order + host bit order */ + uint8_t hicn_ip_address_get_bit (const hicn_ip_address_t *address, uint8_t pos) { - u64 quad = address->v6.as_u64[pos / 64]; - return quad & (0x1 << pos % 64); + return (address->v6.as_u8[pos / 8] >> (7 - pos % 8)) & 0x1; } bool -- cgit 1.2.3-korg