exporter: limit ser2net port range#1743
exporter: limit ser2net port range#1743benjamin1313 wants to merge 1 commit intolabgrid-project:masterfrom
Conversation
6229841 to
f72b887
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1743 +/- ##
========================================
- Coverage 45.4% 45.3% -0.1%
========================================
Files 172 172
Lines 13503 13514 +11
========================================
+ Hits 6131 6132 +1
- Misses 7372 7382 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This allows for specifying a start port and a range up from that to be used when looking for a free port to use with ser2net when creating a networkserialport resource. This can be helpful on networks where access to ports on the network is limited. Signed-off-by: Benjamin B. Frost <benjamin@geanix.com>
f72b887 to
85b2413
Compare
Emantor
left a comment
There was a problem hiding this comment.
I think it's usually more common to have a STARTPORT:ENDPORT definition instead of the PORT:RANGE used here, e.g. 4000:5000 instead of 4000:1000. This might also simplify the code, what do you think?
|
I think this should not be limited to I'm not a huge fan of adding more environment variables, a CLI argument for |
Yeah I see what you mean and will look into it.
Do you mean a global range for everything else that also needs a port? |
|
Letting the exporter bind something is a rather special case. Apart from USBSerialPort/RawSerialPort exports running That being said, maybe it makes more sense (in such a regulated environment) to run |
|
Please keep in mind that without allocating a new port on acquire, you have the risk that an out of date client connects to the port it knows even if it no longer has a lock. |
|
I don't think we should add a ser2net-specific override. Also, we need to make reasonably sure that a new port is chosen when the the resource is acquired again. So: a global port range of at least 1000 ports, used automatically for all calls of @benjamin1313 Would you be interested in reworking this PR accordingly? If not, I'd close it for now. @Emantor @Bastian-Krause, what do you think? |
|
@jluebbe yes i will look into it. Is is currently understood what needs to be done is. |
|
@benjamin1313 I'm interested in a solution as well and have a few hours to spare on this topic. I think I understand the requirements and will open a new PR this weekend if you don't object? |
Originally posted by @jluebbe in #1743 (comment) Looking at it, the strictest approach to not be (ser2net-)specific would be to not implement this feature at all and instead reduce the ephemeral port range to the desired limits in order for the regular I'll give it a shot tomorrow and find whether this more radical approach limits the systems usability. |
i don't. |
This allows for specifying a start port and a range up from that to be used when looking for a free port to use with ser2net when creating a networkserialport resource. This can be helpful on networks where access to ports on the network is limited.
Currently this feature is planed for use in a labgrid setup where the exporter and duts are placed on a network separate from the main network the developers are on and there are restrictions on the tcp ports. Being able to specify what port(s) labgrid can use makes it easier to manage and keep track of what ports are open between the two networks.
Checklist