[PATCH 1/2] Rename netlink attribute

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/osmocom-net-gprs@lists.osmocom.org/.

Jonas Bonn jonas at southpole.se
Fri Mar 24 14:19:19 UTC 2017


This aligns with a kernel patch that renames the netlink parameter
to emphasize that it refers to the remote peer which may be either
a GGSN or an SGSN.

The upstream kernel include file retains the legacy name as a define
but we don't need that in our internal library since we are no longer
using it anywhere.
---
 include/linux/gtp.h | 2 +-
 src/gtp-genl.c      | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/gtp.h b/include/linux/gtp.h
index ca1054d..c525cb3 100644
--- a/include/linux/gtp.h
+++ b/include/linux/gtp.h
@@ -19,7 +19,7 @@ enum gtp_attrs {
 	GTPA_LINK,
 	GTPA_VERSION,
 	GTPA_TID,	/* for GTPv0 only */
-	GTPA_SGSN_ADDRESS,
+	GTPA_PEER_ADDRESS,
 	GTPA_MS_ADDRESS,
 	GTPA_FLOW,
 	GTPA_NET_NS_FD,
diff --git a/src/gtp-genl.c b/src/gtp-genl.c
index 24a640d..1e48020 100644
--- a/src/gtp-genl.c
+++ b/src/gtp-genl.c
@@ -48,7 +48,7 @@ static void gtp_build_payload(struct nlmsghdr *nlh, struct gtp_tunnel *t)
 	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_SGSN_ADDRESS, t->sgsn_addr.s_addr);
+	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->gtp_version == GTP_V0) {
 		mnl_attr_put_u64(nlh, GTPA_TID, t->u.v0.tid);
@@ -131,7 +131,7 @@ static int genl_gtp_validate_cb(const struct nlattr *attr, void *data)
 		break;
 	case GTPA_O_TEI:
 	case GTPA_I_TEI:
-	case GTPA_SGSN_ADDRESS:
+	case GTPA_PEER_ADDRESS:
 	case GTPA_MS_ADDRESS:
 	case GTPA_VERSION:
 		if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) {
@@ -160,9 +160,9 @@ static int genl_gtp_attr_cb(const struct nlmsghdr *nlh, void *data)
 		pdp.u.v1.i_tei = mnl_attr_get_u32(tb[GTPA_I_TEI]);
 	if (tb[GTPA_O_TEI])
 		pdp.u.v1.o_tei = mnl_attr_get_u32(tb[GTPA_O_TEI]);
-	if (tb[GTPA_SGSN_ADDRESS]) {
+	if (tb[GTPA_PEER_ADDRESS]) {
 		pdp.sgsn_addr.s_addr =
-			mnl_attr_get_u32(tb[GTPA_SGSN_ADDRESS]);
+			mnl_attr_get_u32(tb[GTPA_PEER_ADDRESS]);
 	}
 	if (tb[GTPA_MS_ADDRESS]) {
 		pdp.ms_addr.s_addr = mnl_attr_get_u32(tb[GTPA_MS_ADDRESS]);
-- 
2.9.3




More information about the osmocom-net-gprs mailing list