osmith has submitted this change. ( https://gerrit.osmocom.org/c/libgtpnl/+/35989?usp=email )
Change subject: gtp-genl: display gtp device in listing ......................................................................
gtp-genl: display gtp device in listing
Display the device that the tunnel belongs to, users need this information to delete tunnels.
Change-Id: I888723a8318c04772f7d22a042e69fa6e9ef2239 --- M src/gtp-genl.c 1 file changed, 18 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/src/gtp-genl.c b/src/gtp-genl.c index 3b7c3ef..33a78d8 100644 --- a/src/gtp-genl.c +++ b/src/gtp-genl.c @@ -141,6 +141,7 @@ EXPORT_SYMBOL(gtp_del_tunnel);
struct gtp_pdp { + uint32_t ifidx; uint32_t version; union { struct { @@ -181,6 +182,7 @@ case GTPA_PEER_ADDRESS: case GTPA_MS_ADDRESS: case GTPA_VERSION: + case GTPA_LINK: if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) { perror("mnl_attr_validate"); return MNL_CB_ERROR; @@ -210,6 +212,8 @@
mnl_attr_parse(nlh, sizeof(*genl), genl_gtp_validate_cb, tb);
+ if (tb[GTPA_LINK]) + pdp.ifidx = mnl_attr_get_u32(tb[GTPA_LINK]); if (tb[GTPA_TID]) pdp.u.v0.tid = mnl_attr_get_u64(tb[GTPA_TID]); if (tb[GTPA_I_TEI]) @@ -245,6 +249,8 @@ return MNL_CB_ERROR; }
+ printf("%s ", if_indextoname(pdp.ifidx, buf)); + if (tb[GTPA_VERSION]) pdp.version = mnl_attr_get_u32(tb[GTPA_VERSION]);