From: Xuelin Shi <[email protected]>

The prototype says returning cpu endian value but implementation returns
a little-endian value.

Add conversion to cpu endian.

Signed-off-by: Xuelin Shi <[email protected]>
---
 helper/ip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/helper/ip.c b/helper/ip.c
index eb73e5a..e211001 100644
--- a/helper/ip.c
+++ b/helper/ip.c
@@ -12,6 +12,7 @@
 int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str)
 {
        unsigned byte[ODPH_IPV4ADDR_LEN];
+       uint32_t ipaddr_le;
        int i;
 
        memset(byte, 0, sizeof(byte));
@@ -24,7 +25,8 @@ int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str)
                if (byte[i] > 255)
                        return -1;
 
-       *ip_addr = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3];
+       ipaddr_le = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3];
+       *ip_addr = odp_le_to_cpu_32(ipaddr_le);
 
        return 0;
 }
-- 
2.1.0.27.g96db324

Reply via email to