Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static IP configuration (eth and wireless) have hardcoded /24 subnet #116

Open
NickHibma opened this issue Jan 26, 2023 · 4 comments
Open

Comments

@NickHibma
Copy link

/volumio/app/plugins/system_controller/network/index.js hardcodes the subnet to a /24 for both eth0 and wireless network setups. It ignores both subnet settings from the UI.

It requires a UI change to change a subnet setting to a net prefix setting. The subnet mask is not used anywhere else, so this is the easiest solution.

We use a /22 on our ships for the management network, so being able to set the subnet is needed.

@volumio
Copy link
Owner

volumio commented Jan 26, 2023

What would be the logic then?
Can you provide a subnet for each prefix to set?

@NickHibma
Copy link
Author

/22 means the first 22 bits in the netmask are set. This post in StackOverflow explains how to do it in Javascript:

function subnet2Mask(subnet) {
  return subnet
    .split('.')
    .reduce((nbb, byte) => (
      [...Array(8).reverse().keys()]
        .reduce((nb, i) => (nb + ((byte >> i) & 1)), nbb)), 0)
}


function mask2Subnet(val) {
  return [255, 255, 255, 255]
    .map(() => [...Array(8).keys()]
      .reduce((rst) => (rst * 2 + (val-- > 0)), 0))
    .join('.')
}

Or you could have the user enter the prefix number ('22') instead of the netmask ('255.255.252.0').

@volumio
Copy link
Owner

volumio commented Jan 30, 2023

@NickHibma would you be comfortable in doing a Pull Request to add this functionality?

@NickHibma
Copy link
Author

Nope, I am not very proficient in Javascript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants