4#include "net/ethernet.h"
17 if (total_len < ip_hdr_len + 8)
23 uint16_t icmp_len = total_len - ip_hdr_len;
33 bool has_more_fragments = (frag_field & 0x2000);
37 uint16_t fragment_offset = (frag_field & 0x1FFF);
39 if (has_more_fragments || fragment_offset > 0) {
40 LOG2_WARN(
"ICMP",
"packet ini terfragmentasi");
45 if (icmp->
type == 8) {
53 memcopy(icmp_reply, icmp, icmp_len);
59 (
uint16_t*) (
void*) icmp_reply, icmp_len);
void handle_icmp(netdev_t *dev, struct ipv4_header *ip, uint8_t mac_dst[6])
void ipv4_send(netdev_t *dev, struct netbuff *nb, uint32_t dst_ip, uint8_t protocol, uint8_t mac_dest[6])
void free_netbuff(struct netbuff *netbuff)
void * netbuff_put(struct netbuff *nb, size_t len)
struct netbuff * create_netbuff()
char * vxInetNtoa(uint32_t ip, char *buffer)
uint16_t checksum16_adc(const uint16_t *data, size_t length)
static uint16_t vxNtohs(uint16_t netshort)
#define LOG2_WARN(mod, fmt,...)
void memcopy(void *dest, void *src, size_t size)