fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/40127?usp=email )
Change subject: osmo_dia2gsup: set sndbuf/recbuf explicitly for SCTP
......................................................................
osmo_dia2gsup: set sndbuf/recbuf explicitly for SCTP
When opening an SCTP socket on Linux, Erlang/OTP does set its own
default SO_SNDBUF/SO_RCVBUF values if the respective socket options
(sndbuf and recbuf) are not given to gen_sctp:open/N explicitly.
For some reason, the default RCVBUF size (1024) is much smaller than
the default SNDBUF size (65536), and both are well below modern Linux
defaults. Such a small RCVBUF size becomes problematic when the
remote peer is sending large packets.
Let's explicitly set both sndbuf/recbuf parameters to 65536, allowing
the user to overwrite this default via the environment parameters.
For more details, see https://github.com/erlang/otp/issues/9722.
Change-Id: I793f1295ab42bfc548511fc5ffbda9070280745f
---
M src/osmo_dia2gsup.erl
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_dia2gsup refs/changes/27/40127/1
diff --git a/src/osmo_dia2gsup.erl b/src/osmo_dia2gsup.erl
index 1739360..c8a1d2b 100644
--- a/src/osmo_dia2gsup.erl
+++ b/src/osmo_dia2gsup.erl
@@ -48,6 +48,7 @@
-define(SERVER, ?MODULE).
-define(ENV_DEFAULT_SCTP_NODELAY, true).
+-define(ENV_DEFAULT_SCTP_BUFSZ, 65536).
% Diameter application definitions
@@ -162,7 +163,9 @@
tcfg(Cfg, LAddr, LPort);
tcfg(sctp, LAddr, LPort) ->
- Cfg = #{sctp_nodelay => get_env(diameter_nodelay, ?ENV_DEFAULT_SCTP_NODELAY)},
+ Cfg = #{sctp_nodelay => get_env(diameter_nodelay, ?ENV_DEFAULT_SCTP_NODELAY),
+ recbuf => get_env(diameter_sctp_recbuf, ?ENV_DEFAULT_SCTP_BUFSZ),
+ sndbuf => get_env(diameter_sctp_sndbuf, ?ENV_DEFAULT_SCTP_BUFSZ)},
tcfg(Cfg, LAddr, LPort);
tcfg(Cfg, LAddr, LPort) when is_map(Cfg) ->
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/40127?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo_dia2gsup
Gerrit-Branch: master
Gerrit-Change-Id: I793f1295ab42bfc548511fc5ffbda9070280745f
Gerrit-Change-Number: 40127
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: dexter.
laforge has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/40117?usp=email )
Change subject: osmocom.construct: Bytes + GreedyBytes with automatic hexstring-conversion
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/40117?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: I59f500c925848872a7fa38d6dbf3d6ea72bc3a90
Gerrit-Change-Number: 40117
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Apr 2025 12:11:13 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/40119?usp=email )
Change subject: edit_{binary,record}_decoded: Support hex-decode of bytes
......................................................................
edit_{binary,record}_decoded: Support hex-decode of bytes
We've created + used osmocom.utils.JsonEncoder as an encoder class
for json.{dump,dumps} for quite some time. However, we missed to
use this decoder class from the edit_{binary,record}_decoded commands
in the pySim-shell VTY.
Change-Id: I158e028f9920d8085cd20ea022be2437c64ad700
Related: OS#6774
---
M pySim/filesystem.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/19/40119/1
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 7f350ec..8821380 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -661,7 +661,7 @@
filename = '%s/file' % dirname
# write existing data as JSON to file
with open(filename, 'w') as text_file:
- json.dump(orig_json, text_file, indent=4)
+ json.dump(orig_json, text_file, indent=4, cls=JsonEncoder)
# run a text editor
self._cmd.run_editor(filename)
with open(filename, 'r') as text_file:
@@ -963,7 +963,7 @@
filename = '%s/file' % dirname
# write existing data as JSON to file
with open(filename, 'w') as text_file:
- json.dump(orig_json, text_file, indent=4)
+ json.dump(orig_json, text_file, indent=4, cls=JsonEncoder)
# run a text editor
self._cmd.run_editor(filename)
with open(filename, 'r') as text_file:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/40119?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I158e028f9920d8085cd20ea022be2437c64ad700
Gerrit-Change-Number: 40119
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/40117?usp=email )
Change subject: osmocom.construct: Bytes + GreedyBytes with automatic hexstring-conversion
......................................................................
osmocom.construct: Bytes + GreedyBytes with automatic hexstring-conversion
This is a convenience version of the Bytes / GreedyBytes construct
that accepts not only a bytes/bytearray object, but also a hex-encoded
string within the encoder.
Related: OS#6774
Change-Id: I59f500c925848872a7fa38d6dbf3d6ea72bc3a90
---
M src/osmocom/construct.py
1 file changed, 16 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/17/40117/1
diff --git a/src/osmocom/construct.py b/src/osmocom/construct.py
index 7a2851a..620d3f2 100644
--- a/src/osmocom/construct.py
+++ b/src/osmocom/construct.py
@@ -10,9 +10,10 @@
# pylint: disable=import-error,no-name-in-module
from construct.lib.containers import Container, ListContainer
from construct.core import EnumIntegerString
-from construct import Adapter, Prefixed, Int8ub, GreedyBytes, Default, Flag, Byte, Construct, Enum
-from construct import BitsInteger, BitStruct, Bytes, StreamError, stream_read_entire, stream_write
+from construct import Adapter, Prefixed, Int8ub, Default, Flag, Byte, Construct, Enum
+from construct import BitsInteger, BitStruct, StreamError, stream_read_entire, stream_write
from construct import SizeofError, IntegerError, swapbytes
+import construct
from construct.core import evaluate
from construct.lib import integertypes
@@ -33,6 +34,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+class Bytes(construct.Bytes):
+ """Just like construct.Bytes but supporting hex-string input."""
+ def _build(self, obj, stream, context, path):
+ data = h2b(data) if isinstance(obj, str) else obj
+ return super()._build(data, stream, context, path)
+
+(a)construct.core.singleton
+class GreedyBytes(construct.GreedyBytes.__class__):
+ """Just like construct.GreedyBytes but supporting hex-string input."""
+ def _build(self, obj, stream, context, path):
+ data = h2b(data) if isinstance(obj, str) else obj
+ return super()._build(data, stream, context, path)
+
class HexAdapter(Adapter):
"""convert a bytes() type to a string of hex nibbles."""
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/40117?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: I59f500c925848872a7fa38d6dbf3d6ea72bc3a90
Gerrit-Change-Number: 40117
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>