It would be really helpful if you could describe which settings cause the bricked situation and on what device.
Keep in mind that the example is using an older device (TL-WR1043ND) with swconfig (ath79 target), so unless you're working with that specific hardware, it's important to know what was copied over and applied to your device.
ipaddr should be 192.168.1.1/24 not ipaddr+mask combo.
IP + mask works just fine. The new method with CIDR notation is preferred, but the old method still works (it hasn't been deprecated).
Sure "works" Mercusys mr90x bricked during installation
User broke their own network by mixing syntax. The wiki is fine how it is.
The place where the documentation really did need to be updated was here:
I've just added the bit about 25.12 and later using CIDR and 24.10 and earlier just requiring the IP address change.
But if you use:
uci set network.lan.ipaddr=
It wants the new CIDR notation so that looks to be default now.
So maybe the documentation needs to reflect the new default way with CIDR notation?
I think that the documentation could be updated to reflect the current syntax. But it is important to ensure that things are called out by version.
Specifically:
-
25.12 defaults to using CIDR notation (single line).
-
25.12 does accept the older two-line (ipaddr + netmask) approach.
-
25.12 does not 'rewrite' the configs when upgrading from 24.10. That is to say that if the 24.10 config used the 2-line method, 25.12 will keep that syntax intact.
-
24.10 (by default) uses the 2-line method.
-
24.10 supports the use of CIDR slash notation (1-line)
-
In 25.12, setting a new IP (from the default config) must include either the CIDR slash notation or the addition of a netmask line.
-
In 24.10, since the netmask line already exists (at least by default), the IP address can be changed without requiring the slash notation.
-
If CIDR notation is used, the netmask line must be deleted/omitted.
And...
- Versions 23.05 and earlier use the 2-line (ipaddr + netmask) method, and don't support CIDR slash notation (AFAIK this is the case, but I could be wrong here)
The one last thing to consider...
The documentation shows an ath79 device / swconfig. Updating with an example using DSA could also be useful. But again, it needs to be called out as a device+version depenedent difference.
You are correct here. Just that there are 100 documents playing around these settings....
Is the following undefined behaviour?
option ipaddr '192.168.1.1/24'
option netmask '255.255.255.0'
Does the netmask line need to be removed to not cause an error?
Honestly, I'm not sure what happens... but beyond that... my bigger concern/question would be
option ipaddr '192.168.1.1/22'
option netmask '255.255.255.0'
In the above, the subnet maks is a /24, but the CIDR slash notation is /22. I don't know what happens in the case where there is a discrepancy between the two.
I updated the example section to call out that that is an swconfig example, and put in a DSA default example (from my device). Hope this clarifies that page a bit more and this can be closed.
Thank you for that!
I would suggest one more addition -- a quick note to call out the OpenWrt version and the use of CIDR in 25.12 (by default) & 24.10 (optional) vs ipaddr+netmask in 24.10 and ealrier + optional in 25.12.
I feel that main point to be clarified is that as the generated default config in 25.12 has the one-line cidr notation, so if the user uses an (old) uci modifying script to change it, he must either use the cidr notation on the ipaddr line or set also the netmask as a separate item (as it might not exist in the file, yet).
The same naturally applies to manual edit, but there syntax is more visible, decreasing the probability of mistakes.
The change done in the 25.12 development cycle (https://github.com/openwrt/openwrt/pull/13780) was just about the generated default config. Nothing about the underlying functionality. (And similarly DSA/swconfig plays no role here.)
Ok makes sense, I took a shot at it adding a sentence to each config example explaining use of CIDR and ipaddr+netmask. Hopefully that works, if not revert it ![]()
I would say that this is true regardless of the default. You can't blindly assume that the default or current mask is what you want. Any example setting the address without also setting the mask (using either syntax) is wrong, and has always been wrong.
I took a quick peek at the netifd code to try to figure out what happens if you set both cidr and netmask. The cidr value will override the netmask in this case. So new docs could just ignore the netmask option and simply show the cidr way.
True, but I still believe that overlooking that may be the reason for this "25.12 is broken" syndrome. People have (uci-defaults) scripts to modify just the changing config items, not all. And earlier there has already been the netmask line, without need for modifying it when setting ipaddr. Now there isn't one in the default config, so overriding the ipaddr line with a new ipaddr line without cidr is now wrong, as it removes the code notation. That is the likely pitfall for old scripts.