Lines Matching refs:reass
114 static void reassembly_info(char *str, struct net_ipv4_reassembly *reass) in reassembly_info() argument
116 LOG_DBG("%s id 0x%x src %s dst %s remain %d ms", str, reass->id, in reassembly_info()
117 net_sprint_ipv4_addr(&reass->src), in reassembly_info()
118 net_sprint_ipv4_addr(&reass->dst), in reassembly_info()
120 k_work_delayable_remaining_get(&reass->timer))); in reassembly_info()
126 struct net_ipv4_reassembly *reass = in reassembly_timeout() local
129 reassembly_info("Reassembly cancelled", reass); in reassembly_timeout()
132 if (reass->pkt[0] && net_pkt_ipv4_fragment_offset(reass->pkt[0]) == 0) { in reassembly_timeout()
133 net_icmpv4_send_error(reass->pkt[0], NET_ICMPV4_TIME_EXCEEDED, in reassembly_timeout()
137 reassembly_cancel(reass->id, &reass->src, &reass->dst); in reassembly_timeout()
140 static void reassemble_packet(struct net_ipv4_reassembly *reass) in reassemble_packet() argument
148 k_work_cancel_delayable(&reass->timer); in reassemble_packet()
150 NET_ASSERT(reass->pkt[0]); in reassemble_packet()
152 last = net_buf_frag_last(reass->pkt[0]->buffer); in reassemble_packet()
156 pkt = reass->pkt[i]; in reassemble_packet()
174 reassembly_cancel(reass->id, &reass->src, &reass->dst); in reassemble_packet()
183 reass->pkt[i] = NULL; in reassemble_packet()
188 pkt = reass->pkt[0]; in reassemble_packet()
189 reass->pkt[0] = NULL; in reassemble_packet()
244 static int fragments_are_ready(struct net_ipv4_reassembly *reass) in fragments_are_ready() argument
260 struct net_pkt *pkt = reass->pkt[i]; in fragments_are_ready()
295 static int shift_packets(struct net_ipv4_reassembly *reass, int pos) in shift_packets() argument
300 if (!reass->pkt[i]) { in shift_packets()
301 LOG_DBG("Moving [%d] %p (offset 0x%x) to [%d]", pos, reass->pkt[pos], in shift_packets()
302 net_pkt_ipv4_fragment_offset(reass->pkt[pos]), pos + 1); in shift_packets()
307 memmove(&reass->pkt[pos + 1], &reass->pkt[pos], in shift_packets()
311 reass->pkt[pos] = NULL; in shift_packets()
323 struct net_ipv4_reassembly *reass = NULL; in net_ipv4_handle_fragment_hdr() local
334 reass = reassembly_get(id, (struct in_addr *)hdr->src, in net_ipv4_handle_fragment_hdr()
336 if (!reass) { in net_ipv4_handle_fragment_hdr()
357 if (reass->pkt[i]) { in net_ipv4_handle_fragment_hdr()
358 if (net_pkt_ipv4_fragment_offset(reass->pkt[i]) < in net_ipv4_handle_fragment_hdr()
366 if (shift_packets(reass, i)) { in net_ipv4_handle_fragment_hdr()
373 reass->pkt[i] = pkt; in net_ipv4_handle_fragment_hdr()
383 LOG_ERR("No slots available for 0x%x", reass->id); in net_ipv4_handle_fragment_hdr()
388 ret = fragments_are_ready(reass); in net_ipv4_handle_fragment_hdr()
390 LOG_ERR("Reassembled IPv4 verify failed, dropping id %u", reass->id); in net_ipv4_handle_fragment_hdr()
394 reass->pkt[i] = NULL; in net_ipv4_handle_fragment_hdr()
400 reassembly_info("Reassembly nth pkt", reass); in net_ipv4_handle_fragment_hdr()
406 reassembly_info("Reassembly last pkt", reass); in net_ipv4_handle_fragment_hdr()
409 reassemble_packet(reass); in net_ipv4_handle_fragment_hdr()
415 if (reass) { in net_ipv4_handle_fragment_hdr()
416 if (reassembly_cancel(reass->id, &reass->src, &reass->dst)) { in net_ipv4_handle_fragment_hdr()