repl_ftp_v6_addr(struct dp_packet *pkt, struct ct_addr v6_addr_rep,
                 char *ftp_data_start,
                 size_t addr_offset_from_ftp_data_start,
                 size_t addr_size, enum ct_alg_mode mode)
{
    /* This is slightly bigger than really possible. */
    enum { MAX_FTP_V6_NAT_DELTA = 45 };

    if (mode == CT_FTP_MODE_PASSIVE) {
        return 0;
    }

    /* Do conservative check for pathological MTU usage. */
    uint32_t orig_used_size = dp_packet_size(pkt);
    uint16_t allocated_size = dp_packet_get_allocated(pkt);
    if (orig_used_size + MAX_FTP_V6_NAT_DELTA > allocated_size) {
        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
        VLOG_WARN_RL(&rl, "Unsupported effective MTU %u used with FTP",
                     allocated_size);
        return 0;
    }

    const char *rc;
    char v6_addr_str[IPV6_SCAN_LEN] = {0};
    rc = inet_ntop(AF_INET6, &v6_addr_rep.ipv6_aligned, v6_addr_str,
              IPV6_SCAN_LEN - 1);
    ovs_assert(rc != NULL);

    size_t replace_addr_size = strlen(v6_addr_str);

    size_t remain_size = tcp_payload_length(pkt) -
                             addr_offset_from_ftp_data_start;

    char *pkt_addr_str = ftp_data_start + addr_offset_from_ftp_data_start;
    replace_substring(pkt_addr_str, addr_size, remain_size,
                      v6_addr_str, replace_addr_size);

    int overall_delta = (int) replace_addr_size - (int) addr_size;

    dp_packet_set_size(pkt, orig_used_size + overall_delta);
    return overall_delta;
}
repl_ftp_v6_addr(struct dp_packet *pkt, struct ct_addr v6_addr_rep,
                 char *ftp_data_start,
                 size_t addr_offset_from_ftp_data_start,
                 size_t addr_size, enum ct_alg_mode mode)
{
     
    enum { MAX_FTP_V6_NAT_DELTA = 45 };

    if (mode == CT_FTP_MODE_PASSIVE) {
        return 0;
    }

     
    uint32_t orig_used_size = dp_packet_size(pkt);
    uint16_t allocated_size = dp_packet_get_allocated(pkt);
    if (orig_used_size + MAX_FTP_V6_NAT_DELTA > allocated_size) {
        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
        VLOG_WARN_RL(&rl, "Unsupported effective MTU %u used with FTP",
                     allocated_size);
        return 0;
    }

    const char *rc;
    char v6_addr_str[IPV6_SCAN_LEN] = {0};
    rc = inet_ntop(AF_INET6, &v6_addr_rep.ipv6_aligned, v6_addr_str,
              IPV6_SCAN_LEN - 1);
    ovs_assert(rc != NULL);

    size_t replace_addr_size = strlen(v6_addr_str);

    size_t remain_size = tcp_payload_length(pkt) -
                             addr_offset_from_ftp_data_start;

    char *pkt_addr_str = ftp_data_start + addr_offset_from_ftp_data_start;
    replace_substring(pkt_addr_str, addr_size, remain_size,
                      v6_addr_str, replace_addr_size);

    int overall_delta = (int) replace_addr_size - (int) addr_size;

    dp_packet_set_size(pkt, orig_used_size + overall_delta);
    return overall_delta;
}