← Commit list

2feaba1d8

Denys Vlasenko
Denys Vlasenko
2019-02-05
SUCCESS Duration: 150s

Subject

dhcp service example: cater for servers hot giving subnet and/or router

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

examples/var_service/dhcp_if/convert2ipconf+19 -0
@@ -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
+ 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'"