Attention is currently required from: neels.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libgtpnl/+/26990 )
Change subject: fix some cases of rc == 0 on error
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/26990
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: I22fd69709e023572c6c616a4184340a554456faf
Gerrit-Change-Number: 26990
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 26 Jan 2022 08:27:28 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libgtpnl/+/26990 )
Change subject: fix some cases of rc == 0 on error
......................................................................
fix some cases of rc == 0 on error
When genl_socket_talk() fails, return rc != 0.
While testing the new osmo-upf program, I noticed that I failed to get a
"Operation not permitted" error when forgetting to set cap_net_admin on
the osmo-upf binary. It looked like everything should work, but doesn't.
It is possible to catch these error cases without this patch, by
monitoring errno. That may well be the intention of the API? I'm still
submitting this patch because it seems better to return rc != 0.
Returning -2 is an arbitrary choice. Other places return -1, so -2 makes
these cases distinguishable. Not really necessary.
Here is a code example that also catches all error cases without this
patch:
errno = 0;
rc = gtp_add_tunnel(genl_id, nl, t);
if (errno) {
rc = -errno;
} else if (rc) {
rc = -EINVAL;
} else {
tun->active = true;
}
return rc;
Related: SYS#5599
Change-Id: I22fd69709e023572c6c616a4184340a554456faf
---
M src/gtp-genl.c
1 file changed, 7 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/90/26990/1
diff --git a/src/gtp-genl.c b/src/gtp-genl.c
index f12f872..88c0f80 100644
--- a/src/gtp-genl.c
+++ b/src/gtp-genl.c
@@ -77,8 +77,10 @@
GTP_CMD_NEWPDP);
gtp_build_payload(nlh, t);
- if (genl_socket_talk(nl, nlh, seq, NULL, NULL) < 0)
+ if (genl_socket_talk(nl, nlh, seq, NULL, NULL) < 0) {
perror("genl_socket_talk");
+ return -2;
+ }
return 0;
}
@@ -94,8 +96,10 @@
GTP_CMD_DELPDP);
gtp_build_payload(nlh, t);
- if (genl_socket_talk(nl, nlh, seq, NULL, NULL) < 0)
+ if (genl_socket_talk(nl, nlh, seq, NULL, NULL) < 0) {
perror("genl_socket_talk");
+ return -2;
+ }
return 0;
}
@@ -200,7 +204,7 @@
if (genl_socket_talk(nl, nlh, seq, genl_gtp_attr_cb, NULL) < 0) {
perror("genl_socket_talk");
- return 0;
+ return -2;
}
return 0;
--
To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/26990
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: I22fd69709e023572c6c616a4184340a554456faf
Gerrit-Change-Number: 26990
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/simtrace2/+/26986 )
Change subject: contrib/simtrace.lua: Don't print SIMTRACE_MSGT_ in every COL_INFO
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/26986
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I98f90561b39401f1c2339f79a3cb40574bb03b2d
Gerrit-Change-Number: 26986
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 25 Jan 2022 18:59:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/simtrace2/+/26985 )
Change subject: contrib/simtrace.lua: Add Flag bits + Data to COL_INFO
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
File contrib/simtrace.lua:
https://gerrit.osmocom.org/c/simtrace2/+/26985/comment/485c53ea_228e3edc
PS1, Line 93: if is_pbrx().value == 1 then
Using ternary operator may improve readability here:
flagstr = flagstr + if is_pbrx().value == 1 then "R" else "." end
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/26985
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I0aa3d68172022907fbe8371aaca6538df0649dfe
Gerrit-Change-Number: 26985
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 25 Jan 2022 18:58:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment