aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-02-08 10:37:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2019-02-08 10:37:05 +0100
commit5a387e26c2460428d4d5d9a2b2f074a31a994da1 (patch)
tree3bcf565f0e56e6d7f2daea30d202251eb07b2d5a
parent2feaba1d8dc2893d9f1064673e500312eaa70777 (diff)
downloadbusybox-w32-5a387e26c2460428d4d5d9a2b2f074a31a994da1.tar.gz
busybox-w32-5a387e26c2460428d4d5d9a2b2f074a31a994da1.tar.bz2
busybox-w32-5a387e26c2460428d4d5d9a2b2f074a31a994da1.zip
dhcp service example: rewrite "private network to mask" as case statement
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-xexamples/var_service/dhcp_if/convert2ipconf21
1 files changed, 13 insertions, 8 deletions
diff --git a/examples/var_service/dhcp_if/convert2ipconf b/examples/var_service/dhcp_if/convert2ipconf
index 038b1f7f1..31e3c7fde 100755
--- a/examples/var_service/dhcp_if/convert2ipconf
+++ b/examples/var_service/dhcp_if/convert2ipconf
@@ -29,14 +29,19 @@ test "$ip" || exit 1
29# some servers do not return subnet option. 29# some servers do not return subnet option.
30# guess it for standard private networks. 30# guess it for standard private networks.
31if ! test "$mask"; then 31if ! test "$mask"; then
32 if test "$ip" != "${ip#192.168.}"; then 32 case "$ip" in
33 mask=16 33 10.*)
34 elif test "$ip" != "${ip#172.16.}"; then 34 mask=8;;
35 mask=12 35 192.168.*)
36 # repeat for each in 172.17. - 172.31. range? 36 mask=16;;
37 elif test "$ip" != "${ip#10.}"; then 37 #172.16-31.x.x
38 mask=8 38 172.1[6789].*)
39 fi 39 mask=12;;
40 172.2[0123456789].*)
41 mask=12;;
42 172.3[01].*)
43 mask=12;;
44 esac
40fi 45fi
41 46
42# some servers do not return router option. 47# some servers do not return router option.