[SLiRP] Moving port forwarding to config file

Discussion of development and patch submission.
Post Reply
User avatar
smprg
Posts: 4
Joined: Fri 14 Dec, 2018 10:21 am

[SLiRP] Moving port forwarding to config file

Post by smprg »

Hello! :D

I've been using PCem for a while and I'm satisfied with it so far. Well done to you all for its development! ^_^

Recently, I've been "tinkering" with the source code for a bit. XD Reading what neozeed has done with port forwarding (including the fact it is hardcoded at the moment), I wanted to try putting it into the config file. So far, I've met success with the global config and TCP-only settings, and would like to try putting it in the machine-specific config.

Should I carry on to see what I can achieve?

Of course, it has to be reviewed what format I should use for the port forwarding inside the config files, but I guess that has to be discussed once I get "clearance".

Thank you in advance! :3

P.S. The format I'm using so far (assuming TCP):

Code: Select all

# host port = guest port
[slirpRedir]
enable = 1
42322 = 22
42323 = 23
42380 = 80
42443 = 443
Keep learning! :D
User avatar
smprg
Posts: 4
Joined: Fri 14 Dec, 2018 10:21 am

Re: [SLiRP] Moving port forwarding to config file

Post by smprg »

UPDATE

I've changed the proposed config file structure (while being moved to its respective machine-specific configuration file) as follows:

Code: Select all

# type.port_host = port_guest
[SLiRP Redirects]
enable = 1
tcp.42322 = 22
tcp.42323 = 23
tcp.42380 = 80
tcp.42443 = 443
udp.2213 = 2213
udp.2231 = 2231
udp.2271 = 2271
At this point, I can now define port redirections per machine and for both TCP and UDP. :D No GUI configuration for this, though --- it has to be done by manually editing the corresponding config file.

I'll check how to make a patch so that I can send it to you for testing.

Regards! :3
Keep learning! :D
User avatar
smprg
Posts: 4
Joined: Fri 14 Dec, 2018 10:21 am

Re: [SLiRP] Moving port forwarding to config file

Post by smprg »

Here is the patch, as a diff file based on rev 1202.

If the format is incorrect, please let me know.
Attachments
pcem_slirp_redirs.diff.zip
(1.42 KiB) Downloaded 495 times
Keep learning! :D
Post Reply