pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35993?usp=email )
Change subject: Use new 'pre-create tundev' feature from gtp_u_kmod
......................................................................
Use new 'pre-create tundev' feature from gtp_u_kmod
This way osmo-epdg doesn't need to create the gtp tun device, and it can
be pre-created and configured by other tools, like gtp-link from
libgtpnl.git.
Change-Id: I2297b8a75e75cc8095ae1485f73c49c5e6b26c4e
---
M Makefile
M config/sys.config
M rebar.lock
3 files changed, 43 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/93/35993/1
diff --git a/Makefile b/Makefile
index 0470458..286a2dc 100644
--- a/Makefile
+++ b/Makefile
@@ -23,3 +23,16 @@
else
rm -f src/diameter_*.erl
endif
+
+# Path to libgtpnl's "gtp-link" binary:
+GTP_LINK=gtp-link
+# Matching the one defined in config/sys.config:
+NETDEV=gtp0
+
+run-test:
+ echo -n 'module gtp +p' | sudo tee /sys/kernel/debug/dynamic_debug/control
+ sudo ip link del $(NETDEV) || true
+ sleep 1
+ sudo sh -c "$(GTP_LINK) add $(NETDEV) & MYPID=\$$! ; echo
"PID=\$${MYPID}" ; sleep 1; kill \$${MYPID} ;"
+ sudo rebar3 shell --config ./config/sys.config || true
+ echo -n 'module gtp -p' | sudo tee /sys/kernel/debug/dynamic_debug/control
diff --git a/config/sys.config b/config/sys.config
index 660aded..3d12e15 100755
--- a/config/sys.config
+++ b/config/sys.config
@@ -41,21 +41,22 @@
%% gtp_u_kmod config
%% ===========================================
{gtp_u_kmod, [
- %% grx: Name used to log by the module.
- {sockets, [{grx, [%% ip: IP Address assigned at the tunnel, used as local GTP-U IP
Address.
- {ip, {127,0,0,2}},
- %% Create the tun socket on a given netns:
- %%{netns, "mynetns"},
- %% Bind tun socket to a particular interface (SO_BINDTODEVICE):
- %%{netdev, "grx"},
- %% Allow binding to an IP address that is nonlocal or does not
(yet) exist (IP_FREEBIND):
- freebind,
- % Create gtp tundev with role SGSN:
- {role, sgsn}%,
- %{vrf, [{routes, [{{10, 180, 0, 0}, 16}]}%%,
- % %%{netdev, "upstream"}
- % ]
- %}
+ %% gtp0: Iface name, also used to identify the process handling the tunnel.
+ {sockets, [{gtp0, [{create_mode, nocreate},
+ %% ip: IP Address assigned at the tunnel, used as local GTP-U IP
Address.
+ {ip, {127,0,0,2}},
+ %% Create the tun socket on a given netns:
+ %%{netns, "mynetns"},
+ %% Bind tun socket to a particular interface (SO_BINDTODEVICE):
+ %%{netdev, "grx"},
+ %% Allow binding to an IP address that is nonlocal or does not
(yet) exist (IP_FREEBIND):
+ freebind,
+ % Create gtp tundev with role SGSN:
+ {role, sgsn}%,
+ %{vrf, [{routes, [{{10, 180, 0, 0}, 16}]}%%,
+ % %%{netdev, "upstream"}
+ % ]
+ %}
]
}]
}
diff --git a/rebar.lock b/rebar.lock
index 4eefe8e..0237efa 100644
--- a/rebar.lock
+++ b/rebar.lock
@@ -19,7 +19,7 @@
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
{<<"gtp_u_kmod">>,
{git,"https://github.com/osmocom/gtp_u_kmod",
- {ref,"1dc27ed724403026431f51dd4c3f882499a036b0"}},
+ {ref,"b3656ebb11528a2db3171dbf94f1a8bf0d6ffd00"}},
0},
{<<"gtplib">>,{pkg,<<"gtplib">>,<<"3.2.0">>},0},
{<<"lager">>,
--
To view, visit
https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35993?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: erlang/osmo-epdg
Gerrit-Branch: master
Gerrit-Change-Id: I2297b8a75e75cc8095ae1485f73c49c5e6b26c4e
Gerrit-Change-Number: 35993
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange