[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [git commit] dhcp service example: cater for servers hot giving subnet and/or router
From: Bernhard Reutner-Fischer <rep.dot.nop () gmail ! com>
Date: 2019-02-06 7:25:16
Message-ID: 49EF726C-6776-40FF-9A45-922760F3CB43 () gmail ! com
[Download RAW message or body]
On 5 February 2019 17:48:24 CET, Denys Vlasenko <vda.linux@googlemail.com> wrote:
>commit:
>https://git.busybox.net/busybox/commit/?id=2feaba1d8dc2893d9f1064673e500312eaa70777
>branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
>
>Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
>---
> examples/var_service/dhcp_if/convert2ipconf | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
>diff --git a/examples/var_service/dhcp_if/convert2ipconf
>b/examples/var_service/dhcp_if/convert2ipconf
>index 62a288ebf..038b1f7f1 100755
>--- a/examples/var_service/dhcp_if/convert2ipconf
>+++ b/examples/var_service/dhcp_if/convert2ipconf
>@@ -26,6 +26,25 @@ exec 2>&1
> test "$interface" || exit 1
> test "$ip" || exit 1
>
>+# some servers do not return subnet option.
>+# guess it for standard private networks.
>+if ! test "$mask"; then
I'd suggest "case $ip in" here, fwiw.
Cheers,
>+ if test "$ip" != "${ip#192.168.}"; then
>+ mask=16
>+ elif test "$ip" != "${ip#172.16.}"; then
>+ mask=12
>+ # repeat for each in 172.17. - 172.31. range?
>+ elif test "$ip" != "${ip#10.}"; then
>+ mask=8
>+ fi
>+fi
>+
>+# some servers do not return router option.
>+# assume DHCP server is the router.
>+if ! test "$router"; then
>+ test "$serverid" && router="$serverid"
>+fi
>+
> {
> echo "let cfg=cfg+1"
> test "$interface" && echo "if[\$cfg]='$interface'"
>_______________________________________________
>busybox-cvs mailing list
>busybox-cvs@busybox.net
>http://lists.busybox.net/mailman/listinfo/busybox-cvs
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic