Closed ryan-sg closed 2 weeks ago
Tom has confined this bug in 7.5 Current, patch command appears to swap the ips on the patched pair of interfaces workaround for now ... is to patch and un patch and patch again to (reverse x2 ) IP Swapping between the Patched pair of interface
Tom can confirm that this is not an issue with OpenBSD / ifconfig pair patch (repeating the same steps as above with ifconfig in ksh does not exhibit the same bug. It is NSH specific
Should be fixed with https://github.com/yellowman/nsh/pull/153
Tested Stsps PR 153 and it works and resolves the issue PR 153 merged and issue resolved
Hello!
Given the following config (daemon configs, pf, and crontab trimmed to save space, they were all defaults, just playing around with nsh)
EDIT: this is a VM with OpenBSD 7.5, not current
nshrc
```% Functionality is limited without root privileges. % The 'enable' command will switch to the root user. % NSH v1.2.1-current; Compiled by ryan@nshdev.localdomain on 21-Jun-24 15:30 nshdev.localdomain/en nshdev.localdomain(p)/show start ! hostname nshdev.localdomain ! motd rules OpenBSD 7.5 (GENERIC) #79: Wed Mar 20 15:33:49 MDT 2024 OpenBSD: The proactively secure Unix-like operating system. Please use the sendbug(1) utility to report bugs in the system. Before reporting a bug, please try to reproduce it with the latest version of the code. With bug reports, please try to ensure that enough information to reproduce the problem is enclosed, and if a known fix for it exists, include that as well. ! interface lo0 group lo inet ::1/128 inet 127.0.0.1/8 ! interface vio0 group egress inet 10.10.11.209/24 media autoselect ! interface vio1 media autoselect shutdown ! interface vio2 media autoselect shutdown ! interface vio3 inet 10.2.1.1/29 media autoselect ! interface enc0 group enc shutdown ! interface pflog0 group pflog no shutdown ! interface lo2 rdomain 2 group lo shutdown ! interface lo3 rdomain 3 group lo shutdown ! ! ip forwarding ! route 0.0.0.0/0 10.10.11.1 nompath route 224.0.0.0/4 127.0.0.1 iface nompath reject route 127.0.0.0/8 127.0.0.1 nompath reject route ::/96 ::1 nompath reject route ::ffff:0.0.0.0/96 ::1 nompath reject route 2002::/24 ::1 nompath reject route 2002:7f00::/24 ::1 nompath reject route 2002:e000::/20 ::1 nompath reject route 2002:ff00::/24 ::1 nompath reject route fe80::/10 ::1 nompath reject route fec0::/10 ::1 nompath reject route ff01::/16 ::1 nompath reject route ff02::/16 ::1 nompath reject ! ! pf rules ! pf enable pf reload ! snmp rules ! resolv enable ! ospf rules ! ifstate rules ! ntp rules ! smtp rules ! sshd rules ! sshd enable ! crontab rules ! crontab install rtable 1 ! rtable 2 ! rtable 3 ! ! ```
Upon creating some pair(4) interfaces to test using patch to switch between different rdomains on the fly, I noted that while the interfaces are created correctly, and function correctly, the generated config does not look correct.
Let's configure some pair(4)'s:
This looks good so far. We'll write it. Now we have:
OK, all good! Let's patch one of them together:
Hmm, this is odd, it swaps the inet address around. The resulting config ends up being:
The actual interfaces end up looking like this:
When I originally noticed this, I took time to reconfigure inet addresses several times thinking i must have mucked up the ordering. But it appears the config renderer is doing it somehow, when trying to apply the
patch
argument to the participating interfaces.So initial configuration works. You can even change between pair interfaces being patched, and things work. However, as expected, on reboot, the configuration then configures them with the wrong inet addresses: