src/utils/utl_ip.h
inline int ipv6_to_str(ipaddr_t *ip, char * str) {
    int idx=0;
    uint16_t ipv6[8];
    for (uint8_t i=0; i<6; i++) {
        ipv6[i] = PKT_HTONS(ip->v6[i]);
    }
    uint32_t ipv4 = PKT_HTONL(ip->v4);
    ipv6[6] = ipv4 & 0xffff;
    ipv6[7] = ipv4 >> 16;

    str[idx++] = '[';
    inet_ntop(AF_INET6, (const char *)&ipv6, &str[1], INET6_ADDRSTRLEN);
    idx = strlen(str);
    str[idx++] = ']';
    str[idx] = 0;
    return(idx);
}
// Routine to create IPv6 address string
Routine to create IPv6 address string
Routine to create IPv6 address string
inline int ipv6_to_str(ipaddr_t *ip, char * str) {
    int idx=0;
    uint16_t ipv6[8];
    for (uint8_t i=0; i<6; i++) {
        ipv6[i] = PKT_HTONS(ip->v6[i]);
    }
    uint32_t ipv4 = PKT_HTONL(ip->v4);
    ipv6[6] = ipv4 & 0xffff;
    ipv6[7] = ipv4 >> 16;
    str[idx++] = '[';
    inet_ntop(AF_INET6, (const char *)&ipv6, &str[1], INET6_ADDRSTRLEN);
    idx = strlen(str);
    str[idx++] = ']';
    str[idx] = 0;
    return(idx);
}
inline int ipv6_to_str ( ipaddr_t * ip , char * str ) { int idx = 0 ; uint16_t ipv6 [ 8 ] ; for ( uint8_t i = 0 ; i < 6 ; i ++ ) { ipv6 [ i ] = PKT_HTONS ( ip -> v6 [ i ] ) ; } uint32_t ipv4 = PKT_HTONL ( ip -> v4 ) ; ipv6 [ 6 ] = ipv4 & 0xffff ; ipv6 [ 7 ] = ipv4 >> 16 ; str [ idx ++ ] = ' ' ; inet_ntop ( AF_INET6 , ( const char * ) & ipv6 , & str [ 1 ] , INET6_ADDRSTRLEN ) ; idx = strlen ( str ) ; str [ idx ++ ] = ' ' ; str [ idx ] = 0 ; return ( idx ) ; }
Routine to create IPv6 address string
Routine to create IPv6 address string