diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d9416b4..6a0d23f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(log) add_subdirectory(timestamp) add_subdirectory(tuple) add_subdirectory(packet) +add_subdirectory(ip_reassemble) add_subdirectory(id_generator) add_subdirectory(dupkt_filter) add_subdirectory(eviction_filter) diff --git a/src/dupkt_filter/dupkt_filter.cpp b/src/dupkt_filter/dupkt_filter.cpp index c7e667a..364e086 100644 --- a/src/dupkt_filter/dupkt_filter.cpp +++ b/src/dupkt_filter/dupkt_filter.cpp @@ -3,7 +3,7 @@ #include "timestamp.h" #include "dablooms.h" #include "tcp_utils.h" -#include "ipv4_helpers.h" +#include "ipv4_utils.h" #include "dupkt_filter.h" struct dupkt_filter_key diff --git a/src/eviction_filter/eviction_filter.cpp b/src/eviction_filter/eviction_filter.cpp index 27fc6e0..b91faae 100644 --- a/src/eviction_filter/eviction_filter.cpp +++ b/src/eviction_filter/eviction_filter.cpp @@ -5,7 +5,7 @@ #include "timestamp.h" #include "dablooms.h" #include "udp_utils.h" -#include "ipv4_helpers.h" +#include "ipv4_utils.h" #include "ipv6_utils.h" #include "eviction_filter.h" diff --git a/src/ip_fragment/ip_fragment.cpp b/src/ip_fragment/ip_fragment.cpp index 8ee9c74..1286b84 100644 --- a/src/ip_fragment/ip_fragment.cpp +++ b/src/ip_fragment/ip_fragment.cpp @@ -5,9 +5,9 @@ * Packets in the pkts_out array should be freed by calling the packet_free() function */ -uint16_t ipv4_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, uint16_t nb_pkts_out, uint16_t mtu_size) +uint16_t ipv4_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, uint16_t n_pkts_out, uint16_t mtu_size) { - if (pkt_in == NULL || pkts_out == NULL || nb_pkts_out == 0) + if (pkt_in == NULL || pkts_out == NULL || n_pkts_out == 0) { IP_FRAGMENT_LOG_ERROR("invalid input parameters"); return 0; @@ -18,9 +18,9 @@ uint16_t ipv4_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, u return 0; } -uint16_t ipv6_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, uint16_t nb_pkts_out, uint16_t mtu_size) +uint16_t ipv6_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, uint16_t n_pkts_out, uint16_t mtu_size) { - if (pkt_in == NULL || pkts_out == NULL || nb_pkts_out == 0) + if (pkt_in == NULL || pkts_out == NULL || n_pkts_out == 0) { IP_FRAGMENT_LOG_ERROR("invalid input parameters"); return 0; diff --git a/src/ip_fragment/ip_fragment.h b/src/ip_fragment/ip_fragment.h index 227d750..fead52d 100644 --- a/src/ip_fragment/ip_fragment.h +++ b/src/ip_fragment/ip_fragment.h @@ -16,8 +16,8 @@ extern "C" * Return the number of fragmented packets, stored in the pkts_out array * Packets in the pkts_out array should be freed by calling the packet_free() function */ -uint16_t ipv4_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, uint16_t nb_pkts_out, uint16_t mtu_size); -uint16_t ipv6_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, uint16_t nb_pkts_out, uint16_t mtu_size); +uint16_t ipv4_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, uint16_t n_pkts_out, uint16_t mtu_size); +uint16_t ipv6_fragment_packet(struct packet *pkt_in, struct packet **pkts_out, uint16_t n_pkts_out, uint16_t mtu_size); #ifdef __cpluscplus } diff --git a/src/ip_reassemble/CMakeLists.txt b/src/ip_reassemble/CMakeLists.txt new file mode 100644 index 0000000..f216a1e --- /dev/null +++ b/src/ip_reassemble/CMakeLists.txt @@ -0,0 +1,9 @@ +############################################################################### +# ip_reassemble +############################################################################### + +add_library(ip_reassemble ip_reassemble.cpp) +target_include_directories(ip_reassemble PUBLIC ${CMAKE_CURRENT_LIST_DIR}) +target_link_libraries(ip_reassemble timestamp packet) + +add_subdirectory(test) \ No newline at end of file diff --git a/src/ip_reassemble/ip_reassemble.cpp b/src/ip_reassemble/ip_reassemble.cpp index 4479d7f..1fbc068 100644 --- a/src/ip_reassemble/ip_reassemble.cpp +++ b/src/ip_reassemble/ip_reassemble.cpp @@ -1,13 +1,784 @@ +#include +#include +#include +#include + +#include "packet.h" +#include "timestamp.h" +#include "crc32_hash.h" +#include "checksum.h" +#include "ipv4_utils.h" +#include "ipv6_utils.h" +#include "packet_helpers.h" #include "ip_reassemble.h" +#define IP_FRAG_HASH_FNUM 2 +#define PRIME_VALUE 0xeaad8405 + +#define IP_FRAG_TBL_POS(mgr, sig) ((mgr)->table + ((sig) & (mgr)->entry_mask)) + +#define IPV4_KEYLEN 1 +#define IPV6_KEYLEN 4 +#define IPv6_KEY_BYTES(key) (key)[0], (key)[1], (key)[2], (key)[3] + +#define IP_REASSEMBLE_DEBUG_ARG1(desc, key, ...) \ + do \ + { \ + if ((key)->src_dst_len == IPV4_KEYLEN) \ + { \ + IP_REASSEMBLE_DEBUG(desc, "key <%lu, %#x>", (key)->src_dst_addr[0], (key)->ip_id); \ + } \ + else \ + { \ + IP_REASSEMBLE_DEBUG(desc, "key <%08lu%08lu%08lu%08lu, %#x>", IPv6_KEY_BYTES((key)->src_dst_addr), (key)->ip_id); \ + } \ + } while (0) + +#define IP_REASSEMBLE_ERROR_ARG1(desc, key, ...) \ + do \ + { \ + if ((key)->src_dst_len == IPV4_KEYLEN) \ + { \ + IP_REASSEMBLE_ERROR(desc, "key <%lu, %#x>", (key)->src_dst_addr[0], (key)->ip_id); \ + } \ + else \ + { \ + IP_REASSEMBLE_ERROR(desc, "key <%08lu%08lu%08lu%08lu, %#x>", IPv6_KEY_BYTES((key)->src_dst_addr), (key)->ip_id); \ + } \ + } while (0) + +/****************************************************************************** + * Structs + ******************************************************************************/ + +enum +{ + IP_LAST_FRAG_IDX, + IP_FIRST_FRAG_IDX, + IP_MIN_FRAG_NUM, + IP_MAX_FRAG_NUM = 8, +}; + +struct ip_frag_hdr +{ + uint16_t l3_offset; + uint16_t l3_len; + uint16_t hdr_len; + uint8_t next_proto; + void *hdr_data; // need be freed +}; + +struct ip_frag_pkt +{ + uint16_t offset; + uint16_t len; + void *data; // need be freed +}; + +struct ip_flow_key +{ + uint64_t src_dst_addr[4]; // src and dst address (only first 8 bytes used for IPv4) + uint32_t src_dst_len; + uint32_t ip_id; // ipv4: identification is uint16_t; ipv6: identification is uint32_t + uint8_t proto; +}; + +struct ip_flow +{ + struct + { + struct ip_flow *tqe_next; + struct ip_flow **tqe_prev; + } lru; + struct ip_flow_key key; + struct ip_frag_hdr hdr; + uint64_t create_time; + uint32_t expected_total_size; + uint32_t received_frag_size; + uint32_t next_fill_idx; + struct ip_frag_pkt frags[IP_MAX_FRAG_NUM]; // first two entries in the frags[] array are for the last and first fragments. +}; + +struct ip_reassemble_stat +{ + uint64_t find_num; + uint64_t add_num; + uint64_t del_num; + uint64_t fail_total; + uint64_t fail_nospace; +}; + +struct ip_reassemble_manager +{ + // config + bool enable; + uint32_t timeout; + uint32_t bucket_entries; + uint32_t bucket_num; + + // runtime + uint32_t entry_used; + uint32_t entry_total; + uint32_t entry_mask; + + // stats + struct ip_reassemble_stat stat; + + // hash table + struct + { + struct ip_flow *tqh_first; + struct ip_flow **tqh_last; + } lru; + struct ip_flow *last; + struct ip_flow *table; // array of ip_frag_pkt +}; + +/****************************************************************************** + * Private API + ******************************************************************************/ + +static inline uint32_t combine32ms1b(uint32_t x) +{ + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; + + return x; +} + +static inline uint32_t align32pow2(uint32_t x) +{ + x--; + x = combine32ms1b(x); + + return x + 1; +} + +static inline int is_power_of_2(uint32_t n) +{ + return n && !(n & (n - 1)); +} + +static inline int ip_reassemble_check_config(const struct ip_reassemble_config *config) +{ + if (config == NULL) + { + IP_REASSEMBLE_DEBUG("invalid config"); + return -1; + } + + if (config->enable) + { + if (config->timeout == 0) + { + IP_REASSEMBLE_DEBUG("invalid timeout"); + return -1; + } + + if (config->bucket_entries == 0 || is_power_of_2(config->bucket_entries) == 0) + { + IP_REASSEMBLE_DEBUG("invalid bucket entries, must be power of 2"); + return -1; + } + + if (config->bucket_num == 0) + { + IP_REASSEMBLE_DEBUG("invalid bucket num"); + return -1; + } + } + + return 0; +} + +/****************************************************************************** + * struct ip_flow_key + ******************************************************************************/ + +static inline void ipv4_flow_key_hash(const struct ip_flow_key *key, uint32_t *value1, uint32_t *value2) +{ + uint32_t v = 0; + const uint32_t *p = (const uint32_t *)&key->src_dst_addr; + + v = crc32_hash_4byte(p[0], PRIME_VALUE); + v = crc32_hash_4byte(p[1], v); + v = crc32_hash_4byte(key->ip_id, v); + + *value1 = v; + *value2 = (v << 7) + (v >> 14); +} + +static inline void ipv6_flow_key_hash(const struct ip_flow_key *key, uint32_t *value1, uint32_t *value2) +{ + uint32_t v = 0; + const uint32_t *p = (const uint32_t *)&key->src_dst_addr; + + v = crc32_hash_4byte(p[0], PRIME_VALUE); + v = crc32_hash_4byte(p[1], v); + v = crc32_hash_4byte(p[2], v); + v = crc32_hash_4byte(p[3], v); + v = crc32_hash_4byte(p[4], v); + v = crc32_hash_4byte(p[5], v); + v = crc32_hash_4byte(p[6], v); + v = crc32_hash_4byte(p[7], v); + v = crc32_hash_4byte(key->ip_id, v); + + *value1 = v; + *value2 = (v << 7) + (v >> 14); +} + +static inline uint64_t ip_flow_key_cmp(const struct ip_flow_key *key1, const struct ip_flow_key *key2) +{ + if (key1->ip_id != key2->ip_id) + { + return 1; + } + + if (key1->src_dst_len != key2->src_dst_len) + { + return 1; + } + + for (uint32_t i = 0; i < key1->src_dst_len; i++) + { + if (key1->src_dst_addr[i] != key2->src_dst_addr[i]) + { + return 1; + } + } + + return 0; +} + +static inline int ip_flow_key_is_empty(const struct ip_flow_key *key) +{ + return (key->src_dst_len == 0); +} + +static inline void ip_flow_key_zero(struct ip_flow_key *key) +{ + key->src_dst_addr[0] = 0; + key->src_dst_addr[1] = 0; + key->src_dst_addr[2] = 0; + key->src_dst_addr[3] = 0; + + key->src_dst_len = 0; + key->ip_id = 0; +} + +/****************************************************************************** + * struct ip_frag_hdr + ******************************************************************************/ + +static inline void *memdup(const void *src, size_t len) +{ + if (src == NULL || len == 0) + { + return NULL; + } + + void *dst = malloc(len); + if (dst == NULL) + { + return NULL; + } + return memcpy(dst, src, len); +} + +static inline void ip_frag_hdr_init(struct ip_frag_hdr *hdr, const struct packet *pkt) +{ + struct layer_record *layer = pkt->frag_layer; + + if (layer->type == LAYER_TYPE_IPV6) + { + struct ip6_frag *frag_ext = ipv6_hdr_get_frag_ext((const struct ip6_hdr *)layer->hdr_ptr); + hdr->next_proto = frag_ext->ip6f_nxt; + } + else + { + hdr->next_proto = ipv4_hdr_get_proto((const struct ip *)layer->hdr_ptr); + } + + hdr->l3_offset = layer->hdr_offset; + hdr->l3_len = layer->hdr_len; + + hdr->hdr_len = layer->hdr_offset + layer->hdr_len; + hdr->hdr_data = memdup(pkt->data_ptr, hdr->hdr_len); +} + +static inline void ip_frag_hdr_free(struct ip_frag_hdr *hdr) +{ + hdr->next_proto = 0; + + hdr->l3_offset = 0; + hdr->l3_len = 0; + + hdr->hdr_len = 0; + if (hdr->hdr_data != NULL) + { + free(hdr->hdr_data); + hdr->hdr_data = NULL; + } +} + +/****************************************************************************** + * struct ip_flow + ******************************************************************************/ + +static inline void ip_flow_init(struct ip_flow *flow, const struct ip_flow_key *key) +{ + static const struct ip_frag_pkt zero_frag = { + .offset = 0, + .len = 0, + .data = NULL, + }; + + flow->lru.tqe_next = NULL; + flow->lru.tqe_prev = NULL; + flow->key = *key; + flow->create_time = timestamp_get_msec(); + flow->expected_total_size = UINT32_MAX; + flow->received_frag_size = 0; + flow->next_fill_idx = IP_MIN_FRAG_NUM; + flow->frags[IP_LAST_FRAG_IDX] = zero_frag; + flow->frags[IP_FIRST_FRAG_IDX] = zero_frag; +} + +static inline void ip_flow_free(struct ip_flow *flow) +{ + for (uint32_t i = 0; i < IP_MAX_FRAG_NUM; i++) + { + struct ip_frag_pkt *frag = &flow->frags[i]; + frag->offset = 0; + frag->len = 0; + if (frag->data != NULL) + { + free(frag->data); + frag->data = NULL; + } + } + ip_flow_key_zero(&flow->key); + ip_frag_hdr_free(&flow->hdr); +} + +static inline int ip_flow_is_ready(struct ip_flow *flow) +{ + return (flow->received_frag_size == flow->expected_total_size && flow->frags[IP_FIRST_FRAG_IDX].data != NULL); +} + +// return 0 : success +// return -1 : failed +static inline int ip_flow_update(struct ip_flow *flow, const struct packet *pkt, + char *data, uint16_t len, uint16_t offset, bool more_frags) +{ + uint32_t idx; + + if (offset == 0) + { + if (flow->frags[IP_FIRST_FRAG_IDX].data != NULL) + { + IP_REASSEMBLE_ERROR_ARG1("duplicate first fragment encountered: ", &flow->key); + return -1; + } + idx = IP_FIRST_FRAG_IDX; + ip_frag_hdr_init(&flow->hdr, pkt); + } + else if (more_frags == 0) + { + if (flow->frags[IP_LAST_FRAG_IDX].data != NULL) + { + IP_REASSEMBLE_ERROR_ARG1("duplicate last fragment encountered: ", &flow->key); + return -1; + } + idx = IP_LAST_FRAG_IDX; + flow->expected_total_size = offset + len; + } + else + { + if (flow->next_fill_idx >= IP_MAX_FRAG_NUM) + { + IP_REASSEMBLE_ERROR_ARG1("max number of fragment exceeded: ", &flow->key); + return -1; + } + idx = flow->next_fill_idx; + flow->next_fill_idx++; + } + + flow->received_frag_size += len; + flow->frags[idx].data = memdup(data, len); + flow->frags[idx].offset = offset; + flow->frags[idx].len = len; + + return 0; +} + +/****************************************************************************** + * ip flow table + ******************************************************************************/ + +static inline void ip_flow_table_add(struct ip_reassemble_manager *mgr, struct ip_flow *flow) +{ + TAILQ_INSERT_TAIL(&mgr->lru, flow, lru); + mgr->entry_used++; + mgr->stat.add_num++; +} + +static inline void ip_flow_table_del(struct ip_reassemble_manager *mgr, struct ip_flow *flow) +{ + TAILQ_REMOVE(&mgr->lru, flow, lru); + mgr->entry_used--; + mgr->stat.del_num++; +} + +static inline void ip_flow_table_reuse(struct ip_reassemble_manager *mgr, struct ip_flow *flow) +{ + ip_flow_table_del(mgr, flow); + ip_flow_table_add(mgr, flow); +} + +/* + * if return NULL, then *free and *expired are valid + * free : the first empty entry in the bucket + * expired: the first timed-out entry in the bucket + */ +static struct ip_flow *ip_flow_table_find(struct ip_reassemble_manager *mgr, const struct ip_flow_key *key, struct ip_flow **free, struct ip_flow **expired) +{ + mgr->stat.find_num++; + + if (mgr->last != NULL && ip_flow_key_cmp(key, &mgr->last->key) == 0) + { + return mgr->last; + } + + uint32_t sig1 = 0; + uint32_t sig2 = 0; + uint64_t timeout = mgr->timeout; + uint32_t assoc = mgr->bucket_entries; + uint64_t tms = timestamp_get_msec(); + + if (key->src_dst_len == IPV4_KEYLEN) + { + ipv4_flow_key_hash(key, &sig1, &sig2); + } + else + { + ipv6_flow_key_hash(key, &sig1, &sig2); + } + + // get the bucket by hash + struct ip_flow *p1 = IP_FRAG_TBL_POS(mgr, sig1); + struct ip_flow *p2 = IP_FRAG_TBL_POS(mgr, sig2); + + // search in the bucket + struct ip_flow *old = NULL; + struct ip_flow *empty = NULL; + for (uint32_t i = 0; i != assoc; i++) + { + if (ip_flow_key_cmp(key, &p1[i].key) == 0) + { + *free = NULL; + *expired = NULL; + return p1 + i; + } + else if (ip_flow_key_is_empty(&p1[i].key)) + { + empty = (empty == NULL) ? (p1 + i) : empty; + } + else if (timeout + p1[i].create_time < tms) + { + old = (old == NULL) ? (p1 + i) : old; + } + + if (ip_flow_key_cmp(key, &p2[i].key) == 0) + { + *free = NULL; + *expired = NULL; + return p2 + i; + } + else if (ip_flow_key_is_empty(&p2[i].key)) + { + empty = (empty == NULL) ? (p2 + i) : empty; + } + else if (timeout + p2[i].create_time < tms) + { + old = (old == NULL) ? (p2 + i) : old; + } + } + + *free = empty; + *expired = old; + return NULL; +} + +static struct ip_flow *ip_flow_table_update(struct ip_reassemble_manager *mgr, const struct ip_flow_key *key) +{ + struct ip_flow *free = NULL; + struct ip_flow *expired = NULL; + struct ip_flow *flow = NULL; + uint64_t tms = timestamp_get_msec(); + + flow = ip_flow_table_find(mgr, key, &free, &expired); + if (flow == NULL) + { + if (expired) + { + IP_REASSEMBLE_DEBUG_ARG1("ip flow new (use expired iterm): ", key); + ip_flow_free(expired); + ip_flow_init(expired, key); + ip_flow_table_reuse(mgr, expired); + + mgr->last = expired; + return expired; + } + + if (free) + { + IP_REASSEMBLE_DEBUG_ARG1("ip flow new (use free iterm): ", key); + ip_flow_init(free, key); + ip_flow_table_add(mgr, free); + + mgr->last = free; + return free; + } + + // no space + IP_REASSEMBLE_DEBUG_ARG1("bucket full discarding new fragmented packets: ", key); + mgr->stat.fail_nospace++; + return NULL; + } + else + { + // expired + if (mgr->timeout + flow->create_time < tms) + { + IP_REASSEMBLE_DEBUG_ARG1("ip flow find, but expired: ", key); + ip_flow_free(flow); + ip_flow_init(flow, key); + ip_flow_table_reuse(mgr, flow); + + mgr->last = flow; + return flow; + } + // not expired + else + { + IP_REASSEMBLE_DEBUG_ARG1("ip flow find, not expired: ", key); + mgr->last = flow; + return flow; + } + } +} + +void ip_flow_table_expire(struct ip_reassemble_manager *mgr) +{ + struct ip_flow *flow = NULL; + uint64_t curr_ts = timestamp_get_msec(); + uint64_t timeout = mgr->timeout; + + TAILQ_FOREACH(flow, &mgr->lru, lru) + if (timeout + flow->create_time < curr_ts) + { + IP_REASSEMBLE_DEBUG_ARG1("time expires discarding old fragmented packets: ", &flow->key); + ip_flow_free(flow); + ip_flow_table_del(mgr, flow); + } +} + +/****************************************************************************** + * frag reassemble + ******************************************************************************/ + +static struct packet *ip_frag_reassemble(struct ip_flow *flow) +{ + struct ip_frag_pkt *first = &flow->frags[IP_FIRST_FRAG_IDX]; + struct ip_frag_pkt *last = &flow->frags[IP_LAST_FRAG_IDX]; + struct ip_frag_pkt *temp = NULL; + + // calculate the length of the reassembled packet + uint32_t buff_len = flow->expected_total_size + flow->hdr.hdr_len; + char *buff = (char *)calloc(1, buff_len + sizeof(struct packet)); + if (buff == NULL) + { + IP_REASSEMBLE_ERROR("unable to allocate memory"); + return NULL; + } + + char *ptr = buff + sizeof(struct packet); + char *end = ptr + buff_len; + + // copy last frag + if (last->len > end - ptr) + { + IP_REASSEMBLE_ERROR_ARG1("last packet length is greater than the expected reassembled length: ", &flow->key); + free(buff); + return NULL; + } + end -= last->len; + memcpy(end, last->data, last->len); + + uint32_t loop = 0; + uint16_t last_offset = last->offset; + while (first->len != last_offset) + { + /* + * https://datatracker.ietf.org/doc/html/rfc791 + * + * In the case that two or more fragments contain the same data + * either identically or through a partial overlap, this procedure + * will use the more recently arrived copy in the data buffer and + * datagram delivered. + */ + + for (uint32_t i = flow->next_fill_idx - 1; i >= IP_MIN_FRAG_NUM; i--) + { + if (i == IP_FIRST_FRAG_IDX || i == IP_LAST_FRAG_IDX) + { + continue; + } + + temp = &flow->frags[i]; + if (temp->offset + temp->len == last_offset) + { + if (temp->len > end - ptr) + { + IP_REASSEMBLE_ERROR_ARG1("middle fragment packet length doesn't match last fragment packet offset: ", &flow->key); + free(buff); + return NULL; + } + + end -= temp->len; + memcpy(end, temp->data, temp->len); + last_offset = temp->offset; + break; + } + } + + if (loop > flow->next_fill_idx) + { + IP_REASSEMBLE_ERROR_ARG1("holes appear during frag reassemble: ", &flow->key); + free(buff); + return NULL; + } + + loop++; + } + + // copy fist fragment data + if (first->len > end - ptr) + { + IP_REASSEMBLE_ERROR_ARG1("last packet length is greater than the expected reassembled length: ", &flow->key); + free(buff); + return NULL; + } + end -= first->len; + memcpy(end, first->data, first->len); + + // copy frag hdr + if (flow->hdr.hdr_len > end - ptr) + { + IP_REASSEMBLE_ERROR_ARG1("hdr length is greater than the expected reassembled length: ", &flow->key); + free(buff); + return NULL; + } + end -= flow->hdr.hdr_len; + memcpy(end, flow->hdr.hdr_data, flow->hdr.hdr_len); + assert(ptr == end); + + if (flow->key.src_dst_len == IPV4_KEYLEN) + { + // update ip total length & ip checksum + struct ip *hdr = (struct ip *)(ptr + flow->hdr.l3_offset); + ipv4_hdr_set_total_len(hdr, buff_len - flow->hdr.l3_offset); // update total length + ipv4_hdr_set_mf_flag(hdr, false); // update more fragment flag + ipv4_hdr_set_frag_offset(hdr, 0); // update fragment offset + hdr->ip_sum = 0; // update checksum + hdr->ip_sum = checksum((char *)hdr, flow->hdr.l3_len); + } + else + { + // update ipv6 payload length & next header + struct ip6_hdr *hdr = (struct ip6_hdr *)(ptr + flow->hdr.l3_offset); + ipv6_hdr_set_payload_len(hdr, flow->expected_total_size); // update payload length + ipv6_hdr_set_next_header(hdr, flow->hdr.next_proto); // update next header + } + + // create a new packet + struct packet *new_pkt = (struct packet *)buff; + packet_parse(new_pkt, buff + sizeof(struct packet), buff_len); + + return new_pkt; +} + +/****************************************************************************** + * Public API + ******************************************************************************/ + struct ip_reassemble_manager *ip_reassemble_manager_create(const struct ip_reassemble_config *config) { - // TODO + if (ip_reassemble_check_config(config) != 0) + { + return NULL; + } + + struct ip_reassemble_manager *mgr = (struct ip_reassemble_manager *)calloc(1, sizeof(struct ip_reassemble_manager)); + if (mgr == NULL) + { + IP_REASSEMBLE_ERROR("unable to allocate memory"); + return NULL; + } + mgr->enable = config->enable; + mgr->timeout = config->timeout; + mgr->bucket_entries = config->bucket_entries; + mgr->bucket_num = config->bucket_num; + + if (!mgr->enable) + { + return mgr; + } + + uint64_t entry_total = align32pow2(mgr->bucket_num) * mgr->bucket_entries * IP_FRAG_HASH_FNUM; + if (entry_total > UINT32_MAX) + { + IP_REASSEMBLE_ERROR("bucket_num * bucket_entries is too large"); + free(mgr); + return NULL; + } + + mgr->entry_total = (uint32_t)entry_total; + mgr->entry_mask = (mgr->entry_total - 1) & ~(mgr->bucket_entries - 1); + mgr->table = (struct ip_flow *)calloc(mgr->entry_total, sizeof(struct ip_flow)); + if (mgr->table == NULL) + { + IP_REASSEMBLE_ERROR("unable to allocate memory"); + free(mgr); + return NULL; + } + + TAILQ_INIT(&(mgr->lru)); + + return mgr; } void ip_reassemble_manager_destory(struct ip_reassemble_manager *mgr) { - // TODO + if (mgr) + { + if (mgr->table) + { + for (uint32_t i = 0; i < mgr->entry_total; i++) + { + ip_flow_free(mgr->table + i); + } + + free(mgr->table); + mgr->table = NULL; + } + free(mgr); + mgr = NULL; + } } void ip_reassemble_manager_stat(struct ip_reassemble_manager *mgr) @@ -20,12 +791,185 @@ void ip_reassemble_manager_stat(struct ip_reassemble_manager *mgr) * The returned packet should be freed by calling the packet_free() function */ +struct packet *ip_reassemble_packet(struct ip_reassemble_manager *mgr, const struct packet *pkt) +{ + struct packet *pkt1; + struct packet *pkt2; + + if (!mgr->enable) + { + return NULL; + } + + const struct layer_record *layer = pkt->frag_layer; + if (layer == NULL) + { + return NULL; + } + + if (layer->type == LAYER_TYPE_IPV4) + { + pkt1 = ipv4_reassemble_packet(mgr, pkt); + if (pkt1 && pkt1->frag_layer) + { + pkt2 = ip_reassemble_packet(mgr, pkt); + packet_free(pkt1); + return pkt2; + } + + return pkt1; + } + else if (layer->type == LAYER_TYPE_IPV6) + { + pkt1 = ipv6_reassemble_packet(mgr, pkt); + if (pkt1 && pkt1->frag_layer) + { + pkt2 = ip_reassemble_packet(mgr, pkt); + packet_free(pkt1); + return pkt2; + } + + return pkt1; + } + else + { + return NULL; + } +} + struct packet *ipv4_reassemble_packet(struct ip_reassemble_manager *mgr, const struct packet *pkt) { - // TODO + struct layer_record *layer = pkt->frag_layer; + struct ip *hdr = (struct ip *)layer->hdr_ptr; + char *data = (char *)layer->pld_ptr; + uint16_t len = ipv4_hdr_get_total_len(hdr) - ipv4_hdr_get_hdr_len(hdr); + if (len > layer->pld_len) + { + IP_REASSEMBLE_ERROR("unexpected header length on fragmented packet, ip_id: %lu", ipv4_hdr_get_ipid(hdr)); + return NULL; + } + + struct ip_flow_key key = {0}; + uint64_t src_addr = hdr->ip_src.s_addr; + uint64_t dst_addr = hdr->ip_dst.s_addr; + key.src_dst_addr[0] = src_addr << 32 | dst_addr; + key.src_dst_len = IPV4_KEYLEN; + key.ip_id = ipv4_hdr_get_ipid(hdr); + key.proto = ipv4_hdr_get_proto(hdr); + struct ip_flow *flow = ip_flow_table_update(mgr, &key); + if (flow == NULL) + { + return NULL; + } + + bool more_frags = ipv4_hdr_get_mf_flag(hdr); + uint16_t offset = ipv4_hdr_get_frag_offset(hdr); + if (ip_flow_update(flow, pkt, data, len, offset, more_frags) != 0) + { + ip_flow_free(flow); + ip_flow_table_del(mgr, flow); + return NULL; + } + + if (!ip_flow_is_ready(flow)) + { + return NULL; + } + + struct packet *new_pkt = ip_frag_reassemble(flow); + ip_flow_free(flow); + ip_flow_table_del(mgr, flow); + + return new_pkt; } +/* + * https://datatracker.ietf.org/doc/html/rfc8200#section-4.5 + * + * Note: unlike IPv4, fragmentation in IPv6 is performed only by source nodes, + * not by routers along a packet's delivery path + */ + +/* + * original packet: + * +-----------------+-----------------+--------+--------+-//-+--------+ + * | Per-Fragment |Ext & Upper-Layer| first | second | | last | + * | Headers | Headers |fragment|fragment|....|fragment| + * +-----------------+-----------------+--------+--------+-//-+--------+ + * + * fragment packets: + * +-----------------+--------+-------------------+----------+ + * | Per-Fragment |Fragment| Ext & Upper-Layer | first | + * | Headers | Header | Headers | fragment | + * +-----------------+--------+-------------------+----------+ + * + * +-----------------+--------+----------+ + * | Per-Fragment |Fragment| second | + * | Headers | Header | fragment | + * +-----------------+--------+----------+ + * o + * o + * o + * +-----------------+--------+----------+ + * | Per-Fragment |Fragment| last | + * | Headers | Header | fragment | + * +-----------------+--------+----------+ + * + * reassembled packet: + * +-----------------+-----------------+--------+--------+-//-+--------+ + * | Per-Fragment |Ext & Upper-Layer| first | second | | last | + * | Headers | Headers |fragment|fragment|....|fragment| + * +-----------------+-----------------+--------+--------+-//-+--------+ + */ + struct packet *ipv6_reassemble_packet(struct ip_reassemble_manager *mgr, const struct packet *pkt) { - // TODO -} \ No newline at end of file + struct layer_record *layer = pkt->frag_layer; + const struct ip6_hdr *hdr = (const struct ip6_hdr *)layer->hdr_ptr; + struct ip6_frag *frag_ext = ipv6_hdr_get_frag_ext(hdr); + if (frag_ext == NULL) + { + return NULL; + } + struct ip_flow_key key = {0}; + memcpy(&key.src_dst_addr[0], hdr->ip6_src.s6_addr, 16); + memcpy(&key.src_dst_addr[2], hdr->ip6_dst.s6_addr, 16); + key.src_dst_len = IPV6_KEYLEN; + key.ip_id = frag_ext->ip6f_ident; + key.proto = 0; // only first fragment has the upper layer protocol + + struct ip_flow *flow = ip_flow_table_update(mgr, &key); + if (flow == NULL) + { + return NULL; + } + + char *data = (char *)layer->hdr_ptr + sizeof(struct ip6_hdr) + sizeof(struct ip6_frag); + uint16_t len = ipv6_hdr_get_payload_len(hdr) - sizeof(struct ip6_frag); + + if (data + len > pkt->data_ptr + pkt->data_len) + { + IP_REASSEMBLE_ERROR("unexpected header length on fragmented packet, frag_id: %lu", frag_ext->ip6f_ident); + return NULL; + } + + bool more_frags = (frag_ext->ip6f_offlg & IP6F_MORE_FRAG); + uint16_t offset = ntohs(frag_ext->ip6f_offlg & IP6F_OFF_MASK); + if (ip_flow_update(flow, pkt, data, len, offset, more_frags) != 0) + { + ip_flow_free(flow); + ip_flow_table_del(mgr, flow); + return NULL; + } + + if (!ip_flow_is_ready(flow)) + { + return NULL; + } + + struct packet *new_pkt = ip_frag_reassemble(flow); + ip_flow_free(flow); + ip_flow_table_del(mgr, flow); + + return new_pkt; +} diff --git a/src/ip_reassemble/ip_reassemble.h b/src/ip_reassemble/ip_reassemble.h index 911e8bc..5147e57 100644 --- a/src/ip_reassemble/ip_reassemble.h +++ b/src/ip_reassemble/ip_reassemble.h @@ -14,10 +14,9 @@ extern "C" struct ip_reassemble_config { - bool enable_reassemble; + bool enable; - uint32_t max_cycles; - uint32_t max_entries; + uint32_t timeout; uint32_t bucket_entries; uint32_t bucket_num; }; @@ -30,6 +29,7 @@ void ip_reassemble_manager_stat(struct ip_reassemble_manager *mgr); * Returns the reassembled packet, or NULL if the packet is not reassembled * The returned packet should be freed by calling the packet_free() function */ +struct packet *ip_reassemble_packet(struct ip_reassemble_manager *mgr, const struct packet *pkt); struct packet *ipv4_reassemble_packet(struct ip_reassemble_manager *mgr, const struct packet *pkt); struct packet *ipv6_reassemble_packet(struct ip_reassemble_manager *mgr, const struct packet *pkt); diff --git a/src/ip_reassemble/test/CMakeLists.txt b/src/ip_reassemble/test/CMakeLists.txt new file mode 100644 index 0000000..4465f60 --- /dev/null +++ b/src/ip_reassemble/test/CMakeLists.txt @@ -0,0 +1,13 @@ +############################################################################### +# gtest +############################################################################### + +add_executable(gtest_ipv4_reassemble gtest_ipv4_reassemble.cpp) +target_link_libraries(gtest_ipv4_reassemble ip_reassemble gtest) + +add_executable(gtest_ipv6_reassemble gtest_ipv6_reassemble.cpp) +target_link_libraries(gtest_ipv6_reassemble ip_reassemble gtest) + +include(GoogleTest) +gtest_discover_tests(gtest_ipv4_reassemble) +gtest_discover_tests(gtest_ipv6_reassemble) \ No newline at end of file diff --git a/src/ip_reassemble/test/gtest_ipv4_reassemble.cpp b/src/ip_reassemble/test/gtest_ipv4_reassemble.cpp new file mode 100644 index 0000000..8ce9809 --- /dev/null +++ b/src/ip_reassemble/test/gtest_ipv4_reassemble.cpp @@ -0,0 +1,300 @@ +#include + +#include "timestamp.h" +#include "tcp_utils.h" +#include "ipv4_utils.h" +#include "packet_helpers.h" +#include "ip_reassemble.h" + +struct ip_reassemble_config config = { + .enable = true, + .timeout = 1000, + .bucket_entries = 16, + .bucket_num = 8, +}; + +/* + * Frame 4: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) + * Ethernet II, Src: Fortinet_cc:87:22 (e8:1c:ba:cc:87:22), Dst: EvocInte_2f:35:b8 (00:22:46:2f:35:b8) + * Destination: EvocInte_2f:35:b8 (00:22:46:2f:35:b8) + * Address: EvocInte_2f:35:b8 (00:22:46:2f:35:b8) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Source: Fortinet_cc:87:22 (e8:1c:ba:cc:87:22) + * Address: Fortinet_cc:87:22 (e8:1c:ba:cc:87:22) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Type: IPv4 (0x0800) + * Padding: 0000 + * Internet Protocol Version 4, Src: 192.168.36.103, Dst: 192.168.40.137 + * 0100 .... = Version: 4 + * .... 0101 = Header Length: 20 bytes (5) + * Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) + * 0000 00.. = Differentiated Services Codepoint: Default (0) + * .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) + * Total Length: 44 + * Identification: 0xffff (65535) + * 001. .... = Flags: 0x1, More fragments + * 0... .... = Reserved bit: Not set + * .0.. .... = Don't fragment: Not set + * ..1. .... = More fragments: Set + * ...0 0000 0000 0000 = Fragment Offset: 0 + * Time to Live: 127 + * Protocol: TCP (6) + * Header Checksum: 0x4d8b [correct] + * [Header checksum status: Good] + * [Calculated Checksum: 0x4d8b] + * Source Address: 192.168.36.103 + * Destination Address: 192.168.40.137 + * [Reassembled IPv4 in frame: 5] + * Data (24 bytes) + * Data: f4a5270f9107248703d518e75018ff005e9200003132330a + * [Length: 24] + */ + +unsigned char frag1[] = { + /* ETH */ + 0x00, 0x22, 0x46, 0x2f, 0x35, 0xb8, 0xe8, 0x1c, 0xba, 0xcc, 0x87, 0x22, 0x08, 0x00, + /* IP */ + 0x45, 0x00, // version & hdr len & tos + 0x00, 0x2c, // total length + 0xff, 0xff, // ip id + 0x20, 0x00, // flags & frag offset + 0x7f, 0x06, // ttl & protocol + 0x4d, 0x8b, // checksum + 0xc0, 0xa8, 0x24, 0x67, // src addr + 0xc0, 0xa8, 0x28, 0x89, // dst addr + /* TCP */ + 0xf4, 0xa5, // src port + 0x27, 0x0f, // dst port + 0x91, 0x07, 0x24, 0x87, // seq + 0x03, 0xd5, 0x18, 0xe7, // ack + 0x50, 0x18, // data offset & flags + 0xff, 0x00, // windows + 0x5e, 0x92, // checksum + 0x00, 0x00, // urgent pointer + /* DATA */ + 0x31, 0x32, 0x33, 0x0a, + /* Padding */ + 0x00, 0x00}; + +/* + * Frame 5: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) + * Ethernet II, Src: Fortinet_cc:87:22 (e8:1c:ba:cc:87:22), Dst: EvocInte_2f:35:b8 (00:22:46:2f:35:b8) + * Destination: EvocInte_2f:35:b8 (00:22:46:2f:35:b8) + * Address: EvocInte_2f:35:b8 (00:22:46:2f:35:b8) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Source: Fortinet_cc:87:22 (e8:1c:ba:cc:87:22) + * Address: Fortinet_cc:87:22 (e8:1c:ba:cc:87:22) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Type: IPv4 (0x0800) + * Padding: 0000 + * Internet Protocol Version 4, Src: 192.168.36.103, Dst: 192.168.40.137 + * 0100 .... = Version: 4 + * .... 0101 = Header Length: 20 bytes (5) + * Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) + * 0000 00.. = Differentiated Services Codepoint: Default (0) + * .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) + * Total Length: 44 + * Identification: 0xffff (65535) + * 000. .... = Flags: 0x0 + * 0... .... = Reserved bit: Not set + * .0.. .... = Don't fragment: Not set + * ..0. .... = More fragments: Not set + * ...0 0000 0000 0011 = Fragment Offset: 24 + * Time to Live: 127 + * Protocol: TCP (6) + * Header Checksum: 0x6d88 [correct] + * [Header checksum status: Good] + * [Calculated Checksum: 0x6d88] + * Source Address: 192.168.36.103 + * Destination Address: 192.168.40.137 + * [2 IPv4 Fragments (48 bytes): #4(24), #5(24)] + * [Frame: 4, payload: 0-23 (24 bytes)] + * [Frame: 5, payload: 24-47 (24 bytes)] + * [Fragment count: 2] + * [Reassembled IPv4 length: 48] + * [Reassembled IPv4 data: f4a5270f9107248703d518e75018ff005e9200003132330af4a5270f9107248b03d518e7…] + * Transmission Control Protocol, Src Port: 62629, Dst Port: 9999, Seq: 1, Ack: 1, Len: 28 + * Source Port: 62629 + * Destination Port: 9999 + * [Stream index: 0] + * [Conversation completeness: Complete, WITH_DATA (31)] + * [TCP Segment Len: 28] + * Sequence Number: 1 (relative sequence number) + * Sequence Number (raw): 2433164423 + * [Next Sequence Number: 29 (relative sequence number)] + * Acknowledgment Number: 1 (relative ack number) + * Acknowledgment number (raw): 64297191 + * 0101 .... = Header Length: 20 bytes (5) + * Flags: 0x018 (PSH, ACK) + * 000. .... .... = Reserved: Not set + * ...0 .... .... = Accurate ECN: Not set + * .... 0... .... = Congestion Window Reduced: Not set + * .... .0.. .... = ECN-Echo: Not set + * .... ..0. .... = Urgent: Not set + * .... ...1 .... = Acknowledgment: Set + * .... .... 1... = Push: Set + * .... .... .0.. = Reset: Not set + * .... .... ..0. = Syn: Not set + * .... .... ...0 = Fin: Not set + * [TCP Flags: ·······AP···] + * Window: 65280 + * [Calculated window size: 65280] + * [Window size scaling factor: -2 (no window scaling used)] + * Checksum: 0x5e92 [correct] + * [Checksum Status: Good] + * [Calculated Checksum: 0x5e92] + * Urgent Pointer: 0 + * [Timestamps] + * [Time since first frame in this TCP stream: 6.525912000 seconds] + * [Time since previous frame in this TCP stream: 6.525083000 seconds] + * [SEQ/ACK analysis] + * [iRTT: 0.000829000 seconds] + * [Bytes in flight: 28] + * [Bytes sent since last PSH flag: 28] + * TCP payload (28 bytes) + * Data (28 bytes) + * Data: 3132330af4a5270f9107248b03d518e75018ff00301600006162630a + * [Length: 28] + */ + +unsigned char frag2[] = { + /* ETH */ + 0x00, 0x22, 0x46, 0x2f, 0x35, 0xb8, 0xe8, 0x1c, 0xba, 0xcc, 0x87, 0x22, 0x08, 0x00, + /* IP */ + 0x45, 0x00, // version & hdr len & tos + 0x00, 0x2c, // total length + 0xff, 0xff, // ip id + 0x00, 0x03, // flags & frag offset + 0x7f, 0x06, // ttl & protocol + 0x6d, 0x88, // checksum + 0xc0, 0xa8, 0x24, 0x67, // src addr + 0xc0, 0xa8, 0x28, 0x89, // dst addr + /* DATA */ + 0xf4, 0xa5, 0x27, 0x0f, 0x91, 0x07, 0x24, 0x8b, 0x03, 0xd5, 0x18, 0xe7, 0x50, 0x18, 0xff, 0x00, 0x30, 0x16, 0x00, 0x00, 0x61, 0x62, 0x63, 0x0a, + /* Padding */ + 0x00, 0x00}; + +unsigned char expect[] = { + /* ETH */ + 0x00, 0x22, 0x46, 0x2f, 0x35, 0xb8, 0xe8, 0x1c, 0xba, 0xcc, 0x87, 0x22, 0x08, 0x00, + /* IP */ + 0x45, 0x00, // version & hdr len & tos + 0x00, 0x44, // total length --------- need update --------- + 0xff, 0xff, // ip id + 0x00, 0x00, // flags & frag offset --------- need update --------- + 0x7f, 0x06, // ttl & protocol + 0x6d, 0x73, // checksum --------- need update --------- + 0xc0, 0xa8, 0x24, 0x67, // src addr + 0xc0, 0xa8, 0x28, 0x89, // dst addr + /* TCP */ + 0xf4, 0xa5, // src port + 0x27, 0x0f, // dst port + 0x91, 0x07, 0x24, 0x87, // seq + 0x03, 0xd5, 0x18, 0xe7, // ack + 0x50, 0x18, // data offset & flags + 0xff, 0x00, // windows + 0x5e, 0x92, // checksum + 0x00, 0x00, // urgent pointer + /* DATA */ + 0x31, 0x32, 0x33, 0x0a, // data from frag1 + 0xf4, 0xa5, 0x27, 0x0f, 0x91, 0x07, 0x24, 0x8b, 0x03, 0xd5, 0x18, 0xe7, 0x50, 0x18, 0xff, 0x00, 0x30, 0x16, 0x00, 0x00, 0x61, 0x62, 0x63, 0x0a // data from frag2 +}; + +TEST(IPV4_REASSEMBLE, PADDING) +{ + struct packet pkt; + struct packet *new_pkt; + const struct layer_record *layer; + struct ip_reassemble_manager *mgr; + + timestamp_update(); + + mgr = ip_reassemble_manager_create(&config); + EXPECT_TRUE(mgr != NULL); + + // frag1 + packet_parse(&pkt, (const char *)frag1, sizeof(frag1)); + new_pkt = ip_reassemble_packet(mgr, &pkt); + EXPECT_TRUE(new_pkt == NULL); + + // frag2 + packet_parse(&pkt, (const char *)frag2, sizeof(frag2)); + new_pkt = ip_reassemble_packet(mgr, &pkt); + EXPECT_TRUE(new_pkt); + + // check packet + packet_print(new_pkt); + EXPECT_TRUE(new_pkt->data_len == 14 /* ETH */ + 20 /* IPv4 */ + 20 /* TCP */ + 28 /* DATA */); + EXPECT_TRUE(new_pkt->data_len == sizeof(expect)); + EXPECT_TRUE(memcmp(new_pkt->data_ptr, expect, new_pkt->data_len) == 0); + + // check IPv4 + layer = packet_get_innermost_layer(new_pkt, LAYER_TYPE_IPV4); + EXPECT_TRUE(layer); + struct ip *hdr = (struct ip *)layer->hdr_ptr; + EXPECT_TRUE(ipv4_hdr_get_version(hdr) == 4); + EXPECT_TRUE(ipv4_hdr_get_hdr_len(hdr) == 20 /* IPv4 */); + EXPECT_TRUE(ipv4_hdr_get_tos(hdr) == 0); + EXPECT_TRUE(ipv4_hdr_get_total_len(hdr) == 20 /* IPv4 */ + 20 /* TCP */ + 28 /* DATA */); + EXPECT_TRUE(ipv4_hdr_get_ipid(hdr) == 0xffff); + EXPECT_TRUE(ipv4_hdr_get_flags(hdr) == 0x0); + EXPECT_TRUE(ipv4_hdr_get_frag_offset(hdr) == 0); + EXPECT_TRUE(ipv4_hdr_get_ttl(hdr) == 127); + EXPECT_TRUE(ipv4_hdr_get_proto(hdr) == 6); + EXPECT_TRUE(ipv4_hdr_get_checksum(hdr) == 0x6d73); // NOTE this is correct checksum + EXPECT_TRUE(ipv4_hdr_get_src_addr(hdr) == 0xc0a82467); + EXPECT_TRUE(ipv4_hdr_get_dst_addr(hdr) == 0xc0a82889); + EXPECT_TRUE(ipv4_hdr_get_opt_len(hdr) == 0); + EXPECT_TRUE(ipv4_hdr_get_opt_data(hdr) == NULL); + + // check TCP + layer = packet_get_innermost_layer(new_pkt, LAYER_TYPE_TCP); + EXPECT_TRUE(layer); + struct tcphdr *tcp_hdr = (struct tcphdr *)layer->hdr_ptr; + EXPECT_TRUE(tcp_hdr_get_src_port(tcp_hdr) == 62629); + EXPECT_TRUE(tcp_hdr_get_dst_port(tcp_hdr) == 9999); + EXPECT_TRUE(tcp_hdr_get_seq(tcp_hdr) == 2433164423); + EXPECT_TRUE(tcp_hdr_get_ack(tcp_hdr) == 64297191); + EXPECT_TRUE(tcp_hdr_get_hdr_len(tcp_hdr) == 20); + EXPECT_TRUE(tcp_hdr_get_flags(tcp_hdr) == 0x018); + EXPECT_TRUE(tcp_hdr_get_window(tcp_hdr) == 65280); + EXPECT_TRUE(tcp_hdr_get_checksum(tcp_hdr) == 0x5e92); + EXPECT_TRUE(tcp_hdr_get_urg_ptr(tcp_hdr) == 0); + EXPECT_TRUE(tcp_hdr_get_opt_len(tcp_hdr) == 0); + EXPECT_TRUE(tcp_hdr_get_opt_data(tcp_hdr) == NULL); + + // free packet + packet_free(new_pkt); + + ip_reassemble_manager_destory(mgr); +} + +TEST(IPV4_REASSEMBLE, EXPIRE) +{ + // TODO +} + +TEST(IPV4_REASSEMBLE, FULL) +{ + // TODO +} + +TEST(IPV4_REASSEMBLE, HOLE) +{ + // TODO +} + +TEST(IPV4_REASSEMBLE, NESTED) +{ + // TODO +} + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/ip_reassemble/test/gtest_ipv6_reassemble.cpp b/src/ip_reassemble/test/gtest_ipv6_reassemble.cpp new file mode 100644 index 0000000..90951d3 --- /dev/null +++ b/src/ip_reassemble/test/gtest_ipv6_reassemble.cpp @@ -0,0 +1,715 @@ +#include + +#include "timestamp.h" +#include "udp_utils.h" +#include "ipv6_utils.h" +#include "packet_helpers.h" +#include "ip_reassemble.h" + +struct ip_reassemble_config config = { + .enable = true, + .timeout = 1000, + .bucket_entries = 16, + .bucket_num = 8, +}; + +/* + * Frame 3: 1510 bytes on wire (12080 bits), 1510 bytes captured (12080 bits) + * Ethernet II, Src: Apple_c0:61:b6 (68:5b:35:c0:61:b6), Dst: Dell_94:65:38 (00:1d:09:94:65:38) + * Destination: Dell_94:65:38 (00:1d:09:94:65:38) + * Address: Dell_94:65:38 (00:1d:09:94:65:38) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Source: Apple_c0:61:b6 (68:5b:35:c0:61:b6) + * Address: Apple_c0:61:b6 (68:5b:35:c0:61:b6) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Type: IPv6 (0x86dd) + * Internet Protocol Version 6, Src: 2607:f010:3f9::1001, Dst: 2607:f010:3f9::11:0 + * 0110 .... = Version: 6 + * .... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, ECN: Not-ECT) + * .... 0000 00.. .... .... .... .... .... = Differentiated Services Codepoint: Default (0) + * .... .... ..00 .... .... .... .... .... = Explicit Congestion Notification: Not ECN-Capable Transport (0) + * .... 0010 0001 0010 1000 1001 = Flow Label: 0x21289 + * Payload Length: 1456 + * Next Header: Fragment Header for IPv6 (44) + * Hop Limit: 64 + * Source Address: 2607:f010:3f9::1001 + * Destination Address: 2607:f010:3f9::11:0 + * Fragment Header for IPv6 + * Next header: UDP (17) + * Reserved octet: 0x00 + * 0000 0000 0000 0... = Offset: 0 (0 bytes) + * .... .... .... .00. = Reserved bits: 0 + * .... .... .... ...1 = More Fragments: Yes + * Identification: 0xf88eb466 + * [Reassembled IPv6 in frame: 6] + * Data (1448 bytes) + * Data: 18db18db150b791606fd14ff072908076578616d706c6508077465737441707008013108… + * [Length: 1448] + */ + +unsigned char frag1[] = { + 0x00, 0x1d, 0x09, 0x94, 0x65, 0x38, 0x68, 0x5b, 0x35, 0xc0, 0x61, 0xb6, 0x86, 0xdd, 0x60, 0x02, 0x12, 0x89, 0x05, 0xb0, 0x2c, 0x40, 0x26, 0x07, 0xf0, 0x10, + 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x26, 0x07, 0xf0, 0x10, 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x11, 0x00, 0x00, 0x01, 0xf8, 0x8e, 0xb4, 0x66, 0x18, 0xdb, 0x18, 0xdb, 0x15, 0x0b, 0x79, 0x16, 0x06, 0xfd, 0x14, 0xff, 0x07, 0x29, 0x08, 0x07, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x08, 0x07, 0x74, 0x65, 0x73, 0x74, 0x41, 0x70, 0x70, 0x08, 0x01, 0x31, 0x08, 0x07, 0x74, 0x65, 0x73, 0x74, 0x41, + 0x70, 0x70, 0x08, 0x09, 0xfd, 0x00, 0x00, 0x01, 0x4f, 0x23, 0x68, 0xc7, 0x8e, 0x14, 0x04, 0x19, 0x02, 0x27, 0x10, 0x15, 0xfd, 0x13, 0x88, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68}; + +/* + * Frame 4: 1510 bytes on wire (12080 bits), 1510 bytes captured (12080 bits) + * Ethernet II, Src: Apple_c0:61:b6 (68:5b:35:c0:61:b6), Dst: Dell_94:65:38 (00:1d:09:94:65:38) + * Destination: Dell_94:65:38 (00:1d:09:94:65:38) + * Address: Dell_94:65:38 (00:1d:09:94:65:38) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Source: Apple_c0:61:b6 (68:5b:35:c0:61:b6) + * Address: Apple_c0:61:b6 (68:5b:35:c0:61:b6) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Type: IPv6 (0x86dd) + * Internet Protocol Version 6, Src: 2607:f010:3f9::1001, Dst: 2607:f010:3f9::11:0 + * 0110 .... = Version: 6 + * .... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, ECN: Not-ECT) + * .... 0000 00.. .... .... .... .... .... = Differentiated Services Codepoint: Default (0) + * .... .... ..00 .... .... .... .... .... = Explicit Congestion Notification: Not ECN-Capable Transport (0) + * .... 0010 0001 0010 1000 1001 = Flow Label: 0x21289 + * Payload Length: 1456 + * Next Header: Fragment Header for IPv6 (44) + * Hop Limit: 64 + * Source Address: 2607:f010:3f9::1001 + * Destination Address: 2607:f010:3f9::11:0 + * Fragment Header for IPv6 + * Next header: UDP (17) + * Reserved octet: 0x00 + * 0000 0101 1010 1... = Offset: 181 (1448 bytes) + * .... .... .... .00. = Reserved bits: 0 + * .... .... .... ...1 = More Fragments: Yes + * Identification: 0xf88eb466 + * [Reassembled IPv6 in frame: 6] + * Data (1448 bytes) + * Data: 686868686868686868686868686868686868686868686868686868686868686868686868… + * [Length: 1448] + */ + +unsigned char frag2[] = { + 0x00, 0x1d, 0x09, 0x94, 0x65, 0x38, 0x68, 0x5b, 0x35, 0xc0, 0x61, 0xb6, 0x86, 0xdd, 0x60, 0x02, 0x12, 0x89, 0x05, 0xb0, 0x2c, 0x40, 0x26, 0x07, 0xf0, 0x10, + 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x26, 0x07, 0xf0, 0x10, 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x11, 0x00, 0x05, 0xa9, 0xf8, 0x8e, 0xb4, 0x66, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68}; + +/* + * Frame 5: 1510 bytes on wire (12080 bits), 1510 bytes captured (12080 bits) + * Ethernet II, Src: Apple_c0:61:b6 (68:5b:35:c0:61:b6), Dst: Dell_94:65:38 (00:1d:09:94:65:38) + * Destination: Dell_94:65:38 (00:1d:09:94:65:38) + * Address: Dell_94:65:38 (00:1d:09:94:65:38) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Source: Apple_c0:61:b6 (68:5b:35:c0:61:b6) + * Address: Apple_c0:61:b6 (68:5b:35:c0:61:b6) + * .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) + * .... ...0 .... .... .... .... = IG bit: Individual address (unicast) + * Type: IPv6 (0x86dd) + * Internet Protocol Version 6, Src: 2607:f010:3f9::1001, Dst: 2607:f010:3f9::11:0 + * 0110 .... = Version: 6 + * .... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, ECN: Not-ECT) + * .... 0000 00.. .... .... .... .... .... = Differentiated Services Codepoint: Default (0) + * .... .... ..00 .... .... .... .... .... = Explicit Congestion Notification: Not ECN-Capable Transport (0) + * .... 0010 0001 0010 1000 1001 = Flow Label: 0x21289 + * Payload Length: 1456 + * Next Header: Fragment Header for IPv6 (44) + * Hop Limit: 64 + * Source Address: 2607:f010:3f9::1001 + * Destination Address: 2607:f010:3f9::11:0 + * Fragment Header for IPv6 + * Next header: UDP (17) + * Reserved octet: 0x00 + * 0000 1011 0101 0... = Offset: 362 (2896 bytes) + * .... .... .... .00. = Reserved bits: 0 + * .... .... .... ...1 = More Fragments: Yes + * Identification: 0xf88eb466 + * [Reassembled IPv6 in frame: 6] + * Data (1448 bytes) + * Data: 686868686868686868686868686868686868686868686868686868686868686868686868… + * [Length: 1448] + */ + +unsigned char frag3[] = { + 0x00, 0x1d, 0x09, 0x94, 0x65, 0x38, 0x68, 0x5b, 0x35, 0xc0, 0x61, 0xb6, 0x86, 0xdd, 0x60, 0x02, 0x12, 0x89, 0x05, 0xb0, 0x2c, 0x40, 0x26, 0x07, 0xf0, 0x10, + 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x26, 0x07, 0xf0, 0x10, 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x11, 0x00, 0x0b, 0x51, 0xf8, 0x8e, 0xb4, 0x66, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68}; + +/* + * Frame 6: 1105 bytes on wire (8840 bits), 1105 bytes captured (8840 bits) + * Ethernet II, Src: Apple_c0:61:b6 (68:5b:35:c0:61:b6), Dst: Dell_94:65:38 (00:1d:09:94:65:38) + * Internet Protocol Version 6, Src: 2607:f010:3f9::1001, Dst: 2607:f010:3f9::11:0 + * 0110 .... = Version: 6 + * .... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, ECN: Not-ECT) + * .... 0000 00.. .... .... .... .... .... = Differentiated Services Codepoint: Default (0) + * .... .... ..00 .... .... .... .... .... = Explicit Congestion Notification: Not ECN-Capable Transport (0) + * .... 0010 0001 0010 1000 1001 = Flow Label: 0x21289 + * Payload Length: 1051 + * Next Header: Fragment Header for IPv6 (44) + * Hop Limit: 64 + * Source Address: 2607:f010:3f9::1001 + * Destination Address: 2607:f010:3f9::11:0 + * Fragment Header for IPv6 + * Next header: UDP (17) + * Reserved octet: 0x00 + * 0001 0000 1111 1... = Offset: 543 (4344 bytes) + * .... .... .... .00. = Reserved bits: 0 + * .... .... .... ...0 = More Fragments: No + * Identification: 0xf88eb466 + * [4 IPv6 Fragments (5387 bytes): #3(1448), #4(1448), #5(1448), #6(1043)] + * [Frame: 3, payload: 0-1447 (1448 bytes)] + * [Frame: 4, payload: 1448-2895 (1448 bytes)] + * [Frame: 5, payload: 2896-4343 (1448 bytes)] + * [Frame: 6, payload: 4344-5386 (1043 bytes)] + * [Fragment count: 4] + * [Reassembled IPv6 length: 5387] + * [Reassembled IPv6 data: 18db18db150b791606fd14ff072908076578616d706c6508077465737441707008013108…] + * User Datagram Protocol, Src Port: 6363, Dst Port: 6363 + * Source Port: 6363 + * Destination Port: 6363 + * Length: 5387 + * Checksum: 0x7916 [correct] + * [Calculated Checksum: 0x7916] + * [Checksum Status: Good] + * [Stream index: 0] + * [Timestamps] + * [Time since first frame: 0.257001000 seconds] + * [Time since previous frame: 0.019796000 seconds] + * UDP payload (5379 bytes) + * Data (5379 bytes) + * Data: 06fd14ff072908076578616d706c65080774657374417070080131080774657374417070… + * [Length: 5379] + */ + +unsigned char frag4[] = { + 0x00, 0x1d, 0x09, 0x94, 0x65, 0x38, 0x68, 0x5b, 0x35, 0xc0, 0x61, 0xb6, 0x86, 0xdd, 0x60, 0x02, 0x12, 0x89, 0x04, 0x1b, 0x2c, 0x40, 0x26, 0x07, 0xf0, 0x10, + 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x26, 0x07, 0xf0, 0x10, 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x11, 0x00, 0x10, 0xf8, 0xf8, 0x8e, 0xb4, 0x66, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x16, 0x3c, 0x1b, 0x01, 0x01, 0x1c, 0x37, 0x07, 0x35, 0x08, 0x0c, 0x74, 0x6d, 0x70, 0x2d, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x08, 0x04, 0x12, 0xc2, 0x99, 0x9e, 0x08, 0x03, 0x4b, 0x45, 0x59, 0x08, 0x11, 0x6b, 0x73, 0x6b, 0x2d, 0x31, 0x34, 0x33, 0x33, 0x39, 0x38, 0x30, 0x38, 0x37, + 0x36, 0x33, 0x30, 0x36, 0x08, 0x07, 0x49, 0x44, 0x2d, 0x43, 0x45, 0x52, 0x54, 0x17, 0xfd, 0x01, 0x00, 0x30, 0x6f, 0x6b, 0xab, 0x96, 0x61, 0x9b, 0x71, 0x2a, + 0xf4, 0xa0, 0xde, 0x35, 0x84, 0xed, 0x89, 0xb6, 0xe7, 0x09, 0x3e, 0xe9, 0x5e, 0xb9, 0xcd, 0x1f, 0x66, 0x37, 0x5f, 0xfa, 0xbc, 0x52, 0xee, 0x40, 0xf6, 0xd1, + 0xc5, 0x60, 0xff, 0x78, 0xf1, 0x51, 0xc9, 0x1b, 0xc9, 0x9c, 0xd0, 0xb0, 0xac, 0x0f, 0x42, 0x2e, 0x1c, 0xc1, 0xea, 0x5b, 0x50, 0xff, 0x50, 0x99, 0x60, 0x6d, + 0x02, 0xed, 0xec, 0x2c, 0xd6, 0x97, 0x1b, 0x9a, 0xf7, 0x17, 0xde, 0xef, 0x58, 0x6b, 0xc0, 0x63, 0x6d, 0x64, 0x12, 0x77, 0xb2, 0x34, 0xbe, 0x05, 0x79, 0x8a, + 0x59, 0x2c, 0x25, 0x94, 0x52, 0x8e, 0x1e, 0xd4, 0xdc, 0x12, 0xe7, 0x60, 0x66, 0xc9, 0x09, 0xe5, 0x9b, 0x53, 0xf2, 0xed, 0x37, 0x17, 0x91, 0x90, 0x8d, 0xe6, + 0x8a, 0x47, 0xcd, 0xcc, 0x47, 0xab, 0xd2, 0xbe, 0xcb, 0xa8, 0x3f, 0x88, 0x7b, 0xcc, 0x58, 0x80, 0xdd, 0xb2, 0x08, 0x30, 0x79, 0x95, 0xb3, 0x8b, 0xd0, 0x5b, + 0xc5, 0x13, 0x8c, 0x11, 0xab, 0x2b, 0x91, 0xac, 0x3c, 0x55, 0xa9, 0x52, 0x02, 0x12, 0xf1, 0xb8, 0x2f, 0xca, 0xea, 0xd0, 0x70, 0x56, 0x3c, 0x2a, 0x36, 0x6e, + 0xd2, 0x57, 0x0c, 0xe6, 0x9b, 0xbc, 0xc8, 0x5b, 0x1c, 0x39, 0xed, 0x9b, 0x7c, 0xfa, 0xa7, 0x2b, 0x66, 0x17, 0x10, 0x40, 0x9e, 0x0f, 0xe0, 0x90, 0xd1, 0x61, + 0xfd, 0xbb, 0xc8, 0x6d, 0x1b, 0xcf, 0xec, 0x81, 0xf7, 0xde, 0x24, 0xc3, 0x12, 0xac, 0x39, 0xfd, 0xb3, 0xa8, 0x57, 0x35, 0xc6, 0xfb, 0x1a, 0x15, 0x52, 0x23, + 0x29, 0xa1, 0x25, 0xca, 0x66, 0x98, 0x05, 0xa6, 0x7b, 0x0d, 0x49, 0xe1, 0x76, 0x34, 0x07, 0xf7, 0x9e, 0xe5, 0xb7, 0x66, 0x39, 0xb1, 0xb0, 0xa0, 0x1a, 0x44, + 0x90, 0xce, 0x07, 0x03, 0xf2, 0x1b, 0x0e, 0xc6, 0x17, 0xed, 0xd8, 0x4f, 0x4f}; + +unsigned char expect[] = { + // ETH + 0x00, 0x1d, 0x09, 0x94, 0x65, 0x38, 0x68, 0x5b, 0x35, 0xc0, 0x61, 0xb6, 0x86, 0xdd, + // IPv6 + 0x60, 0x02, 0x12, 0x89, // version & traffic class & flow label + 0x15, 0x0b, // payload length + 0x11, // next header + 0x40, // hop limit + 0x26, 0x07, 0xf0, 0x10, 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, // src addr + 0x26, 0x07, 0xf0, 0x10, 0x03, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, // dst addr + // IPv6 Payload + 0x18, 0xdb, 0x18, 0xdb, 0x15, 0x0b, 0x79, 0x16, 0x06, 0xfd, 0x14, 0xff, 0x07, 0x29, 0x08, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x08, 0x07, 0x74, + 0x65, 0x73, 0x74, 0x41, 0x70, 0x70, 0x08, 0x01, 0x31, 0x08, 0x07, 0x74, 0x65, 0x73, 0x74, 0x41, 0x70, 0x70, 0x08, 0x09, 0xfd, 0x00, 0x00, 0x01, 0x4f, 0x23, + 0x68, 0xc7, 0x8e, 0x14, 0x04, 0x19, 0x02, 0x27, 0x10, 0x15, 0xfd, 0x13, 0x88, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x16, 0x3c, 0x1b, 0x01, 0x01, + 0x1c, 0x37, 0x07, 0x35, 0x08, 0x0c, 0x74, 0x6d, 0x70, 0x2d, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x08, 0x04, 0x12, 0xc2, 0x99, 0x9e, 0x08, 0x03, + 0x4b, 0x45, 0x59, 0x08, 0x11, 0x6b, 0x73, 0x6b, 0x2d, 0x31, 0x34, 0x33, 0x33, 0x39, 0x38, 0x30, 0x38, 0x37, 0x36, 0x33, 0x30, 0x36, 0x08, 0x07, 0x49, 0x44, + 0x2d, 0x43, 0x45, 0x52, 0x54, 0x17, 0xfd, 0x01, 0x00, 0x30, 0x6f, 0x6b, 0xab, 0x96, 0x61, 0x9b, 0x71, 0x2a, 0xf4, 0xa0, 0xde, 0x35, 0x84, 0xed, 0x89, 0xb6, + 0xe7, 0x09, 0x3e, 0xe9, 0x5e, 0xb9, 0xcd, 0x1f, 0x66, 0x37, 0x5f, 0xfa, 0xbc, 0x52, 0xee, 0x40, 0xf6, 0xd1, 0xc5, 0x60, 0xff, 0x78, 0xf1, 0x51, 0xc9, 0x1b, + 0xc9, 0x9c, 0xd0, 0xb0, 0xac, 0x0f, 0x42, 0x2e, 0x1c, 0xc1, 0xea, 0x5b, 0x50, 0xff, 0x50, 0x99, 0x60, 0x6d, 0x02, 0xed, 0xec, 0x2c, 0xd6, 0x97, 0x1b, 0x9a, + 0xf7, 0x17, 0xde, 0xef, 0x58, 0x6b, 0xc0, 0x63, 0x6d, 0x64, 0x12, 0x77, 0xb2, 0x34, 0xbe, 0x05, 0x79, 0x8a, 0x59, 0x2c, 0x25, 0x94, 0x52, 0x8e, 0x1e, 0xd4, + 0xdc, 0x12, 0xe7, 0x60, 0x66, 0xc9, 0x09, 0xe5, 0x9b, 0x53, 0xf2, 0xed, 0x37, 0x17, 0x91, 0x90, 0x8d, 0xe6, 0x8a, 0x47, 0xcd, 0xcc, 0x47, 0xab, 0xd2, 0xbe, + 0xcb, 0xa8, 0x3f, 0x88, 0x7b, 0xcc, 0x58, 0x80, 0xdd, 0xb2, 0x08, 0x30, 0x79, 0x95, 0xb3, 0x8b, 0xd0, 0x5b, 0xc5, 0x13, 0x8c, 0x11, 0xab, 0x2b, 0x91, 0xac, + 0x3c, 0x55, 0xa9, 0x52, 0x02, 0x12, 0xf1, 0xb8, 0x2f, 0xca, 0xea, 0xd0, 0x70, 0x56, 0x3c, 0x2a, 0x36, 0x6e, 0xd2, 0x57, 0x0c, 0xe6, 0x9b, 0xbc, 0xc8, 0x5b, + 0x1c, 0x39, 0xed, 0x9b, 0x7c, 0xfa, 0xa7, 0x2b, 0x66, 0x17, 0x10, 0x40, 0x9e, 0x0f, 0xe0, 0x90, 0xd1, 0x61, 0xfd, 0xbb, 0xc8, 0x6d, 0x1b, 0xcf, 0xec, 0x81, + 0xf7, 0xde, 0x24, 0xc3, 0x12, 0xac, 0x39, 0xfd, 0xb3, 0xa8, 0x57, 0x35, 0xc6, 0xfb, 0x1a, 0x15, 0x52, 0x23, 0x29, 0xa1, 0x25, 0xca, 0x66, 0x98, 0x05, 0xa6, + 0x7b, 0x0d, 0x49, 0xe1, 0x76, 0x34, 0x07, 0xf7, 0x9e, 0xe5, 0xb7, 0x66, 0x39, 0xb1, 0xb0, 0xa0, 0x1a, 0x44, 0x90, 0xce, 0x07, 0x03, 0xf2, 0x1b, 0x0e, 0xc6, + 0x17, 0xed, 0xd8, 0x4f, 0x4f}; + +TEST(IPV6_REASSEMBLE, NORMAL) +{ + struct packet pkt; + struct packet *new_pkt; + const struct layer_record *layer; + struct ip_reassemble_manager *mgr; + + timestamp_update(); + + mgr = ip_reassemble_manager_create(&config); + EXPECT_TRUE(mgr != NULL); + + // frag1 + packet_parse(&pkt, (const char *)frag1, sizeof(frag1)); + new_pkt = ip_reassemble_packet(mgr, &pkt); + EXPECT_TRUE(new_pkt == NULL); + + // frag2 + packet_parse(&pkt, (const char *)frag2, sizeof(frag2)); + new_pkt = ip_reassemble_packet(mgr, &pkt); + EXPECT_TRUE(new_pkt == NULL); + + // frag3 + packet_parse(&pkt, (const char *)frag3, sizeof(frag3)); + new_pkt = ip_reassemble_packet(mgr, &pkt); + EXPECT_TRUE(new_pkt == NULL); + + // frag4 + packet_parse(&pkt, (const char *)frag4, sizeof(frag4)); + new_pkt = ip_reassemble_packet(mgr, &pkt); + EXPECT_TRUE(new_pkt); + + // check packet + packet_print(new_pkt); + EXPECT_TRUE(new_pkt->data_len == 14 /* ETH */ + 40 /* IPv6 */ + 8 /* UDP */ + 5379 /* DATA */); + EXPECT_TRUE(new_pkt->data_len == sizeof(expect)); + EXPECT_TRUE(memcmp(new_pkt->data_ptr, expect, new_pkt->data_len) == 0); + + // check IPv6 + layer = packet_get_innermost_layer(new_pkt, LAYER_TYPE_IPV6); + EXPECT_TRUE(layer); + struct ip6_hdr *hdr = (struct ip6_hdr *)layer->hdr_ptr; + EXPECT_TRUE(ipv6_hdr_get_version(hdr) == 6); + EXPECT_TRUE(ipv6_hdr_get_traffic_class(hdr) == 0); + EXPECT_TRUE(ipv6_hdr_get_flow_label(hdr) == 0x21289); + EXPECT_TRUE(ipv6_hdr_get_payload_len(hdr) == 5387); + EXPECT_TRUE(ipv6_hdr_get_next_header(hdr) == 17); // UDP + EXPECT_TRUE(ipv6_hdr_get_hop_limit(hdr) == 64); + char src_str[INET6_ADDRSTRLEN]; + char dst_str[INET6_ADDRSTRLEN]; + struct in6_addr src_addr = ipv6_hdr_get_src_in6_addr(hdr); + struct in6_addr dst_addr = ipv6_hdr_get_dst_in6_addr(hdr); + inet_ntop(AF_INET6, &src_addr, src_str, INET6_ADDRSTRLEN); + inet_ntop(AF_INET6, &dst_addr, dst_str, INET6_ADDRSTRLEN); + EXPECT_TRUE(strcmp(src_str, "2607:f010:3f9::1001") == 0); + EXPECT_TRUE(strcmp(dst_str, "2607:f010:3f9::11:0") == 0); + EXPECT_TRUE(ipv6_hdr_get_frag_ext(hdr) == NULL); + + // check UDP + layer = packet_get_innermost_layer(new_pkt, LAYER_TYPE_UDP); + EXPECT_TRUE(layer); + struct udphdr *udp_hdr = (struct udphdr *)layer->hdr_ptr; + EXPECT_TRUE(udp_hdr_get_src_port(udp_hdr) == 6363); + EXPECT_TRUE(udp_hdr_get_dst_port(udp_hdr) == 6363); + EXPECT_TRUE(udp_hdr_get_total_len(udp_hdr) == 5387); + EXPECT_TRUE(udp_hdr_get_checksum(udp_hdr) == 0x7916); + + // free packet + packet_free(new_pkt); + + ip_reassemble_manager_destory(mgr); +} + +TEST(IPV6_REASSEMBLE, EXPIRE) +{ + // TODO +} + +TEST(IPV6_REASSEMBLE, FULL) +{ + // TODO +} + +TEST(IPV6_REASSEMBLE, HOLE) +{ + // TODO +} + +TEST(IPV6_REASSEMBLE, NESTED) +{ + // TODO +} + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/packet/checksum.h b/src/packet/checksum.h new file mode 100644 index 0000000..4a91ea7 --- /dev/null +++ b/src/packet/checksum.h @@ -0,0 +1,41 @@ +#ifndef _CHECKSUM_H +#define _CHECKSUM_H + +#ifdef __cpluscplus +extern "C" +{ +#endif + +#include + +// https://datatracker.ietf.org/doc/html/rfc1071 +static inline uint16_t checksum(char *data, int len) +{ + long sum = 0; + uint16_t *addr = (uint16_t *)data; + + while (len > 1) + { + sum += *addr++; + len -= 2; + } + + if (len > 0) + { + sum += *(unsigned char *)addr; + } + + // Fold 32-bit sum to 16 bits + while (sum >> 16) + { + sum = (sum & 0xffff) + (sum >> 16); + } + + return (uint16_t)(~sum); +} + +#ifdef __cpluscplus +} +#endif + +#endif diff --git a/src/packet/ipv4_utils.h b/src/packet/ipv4_utils.h index 3e53631..9ce0040 100644 --- a/src/packet/ipv4_utils.h +++ b/src/packet/ipv4_utils.h @@ -126,6 +126,11 @@ static inline uint8_t ipv4_hdr_get_opt_len(const struct ip *hdr) static inline const char *ipv4_hdr_get_opt_data(const struct ip *hdr) { + if (ipv4_hdr_get_opt_len(hdr) == 0) + { + return NULL; + } + return (const char *)hdr + sizeof(struct ip); } diff --git a/src/packet/ipv6_utils.h b/src/packet/ipv6_utils.h index 7b27f80..0d3b2e4 100644 --- a/src/packet/ipv6_utils.h +++ b/src/packet/ipv6_utils.h @@ -35,6 +35,16 @@ extern "C" * + + * | | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * + * Fragment Header + * + * 0 1 2 3 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Next Header | Reserved | Fragment Offset |Res|M| + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Identification | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ /****************************************************************************** @@ -81,6 +91,15 @@ static inline struct in6_addr ipv6_hdr_get_dst_in6_addr(const struct ip6_hdr *hd return hdr->ip6_dst; } +static inline struct ip6_frag *ipv6_hdr_get_frag_ext(const struct ip6_hdr *hdr) +{ + if (hdr->ip6_nxt != IPPROTO_FRAGMENT) + { + return NULL; + } + return (struct ip6_frag *)((char *)hdr + sizeof(struct ip6_hdr)); +} + // TODO IPv6 extension headers /****************************************************************************** diff --git a/src/packet/packet.cpp b/src/packet/packet.cpp index a2019a0..04220fb 100644 --- a/src/packet/packet.cpp +++ b/src/packet/packet.cpp @@ -861,12 +861,12 @@ static inline const char *parse_ipv4(struct packet *handler, const char *data, u return data; } struct ip *hdr = (struct ip *)data; - uint8_t next_proto = ipv4_get_proto(hdr); + uint8_t next_proto = ipv4_hdr_get_proto(hdr); uint16_t hdr_len = ipv4_hdr_get_hdr_len(hdr); SET_LAYER(handler, layer, LAYER_TYPE_IPV4, hdr_len, data, len); // ip fragmented - if ((ntohs(hdr->ip_off) & IP_MF) || (ntohs(hdr->ip_off) & IP_OFFMASK)) + if (ipv4_hdr_get_mf_flag(hdr) || ipv4_hdr_get_frag_offset(hdr)) { PACKET_LOG_DEBUG("ip is fragmented"); handler->frag_layer = layer; @@ -893,7 +893,13 @@ static inline const char *parse_ipv6(struct packet *handler, const char *data, u uint8_t next_proto = ipv6_hdr_get_next_header((const struct ip6_hdr *)data); SET_LAYER(handler, layer, LAYER_TYPE_IPV6, sizeof(struct ip6_hdr), data, len); - // TODO ipv6 fragment + // ipv6 fragment + if (next_proto == IPPROTO_FRAGMENT) + { + PACKET_LOG_DEBUG("ipv6 is fragmented"); + handler->frag_layer = layer; + return layer->pld_ptr; + } // TESTED return parse_l4(handler, next_proto, layer->pld_ptr, layer->pld_len); @@ -1132,6 +1138,11 @@ void packet_print(const struct packet *handler) i, layer, layer_type_tostring(layer->type), layer->hdr_offset, layer->hdr_ptr, layer->hdr_len, layer->pld_ptr, layer->pld_len); } + for (uint16_t i = 0; i < handler->data_len; i++) + { + printf("0x%02x, ", (uint8_t)handler->data_ptr[i]); + } + printf("\n"); } // return 0 : found diff --git a/src/packet/packet_helpers.h b/src/packet/packet_helpers.h index ca024a9..eb6e964 100644 --- a/src/packet/packet_helpers.h +++ b/src/packet/packet_helpers.h @@ -12,7 +12,8 @@ extern "C" #include #include "packet.h" -#include "ipv4_helpers.h" +#include "ipv4_utils.h" +#include "ipv6_utils.h" struct metadata { @@ -71,7 +72,7 @@ static inline bool paket_is_fragment(const struct packet *pkt) if (pkt->layers[i].type == LAYER_TYPE_IPV4) { struct ip *ip_hdr = (struct ip *)pkt->layers[i].hdr_ptr; - if (ipv4_hdr_has_flag_mf(ip_hdr) || ipv4_hdr_get_frag_offset(ip_hdr)) + if (ipv4_hdr_get_mf_flag(ip_hdr) || ipv4_hdr_get_frag_offset(ip_hdr)) { return true; } @@ -79,8 +80,8 @@ static inline bool paket_is_fragment(const struct packet *pkt) if (pkt->layers[i].type == LAYER_TYPE_IPV6) { - struct ip6_hdr *ip6_hdr = (struct ip6_hdr *)pkt->layers[i].hdr_ptr; - if (ip6_hdr->ip6_nxt == IPPROTO_FRAGMENT) + const struct ip6_hdr *ip6_hdr = (const struct ip6_hdr *)pkt->layers[i].hdr_ptr; + if (ipv6_hdr_get_next_header(ip6_hdr) == IPPROTO_FRAGMENT) { return true; } @@ -97,7 +98,7 @@ static inline struct packet *packet_dup(const struct packet *pkt) return NULL; } - struct packet *pkt_dup = (struct packet *)calloc(1, sizeof(struct packet)); + struct packet *pkt_dup = (struct packet *)calloc(1, sizeof(struct packet) + pkt->data_len); if (pkt_dup == NULL) { return NULL; @@ -105,21 +106,23 @@ static inline struct packet *packet_dup(const struct packet *pkt) memcpy(pkt_dup, pkt, sizeof(struct packet)); pkt_dup->user_data = NULL; - if (pkt->data_len) + pkt_dup->data_ptr = (const char *)pkt_dup + sizeof(struct packet); + if (pkt_dup->data_ptr == NULL) { - pkt_dup->data_ptr = (const char *)calloc(1, pkt->data_len); - if (pkt_dup->data_ptr == NULL) - { - free(pkt_dup); - return NULL; - } - memcpy((char *)pkt_dup->data_ptr, pkt->data_ptr, pkt->data_len); + free(pkt_dup); + return NULL; + } + memcpy((char *)pkt_dup->data_ptr, pkt->data_ptr, pkt->data_len); - for (int8_t i = 0; i < pkt->layers_used; i++) - { - pkt_dup->layers[i].hdr_ptr = pkt_dup->data_ptr + pkt->layers[i].hdr_offset; - pkt_dup->layers[i].pld_ptr = pkt_dup->data_ptr + pkt->layers[i].hdr_offset + pkt->layers[i].hdr_len; - } + for (int8_t i = 0; i < pkt->layers_used; i++) + { + pkt_dup->layers[i].hdr_ptr = pkt_dup->data_ptr + pkt->layers[i].hdr_offset; + pkt_dup->layers[i].pld_ptr = pkt_dup->data_ptr + pkt->layers[i].hdr_offset + pkt->layers[i].hdr_len; + } + + if (pkt->frag_layer) + { + pkt_dup->frag_layer = &pkt_dup->layers[pkt->frag_layer - pkt->layers]; } packet_set0_metadata(pkt_dup, metadata_dup(packet_get0_metadata(pkt))); @@ -133,66 +136,21 @@ static inline void packet_free(struct packet *pkt) metadata_free((struct metadata *)packet_get0_metadata(pkt)); packet_set0_metadata(pkt, NULL); - if (pkt->data_ptr) - { - free((char *)pkt->data_ptr); - pkt->data_ptr = NULL; - } free(pkt); pkt = NULL; } } -static inline uint64_t packet_get_domain(const struct packet *pkt) -{ - return pkt->domain; -} - -static inline uint16_t packet_get_raw_len(const struct packet *pkt) +static inline uint16_t packet_get_len(const struct packet *pkt) { return pkt->data_len; } -static inline const char *packet_get0_raw_data(const struct packet *pkt) +static inline const char *packet_get_data(const struct packet *pkt) { return pkt->data_ptr; } -static inline uint8_t packet_get_layer_count(const struct packet *pkt) -{ - return pkt->layers_used; -} - -static inline const struct layer_record *packet_get_layer(const struct packet *pkt, uint8_t index) -{ - return &pkt->layers[index]; -} - -static inline enum layer_type layer_get_type(const struct layer_record *layer) -{ - return layer->type; -} - -static inline const char *layer_get_hdr_ptr(const struct layer_record *layer) -{ - return layer->hdr_ptr; -} - -static inline const char *layer_get_pld_ptr(const struct layer_record *layer) -{ - return layer->pld_ptr; -} - -static inline uint16_t layer_get_hdr_len(const struct layer_record *layer) -{ - return layer->hdr_len; -} - -static inline uint16_t layer_get_pld_len(const struct layer_record *layer) -{ - return layer->pld_len; -} - #ifdef __cpluscplus } #endif diff --git a/src/packet/tcp_utilis.h b/src/packet/tcp_utils.h similarity index 98% rename from src/packet/tcp_utilis.h rename to src/packet/tcp_utils.h index 26fdc53..0a9b2c5 100644 --- a/src/packet/tcp_utilis.h +++ b/src/packet/tcp_utils.h @@ -121,6 +121,11 @@ static inline uint16_t tcp_hdr_get_opt_len(const struct tcphdr *hdr) static inline const char *tcp_hdr_get_opt_data(const struct tcphdr *hdr) { + if (tcp_hdr_get_opt_len(hdr) == 0) + { + return NULL; + } + return ((const char *)hdr) + sizeof(struct tcphdr); } diff --git a/src/packet/test/gtest_ipv4_utils.cpp b/src/packet/test/gtest_ipv4_utils.cpp index bd39f88..184991f 100644 --- a/src/packet/test/gtest_ipv4_utils.cpp +++ b/src/packet/test/gtest_ipv4_utils.cpp @@ -52,7 +52,7 @@ TEST(IPV4_UTILS, GET1) EXPECT_TRUE(ipv4_hdr_get_src_addr(hdr) == 0xc0a82467); EXPECT_TRUE(ipv4_hdr_get_dst_addr(hdr) == 0xc0a82889); EXPECT_TRUE(ipv4_hdr_get_opt_len(hdr) == 0); - EXPECT_TRUE(ipv4_hdr_get_opt_data(hdr) == data + 20); + EXPECT_TRUE(ipv4_hdr_get_opt_data(hdr) == NULL); } TEST(IPV4_UTILS, SET1) @@ -143,7 +143,7 @@ TEST(IPV4_UTILS, GET2) EXPECT_TRUE(ipv4_hdr_get_src_addr(hdr) == 0xc0a82467); EXPECT_TRUE(ipv4_hdr_get_dst_addr(hdr) == 0xc0a82889); EXPECT_TRUE(ipv4_hdr_get_opt_len(hdr) == 0); - EXPECT_TRUE(ipv4_hdr_get_opt_data(hdr) == data + 20); + EXPECT_TRUE(ipv4_hdr_get_opt_data(hdr) == NULL); } TEST(IPV4_UTILS, SET2) @@ -236,7 +236,7 @@ TEST(IPV4_UTILS, GET3) EXPECT_TRUE(ipv4_hdr_get_src_addr(hdr) == 0x7f000001); EXPECT_TRUE(ipv4_hdr_get_dst_addr(hdr) == 0x7f000001); EXPECT_TRUE(ipv4_hdr_get_opt_len(hdr) == 40); - EXPECT_TRUE(ipv4_hdr_get_opt_data(hdr) == data + 20); + EXPECT_TRUE(ipv4_hdr_get_opt_data(hdr) == (const char *)(data3 + 20)); } TEST(IPV4_UTILS, SET3) @@ -256,7 +256,7 @@ TEST(IPV4_UTILS, SET3) ipv4_hdr_set_src_addr(hdr, 0x7f000001); ipv4_hdr_set_dst_addr(hdr, 0x7f000001); ipv4_hdr_set_opt_len(hdr, 40); - ipv4_hdr_set_opt_data(hdr, data3 + 20); + ipv4_hdr_set_opt_data(hdr, (const char *)(data3 + 20)); ipv4_hdr_set_flags(hdr, 2); EXPECT_TRUE(memcmp(buff, data3, 60) == 0); diff --git a/src/packet/test/gtest_tcp_utils.cpp b/src/packet/test/gtest_tcp_utils.cpp index d5ac03b..2e46c67 100644 --- a/src/packet/test/gtest_tcp_utils.cpp +++ b/src/packet/test/gtest_tcp_utils.cpp @@ -93,7 +93,7 @@ TEST(TCP_UTILS, GET) EXPECT_TRUE(tcp_hdr_get_checksum(hdr) == 0xfe30); EXPECT_TRUE(tcp_hdr_get_urg_ptr(hdr) == 0); EXPECT_TRUE(tcp_hdr_get_opt_len(hdr) == 20); - EXPECT_TRUE(tcp_hdr_get_opt_data(hdr) == data + 20); + EXPECT_TRUE(tcp_hdr_get_opt_data(hdr) == (const char *)(data + 20)); } TEST(TCP_UTILS, SET1) @@ -111,7 +111,7 @@ TEST(TCP_UTILS, SET1) tcp_hdr_set_checksum(hdr, 0xfe30); tcp_hdr_set_urg_ptr(hdr, 0); tcp_hdr_set_opt_len(hdr, 20); - tcp_hdr_set_opt_data(hdr, data + 20); + tcp_hdr_set_opt_data(hdr, (const char *)(data + 20)); EXPECT_TRUE(memcmp(buff, data, 40) == 0); } @@ -136,7 +136,7 @@ TEST(TCP_UTILS, SET2) tcp_hdr_set_checksum(hdr, 0xfe30); tcp_hdr_set_urg_ptr(hdr, 0); tcp_hdr_set_opt_len(hdr, 20); - tcp_hdr_set_opt_data(hdr, data + 20); + tcp_hdr_set_opt_data(hdr, (const char *)(data + 20)); EXPECT_TRUE(memcmp(buff, data, 40) == 0); } diff --git a/src/session/test/gtest_state_tcp_active_to_closing.cpp b/src/session/test/gtest_state_tcp_active_to_closing.cpp index b14e5ea..edcd177 100644 --- a/src/session/test/gtest_state_tcp_active_to_closing.cpp +++ b/src/session/test/gtest_state_tcp_active_to_closing.cpp @@ -197,7 +197,7 @@ TEST(TCP_ACTIVE_TO_CLOSING, BY_C2S_RST) EXPECT_TRUE(tcp_layer); struct tcphdr *hdr = (struct tcphdr *)tcp_layer->hdr_ptr; tcp_hdr_set_flags(hdr, 0); - tcp_hdr_set_flag_rst(hdr); + tcp_hdr_set_rst_flag(hdr, true); printf("<= packet parse\n\n"); sess = session_manager_update_session(mgr, &pkt); EXPECT_TRUE(sess); @@ -261,7 +261,7 @@ TEST(TCP_ACTIVE_TO_CLOSING, BY_S2C_RST) EXPECT_TRUE(tcp_layer); struct tcphdr *hdr = (struct tcphdr *)tcp_layer->hdr_ptr; tcp_hdr_set_flags(hdr, 0); - tcp_hdr_set_flag_rst(hdr); + tcp_hdr_set_rst_flag(hdr, true); printf("<= packet parse\n\n"); sess = session_manager_update_session(mgr, &pkt); EXPECT_TRUE(sess); diff --git a/src/session/test/gtest_state_tcp_opening_to_closing.cpp b/src/session/test/gtest_state_tcp_opening_to_closing.cpp index febe5e0..0c8fd2b 100644 --- a/src/session/test/gtest_state_tcp_opening_to_closing.cpp +++ b/src/session/test/gtest_state_tcp_opening_to_closing.cpp @@ -163,7 +163,7 @@ TEST(TCP_OPENING_TO_CLOSING, BY_C2S_RST) EXPECT_TRUE(tcp_layer); struct tcphdr *hdr = (struct tcphdr *)tcp_layer->hdr_ptr; tcp_hdr_set_flags(hdr, 0); - tcp_hdr_set_flag_rst(hdr); + tcp_hdr_set_rst_flag(hdr, true); printf("<= packet parse\n\n"); sess = session_manager_update_session(mgr, &pkt); EXPECT_TRUE(sess); @@ -227,7 +227,7 @@ TEST(TCP_OPENING_TO_CLOSING, BY_S2C_RST) EXPECT_TRUE(tcp_layer); struct tcphdr *hdr = (struct tcphdr *)tcp_layer->hdr_ptr; tcp_hdr_set_flags(hdr, 0); - tcp_hdr_set_flag_rst(hdr); + tcp_hdr_set_rst_flag(hdr, true); printf("<= packet parse\n\n"); sess = session_manager_update_session(mgr, &pkt); EXPECT_TRUE(sess);