-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
executable file
·47 lines (38 loc) · 897 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
sudo -v
PID_LIST=()
function terminate()
{
sleep 1
sudo ./clean.sh
sudo kill -SIGTERM ${PID_LIST[@]}
}
function dump()
{
LOG_PATH=log
mkdir -p ${LOG_PATH}
N3UE_IPSec_iface_addr=10.0.1.2
N3IWF_IPsec_inner_addr=10.0.0.1
UE_DN_addr=10.60.0.1
TCPDUMP_QUERY=" host $N3UE_IPSec_iface_addr or \
host $N3IWF_IPsec_inner_addr or \
host $UE_DN_addr"
sudo -E tcpdump -U -i any $TCPDUMP_QUERY -w $LOG_PATH/n3ue.pcap &
SUDO_TCPDUMP_PID=$!
sleep 0.1
TCPDUMP_PID=$(pgrep -P ${SUDO_TCPDUMP_PID})
PID_LIST+=($SUDO_TCPDUMP_PID $TCPDUMP_PID)
}
dump
sleep 1
# Run N3UE
sudo ./n3iwue &
SUDO_N3UE_PID=$!
sleep 0.1
echo SUDO_N3UE_PID $SUDO_N3UE_PID
N3UE_PID=$(pgrep -P ${SUDO_N3UE_PID})
PID_LIST+=($SUDO_N3UE_PID $N3UE_PID)
echo N3UE_PID ${N3UE_PID}
trap terminate SIGINT
wait ${PID_LIST}
exit 0