SLiRP: Support for changing the network.

Since the default 10.0.2.0/24 (or 10.0.3.0... etc) address can
conflict with a LAN (as it does in my case), this feature now adds the
ability to set custom network prefixes in the configuration file.  I
believe this is an “advanced” usage feature (like port forwarding) and
should not be exposed in the GUI, therefore no GUI changes have been
made.

In the `[Network]` section of 86box.cfg, each of the four NICs can be
set to have a custom address like such:

```
net_01_addr = 10.80.88.0
net_02_addr = 10.82.86.0
net_03_addr = 10.84.86.0
net_04_addr = 10.85.86.0
```

The last octet of the address is effectively ignored and always set to
0 again when the configuration file is saved.  Only a /24 CIDR
(netmask 255.255.255.0) is supported.  IPv4 has three local-scope
ranges: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0.  Finding a network
prefix within these that do not conflict with your real LAN should not
pose a problem.
This commit is contained in:
Mike Swanson
2026-02-06 17:25:34 -08:00
parent d3d86d49b5
commit eaa4c7063f
3 changed files with 59 additions and 9 deletions

View File

@@ -99,6 +99,7 @@ typedef struct netcard_conf_t {
uint32_t link_state;
uint8_t switch_group;
uint8_t promisc_mode;
char slirp_net[16];
char nrs_hostname[128];
} netcard_conf_t;