pespin has submitted this change. (
https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35943?usp=email )
Change subject: Use gtp_u_kmod to create a gtp tundev
......................................................................
Use gtp_u_kmod to create a gtp tundev
Adding gtp_u_kmod app in osmo_epdg.app.src makes the module app started
and create gtp tunnel based on config file upon startup.
No other operation is done yet on the tunnel, but this step already
allows testing by manually creating pdp contexts outside of the app.
The module gtp_u_kmod currently creates the tundev interface with name
"gtp0" (hardcoded).
The module gtp_u_kmod will fail if the gtp tundev is already created, so
be sure to have it removed before starting osmo-epdg.
Change-Id: Ie7718e1b161477bd738fa75f803ab37e9f35121d
---
M config/sys.config
M debian/osmo-epdg.install
M debian/rules
M rebar.config
M rebar.lock
M src/osmo_epdg.app.src
6 files changed, 76 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/config/sys.config b/config/sys.config
index 905b8a1..6119e02 100755
--- a/config/sys.config
+++ b/config/sys.config
@@ -38,6 +38,35 @@
{gtpc_remote_port, 2123}
]},
%% ===========================================
+ %% gtp_u_kmod config
+ %% ===========================================
+ {gtp_u_kmod, [
+ %% grx: Name used to log by the module.
+ {sockets, [{grx, [%% ip: IP Address assigned at the tunnel. TODO: not currently
applied?
+ {ip, {192,0,2,16}},
+ %% 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"}
+ ]
+ }
+ ]
+ }]
+ }
+ ]},
+ %% ===========================================
+ %% gen_socket config
+ %% ===========================================
+ {gen_socket, [
+ {libdir, "_build/default/lib/gen_socket/priv/lib"}
+]},
+ %% ===========================================
%% Lager logging config
%% ===========================================
{lager, [
diff --git a/debian/osmo-epdg.install b/debian/osmo-epdg.install
index 0840d06..62aec37 100644
--- a/debian/osmo-epdg.install
+++ b/debian/osmo-epdg.install
@@ -1,2 +1,3 @@
/contrib/systemd/osmo-epdg.service /lib/systemd/system/
/_build/default/bin/osmo-epdg /usr/bin/
+/_build/default/lib/gen_socket/priv/lib/gen_socket*.so /usr/lib/${DEB_HOST_MULTIARCH}/
diff --git a/debian/rules b/debian/rules
index 72a2bb6..55115ce 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,6 +11,13 @@
if [ -e build_dep.tar.gz ] ; then tar xzf ./build_dep.tar.gz ; fi
dh_auto_build
rebar3 eunit
+ # Libraries are built under _checkouts/priv/lib/, but dh_install
(debian/osmo-epdg.install)
+ # will expect them under /_build/default/lib/gen_socket/priv/lib/.
+ # Copy the path under debian/tmp/ to let dh_install find it.
+ if [ -e build_dep.tar.gz ]; then \
+ mkdir -p ./_build/default/lib/gen_socket/priv/lib/; \
+ cp _checkouts/gen_socket/priv/lib/gen_socket*.so
./_build/default/lib/gen_socket/priv/lib/; \
+ fi
override_dh_clean:
dh_clean
diff --git a/rebar.config b/rebar.config
index 19688f5..8541410 100644
--- a/rebar.config
+++ b/rebar.config
@@ -5,6 +5,7 @@
{deps, [
{lager, {git, "https://github.com/erlang-lager/lager", {tag,
"3.9.2"}}},
{gtplib, "3.2.0"},
+ {gtp_u_kmod, {git, "https://github.com/osmocom/gtp_u_kmod", {branch,
"osmocom/master"}}},
{osmo_ss7, {git, "https://gitea.osmocom.org/erlang/osmo_ss7", {ref,
"9f294d3612f998860004820d1d85b4264721577b"}}},
{osmo_gsup, {git, "https://gerrit.osmocom.org/erlang/osmo_gsup", {branch,
"osmocom/epdg"}}}
]}.
diff --git a/rebar.lock b/rebar.lock
index a542cbc..4eefe8e 100644
--- a/rebar.lock
+++ b/rebar.lock
@@ -4,7 +4,23 @@
{git,"https://github.com/msantos/epcap",
{ref,"b98edbfbb0392101cd874b098caa5180f2f44b2e"}},
1},
+ {<<"erlando">>,
+ {git,"https://github.com/travelping/erlando.git",
+ {ref,"2cb56e06308beb4d65ae2217a02dc60bafc99b9d"}},
+ 1},
+ {<<"gen_netlink">>,
+ {git,"https://github.com/osmocom/gen_netlink",
+ {ref,"0de39ae6496fc55a145795c45e4b3119a9ee777c"}},
+ 1},
+ {<<"gen_socket">>,
+ {git,"https://github.com/osmocom/gen_socket",
+ {ref,"35e11d6e2f6d87b02dcfc7507a9500bf7ca7329e"}},
+ 2},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
+ {<<"gtp_u_kmod">>,
+ {git,"https://github.com/osmocom/gtp_u_kmod",
+ {ref,"1dc27ed724403026431f51dd4c3f882499a036b0"}},
+ 0},
{<<"gtplib">>,{pkg,<<"gtplib">>,<<"3.2.0">>},0},
{<<"lager">>,
{git,"https://github.com/erlang-lager/lager",
diff --git a/src/osmo_epdg.app.src b/src/osmo_epdg.app.src
index ec60bd2..4481df5 100644
--- a/src/osmo_epdg.app.src
+++ b/src/osmo_epdg.app.src
@@ -11,7 +11,8 @@
gtplib,
diameter,
osmo_gsup,
- osmo_ss7
+ osmo_ss7,
+ gtp_u_kmod
]},
{mod, {osmo_epdg_app, []}},
{env, []}
--
To view, visit
https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/35943?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: Ie7718e1b161477bd738fa75f803ab37e9f35121d
Gerrit-Change-Number: 35943
Gerrit-PatchSet: 7
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged