diff options
Diffstat (limited to 'netconfig')
-rw-r--r-- | netconfig | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -356,6 +356,14 @@ fi rm -f $TMP/tempmsg /cardfound } # end write_config_files +# Covert CIDR notation masks to old style dotted quad. +cidr2mask() { + # https://forum.archive.openwrt.org/viewtopic.php?id=47986&p=1#p220781 + set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 + [ $1 -gt 1 ] && shift $1 || shift + echo "${1-0}.${2-0}.${3-0}.${4-0}" +} + # This checks IPv4 address syntax. # usage: syntax_check_v4 ADDRESS #-OF-EXPECTED-SEGMENTS (up to 4) # example: syntax_check_v4 123.22.43.1 4 @@ -635,7 +643,6 @@ else fi if [ "$LOOPBACK" = "no" -a ! "$USE_DHCP" = "yes" -a ! "$USE_SLAAC" = "yes" ]; then -# FIXME: need to check the logic in these: while [ 0 ]; do while [ 0 ]; do if [ -r $TMP/SeTIPSv4 ]; then @@ -1068,6 +1075,11 @@ can do that now using 'Edit' (or reconfigure later using 'netconfig')." \ break fi done + if [ ! "${IPADDRS[0]}" = "" ]; then + NM="$(cidr2mask "${IPADDRS[0]#*/}")" + BROADCAST="$(ipmask "$NM" "${IPADDRS[0]%/*}" | cut -f 1 -d ' ')" + NETWORK="$(ipmask "$NM" "${IPADDRS[0]%/*}" | cut -f 2 -d ' ')" + fi else # DHCP was used dialog --title "CONFIRM NETWORK SETUP" \ --yesno "Your networking system is now configured to use DHCP: |