[Patch] SLiRP port forwarding moved to config files

Post new patches here!
Post Reply
User avatar
smprg
Posts: 4
Joined: Fri 14 Dec, 2018 10:21 am

[Patch] SLiRP port forwarding moved to config files

Post by smprg » Sun 16 Dec, 2018 11:01 pm

Hi there! :D

As a repeater of this separate topic, I upload the patch here.

Basically, neozeed started with SLiRP redirections (or port forwarding) in order to make guests visible from the host. His contribution was put hardcoded for testing, so I thought it would be a good idea to move the port forwarding entries to the machine-specific config file.

After a bit of work, I got it working for both TCP and UDP, using the following proposed notation (omit the comments if copying):

Code: Select all

# Inside a machine-specific config file, put this group.
[SLiRP Redirects]
# Use this to enable/disble port forwarding. "0" disables, "1" enables.
enable = 1
# From here, the notation in use is as follows: connection_type.host_port = guest_port
# It reads: forward any packages from the specified host port that are a certain type into the given guest port.
# Following are the examples *neozeed* initially hardcoded.
tcp.42322 = 22
tcp.42323 = 23
tcp.42380 = 80
tcp.42443 = 443
udp.2213 = 2213
udp.2231 = 2231
udp.2271 = 2271
ATTENTION: This patch was based on rev 1202, but as I initially coded it over plain PCem v14, it should also work there (I guess not as directly as with hg import, but anyway it should work).

Any comments or questions regarding this patch are welcome.

Regards! :3
Attachments
pcem_slirp_redirs.diff.zip
Based on rev 1202 (should work over plain v14 with a little fiddling).
(1.42 KiB) Downloaded 76 times
Keep learning! :D

Post Reply