Hi,

http://lists.osmocom.org/pipermail/osmocom-net-gprs/2020-July/001151.html
(Sorry I could not respond to the original email to show this in thread)

I have confirmed that "ping: sendmsg: Network is unreachable" could be 
reproduced on Ubuntu 18.04.4 with Kernel 4.15.0-111-generic, while it does not (could 
ping through gtp tunnel) on 4.15.0-76-generic.

To be more specific, the issue is GTP packet would not be created even if I send 
packet with destination IP address matching <ms-addr> to gtp link using 
4.15.0-111-generic. (and most likely on later versions)
However, when I switch kernel version to 4.15.0-76-generic on the same host, it 
will generate GTP packet with exactly the same rule configured to the GTP link.

I have created GTP tunnel using command below.
./gtp-link add gtp1
./gtp-tunnel add gtp1 v1 200 100 172.99.0.2 172.0.0.2
and sent packet with dst IP 172.99.0.2, which is same as the ms-addr in the 
above rule.

I have monitored veth1 using "tcpdump -n -i veth1" and GTP packet will be 
captured on 4.15.0-76-generic, but not on 4.15.0-111-generic.

Can anyone think of the difference between the two kernel or gtp module version?


### FYI: list of commands to create gtp link, tunnel rule and routing entry to 
route packet to gtp link.

# Create veth pair so GTP packet can flow within the host.
ip link add veth1 type veth peer name veth2
ip addr add 172.0.0.1/24 dev veth1
ip link set veth1 up
ip addr add 172.99.0.1/32 dev lo

# Create gtp link, gtp1
./gtp-link add gtp1
WARNING: attaching dummy socket descriptors. Keep this process running for 
testing purposes.

-- open new terminal --

# Create tunnel rule from netns default to ns2
./gtp-tunnel add gtp1 v1 200 100 172.99.0.2 172.0.0.2
./gtp-tunnel list
version 1 tei 200/100 ms_addr 172.99.0.2 sgsn_addr 172.0.0.2

# Add route to navigte packets to 172.99.0.2 (ms-addr) via gtp1
ip route add 172.99.0.2/32 dev gtp1

# Create netns ns2 to receive GTP packets.
ip netns add ns2
ip link set veth2 netns ns2
ip netns exec ns2 ip addr add 172.0.0.2/24 dev veth2
ip netns exec ns2 ip link set veth2 up
ip netns exec ns2 ip addr add 172.99.0.2/32 dev lo
ip netns exec ns2 ip link set lo up

# Create gtp link, gtp2
ip netns exec ns2 ./gtp-link add gtp2
WARNING: attaching dummy socket descriptors. Keep this process running for 
testing purposes.

-- open new terminal --

# Create tunnel rule from netns ns2 to default
ip netns exec ns2 ./gtp-tunnel add gtp2 v1 100 200 172.99.0.1 172.0.0.1

# Add route to navigte packets to 172.99.0.1 (ms-addr) via gtp2
ip netns exec ns2 ip route add 172.99.0.1/32 dev gtp2

# Send ping ...
$ ping 172.99.0.2

# error below will shown on Kernel 4.15.0-111-generic.
$ ping 172.99.0.2
PING 172.99.0.2 (172.99.0.2) 56(84) bytes of data.
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable

# GTP packet will be generated and ping success on Kernel 4.15.0-76-generic
$ ping 172.99.0.2
PING 172.99.0.2 (172.99.0.2) 56(84) bytes of data.
64 bytes from 172.99.0.2: icmp_seq=1 ttl=64 time=0.130 ms
64 bytes from 172.99.0.2: icmp_seq=2 ttl=64 time=0.035 ms

Thanks,
--
Kentaro Ebisawa <[email protected]>

Reply via email to