[PATCH] osmo-gsm-tester[master]: util: Add setcap_net_raw API

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Oct 26 09:53:09 UTC 2017


Review at  https://gerrit.osmocom.org/4423

util: Add setcap_net_raw API

Some binaries such as osmo-bts-ocpty require specific capabilities, and
we need to provide them in case osmo-gsm-tester is not run as root.

Change-Id: If3eb24461c02173dc80837a4cc83f9f2420c7816
---
M src/osmo_gsm_tester/util.py
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/23/4423/1

diff --git a/src/osmo_gsm_tester/util.py b/src/osmo_gsm_tester/util.py
index c07bcf2..e0de997 100644
--- a/src/osmo_gsm_tester/util.py
+++ b/src/osmo_gsm_tester/util.py
@@ -49,6 +49,16 @@
         pass
     return None
 
+def setcap_net_raw(binary):
+    '''This functionality requires specific setup on the host running
+    osmo-gsm-tester. See osmo-gsm-tester manual for more information.'''
+    proc = subprocess.Popen(['sudo', 'osmo-gsm-tester_setcap_net_raw.sh', binary], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+    (stdoutdata, stderrdata) = proc.communicate()
+    if proc.returncode != 0:
+        print('stdout: %s' % stdoutdata)
+        print('stderr: %s' % stderrdata)
+        raise RuntimeError('setcap_net_raw subprocess finished with err code %d' % proc.returncode)
+
 class listdict(dict):
     'a dict of lists { "a": [1, 2, 3],  "b": [1, 2] }'
 

-- 
To view, visit https://gerrit.osmocom.org/4423
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If3eb24461c02173dc80837a4cc83f9f2420c7816
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>


More information about the gerrit-log mailing list