diff --git a/configure.ac b/configure.ac index 1f0f8597d..dc76ce1de 100644 --- a/configure.ac +++ b/configure.ac @@ -254,7 +254,7 @@ AC_CHECK_HEADERS( \ sys/uio.h \ ) -AC_CHECK_HEADERS(netinet/ip.h netinet/ip6.h netinet/ip_icmp.h net/route.h,,,[[ +AC_CHECK_HEADERS(netinet/ip.h netinet/ip6.h net/route.h,,,[[ #include #if HAVE_SYS_SOCKET_H #include diff --git a/src/pgw/pgw_gtp_path.c b/src/pgw/pgw_gtp_path.c index f4f874864..9dab0958c 100644 --- a/src/pgw/pgw_gtp_path.c +++ b/src/pgw/pgw_gtp_path.c @@ -424,8 +424,7 @@ static status_t pgw_gtp_send_router_advertisement(pgw_sess_t *sess) p += sizeof dst_ipsub.sub; p += 2; memcpy(p, &plen, 2); p += 2; p += 3; *p = nxt; p += 1; - advert_h->nd_ra_cksum = in_cksum( - (c_uint16_t *)pkbuf->payload, pkbuf->len); + advert_h->nd_ra_cksum = in_cksum((c_uint16_t *)pkbuf->payload, pkbuf->len); ip6_h->ip6_flow = htonl(0x60000001); ip6_h->ip6_plen = plen; diff --git a/test/testpacket.c b/test/testpacket.c index 9c418e464..81bdacec9 100644 --- a/test/testpacket.c +++ b/test/testpacket.c @@ -1828,11 +1828,13 @@ status_t testgtpu_build_ping( if (dst_ipsub.family == AF_INET) { struct ip *ip_h = NULL; - struct icmp6_hdr *icmp_h = NULL; + struct icmp *icmp_h = NULL; - gtp_h->length = htons(sizeof *ip_h + sizeof *icmp_h); + gtp_h->length = htons(sizeof *ip_h + ICMP_MINLEN); ip_h = (struct ip *)(pkbuf->payload + GTPV1U_HEADER_LEN); + icmp_h = (struct icmp *)((c_uint8_t *)ip_h + sizeof *ip_h); + ip_h->ip_v = 4; ip_h->ip_hl = 5; ip_h->ip_tos = 0; @@ -1845,11 +1847,10 @@ status_t testgtpu_build_ping( ip_h->ip_dst.s_addr = dst_ipsub.sub[0]; ip_h->ip_sum = in_cksum((c_uint16_t *)ip_h, sizeof *ip_h); - icmp_h = (struct icmp6_hdr *)((c_uint8_t *)ip_h + sizeof *ip_h); - icmp_h->icmp6_type = 8; - icmp_h->icmp6_seq = rand(); - icmp_h->icmp6_id = rand(); - icmp_h->icmp6_cksum = in_cksum((c_uint16_t *)icmp_h, sizeof *icmp_h); + icmp_h->icmp_type = 8; + icmp_h->icmp_seq = rand(); + icmp_h->icmp_id = rand(); + icmp_h->icmp_cksum = in_cksum((c_uint16_t *)icmp_h, ICMP_MINLEN); } else if (dst_ipsub.family == AF_INET6) {