eth_setup_ip4_fragmentation(const void *l2hdr, size_t l2hdr_len,

                            void *l3hdr, size_t l3hdr_len,

                            size_t l3payload_len,

                            size_t frag_offset, bool more_frags)

{

    if (eth_get_l3_proto(l2hdr, l2hdr_len) == ETH_P_IP) {

        uint16_t orig_flags;

        struct ip_header *iphdr = (struct ip_header *) l3hdr;

        uint16_t frag_off_units = frag_offset / IP_FRAG_UNIT_SIZE;

        uint16_t new_ip_off;



        assert(frag_offset % IP_FRAG_UNIT_SIZE == 0);

        assert((frag_off_units & ~IP_OFFMASK) == 0);



        orig_flags = be16_to_cpu(iphdr->ip_off) & ~(IP_OFFMASK|IP_MF);

        new_ip_off = frag_off_units | orig_flags  | (more_frags ? IP_MF : 0);

        iphdr->ip_off = cpu_to_be16(new_ip_off);

        iphdr->ip_len = cpu_to_be16(l3payload_len + l3hdr_len);

    }

}

eth_setup_ip4_fragmentation(const void *l2hdr, size_t l2hdr_len,

                            void *l3hdr, size_t l3hdr_len,

                            size_t l3payload_len,

                            size_t frag_offset, bool more_frags)

{

    if (eth_get_l3_proto(l2hdr, l2hdr_len) == ETH_P_IP) {

        uint16_t orig_flags;

        struct ip_header *iphdr = (struct ip_header *) l3hdr;

        uint16_t frag_off_units = frag_offset / IP_FRAG_UNIT_SIZE;

        uint16_t new_ip_off;



        assert(frag_offset % IP_FRAG_UNIT_SIZE == 0);

        assert((frag_off_units & ~IP_OFFMASK) == 0);



        orig_flags = be16_to_cpu(iphdr->ip_off) & ~(IP_OFFMASK|IP_MF);

        new_ip_off = frag_off_units | orig_flags  | (more_frags ? IP_MF : 0);

        iphdr->ip_off = cpu_to_be16(new_ip_off);

        iphdr->ip_len = cpu_to_be16(l3payload_len + l3hdr_len);

    }

}

FUNC_0(const void *VAR_0, size_t VAR_1,

                            void *VAR_2, size_t VAR_3,

                            size_t VAR_4,

                            size_t VAR_5, bool VAR_6)

{

    if (eth_get_l3_proto(VAR_0, VAR_1) == ETH_P_IP) {

        uint16_t orig_flags;

        struct ip_header *VAR_7 = (struct ip_header *) VAR_2;

        uint16_t frag_off_units = VAR_5 / IP_FRAG_UNIT_SIZE;

        uint16_t new_ip_off;



        assert(VAR_5 % IP_FRAG_UNIT_SIZE == 0);

        assert((frag_off_units & ~IP_OFFMASK) == 0);



        orig_flags = be16_to_cpu(VAR_7->ip_off) & ~(IP_OFFMASK|IP_MF);

        new_ip_off = frag_off_units | orig_flags  | (VAR_6 ? IP_MF : 0);

        VAR_7->ip_off = cpu_to_be16(new_ip_off);

        VAR_7->ip_len = cpu_to_be16(VAR_4 + VAR_3);

    }

}

FUNC_0(const void *VAR_0, size_t VAR_1,
void *VAR_2, size_t VAR_3,
size_t VAR_4,
size_t VAR_5, bool VAR_6)
{ if (eth_get_l3_proto(VAR_0, VAR_1) == ETH_P_IP) { uint16_t orig_flags; struct ip_header *VAR_7 = (struct ip_header *) VAR_2; uint16_t frag_off_units = VAR_5 / IP_FRAG_UNIT_SIZE; uint16_t new_ip_off; assert(VAR_5 % IP_FRAG_UNIT_SIZE == 0); assert((frag_off_units & ~IP_OFFMASK) == 0); orig_flags = be16_to_cpu(VAR_7->ip_off) & ~(IP_OFFMASK|IP_MF); new_ip_off = frag_off_units | orig_flags  | (VAR_6 ? IP_MF : 0); VAR_7->ip_off = cpu_to_be16(new_ip_off); VAR_7->ip_len = cpu_to_be16(VAR_4 + VAR_3); } }