Attention is currently required from: msuraev.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31046 )
Change subject: ASCI: add VBS/VGCS support to BTS features list
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31046
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I583a170070c192c6c47fae41ce923a7439561b4f
Gerrit-Change-Number: 31046
Gerrit-PatchSet: 2
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: msuraev <msuraev(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 24 Jan 2023 13:17:53 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/30438 )
Change subject: pySim-trace: Add support for reading GSMTAP from pcap files
......................................................................
pySim-trace: Add support for reading GSMTAP from pcap files
So far we supported
* GSMTAP live traces via a UDP socket
* RSPRO traces from pcap files (or live)
We were lacking support for reading GSMTAP stored in pcap, which
is what this patch implements.
Change-Id: I46d42774b39a2735500ff5804206ddcfa545568c
---
M pySim-trace.py
A pySim/apdu_source/pyshark_gsmtap.py
2 files changed, 98 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/pySim-trace.py b/pySim-trace.py
index 33cb75a..79069a6 100755
--- a/pySim-trace.py
+++ b/pySim-trace.py
@@ -18,6 +18,7 @@
from pySim.apdu_source.gsmtap import GsmtapApduSource
from pySim.apdu_source.pyshark_rspro import PysharkRsproPcap, PysharkRsproLive
+from pySim.apdu_source.pyshark_gsmtap import PysharkGsmtapPcap
from pySim.apdu.ts_102_221 import UiccSelect, UiccStatus
@@ -130,6 +131,11 @@
parser_gsmtap.add_argument('-p', '--bind-port', default=4729,
help='Local UDP port')
+parser_gsmtap_pyshark_pcap = subparsers.add_parser('gsmtap-pyshark-pcap', help="""
+ PCAP file containing GSMTAP (SIM APDU) communication; processed via pyshark.""")
+parser_gsmtap_pyshark_pcap.add_argument('-f', '--pcap-file', required=True,
+ help='Name of the PCAP[ng] file to be read')
+
parser_rspro_pyshark_pcap = subparsers.add_parser('rspro-pyshark-pcap', help="""
PCAP file containing RSPRO (osmo-remsim) communication; processed via pyshark.
REQUIRES OSMOCOM PATCHED WIRESHARK!""")
@@ -153,6 +159,8 @@
s = PysharkRsproPcap(opts.pcap_file)
elif opts.source == 'rspro-pyshark-live':
s = PysharkRsproLive(opts.interface)
+ elif opts.source == 'gsmtap-pyshark-pcap':
+ s = PysharkGsmtapPcap(opts.pcap_file)
tracer = Tracer(source=s, suppress_status=opts.suppress_status, suppress_select=opts.suppress_select)
logger.info('Entering main loop...')
diff --git a/pySim/apdu_source/pyshark_gsmtap.py b/pySim/apdu_source/pyshark_gsmtap.py
new file mode 100644
index 0000000..8ea9ae7
--- /dev/null
+++ b/pySim/apdu_source/pyshark_gsmtap.py
@@ -0,0 +1,90 @@
+# coding=utf-8
+
+# (C) 2022 by Harald Welte <laforge(a)osmocom.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+import sys
+import logging
+from pprint import pprint as pp
+from typing import Tuple
+import pyshark
+
+from pySim.utils import h2b, b2h
+from pySim.apdu import Tpdu
+from pySim.gsmtap import GsmtapMessage
+from . import ApduSource, PacketType, CardReset
+
+from pySim.apdu.ts_102_221 import ApduCommands as UiccApduCommands
+from pySim.apdu.ts_31_102 import ApduCommands as UsimApduCommands
+from pySim.apdu.global_platform import ApduCommands as GpApduCommands
+ApduCommands = UiccApduCommands + UsimApduCommands + GpApduCommands
+
+logger = logging.getLogger(__name__)
+
+class _PysharkGsmtap(ApduSource):
+ """APDU Source [provider] base class for reading GSMTAP SIM APDU via tshark."""
+
+ def __init__(self, pyshark_inst):
+ self.pyshark = pyshark_inst
+ self.bank_id = None
+ self.bank_slot = None
+ self.cmd_tpdu = None
+ super().__init__()
+
+ def read_packet(self) -> PacketType:
+ p = self.pyshark.next()
+ return self._parse_packet(p)
+
+ def _set_or_verify_bank_slot(self, bsl: Tuple[int, int]):
+ """Keep track of the bank:slot to make sure we don't mix traces of multiple cards"""
+ if not self.bank_id:
+ self.bank_id = bsl[0]
+ self.bank_slot = bsl[1]
+ else:
+ if self.bank_id != bsl[0] or self.bank_slot != bsl[1]:
+ raise ValueError('Received data for unexpected B(%u:%u)' % (bsl[0], bsl[1]))
+
+ def _parse_packet(self, p) -> PacketType:
+ udp_layer = p['udp']
+ udp_payload_hex = udp_layer.get_field('payload').replace(':','')
+ gsmtap = GsmtapMessage(h2b(udp_payload_hex))
+ gsmtap_msg = gsmtap.decode()
+ if gsmtap_msg['type'] != 'sim':
+ raise ValueError('Unsupported GSMTAP type %s' % gsmtap_msg['type'])
+ sub_type = gsmtap_msg['sub_type']
+ if sub_type == 'apdu':
+ return ApduCommands.parse_cmd_bytes(gsmtap_msg['body'])
+ elif sub_type == 'atr':
+ # card has been reset
+ return CardReset()
+ elif sub_type in ['pps_req', 'pps_rsp']:
+ # simply ignore for now
+ pass
+ else:
+ raise ValueError('Unsupported GSMTAP-SIM sub-type %s' % sub_type)
+
+class PysharkGsmtapPcap(_PysharkGsmtap):
+ """APDU Source [provider] class for reading GSMTAP from a PCAP
+ file via pyshark, which in turn uses tshark (part of wireshark).
+ """
+ def __init__(self, pcap_filename):
+ """
+ Args:
+ pcap_filename: File name of the pcap file to be opened
+ """
+ pyshark_inst = pyshark.FileCapture(pcap_filename, display_filter='gsm_sim', use_json=True, keep_packets=False)
+ super().__init__(pyshark_inst)
+
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/30438
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I46d42774b39a2735500ff5804206ddcfa545568c
Gerrit-Change-Number: 30438
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jtavares <jtavares(a)kvh.com>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
Attention is currently required from: jtavares, dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/30440 )
Change subject: pySim-trace: Also consider SW 91xx as successful
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
more than 6 weeks without any additional review, marking as +2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/30440
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I9e4170721be30342bdce7fb4beeefd1927263ca6
Gerrit-Change-Number: 30440
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jtavares <jtavares(a)kvh.com>
Gerrit-Attention: jtavares <jtavares(a)kvh.com>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 24 Jan 2023 12:53:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Hello osmith, Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/31024
to look at the new patch set (#6).
Change subject: Introduce netns API
......................................................................
Introduce netns API
Write a new API and implementation to manage network namespace related
operations.
This will be used by the upcoming tundev module.
Change-Id: I0f2fba2fa42250a07211a7b7f479498f27c529da
---
M TODO-RELEASE
M include/osmocom/core/Makefile.am
A include/osmocom/core/netns.h
M src/core/Makefile.am
A src/core/netns.c
5 files changed, 235 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/24/31024/6
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31024
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0f2fba2fa42250a07211a7b7f479498f27c529da
Gerrit-Change-Number: 31024
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31025 )
Change subject: Introduce tundev API
......................................................................
Patch Set 12:
(2 comments)
File src/core/tun.c:
https://gerrit.osmocom.org/c/libosmocore/+/31025/comment/97f47869_9a592383
PS12, Line 402: if_index = if_nametoindex(dev_name);
: if (if_index == 0)
: return -ENODEV;
I think it's dangerous to use the string as a persistent/permanent identifier for a network device. That's what the ifindex is normally used for. It is unique even across device renames. Is there a specific reeason why you're not storing the ifindex in the local state structure and use that every time another operation is performed?
It looks a bit odd that every API function here first performs a name-to-ifindex translation.
https://gerrit.osmocom.org/c/libosmocore/+/31025/comment/df828b70_9a74e190
PS12, Line 639: /
what's this about?
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31025
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3463271666df1e85746fb7b06ec45a17024b8c53
Gerrit-Change-Number: 31025
Gerrit-PatchSet: 12
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 24 Jan 2023 11:08:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment