Closed dorianim closed 3 years ago
The function could look something like this:
subnet(){
local iface
local subnet
iface="$(LANG=C route | grep ^default | awk '{ print $8 }' 2> /dev/null)"
[ -n "$iface" ] && subnet="$(LANG=C ifconfig "$iface" | grep 'Mask:' awk '{ print $4 }')"
[ -z "$subnet" ] && ip="OFFLINE"
echo "$subnet"
}
Is this ip address in registration form necessary at all? It was mentioned, that there are DHCP clients, that don't even have a fixed IP address. In oss_linbo an IP is assigned during import, maybe we can get rid of this input field alltogether? @HappyBasher Thomas, what do you think?
As @fschuett mentioned there are dynamic ip clients. So it should be allowed to enter DHCP
optionally instead of a fixed ip address.
The subnet mask is not necessary to fill in. The client does not take care of it. Anyway it will be calculated on the server. There we better remain data economical. ;)
Oh, ok, I didn't consider that. So should I just remove the field? And is there any other functionality that is unnecessary?
So should I just remove the field?
Yep. Just use the fields that exist at the moment.
I think we kind of misunderstood each other, I don't want to add a field for the subnet mask, I just want to prefill the currently existing field :)
For example:
Client IP: 10.16.0.101
Client subnet: 255.255.0.0
What the registration dialog looks like when opened:
There is no currently existing field for the subnet mask, I think. But we can provide subnet information in a client status area on the start page.
That's true, there is no field for the subnet mask, and I don't want to add one ;) I think we are kind of talking past each other. I just want to use the mask to pre-fill the IP-Adress field. And yes, we could also provide subnet information on a status page. So will you add the function to get the subnet mask? :upside_down_face:
I just want to use the mask to pre-fill the IP-Adress field.
Yes, indeed, I don't understand. Why do you need the subnet mask to pre-fill the ip address field?
And: On the server I use cidr notation for ip addresses and subnets. What about a function that returns the ip address in cidr?
You get the client's ip with _linbocmd ip ....
I need the subnet mask to know what parts oft the IP Address are actually fixed. For example: Client IP: 10.0.0.145 For the subnetmask 255.255.0.0 I would prefill: 10.0. But with the subnetmask 255.255.255.0 I would prefill: 10.0.0.
The IP in with cidr suffix would be fine as well :)
Example:
~ # linbo_cmd netmask
255.255.255.0
~ # linbo_cmd bitmask
24
Thank you :)
Please add a function to get the current subnet mask of the client to the linbo_cmd. I would like to use this function to prefill the parts of the IP-Address that are known in the client registration UI. For example: Client IP:
10.0.0.145
Subnet Mask:255.255.0.0
What I would prefill:10.0.
Would be nice to get that added :)