extract_ipv4(const uint8_t ipv6[], size_t ipv6_len, const int offset)
{
    uint32_t ipv4 = 0;
    int i, pos;
    log_assert(ipv6_len == 16); (void)ipv6_len;
    log_assert(offset == 32 || offset == 40 || offset == 48 || offset == 56 ||
        offset == 64 || offset == 96);
    for(i = 0, pos = offset / 8; i < 4; i++, pos++) {
        if (pos == 8)
            pos++;
        ipv4 = ipv4 << 8;
        ipv4 |= ipv6[pos];
    }
    return ipv4;
}
extract_ipv4(const uint8_t ipv6[], size_t ipv6_len, const int offset)
{
    uint32_t ipv4 = 0;
    int i, pos;
    log_assert(ipv6_len == 16); (void)ipv6_len;
    log_assert(offset == 32 || offset == 40 || offset == 48 || offset == 56 ||
        offset == 64 || offset == 96);
    for(i = 0, pos = offset / 8; i < 4; i++, pos++) {
        if (pos == 8)
            pos++;
        ipv4 = ipv4 << 8;
        ipv4 |= ipv6[pos];
    }
    return ipv4;
}