[PATCH] libgtpnl[master]: gtp_build_payload(): Support absent peer and SGSN address

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Nov 12 13:48:18 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4794

to look at the new patch set (#5).

gtp_build_payload(): Support absent peer and SGSN address

When deleting a PDP context via "gtp-tunnel delete", we specify only
the gtp netdevice, the gtp version and the TID/TEI.  However, the
gtp_build_payload() function unconditionally created the netlink
attributes for GTPA_PEER_ADDRESS and GTPA_MS_ADDRESS, having their
addresses set to zero.  The kernel then tried to find a PDP context with
MS and PEER address of 0.0.0.0, and always failed with ENOENT.

The same problem also occurred with OsmoGGSN and OpenGGSN: PDP contexts
could be added but never removed.

The corresponding kernel change that requires this userland change
is the following commit introduced in 4.12-rc1:

commit d9e2dd122637034a0697bf268eed9233701b9dca
Author: Andreas Schultz <aschultz at tpip.net>
Date:   Thu Mar 9 17:43:00 2017 +0100

    gtp: unify genl_find_pdp and prepare for per socket lookup

Older kernels will work with libgtpnl both before and after this commit,
as they internally will simply disregard any attributes beyond TID/TEI.

Change-Id: Ie2ceb2cd6d2fb009bba01a05b5480c1ad775d619
---
M src/gtp-genl.c
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/94/4794/5

diff --git a/src/gtp-genl.c b/src/gtp-genl.c
index 1e48020..f12f872 100644
--- a/src/gtp-genl.c
+++ b/src/gtp-genl.c
@@ -48,8 +48,10 @@
 	if (t->ifns >= 0)
 		mnl_attr_put_u32(nlh, GTPA_NET_NS_FD, t->ifns);
 	mnl_attr_put_u32(nlh, GTPA_LINK, t->ifidx);
-	mnl_attr_put_u32(nlh, GTPA_PEER_ADDRESS, t->sgsn_addr.s_addr);
-	mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, t->ms_addr.s_addr);
+	if (t->sgsn_addr.s_addr)
+		mnl_attr_put_u32(nlh, GTPA_PEER_ADDRESS, t->sgsn_addr.s_addr);
+	if (t->ms_addr.s_addr)
+		mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, t->ms_addr.s_addr);
 	if (t->gtp_version == GTP_V0) {
 		mnl_attr_put_u64(nlh, GTPA_TID, t->u.v0.tid);
 		mnl_attr_put_u16(nlh, GTPA_FLOW, t->u.v0.flowid);

-- 
To view, visit https://gerrit.osmocom.org/4794
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie2ceb2cd6d2fb009bba01a05b5480c1ad775d619
Gerrit-PatchSet: 5
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list