Static IP settings do not accept all valid subnet masks

my subnet mask on my network is 255.255.0.0. This is rejected by Volumio even though it is perfectly valid and it refuses to allow me to use it.

after playing with it for a while to see what was valid and what was not, It appears that an attempt was made to only allow valid subnet masks, but it was done partially and incorrectly, and therefore should not have been done at all… if you aren’t going to do it 100%, then just take whatever is input and let the user worry about if they got it right or not.

as a quick summary, the subnet mask is a 32 bit binary number such that all the digits to the left are 1’s and the digits to the right are 0’s The 1’s are masked, the 0’s are not. so…

11111111.11111111.11111111.00000000 = 255.255.255.0 is valid
11111111.00000000.11111111.00000000 = 255.0.255.0 is NOT valid

Here’s how it is currently working
it allows any number from 0 to 255 in the 4th position… but not all those numbers are valid, the only valid numbers in ANY and ALL positions are:
255 (255 in the 4th position is discouraged but still valid)
254
252
248
240
224
192
128
0 (0 in the 1st position is discouraged but still valid)

these numbers are ONLY valid in the 4th position If and ONLY IF the previous 3 positions are ALL 255, they must ALL be 255 or the 4th position MUST be zero because you can’t have any more 1’s after you have a 0

positions 1, 2, and 3 are all TRYING to enforce the correct scheme, but are doing it wrong. these 3 positions only accept:

255
254
252
248
240
224
192
128

but NOT 0

furthermore they will accept any of these numbers in any order which is NOT always valid… numbers in any positon other that zero are invalid unless ALL previous positions are 255 here are some examples:
it WILL accept:
192.192.255.0 11000000.11000000.11111111.00000000 = NOT VALID
255.128.255.34 11111111.10000000.11111111.001000010 = NOT VALID
252.224.128.255 11111100.11100000.10000000.11111111 = NOT VALID

while it will NOT accept the following VALID combinations:
255.0.0.0 11111111.00000000.00000000.00000000 = Valid ---- not accepted
255.128.0.0 11111111.10000000.00000000.00000000 = Valid ---- not accepted
255.255.0.0 11111111.11111111.00000000.00000000 = Valid ---- not accepted
255.192.0.0 11111111.11000000.00000000.00000000 = Valid ---- not accepted

in my personal opinion, it’s a waste of time and space to bother checking and enforcing the subnet mask, just default it to 255.255.255.0 and let the user change it to whatever they want… if they are changing it, they will know what they are doing. There’s no reason to bloat things with a useless check, but if it’s going to be checked and enforced, then do it correctly

for your Reference:

en.wikipedia.org/wiki/Subnetwork
see:

"Determining the network prefix

An IPv4 network mask consists of 32 bits, a sequence of ones (1) followed by a block of 0s. The trailing block of zeros (0) designates that part as being the host identifier."