forked from acouzens/open5gs
refine code
This commit is contained in:
parent
0c3054652d
commit
f0f5a5ce31
|
@ -254,7 +254,7 @@ AC_CHECK_HEADERS( \
|
||||||
sys/uio.h \
|
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 <sys/types.h>
|
#include <sys/types.h>
|
||||||
#if HAVE_SYS_SOCKET_H
|
#if HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
|
@ -424,8 +424,7 @@ static status_t pgw_gtp_send_router_advertisement(pgw_sess_t *sess)
|
||||||
p += sizeof dst_ipsub.sub;
|
p += sizeof dst_ipsub.sub;
|
||||||
p += 2; memcpy(p, &plen, 2); p += 2;
|
p += 2; memcpy(p, &plen, 2); p += 2;
|
||||||
p += 3; *p = nxt; p += 1;
|
p += 3; *p = nxt; p += 1;
|
||||||
advert_h->nd_ra_cksum = in_cksum(
|
advert_h->nd_ra_cksum = in_cksum((c_uint16_t *)pkbuf->payload, pkbuf->len);
|
||||||
(c_uint16_t *)pkbuf->payload, pkbuf->len);
|
|
||||||
|
|
||||||
ip6_h->ip6_flow = htonl(0x60000001);
|
ip6_h->ip6_flow = htonl(0x60000001);
|
||||||
ip6_h->ip6_plen = plen;
|
ip6_h->ip6_plen = plen;
|
||||||
|
|
|
@ -1828,11 +1828,13 @@ status_t testgtpu_build_ping(
|
||||||
if (dst_ipsub.family == AF_INET)
|
if (dst_ipsub.family == AF_INET)
|
||||||
{
|
{
|
||||||
struct ip *ip_h = NULL;
|
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);
|
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_v = 4;
|
||||||
ip_h->ip_hl = 5;
|
ip_h->ip_hl = 5;
|
||||||
ip_h->ip_tos = 0;
|
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_dst.s_addr = dst_ipsub.sub[0];
|
||||||
ip_h->ip_sum = in_cksum((c_uint16_t *)ip_h, sizeof *ip_h);
|
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->icmp_type = 8;
|
||||||
icmp_h->icmp6_type = 8;
|
icmp_h->icmp_seq = rand();
|
||||||
icmp_h->icmp6_seq = rand();
|
icmp_h->icmp_id = rand();
|
||||||
icmp_h->icmp6_id = rand();
|
icmp_h->icmp_cksum = in_cksum((c_uint16_t *)icmp_h, ICMP_MINLEN);
|
||||||
icmp_h->icmp6_cksum = in_cksum((c_uint16_t *)icmp_h, sizeof *icmp_h);
|
|
||||||
}
|
}
|
||||||
else if (dst_ipsub.family == AF_INET6)
|
else if (dst_ipsub.family == AF_INET6)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue