pespin has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/60/38460/1

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: newchange
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: Ib7e1d362fbb556c9b15b25408058fbf00bcc7aa3
Gerrit-Change-Number: 38460
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to