pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libgtpnl/+/38460?usp=email )

Change subject: dev_create: Avoid passing IFLA_GTP_FD* attribute with value -1
......................................................................

dev_create: Avoid passing IFLA_GTP_FD* attribute with value -1

The kernel will just reject with errno=9 and log message:
"gtp: gtp socket fd=-1 not found".

Instead, avoid adding the attribute in first place, which is what the
kernel expects.

Related: SYS#7126
Change-Id: Ib7e1d362fbb556c9b15b25408058fbf00bcc7aa3
---
M src/gtp-rtnl.c
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  pespin: Looks good to me, approved
  laforge: Looks good to me, approved




diff --git a/src/gtp-rtnl.c b/src/gtp-rtnl.c
index 6baa5a6..e0db921 100644
--- a/src/gtp-rtnl.c
+++ b/src/gtp-rtnl.c
@@ -127,8 +127,10 @@
        nest = mnl_attr_nest_start(nlh, IFLA_LINKINFO);
        mnl_attr_put_str(nlh, IFLA_INFO_KIND, "gtp");
        nest2 = mnl_attr_nest_start(nlh, IFLA_INFO_DATA);
-       mnl_attr_put_u32(nlh, IFLA_GTP_FD0, fd0);
-       mnl_attr_put_u32(nlh, IFLA_GTP_FD1, fd1);
+       if (fd0 >= 0)
+               mnl_attr_put_u32(nlh, IFLA_GTP_FD0, fd0);
+       if (fd1 >= 0)
+               mnl_attr_put_u32(nlh, IFLA_GTP_FD1, fd1);
        mnl_attr_put_u32(nlh, IFLA_GTP_PDP_HASHSIZE, 131072);
        if (role != GTP_ROLE_GGSN)
                mnl_attr_put_u32(nlh, IFLA_GTP_ROLE, role);

--
To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/38460?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: Ib7e1d362fbb556c9b15b25408058fbf00bcc7aa3
Gerrit-Change-Number: 38460
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pablo <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to