mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-02 13:03:31 +00:00
improve netconfig
modify GTP packet sending function interface
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
ifconfig eth1:hss 10.1.35.214/24 up
|
||||
ifconfig eth1:mme 10.1.35.215/24 up
|
||||
ifconfig eth1:sgw 10.1.35.216/24 up
|
||||
ifconfig eth1:pcrf 10.1.35.218/24 up
|
||||
ifconfig eth1:pgw 10.1.35.219/24 up
|
||||
ifconfig pgwtun 45.45.0.1/16 up
|
||||
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
ifconfig en0 alias 10.1.35.214 netmask 255.255.255.255
|
||||
ifconfig en0 alias 10.1.35.215 netmask 255.255.255.255
|
||||
ifconfig en0 alias 10.1.35.216 netmask 255.255.255.255
|
||||
ifconfig en0 alias 10.1.35.218 netmask 255.255.255.255
|
||||
ifconfig en0 alias 10.1.35.219 netmask 255.255.255.255
|
||||
|
24
support/netconfig.sh
Executable file
24
support/netconfig.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ 1 -ne $# ]
|
||||
then
|
||||
echo You must specify interface name : ./netconfig.sh eth0
|
||||
|
||||
exit;
|
||||
fi
|
||||
|
||||
SYSTEM=`uname`;
|
||||
|
||||
if [ "$SYSTEM" = "Linux" ]; then
|
||||
ifconfig $1:hss 10.1.35.214/32 up
|
||||
ifconfig $1:mme 10.1.35.215/32 up
|
||||
ifconfig $1:sgw 10.1.35.216/32 up
|
||||
ifconfig $1:pcrf 10.1.35.218/32 up
|
||||
ifconfig $1:pgw 10.1.35.219/32 up
|
||||
else
|
||||
ifconfig $1 alias 10.1.35.214 netmask 255.255.255.255
|
||||
ifconfig $1 alias 10.1.35.215 netmask 255.255.255.255
|
||||
ifconfig $1 alias 10.1.35.216 netmask 255.255.255.255
|
||||
ifconfig $1 alias 10.1.35.218 netmask 255.255.255.255
|
||||
ifconfig $1 alias 10.1.35.219 netmask 255.255.255.255
|
||||
fi
|
@@ -295,7 +295,7 @@ static void attach_test1(abts_case *tc, void *data)
|
||||
core_sleep(time_from_msec(300));
|
||||
|
||||
/* Send GTP-U ICMP Packet */
|
||||
rv = testgtpu_enb_send(gtpu);
|
||||
rv = testgtpu_enb_send(gtpu, inet_addr("45.45.0.2"), mme_self()->s1ap_addr);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
||||
/* Receive GTP-U ICMP Packet */
|
||||
|
@@ -112,7 +112,7 @@ static uint16_t in_cksum(uint16_t *addr, int len)
|
||||
return answer;
|
||||
}
|
||||
|
||||
int testgtpu_enb_send(net_sock_t *sock)
|
||||
int testgtpu_enb_send(net_sock_t *sock, c_uint32_t src_ip, c_uint32_t dst_ip)
|
||||
{
|
||||
mme_sgw_t *sgw = mme_sgw_first();
|
||||
if (!sgw) return -1;
|
||||
@@ -164,8 +164,8 @@ int testgtpu_enb_send(net_sock_t *sock)
|
||||
ip_h->ip_ttl = 255;
|
||||
ip_h->ip_p = IPPROTO_ICMP;
|
||||
ip_h->ip_len = gtp_h->length;
|
||||
ip_h->ip_src.s_addr = inet_addr("45.45.0.2");
|
||||
ip_h->ip_dst.s_addr = inet_addr("10.1.35.215");
|
||||
ip_h->ip_src.s_addr = src_ip;
|
||||
ip_h->ip_dst.s_addr = dst_ip;
|
||||
ip_h->ip_sum = in_cksum(
|
||||
(unsigned short *)ip_h, sizeof(struct ip));
|
||||
|
||||
|
@@ -14,7 +14,8 @@ CORE_DECLARE(int) tests1ap_enb_read(net_sock_t *sock, pkbuf_t *recvbuf);
|
||||
|
||||
CORE_DECLARE(net_sock_t) *testgtpu_enb_connect(void);
|
||||
CORE_DECLARE(status_t) testgtpu_enb_close(net_sock_t *sock);
|
||||
CORE_DECLARE(int) testgtpu_enb_send(net_sock_t *sock);
|
||||
CORE_DECLARE(int) testgtpu_enb_send(net_sock_t *sock,
|
||||
c_uint32_t src_ip, c_uint32_t dst_ip);
|
||||
CORE_DECLARE(int) testgtpu_enb_read(net_sock_t *sock, pkbuf_t *recvbuf);
|
||||
|
||||
CORE_DECLARE(status_t) tests1ap_build_setup_req(
|
||||
|
Reference in New Issue
Block a user